function metlabel_list($listtype = 'text', $mark, $type, $order, $module, $time = 0, $titleok = 1, $bian = 1, $listmx, $txtmax, $imgwidth)
{
    global $class_index, $index, $lang, $class_list, $metblank;
    global $index_news_no, $index_product_no, $index_download_no, $index_img_no, $index_job_no;
    $modules = $mark ? $class_index[$mark]['module'] : $module;
    $modules = $modules ? $modules : 2;
    $marktype = 0;
    if ($mark && strstr($mark, "-")) {
        $hngy5 = explode('-', $mark);
        if ($hngy5[1] == 'cm') {
            $mark = $hngy5[0];
            $modules = $class_list[$mark]['module'];
            $marktype = 1;
            $module = $modules;
        }
        if ($hngy5[1] == 'md') {
            $mark = '';
            $modules = $hngy5[0];
            $module = metmodname($hngy5[0]);
        }
    }
    $listarray = methtml_getarray($mark, $type, $order, $module, $listmx, '', '', $marktype, $txtmax);
    switch ($listtype) {
        case 'img':
            $metinfo .= "<ol class='list-none metlist'>";
            $i = 0;
            foreach ($listarray as $key => $val) {
                $val[imgurls] = str_replace("../http://", "http://", $val[imgurls]);
                $i++;
                if ($imgwidth) {
                    $val[img_y] = round($imgwidth * $val[img_y] / $val[img_x]);
                    $val[img_x] = $imgwidth;
                }
                $metinfo .= "<li class='list'>";
                $metinfo .= "<a href='{$val[url]}' title='{$val[title]}' {$metblank} class='img'><img src='{$val[imgurls]}' alt='{$val[title]}' title='{$val[title]}' width='{$val[img_x]}' height='{$val[img_y]}' /></a>";
                if ($titleok) {
                    $metinfo .= "<h3 style='width:{$val[img_x]}px;'><a href='{$val[url]}' title='{$val[title]}' {$metblank}>{$val[title]}</a></h3>";
                }
                $metinfo .= "</li>";
            }
            $metinfo .= "</ol>";
            break;
        case 'text':
            $metinfo .= "<ol class='list-none metlist'>";
            $i = 0;
            foreach ($listarray as $key => $val) {
                $i++;
                $top = '';
                if ($i == 1) {
                    $top = 'top';
                }
                $metinfo .= "<li class='list {$top}'>";
                if ($bian) {
                    $a = '[';
                    $b = ']';
                }
                if ($time) {
                    $metinfo .= "<span class='time'>{$a}{$val[updatetime]}{$b}</span>";
                }
                $metinfo .= "<a href='{$val[url]}' title='{$val[title]}' {$metblank}>{$val[title]}</a>{$val[hot]}{$val[news]}{$val[top]}";
                $metinfo .= "</li>";
            }
            if ($modules == 1) {
                $metinfo .= $marktype == 1 ? $class_list[$mark]['description'] : $class_index[$mark]['description'];
            }
            $metinfo .= "</ol>";
            break;
    }
    return $metinfo;
}
Beispiel #2
0
function jump_pseudo()
{
    global $db, $met_skin_user, $pseudo_jump;
    global $met_column, $met_news, $met_product, $met_download, $met_img, $met_job;
    global $class1, $class2, $class3, $id, $lang, $page, $selectedjob;
    global $met_index_type, $index, $met_pseudo;
    if ($met_pseudo) {
        $metadmin[pagename] = 1;
        $pseudo_url = $_SERVER[HTTP_X_REWRITE_URL] ? $_SERVER[HTTP_X_REWRITE_URL] : $_SERVER[REQUEST_URI];
        $pseudo_jump = @strstr($_SERVER['SERVER_SOFTWARE'], 'IIS') && $_SERVER[HTTP_X_REWRITE_URL] == '' ? 1 : $pseudo_jump;
        $dirs = explode('/', $pseudo_url);
        $dir_dirname = $dirs[count($dirs) - 2];
        $dir_filename = $dirs[count($dirs) - 1];
        if ($pseudo_jump != 1) {
            $dir_filenames = explode('?', $dir_filename);
            switch ($dir_filenames[0]) {
                case 'index.php':
                    if (!$class1 && !$class2 && !$class3) {
                        if ($index == 'index') {
                            if ($lang == $met_index_type) {
                                $jump['url'] = './';
                            } else {
                                $jump['url'] = 'index-' . $lang . '.html';
                            }
                        } else {
                            if ($lang == $met_index_type) {
                                $jump['url'] = './';
                            } else {
                                $id = $class3 ? $class3 : ($class2 ? $class2 : $class1);
                                if ($id) {
                                    $query = "select * from {$met_column} where id='{$id}'";
                                } else {
                                    $query = "select * from {$met_column} where foldername='{$dir_dirname}' and lang='{$lang}' and (classtype='1' or releclass!='0') order by id asc";
                                }
                                $jump = $db->get_one($query);
                                $psid = ($jump['filename'] != "" and $metadmin['pagename']) ? $jump['filename'] : $jump['id'];
                                if ($jump[module] == 1) {
                                    $jump['url'] = './' . $psid . '-' . $lang . '.html';
                                } else {
                                    if ($jump[module] == 8) {
                                        $jump['url'] = './' . 'index-' . $lang . '.html';
                                    } else {
                                        if ($page && $page != 1) {
                                            $psid .= '-' . $page;
                                        }
                                        $jump['url'] = './' . 'list-' . $psid . '-' . $lang . '.html';
                                    }
                                }
                            }
                        }
                    } else {
                        if ($dir_dirname == 'job.php') {
                            $query = "select * from {$met_column} where lang='{$lang}' and module='6'";
                        } else {
                            $id = $class3 ? $class3 : ($class2 ? $class2 : $class1);
                            $query = "select * from {$met_column} where id='{$id}'";
                        }
                        $jump = $db->get_one($query);
                        $dir_filenames[0] = metmodname($jump[module]) . '.php';
                        if ($jump) {
                            $psid = ($jump['filename'] != "" and $metadmin['pagename']) ? $jump['filename'] : $jump['id'];
                            if ($page && $page != 1) {
                                $psid .= '-' . $page;
                            }
                            $jump['url'] = './' . 'list-' . $psid . '-' . $lang . '.html';
                        } else {
                            if (!$psid) {
                                if ($dir_filenames[0] == 'product.php') {
                                    $psid = 'product';
                                }
                                if ($dir_filenames[0] == 'img.php') {
                                    $psid = 'img';
                                }
                            }
                            $jump['url'] = './' . $psid . '-list-' . $lang . '.html';
                        }
                    }
                    break;
                case 'show.php':
                    $query = "select * from {$met_column} where id='{$id}'";
                    $jump = $db->get_one($query);
                    $psid = ($jump['filename'] != "" and $metadmin['pagename']) ? $jump['filename'] : $jump['id'];
                    $jump['url'] = './' . $psid . '-' . $lang . '.html';
                    break;
                case 'news.php':
                case 'product.php':
                case 'download.php':
                case 'img.php':
                case 'job.php':
                    if ($dir_filenames[0] == 'job.php') {
                        $query = "select * from {$met_column} where lang='{$lang}' and module='6'";
                    } else {
                        $id = $class3 ? $class3 : ($class2 ? $class2 : $class1);
                        $query = "select * from {$met_column} where id='{$id}'";
                    }
                    $jump = $db->get_one($query);
                    if ($jump) {
                        $psid = ($jump['filename'] != "" and $metadmin['pagename']) ? $jump['filename'] : $jump['id'];
                        if ($page && $page != 1) {
                            $psid .= '-' . $page;
                        }
                        $jump['url'] = './' . 'list-' . $psid . '-' . $lang . '.html';
                    } else {
                        if (!$psid) {
                            if ($dir_filenames[0] == 'product.php') {
                                $psid = 'product';
                            }
                            if ($dir_filenames[0] == 'img.php') {
                                $psid = 'img';
                            }
                        }
                        $jump['url'] = './' . $psid . '-list-' . $lang . '.html';
                    }
                    break;
                case 'shownews.php':
                case 'showproduct.php':
                case 'showdownload.php':
                case 'showimg.php':
                case 'showjob.php':
                    switch ($dir_filenames[0]) {
                        case 'shownews.php':
                            $query = "select * from {$met_news} where id='{$id}'";
                            break;
                        case 'showproduct.php':
                            $query = "select * from {$met_product} where id='{$id}'";
                            break;
                        case 'showdownload.php':
                            $query = "select * from {$met_download} where id='{$id}'";
                            break;
                        case 'showimg.php':
                            $query = "select * from {$met_img} where id='{$id}'";
                            break;
                        case 'showjob.php':
                            $query = "select * from {$met_job} where id='{$id}'";
                            break;
                    }
                    $jump = $db->get_one($query);
                    $panyid = ($jump['filename'] != "" and $metadmin['pagename']) ? $jump['filename'] : $jump['id'];
                    $jump['url'] = './' . $panyid . '-' . $lang . '.html';
                    break;
                case 'message.php':
                    $jump['url'] = './' . 'message-' . $lang . '.html';
                    break;
                case 'cv.php':
                    $selectedjob = $selectedjob ? $selectedjob : 0;
                    $jump['url'] = './' . 'jobcv-' . $selectedjob . '-' . $lang . '.html';
                    break;
            }
            if ($jump['url']) {
                $jump['url'] = str_replace('./', '', $jump['url']);
                $jump['url'] = 'http://' . $_SERVER[HTTP_HOST] . str_replace($dir_filename, $jump['url'], $_SERVER[REQUEST_URI]);
                Header("HTTP/1.1 301 Moved Permanently");
                Header("Location: {$jump['url']}");
            }
        }
    }
}
Beispiel #3
0
function methtml_getarray($mark, $type, $order, $module, $listmx = -1, $para = 0, $categoryname = 0, $marktype = 0, $txtmax = 0, $descmax = 0, $rand = 0)
{
    global $met_member_use, $class_index, $met_listtime, $metinfo_member_type, $db, $met_news, $met_product, $met_download, $met_img, $met_job, $met_parameter, $met_plist, $class_list, $metpara, $module_list2;
    global $index_news_no, $index_product_no, $index_download_no, $index_img_no, $index_job_no, $mobilesql;
    global $index, $navurl, $weburly, $lang, $pagename, $langmark, $met_htmpagename, $met_chtmtype, $met_htmtype, $met_pseudo, $met_webhtm;
    global $dataoptimize, $pagemark, $img_url, $met_hot, $m_now_date, $met_newsdays, $metmemberforce, $met_alt, $metblank, $met_agents_img;
    global $product_paralist, $download_paralist, $img_paralist, $m_now_time;
    if ($mark && strstr($mark, "-")) {
        $hngy5 = explode('-', $mark);
        if ($hngy5[1] == 'cm') {
            $mark = $hngy5[0];
            $marktype = 1;
        }
        if ($hngy5[1] == 'md') {
            $mark = '';
            $module = metmodname($hngy5[0]);
        }
    }
    $listmx = $listmx == '' ? -1 : $listmx;
    if ($met_member_use == 2) {
        $access_sql = " and access<={$metinfo_member_type}";
    }
    $numname = ' id,title,description,class1,class2,class3,updatetime,addtime,filename,access,top_ok,hits,issue,com_ok,no_order,';
    $listitem['news'] = array(0 => $numname . 'img_ok,imgurls,content,imgurl,links', 1 => $met_news, 2 => 'shownews');
    $listitem['product'] = array(0 => $numname . 'new_ok,imgurls,content,imgurl,displayimg,links', 1 => $met_product, 2 => 'showproduct');
    $listitem['download'] = array(0 => $numname . 'downloadurl,filesize,content,downloadaccess', 1 => $met_download, 2 => 'showdownload');
    $listitem['img'] = array(0 => $numname . 'new_ok,imgurls,content,imgurl,displayimg,links', 1 => $met_img, 2 => 'showimg');
    $listitem['job'] = array(0 => '*', 1 => $met_job, 2 => 'showjob');
    $sqlorder = $order == 'hits' ? ' order by top_ok desc,com_ok desc,no_order desc,hits desc,id desc' : ' order by top_ok desc,com_ok desc,no_order desc,updatetime desc,id desc';
    switch ($type) {
        default:
            $sqltype = "";
            break;
        case 'com':
            $sqltype = "and com_ok=1";
            break;
        case 'new':
            $sqltype = "and new_ok=1";
            break;
        case 'img':
            $sqltype = "and img_ok=1";
            break;
    }
    if ($mark) {
        if ($marktype) {
            $listnowid = $mark;
            $listnowclass = "class{$class_list[$mark]['classtype']}";
            if ($class_list[$mark]['releclass']) {
                $listnowclass = "class1";
            }
            $modulex = metmodname($class_list[$mark]['module']);
            $sqlorder = $order ? $sqlorder : list_order($class_list[$mark]['list_order']);
        } else {
            $listnowid = $class_index[$mark]['id'];
            $listnowclass = "{$class_index[$mark]['classtype']}";
            $modulex = metmodname($class_index[$mark]['module']);
            $sqlorder = $order ? $sqlorder : list_order($class_index[$mark]['list_order']);
        }
        $folderone = $db->get_one("SELECT * FROM {$met_column} WHERE bigclass='{$listnowid}' and module ='{$class_list[$listnowid][module]}' and releclass!='0' and lang='{$lang}'");
        if ($folderone) {
            $sqlclounm = "and ({$listnowclass}='{$listnowid}' or class1='{$folderone['id']}')";
        } else {
        }
        if ($listnowclass == 'class1') {
            $class1sql = " {$listnowclass}='{$listnowid}' ";
            foreach ($module_list2[$class_list[$listnowid]['module']] as $key => $val) {
                if ($val['releclass'] == $listnowid) {
                    $class1re .= " or {$listnowclass}='{$val['id']}' ";
                }
            }
            if ($class1re) {
                $class1sql = '(' . $class1sql . $class1re . ')';
            }
            $sqlclounm = ' and ' . $class1sql;
        } else {
            $sqlclounm = "and {$listnowclass}='{$listnowid}'";
        }
        if (!$modulex) {
            $module = $module ? $module : 'news';
            $sqlclounm = '';
        } else {
            $module = $modulex;
        }
    }
    $module = $module ? $module : 'news';
    switch ($module) {
        case 'news':
            $modulenunm = 2;
            break;
        case 'product':
            $modulenunm = 3;
            break;
        case 'download':
            $modulenunm = 4;
            break;
        case 'img':
            $modulenunm = 5;
            break;
        case 'job':
            $modulenunm = 6;
            break;
    }
    if ($listmx == -1) {
        switch ($module) {
            case 'news':
                $listmx = $index_news_no;
                break;
            case 'product':
                $listmx = $index_product_no;
                break;
            case 'download':
                $listmx = $index_download_no;
                break;
            case 'img':
                $listmx = $index_img_no;
                break;
            case 'job':
                $listmx = $index_job_no;
                break;
        }
    } else {
        $listmx = $listmx;
    }
    $select = $listitem[$module][0];
    $table = $listitem[$module][1];
    if ($module == 'news' || $module == 'product' || $module == 'download' || $module == 'img' || $module == 'job') {
        $displaytype_sql = "and displaytype='1'";
    } else {
        $displaytype_sql = "";
    }
    if ($modulenunm == 6) {
        if ($rand == 0) {
            $rand_query = "order by top_ok desc,no_order desc,addtime desc limit 0, {$listmx}";
        } else {
            if ($rand == '-1') {
                $rand_query = "ORDER BY RAND() LIMIT {$listmx} ";
            } else {
                $rand_query = "order by top_ok desc,no_order desc,addtime desc limit {$rand}, {$listmx}";
            }
        }
        $query = "SELECT {$select} FROM {$table} where lang='{$lang}' {$mobilesql} and ((TO_DAYS(NOW())-TO_DAYS(`addtime`)< useful_life) OR useful_life=0) and addtime<='{$m_now_date}' {$displaytype_sql} {$access_sql} {$rand_query}";
    } else {
        if ($rand == 0) {
            $rand_query = $sqlorder . " limit 0, {$listmx}";
        } else {
            if ($rand == '-1') {
                $rand_query = "ORDER BY RAND() LIMIT {$listmx}";
            } else {
                $rand_query = $sqlorder . " limit {$rand}, {$listmx}";
            }
        }
        $query = "SELECT {$select} FROM {$table} where lang='{$lang}' {$mobilesql} {$sqlclounm} {$access_sql} {$sqltype} and (recycle='0' or recycle='-1') and addtime<='{$m_now_date}' {$displaytype_sql} {$rand_query}";
    }
    $result = $db->query($query);
    while ($list = $db->fetch_array($result)) {
        if ($modulenunm == 6) {
            $list['updatetime'] = $list['addtime'];
            $list['title'] = $list['position'];
        }
        $list['updatetime_original'] = $list['updatetime'];
        $list['title_all'] = $list['title'];
        $list['description_all'] = $list['description'];
        if ($txtmax) {
            $list['title'] = utf8substr($list['title'], 0, $txtmax);
        }
        if ($descmax) {
            $list['description'] = utf8substr($list['description'], 0, $descmax);
        }
        if ($dataoptimize[$pagemark]['categoryname'] || $categoryname) {
            $list['class1_name'] = $class_list[$list['class1']]['name'];
            $list['class1_url'] = $class_list[$list['class1']]['url'];
            $list['class2_name'] = $list['class2'] ? $class_list[$list['class2']]['name'] : $list['class1_name'];
            $list['class2_url'] = $list['class2'] ? $class_list[$list['class2']]['url'] : $list['class1_url'];
            $list['class3_name'] = $list['class3'] ? $class_list[$list['class3']]['name'] : ($list['class2'] ? $class_list[$list['class2']]['name'] : $list['class1_name']);
            $list['class3_url'] = $list['class3'] ? $class_list[$list['class3']]['url'] : ($list['class2'] ? $class_list[$list['class2']]['url'] : $list['class1_url']);
        }
        if ($list['top_ok'] == 1) {
            $list['top'] = "<img class='listtop' src='" . $img_url . "top.gif" . "' alt='" . $met_alt . "' />";
            $list['hot'] = "";
            $list['news'] = "";
        } else {
            $list['top'] = "";
            $list['hot'] = $list['hits'] >= $met_hot ? "<img class='listhot' src='" . $img_url . "hot.gif" . "' alt='" . $met_alt . "' />" : "";
            $list['news'] = (strtotime($m_now_date) - strtotime($list['updatetime'])) / 86400 < $met_newsdays ? "<img class='listnew' src='" . $img_url . "news.gif" . "' alt='" . $met_alt . "' />" : "";
        }
        $list['status'] = $list['top'] . $list['hot'] . $list['news'];
        $weburly = "";
        if ($index[index] == "index") {
            if (!strstr($list['imgurls'], "http://")) {
                $listarray[imgurls] = explode("../", $list['imgurls']);
                $list[imgurls] = $weburly . $listarray['imgurls'][1];
            }
            if (!strstr($list['imgurl'], "http://")) {
                $listarray[imgurl] = explode("../", $list['imgurl']);
                $list[imgurl] = $weburly . $listarray['imgurl'][1];
            }
        }
        if (strstr($list['imgurls'], "http://")) {
            $list['imgurls'] = $list['imgurls'] != "" ? $list['imgurls'] : $list['imgurls'];
        } else {
            $list['imgurls'] = $list['imgurls'] != "" ? $list['imgurls'] : $weburly . $met_agents_img;
        }
        if (strstr($list['imgurl'], "http://")) {
            $list['imgurl'] = $list['imgurl'] != "" ? $list['imgurl'] : $list['imgurl'];
        } else {
            $list['imgurl'] = $list['imgurl'] != "" ? $list['imgurl'] : $weburly . $met_agents_img;
        }
        if (($dataoptimize[$pagemark]['para'][$modulenunm] and $dataoptimize[$pagemark]['parameter']) || $para) {
            switch ($modulenunm) {
                case 3:
                    $md_paralist = $product_paralist;
                    break;
                case 4:
                    $md_paralist = $download_paralist;
                    break;
                case 5:
                    $md_paralist = $img_paralist;
                    break;
            }
            $query1 = "select * from {$met_plist} where lang='{$lang}' and listid='{$list['id']}' and module='{$modulenunm}' order by id";
            $result1 = $db->query($query1);
            while ($list1 = $db->fetch_array($result1)) {
                $i = 0;
                $ik = 0;
                foreach ($md_paralist as $key => $val) {
                    $i++;
                    if ($list1['paraid'] == $val['id']) {
                        if ($metpara[$list1['paraid']]['class1'] == 0 or $metpara[$list1['paraid']]['class1'] == $list['class1'] and $metpara[$list1['paraid']]['class2'] == 0 and $metpara[$list1['paraid']]['class3'] == 0 or $metpara[$list1['paraid']]['class1'] == $list['class1'] and $metpara[$list1['paraid']]['class2'] == $list['class2'] and $metpara[$list1['paraid']]['class3'] == 0 or $metpara[$list1['paraid']]['class1'] == $list['class1'] and $metpara[$list1['paraid']]['class2'] == $list['class2'] and $metpara[$list1['paraid']]['class3'] == $list['class3']) {
                            $ik = $i;
                        }
                    }
                }
                $nowpara1 = "para" . $ik;
                $list[$nowpara1] = $list1['info'];
                $metparaaccess = $metpara[$list1['paraid']]['access'];
                if (intval($metparaaccess) > 0 && $met_member_use) {
                    $paracode = authcode($list1[$nowpara1], 'ENCODE', $met_member_force);
                    $paracode = codetra($paracode, 1);
                    $list[$nowpara1] = "<script language='javascript' src='" . $navurl . "include/access.php?metuser=para&metaccess=" . $metparaaccess . "&lang=" . $lang . "&listinfo=" . $paracode . "&paratype=" . $metpara[$list1['paraid']]['type'] . "&index=" . $index[index] . "'></script>";
                }
                $nowparaname = "";
                $nowparaname = $nowpara1 . "name";
                $list[$nowparaname] = $metpara[$list1['paraid']]['name'];
                if ($metpara[$list1['paraid']]['type'] == 5 && $index[index] == "index") {
                    $listarray['info'] = explode("../", $list1['info']);
                    $list1['info'] = $listarray['info'][1];
                }
                if ($metpara[$list1['paraid']]['type'] == 5) {
                    $fltp = metfiletype($list1['info']);
                    $fltp = $fltp ? 'met_annex_' . $fltp : '';
                    $list[$nowpara1] = "<a href='{$list1['info']}' {$metblank} class='met_annex {$fltp}' title='{$list1['imgname']}'>{$list1['imgname']}</a>";
                    $list[$nowpara1 . 's'] = $list1['info'];
                }
            }
            unset($list['para0']);
            unset($list['para0name']);
        }
        //URL地址
        $filename = $modulenunm == 6 ? $navurl . 'job' : $navurl . $class_list[$list['class1']]['foldername'];
        $filenamenow = $met_htmpagename == 2 ? $modulenunm == 6 ? 'job' : $class_list[$list['class1']]['foldername'] : ($met_htmpagename == 1 ? date('Ymd', strtotime($list['addtime'])) : $listitem[$module][2]);
        $htmname = $list['filename'] != "" ? $filename . "/" . $list['filename'] : $filename . "/" . $filenamenow . $list['id'];
        $panyid = $list['filename'] != '' ? $list['filename'] : $list['id'];
        $met_ahtmtype = $list['filename'] != "" ? $met_chtmtype : $met_htmtype;
        $phpname = $met_pseudo ? $filename . "/" . $panyid . '-' . $lang . '.html' : $filename . "/" . $listitem[$module][2] . ".php?" . $langmark . "&id=" . $list['id'];
        if ($list['links']) {
            $list['url'] = $list['links'];
        } else {
            $list['url'] = $met_pseudo ? $phpname : ($met_webhtm ? $htmname . $met_ahtmtype : $phpname);
        }
        $list['updatetime'] = date($met_listtime, strtotime($list['updatetime']));
        $list['img_x'] = met_imgxy(1, $module);
        $list['img_y'] = met_imgxy(2, $module);
        $relist[] = $list;
    }
    return $relist;
}