/**
     * @param ServerRequestInterface $request
     * @param ResponseInterface $response
     * @param callable $next
     * @return ResponseInterface
     * @throws \ErrorException
     */
    public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next)
    {
        // path
        $path = $request->getUri()->getPath();
        // skip admin
        if (0 === strpos($path, "/admin")) {
            return $next($request, $response);
        }
        // check seo
        if ($this->config->cfg('url_style') == 'seo' && 1 === preg_match('~^/(.+)\\.html$~', $path, $seo)) {
            $_GET['seoq'] = $seo[1];
            get_seo(true);
        }
        // Check $_GET['go']
        $this->config->setConfig('env', 'get_go_raw', isset($_GET['go']) ? $_GET['go'] : null);
        if (isset($_GET['go'])) {
            // current uri
            $uri = $request->getUri()->withPath('/' . $_GET['go'] . '/');
            // Articles from DB
            $stmt = $this->db->conn()->prepare(<<<SQL
                SELECT COUNT(`article_id`) FROM
                `{$this->db->getPrefix()}articles`
                WHERE `article_url` = ? LIMIT 0,1
SQL
);
            $stmt->execute(array($_GET['go']));
            $num = $stmt->fetchColumn();
            // Found articles
            if ($num >= 1) {
                // rewrite URI to /{go}.html
                $uri = $request->getUri()->withPath('/' . $_GET['go'] . '.html');
            }
            // rewrite URI to = /{go}
            $request = $request->withUri($uri);
        }
        return $next($request, $response);
    }
Example #2
0
            $meta_description_d = trim(gpc('meta_description_d', 'P', ''));
            $setting = array('open_rewrite' => 0);
            $settings = gpc('setting', 'P', $setting);
            if (!$error) {
                update_seo('index', 0, $meta_title, $meta_keywords, $meta_description);
                if ($auth[pd_a]) {
                    update_seo('public', 0, $meta_title2, $meta_keywords2, $meta_description2);
                    update_seo('hotfile', 0, $meta_title3, $meta_keywords3, $meta_description3);
                    update_seo('space', 0, $meta_title_s, $meta_keywords_s, $meta_description_s);
                    update_seo('viewfile', 0, $meta_title_v, $meta_keywords_v, $meta_description_v);
                    update_seo('download', 0, $meta_title_d, $meta_keywords_d, $meta_description_d);
                }
                settings_cache($settings);
                $sysmsg[] = __('seo_update_success');
                redirect(urr(ADMINCP, "item={$item}&menu={$menu}"), $sysmsg);
            } else {
                redirect('back', $sysmsg);
            }
        } else {
            $s = get_seo('index', 0);
            if ($auth[pd_a]) {
                $s2 = get_seo('public', 0);
                $s3 = get_seo('hotfile', 0);
                $ss = get_seo('space', 0);
                $sv = get_seo('viewfile', 0);
                $sd = get_seo('download', 0);
            }
            $setting = $settings;
            require_once template_echo($item, $admin_tpl_dir, '', 1);
        }
}
Example #3
0
                $conn = conndB();
                $sql = "SELECT COUNT(*) AS rows FROM tbl_product AS prod_ LEFT JOIN tbl_product_type AS type_ ON prod_.id = type_.product_id\n\t             WHERE `product_visibility` = '1'\n\t\t\t\t AND `type_visibility` = '1'\n\t\t\t\t AND `product_alias` = '{$product_alias}'\n\t\t\t\t AND `type_alias` = '{$type_alias}'\n\t\t\t\t";
                $query = mysql_query($sql, $conn);
                $result = mysql_fetch_array($query);
                return $result;
            }
            function get_seo($product_alias, $type_alias)
            {
                $conn = conndB();
                $sql = "SELECT * FROM tbl_product AS prod_ LEFT JOIN tbl_product_type AS type_ ON prod_.id = type_.product_id\n\t             WHERE `product_visibility` = '1'\n\t\t\t\t AND `type_visibility` = '1'\n\t\t\t\t AND `product_alias` = '{$product_alias}'\n\t\t\t\t AND `type_alias` = '{$type_alias}'\n\t\t\t\t";
                $query = mysql_query($sql, $conn);
                $result = mysql_fetch_array($query);
                return $result;
            }
            /* --- DEFINED VARIABLE --- */
            $product_alias = $_REQUEST['prod_name'];
            $type_alias = $_REQUEST['prod_type'];
            /* --- CALL FUNCTION --- */
            $count_seo = count_seo($product_alias, $type_alias);
            $data_seo = get_seo($product_alias, $type_alias);
            /* --- CONTROL --- */
            if ($count_seo['rows'] > 0) {
                $data_seo_description = $data_seo['page_description'];
                $data_seo_keywords = $data_seo['page_keywords'];
            } else {
                $data_seo_description = $data_seo['type_description'];
                $data_seo_keywords = $data_seo['product_name'];
            }
        }
    }
}
Example #4
0
#
*/
include "includes/commons.inc.php";
!$auth[is_fms] && exit(msg::umsg('Not_FMS', __('zcore_no_power')));
$in_front = true;
$cate_id = (int) gpc('cate_id', 'G', 0);
if ($cate_id) {
    $cate_name = $db->result_first("select cate_name from {$tpf}categories where cate_id='{$cate_id}'");
}
$nav_title = $cate_name ? $cate_name . '' : '';
$nav_title = $nav_title;
$title = $nav_title . ' - ' . $settings['site_title'];
$file_keywords = $nav_title . ',';
$C[cate_hot_file] = get_cate_file($cate_id, 'file_downs');
if ($auth[pd_a]) {
    $seo = get_seo('public', $cate_id);
    if ($seo[title]) {
        eval("\$title = \"{$seo['title']}\";");
    }
    eval("\$keywords = \"{$seo['keywords']}\";");
    eval("\$description = \"{$seo['description']}\";");
}
include PHPDISK_ROOT . "./includes/header.inc.php";
if ($cate_id) {
    //面包屑
    $cur_cate = $cate_obj->getNodeById($cate_id);
    $breadcrumb = array();
    get_cate_breakcrumb($cur_cate, $breadcrumb);
    //分类数据
    $C[cate_list] = get_all_relate_cate_from_cateid($cate_id);
    //课程数据
Example #5
0
		$login_txt = __('please_login');
		$disabled = 'disabled';
	}
}
*/
$title = $course['course_name'] . ' - ' . $settings['site_title'];
$arr = course2tag($course_id);
$course_tags = '';
if (count($arr)) {
    foreach ($arr as $v) {
        $course_tags .= $v['tag_name'] . ',';
    }
}
if ($auth[pd_a]) {
    $seo = get_seo('viewfile', $course_id);
    $seo_a = get_seo('viewfile', 0);
    if ($seo_a[title]) {
        eval("\$title = \"{$seo['title']} {$seo_a['title']}\";");
    }
    eval("\$keywords = \"{$seo['keywords']} {$seo_a['keywords']}\";");
    eval("\$description = \"{$seo['description']} {$seo_a['description']}\";");
}
$loading_secs = get_loadiong_secs();
$myinfo = get_profile($course[user_id]);
//$curr_tpl = $myinfo[curr_tpl] ? $myinfo[curr_tpl] : 'default';
//$user_tpl_dir = 'templates/'.$curr_tpl.'/';
//$username = $file['p_name'] ? $file['p_name'] : $pd_username;
//$tmp_username = $username;//convert_str('utf-8','gbk',$username);
$logo = $myinfo[logo] ? $settings['file_path'] . '/' . $myinfo[logo] : $user_tpl_dir . 'images/logo.png';
$logo_url = $myinfo[logo_url] ? $myinfo[logo_url] : urr("space", "username="******"./includes/header.inc.php";
Example #6
0
             $q = $db->query("select u.username,u.userid from {$tpf}buddys b,{$tpf}users u where b.touserid=u.userid and b.userid='{$user['userid']}'");
             $buddy_list = array();
             while ($rs = $db->fetch_array($q)) {
                 $rs['a_user_edit'] = urr(ADMINCP, "item=users&menu=user&action=user_edit&uid={$rs['userid']}");
                 $buddy_list[] = $rs;
             }
             $db->free($q);
             unset($rs);
         }
         $curr_credit_rate = $myinfo[credit_rate] ? exp_credit_rate($myinfo[credit_rate]) : ($settings[how_downs_credit] && $settings[how_money_credit] ? $settings[how_downs_credit] . '==' . $settings[how_money_credit] : __('not_set'));
         $curr_downline_rate = $myinfo[downline_income] ? $myinfo[downline_income] . '%' : ($settings[downline_income] ? $settings[downline_income] . '%' : __('not_set'));
         $curr_downline_rate2 = $myinfo[downline_income2] ? $myinfo[downline_income2] . '%' : ($settings[downline_income2] ? $settings[downline_income2] . '%' : __('not_set'));
         $curr_discount_rate = $myinfo[discount_rate] ? $myinfo[discount_rate] . '%' : ($settings[discount_rate] ? $settings[discount_rate] . '%' : __('not_set'));
         $add_discount = get_discount($uid, $myinfo[credit], 'desc');
         if ($auth[pd_a]) {
             $s = get_seo('space', $uid);
         }
         require_once template_echo($item, $admin_tpl_dir, '', 1);
     }
     break;
 case 'adminlogout':
     $db->query_unbuffered("update {$tpf}adminsession set hashcode='' where userid='{$pd_uid}'");
     $sysmsg[] = __('system_logout_success');
     redirect('javascript:self.parent.close();', $sysmsg);
     break;
 case 'orders':
     admin_no_power($task, 7, $pd_uid);
     if ($task == 'update') {
         form_auth(gpc('formhash', 'P', ''), formhash());
         $order_ids = gpc('order_ids', 'P', array());
         $o_status = gpc('o_status', 'P', array());
Example #7
0
*/
include "includes/commons.inc.php";
!$auth[is_fms] && exit(msg::umsg('Not_FMS', __('zcore_no_power')));
$in_front = true;
$cate_id = (int) gpc('cate_id', 'G', 0);
$o_type = trim(gpc('o_type', 'G', ''));
$o_type = $o_type ? str_replace(array("'", "'"), '', $o_type) : 'd_all';
if (!in_array($o_type, array('d_all', 'd_day', 'd_3day', 'd_now_week', 'd_week', 'd_month'))) {
    header('Location: ' . $settings[phpdisk_url] . urr("hotfile", ""));
    exit;
}
$o_type_tit = array('d_all' => __('d_all_tit'), 'd_day' => date('Y-m-d', strtotime('-1 day')) . __('d_day_tit'), 'd_3day' => __('d_3day_tit'), 'd_now_week' => __('d_now_week_tit'), 'd_week' => __('d_week_tit'), 'd_month' => __('d_month_tit'));
$nav_title = $o_type_tit[$o_type];
$title = $nav_title . ' - ' . $settings['site_title'];
if ($auth[pd_a]) {
    $seo = get_seo('hotfile', $cate_id);
    if ($seo[title]) {
        eval("\$title = \"{$seo['title']}\";");
    }
    eval("\$keywords = \"{$seo['keywords']}\";");
    eval("\$description = \"{$seo['description']}\";");
}
include PHPDISK_ROOT . "./includes/header.inc.php";
$C[cate_list] = get_cate_list();
$cate_sql = $cate_id ? " and cate_id='{$cate_id}'" : '';
if ($o_type == 'd_all') {
    $sql_do = " {$tpf}files fl,{$tpf}users u where fl.userid=u.userid and fl.is_del=0";
} else {
    switch ($o_type) {
        case 'd_day':
            $d_val = date('Ymd', strtotime('-1 day'));
Example #8
0
$userid = $rs['userid'];
$space_pwd = $rs['space_pwd'];
$title = $space_title . ' - ' . $settings['site_title'];
$c_space_pwd = gpc('c_space_pwd', 'C', '');
if (!$userid) {
    header("HTTP/1.0 404 Not Found");
    exit;
}
if ($pd_uid == $userid || !$space_pwd || $space_pwd && $space_pwd == $c_space_pwd) {
    $need_pwd = false;
} else {
    $need_pwd = true;
}
if ($auth[pd_a]) {
    $seo = get_seo('space', $userid);
    $seo_a = get_seo('space', 0);
    if ($seo_a[title]) {
        eval("\$title = \"{$seo['title']} {$seo_a['title']}\";");
    }
    eval("\$keywords = \"{$seo['keywords']} {$seo_a['keywords']}\";");
    eval("\$description = \"{$seo['description']} {$seo_a['description']}\";");
}
include PHPDISK_ROOT . "./includes/header.inc.php";
$my_announce = get_profile($userid, 'my_announce') ? get_profile($userid, 'my_announce') : '...此用户暂无公告...';
if ($need_pwd) {
    $arr = explode('space.php', $_SERVER['SCRIPT_NAME']);
    $ajax_url = 'http://' . $_SERVER['HTTP_HOST'] . $arr[0];
    require_once template_echo('pd_space_pwd', $user_tpl_dir);
    include PHPDISK_ROOT . "./includes/footer.inc.php";
    exit;
}
Example #9
0
                $file_description = preg_replace("/<(\\/?i?frame.*?)>/si", "", $file_description);
                $file_description = preg_replace("/<(\\/?script.*?)>/si", "", $file_description);
            }
            if (!$error) {
                if ($auth[pd_a]) {
                    update_seo('viewfile', $file_id, $meta_title, $meta_keywords, $meta_description);
                    update_seo('download', $file_id, $meta_title2, $meta_keywords2, $meta_description2);
                }
                $db->query_unbuffered("update {$tpf}files set file_description='{$file_description}' where file_id='{$file_id}'");
                $sysmsg[] = __('file_edit_success');
                redirect($ref, $sysmsg);
            } else {
                redirect('back', $sysmsg);
            }
        } else {
            $rs = $db->fetch_one_array("select file_description,file_name,file_extension from {$tpf}files where file_id='{$file_id}'");
            if ($rs) {
                $file_description = str_replace('<br>', LF, $rs[file_description]);
                $tmp_ext = $rs[file_extension] ? '.' . $rs[file_extension] : '';
                $file_name = file_icon($rs['file_extension']) . $rs[file_name] . $tmp_ext;
            }
            unset($rs);
            $ref = $_SERVER['HTTP_REFERER'];
            if ($auth[pd_a]) {
                $s = get_seo('viewfile', $file_id);
                $s2 = get_seo('download', $file_id);
            }
            require_once template_echo($item, $admin_tpl_dir, '', 1);
        }
        break;
}
Example #10
0
$nodes = get_nodes($file[server_oid]);
if ($auth[is_fms]) {
    $C[you_like_file] = super_cache::get('get_rand_file|10');
}
if (get_profile($file[userid], 'plan_id')) {
    $adv_top = stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'download_code_top')));
    $adv_inner = stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'download_code_left')));
    $adv_bottom = stripslashes(base64_decode(get_plans(get_profile($file[userid], 'plan_id'), 'download_code_bottom')));
} else {
    $adv_top = show_adv_data('adv_download_top', 0);
    $adv_inner = show_adv_data('adv_download_inner', 0);
    $adv_bottom = show_adv_data('adv_download_bottom', 0);
}
if ($auth[pd_a]) {
    $seo = get_seo('download', $file_id);
    $seo_a = get_seo('download', 0);
    if ($seo_a[title]) {
        eval("\$title = \"{$seo['title']} {$seo_a['title']}\";");
    }
    eval("\$keywords = \"{$seo['keywords']} {$seo_a['keywords']}\";");
    eval("\$description = \"{$seo['description']} {$seo_a['description']}\";");
}
include PHPDISK_ROOT . "./includes/header.inc.php";
if (!$file[is_checked]) {
    $msg = __('file_checking');
    require_once template_echo('information', $user_tpl_dir);
    include PHPDISK_ROOT . "./includes/footer.inc.php";
    exit;
}
require_once template_echo('pd_download', $user_tpl_dir);
include PHPDISK_ROOT . "./includes/footer.inc.php";
Example #11
0
#
#	Copyright (C) 2008-2014 PHPDisk Team. All Rights Reserved.
#
*/
include "includes/commons.inc.php";
$in_front = true;
if ($action == 'set_default_tpl') {
    pd_setcookie('ptpl', 'default');
    settings_cache(array('open_switch_tpls' => 1));
    $db->query_unbuffered("update {$tpf}templates set actived=0 where tpl_type='user';");
    $db->query_unbuffered("update {$tpf}templates set actived=1 where tpl_name='default'");
    header('Location: ' . $settings[phpdisk_url]);
    exit;
}
$title = $settings[site_title];
$seo = get_seo('index', 0);
if (isset($seo[title])) {
    eval("\$title = \"{$seo['title']}\";");
}
if (isset($seo[keywords])) {
    eval("\$keywords = \"{$seo['keywords']}\";");
}
if (isset($seo[description])) {
    eval("\$description = \"{$seo['description']}\";");
}
include PHPDISK_ROOT . "./includes/header.inc.php";
if (!$auth[is_fms]) {
    $show_multi = false;
    if (in_array($curr_script, array('index'))) {
        $ts = (int) gpc('ts', 'G', 0);
        if ($action == 'multi') {