コード例 #1
0
 public function after_load(Model_Url $url)
 {
     if (Uri::Current() != Uri::Create('core/404')) {
         if (strpos($url->url, Uri::Create('assets/screenshots')) !== false) {
             if ($url->custom == false) {
                 $url->custom = $url->url;
                 $url->url = 'Image URL';
             } else {
                 $url->custom = $url->url;
                 $url->url = 'Image : ' . $url->short_url;
             }
         }
     }
 }
コード例 #2
0
 public function after($response)
 {
     $response = parent::after($response);
     if (Uri::Current() != Uri::Create('login')) {
         if (Settings::get('maintenance_mode') === true) {
             if (!Auth::member(5)) {
                 $this->template->content = View::Forge('core/maintenance');
             } elseif (Uri::Current() != Uri::Create('admin/settings')) {
                 // YOUR GOOD
                 Response::Redirect(Uri::Create('admin/settings'));
             }
         }
     }
     return $response;
 }
コード例 #3
0
<?php

echo View::Forge('core/menu');
?>
<style>
	.meelab{
		margin-bottom: 20px;
	}
</style>
<div class="container">
    <?php 
if (Uri::Current() === Uri::Create('admin')) {
    ?>
      <div class="row meela-pods">
            <div class="col-lg-12" style="font-size: 40px;width: 100%;display: block;text-align: center;padding-left: 0px ;padding-right: 0px;">
                <?php 
    if (empty($style) === false) {
        ?>
                        <div style="font-size:15px;" class="alert alert-danger">Please change the random length for your URLs!</div>
                    <?php 
    }
    ?>
                <div class="pod-3 meela-bg">
                    
                    <span class="title">Unique URLs Left</span>
                    <?php 
    $threshold = Settings::get('url_limit_threshold');
    if (empty($threshold) === true) {
        $threshold = 1000;
    }
    if ($urls_left < $threshold) {
コード例 #4
0
        </footer>
               

        <div class="hide" id="dialog" title="Confirmation Required" >
            Are you sure you want to continue?
        </div>

    <!-- Placed at the end of the document so the pages load faster -->
    <?php 
Casset::js('jquery.zclip.min.js');
Casset::js('bootstrap.min.js');
Casset::js('sortable.js');
Casset::js('jquery-ui-1.10.3.custom.min.js');
Casset::js('bootstrap-switch.min.js');
Casset::js('base.js');
if (Uri::Current() === Uri::Base() && isset($image_js) === true) {
    Casset::add_path('image', APPPATH . 'modules/image/');
    Casset::js('image::image.js');
}
Casset::js('jquery.colorbox-min.js');
echo Casset::render_js();
?>
    <script>
        var text_input = document.getElementById ('urlbox');
 
        if (text_input != null)
        {
           text_input.focus ();
           text_input.select ();
        }
        
コード例 #5
0
<div class="navbar navbar-meela shadow <?php 
if (Uri::Base() == Uri::Current() || Uri::Base() . 'home' == Uri::Current()) {
    echo "nav-remove top-minus-80";
} else {
    echo "navbar-fixed-top";
}
?>
">
    <div class="container">
        <!-- .navbar-toggle is used as the toggle for collapsed navbar content -->
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
          <span class="icon-bar"></span>
        </button>
    
        <?php 
$site_name = \Settings::Get('site_name');
if (empty($site_name) === true) {
    $site_name = 'Mee.La';
}
?>
        <!-- Be sure to leave the brand out there if you want it shown -->
        <a class="navbar-brand" href="<?php 
echo Uri::Base();
?>
" title="<?php 
echo $site_name;
?>
"><?php 
echo $site_name;
コード例 #6
0
">Dashboard</a>
        </li>
       <li <?php 
echo Uri::Current() == Uri::Create('user/urls') ? 'class="active"' : '';
?>
>
            <a href="<?php 
echo Uri::Create('user/urls');
?>
">My URLs</a>
        </li>
    <?php 
if (Module::loaded('image') === true) {
    ?>
        <li <?php 
    echo Uri::Current() == Uri::Create('user/images') ? 'class="active"' : '';
    ?>
>
            <a href="<?php 
    echo Uri::Create('user/images');
    ?>
">My Images</a>
        </li>
    <?php 
}
?>
    <?php 
if (Auth::member(5)) {
    ?>
    
        <li>
コード例 #7
0
        } else {
            ?>
                                            <td>
                                                <a data-text="This URL will be removed!" class="confirm" href="<?php 
            echo Uri::Create('url/delete/' . $url->id);
            ?>
">
                                                    <i class="icon-remove"></i></a> <a target="_blank" id="url_<?php 
            echo $url->id;
            ?>
" href="<?php 
            echo $url->url;
            ?>
">
                                                    <?php 
            if (Auth::member(5) && Uri::Create('admin/urls') == Uri::Current()) {
                $url_parts = parse_url($url->url);
                $host = $url_parts['host'];
                ?>
                                                            <a class="confirm" data-text="All URLs LIKE <?php 
                echo $host;
                ?>
 will be blocked!" href="<?php 
                echo Uri::Create('admin/add_blocked/' . str_replace('.', '-', $host) . '');
                ?>
">
                                                                <i class="icon-ban-circle"></i>
                                                            </a>
                                                        <?php 
            }
            ?>
コード例 #8
0
        <div class="col-lg-4 pull-right">
        <form method="get">
            <div class="<?php 
echo isset($search) === true ? 'input-group' : '';
?>
">
                <input placeholder="Search for Users" class="form-control" name="search" type="text" value="<?php 
echo isset($search) === true ? $search : '';
?>
">
                <?php 
if (isset($search) === true) {
    ?>
                        <span class="input-group-addon">
                            <a href="<?php 
    echo Uri::Create(Uri::Current());
    ?>
"> <i class="icon-remove"></i></a>
                        </span>
                    <?php 
}
?>
            </div>
        </form>
    </div>
     
<?php 
if (empty($users) === false) {
    echo htmlspecialchars_decode($pagination);
    ?>
<form method="post">
コード例 #9
0
 public function action_view($all = null)
 {
     $limit = 25;
     if (empty($all) === false) {
         // check for admin
         if (!Auth::member(5)) {
             Response::Redirect(Uri::Create('user'));
         }
     }
     // Total Urls
     $data['total_urls'] = Model_Url::query();
     if (empty($all) === true) {
         $data['total_urls']->where('user_id', static::$user_id);
     }
     $data['total_urls'] = $data['total_urls']->count();
     if (Uri::Current() == Uri::Create('admin')) {
         $keys = \Settings::Get('character_set');
         if (empty($keys) === true) {
             $keys = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
         }
         $random_length = \Settings::Get('random_url_length');
         if (empty($random_length) === true) {
             $random_length = 5;
         }
         $url_sample_space = DB::select(DB::expr('count(id) as count'))->from('urls')->where(DB::expr('char_length(short_url)'), $random_length)->limit(1)->execute()->as_array();
         $data['urls_left'] = Controller_Dashboard::mathFact(strlen($keys)) / (Controller_Dashboard::mathFact(strlen($keys) - $random_length) * Controller_Dashboard::mathFact($random_length)) - $url_sample_space[0]['count'];
     }
     // Total Hits
     $data['total_hits'] = DB::select(DB::Expr('SUM(hits) as hits'))->from('urls');
     if (empty($all) === true) {
         $data['total_hits']->where('user_id', static::$user_id);
     }
     $data['total_hits'] = $data['total_hits']->execute()->as_array();
     $data['total_hits'] = reset($data['total_hits']);
     $data['total_hits'] = $data['total_hits']['hits'];
     // No Clicks
     $data['no_clicks'] = Model_Url::query()->where('hits', 0);
     if (empty($all) === true) {
         $data['no_clicks']->where('user_id', static::$user_id);
     }
     $data['no_clicks'] = $data['no_clicks']->count();
     // Total Custom Urls
     $data['total_custom_urls'] = Model_Url::query()->where('custom', 1);
     if (empty($all) === true) {
         $data['total_custom_urls']->where('user_id', static::$user_id);
     }
     $data['total_custom_urls'] = $data['total_custom_urls']->count();
     // Created Today Urls
     $data['created_today'] = Model_Url::query()->where('created_at', '>=', strtotime('today 12:01 AM'));
     if (empty($all) === true) {
         $data['created_today']->where('user_id', static::$user_id);
     }
     $data['created_today'] = $data['created_today']->count();
     // Most visted Urls
     $data['most_visited'] = Model_Url::query();
     if (empty($all) === true) {
         $data['most_visited']->where('user_id', static::$user_id);
     }
     $data['most_visited']->order_by('hits', 'desc')->limit($limit);
     $data['most_visited'] = $data['most_visited']->get();
     // Created Today Urls
     $data['recently_created'] = Model_Url::query();
     if (empty($all) === true) {
         $data['recently_created']->where('user_id', static::$user_id);
     }
     $data['recently_created']->order_by('created_at', 'desc')->limit($limit);
     $data['recently_created'] = $data['recently_created']->get();
     if (empty($all) === true) {
         $data['recently_viewed'] = Model_Url::query()->order_by('updated_at', 'desc')->where('updated_at', '!=', 'created_at')->where('user_id', static::$user_id)->limit($limit)->get();
     } else {
         $data['recently_viewed'] = Model_Url::query()->order_by('updated_at', 'desc')->where('updated_at', '!=', null)->limit($limit)->get();
     }
     // Short URL Stats string for google graphs
     $m = date("m");
     $de = date("d");
     $y = date("Y");
     $new_results = '';
     if (empty($all) === true) {
         $date_vist_counts = DB::query('  
             SELECT
             COUNT(url_stats.id) as hits,
             DAY(FROM_UNIXTIME(url_stats.created_at)) as day,
             MONTH(FROM_UNIXTIME(url_stats.created_at)) as month,
             YEAR(FROM_UNIXTIME(url_stats.created_at)) as year
             FROM `url_stats`
             INNER JOIN `urls` ON urls.id = url_stats.url_id
             WHERE url_stats.created_at >= ' . strtotime('12:01 AM TODAY - 15 days') . '
             AND urls.user_id = ' . static::$user_id . '
             GROUP BY year,month,day')->execute()->as_array();
         $date_created_counts = DB::query('  
             SELECT
             COUNT(id) as created,
             DAY(FROM_UNIXTIME(created_at)) as day,
             MONTH(FROM_UNIXTIME(created_at)) as month,
             YEAR(FROM_UNIXTIME(created_at)) as year
             FROM `urls`
             WHERE created_at >= ' . strtotime('12:01 AM TODAY - 15 days') . '
             AND user_id = ' . static::$user_id . '
             GROUP BY year,month,day')->execute()->as_array();
     } else {
         $date_vist_counts = DB::query('  
             SELECT
             COUNT(id) as hits,
             DAY(FROM_UNIXTIME(created_at)) as day,
             MONTH(FROM_UNIXTIME(created_at)) as month,
             YEAR(FROM_UNIXTIME(created_at)) as year
             FROM `url_stats`
             WHERE created_at >= ' . strtotime('12:01 AM TODAY - 15 days') . '
             GROUP BY year,month,day')->execute()->as_array();
         $date_created_counts = DB::query('  
             SELECT
             COUNT(id) as created,
             DAY(FROM_UNIXTIME(created_at)) as day,
             MONTH(FROM_UNIXTIME(created_at)) as month,
             YEAR(FROM_UNIXTIME(created_at)) as year
             FROM `urls`
             WHERE created_at >= ' . strtotime('12:01 AM TODAY - 15 days') . '
             GROUP BY year,month,day')->execute()->as_array();
     }
     $created_counts_array = null;
     foreach ($date_created_counts as $created_counts) {
         $created_counts_array[$created_counts['year'] . '-' . $created_counts['month'] . '-' . $created_counts['day']] = $created_counts;
     }
     foreach ($date_vist_counts as $vists) {
         if (isset($created_counts_array[$vists['year'] . '-' . $vists['month'] . '-' . $vists['day']]) === true) {
             $created_count = $created_counts_array[$vists['year'] . '-' . $vists['month'] . '-' . $vists['day']]['created'];
         } else {
             $created_count = 0;
         }
         $date_timestamp = strtotime($vists['year'] . '-' . $vists['month'] . '-' . $vists['day']);
         $new_results .= "['" . date('l dS F Y', $date_timestamp) . "', " . $vists['hits'] . ", " . $created_count . "], ";
     }
     $data['short_url_stats'] = $new_results;
     $new_results = '';
     // Get countries Stats
     if (empty($all) === true) {
         $countries = DB::select('country', DB::expr('count(url_stats.id) as hits'))->from('url_stats')->join('urls', 'LEFT')->on('urls.id', '=', 'url_stats.url_id')->where('urls.user_id', static::$user_id)->group_by('country');
     } else {
         $countries = DB::select('country', DB::expr('count(id) as hits'))->from('url_stats')->group_by('country');
     }
     $countries = $countries->execute()->as_array();
     if (empty($countries) === false) {
         foreach ($countries as $country) {
             $new_results .= "['" . $country['country'] . "', " . $country['hits'] . "], ";
         }
     }
     $data['country_stats'] = $new_results;
     $data['short_urls'] = Model_Url::query();
     if (empty($all) === true) {
         $data['short_urls']->where('user_id', static::$user_id);
     }
     $data['short_urls']->rows_limit($limit);
     $data['short_urls'] = $data['short_urls']->get();
     $this->template->content = View::Forge('dashboard/index', $data);
 }