Esempio n. 1
0
function metlabel_img($z, $w, $l, $n = 0)
{
    global $img_list, $metblank, $met_img_style, $met_img_x, $met_img_y, $met_img_page, $class1, $class2, $class3, $search, $nav_list2, $nav_list3, $weburly, $id, $class_list, $module_listall;
    $met_img_x = $met_img_style ? met_imgxy(1, 'img') : $met_img_x;
    $met_img_y = $met_img_style ? met_imgxy(2, 'img') : $met_img_y;
    $metinfo .= "<ul class='list-none metlist'>";
    $listarray = $img_list;
    $metok = 0;
    if ($met_img_page && $search != 'search') {
        if ($class2 && count($nav_list3[$class2]) && !$class3) {
            $listarray = $nav_list3[$class2];
            $metok = 1;
        }
        if (!$class2 && count($nav_list2[$class1]) && $class1 && !$class3) {
            $listarray = $nav_list2[$class1];
            $metok = 1;
        }
        if ($class_list[$class1]['module'] == '101') {
            $listarray = array();
            foreach ($module_listall[5] as $key => $val) {
                if ($val['classtype'] == 1 || $val['releclass'] != 0) {
                    $listarray[] = $val;
                }
            }
            $metok = 1;
        }
    }
    if ($z) {
        $l = $l ? $l : floor($z / $w);
        $margin = ($z / $l - $w) / 2;
        $margin = $margin < 0 ? ($z / floor($z / $w) - $w) / 2 : $margin;
        $dwidth = array();
        if (strstr($margin, ".")) {
            $margin = sprintf("%.1f", $margin);
            $y = explode('.', $margin);
            $f = (int) $y[0];
            $k = '0.' . $y[1];
            $k = intval($k * $l);
            for ($i = 0; $i < $l; $i++) {
                $m = $k < 1 ? $f : $f + 1;
                $dwidth[$i] = $m;
                $k = $k - 1;
            }
        } else {
            for ($i = 0; $i < $l; $i++) {
                $dwidth[$i] = $margin;
            }
        }
    }
    $i = 0;
    foreach ($listarray as $key => $val) {
        if (!$n || $id != $val[id]) {
            if ($metok) {
                $val['title'] = $val['name'];
                $val['imgurls'] = $val['columnimg'] == '' ? $weburly . $met_agents_img : $val['columnimg'];
            }
            $style = $dwidth[$i] ? "style='width:{$w}px; margin-left:{$dwidth[$i]}px; margin-right:{$dwidth[$i]}px;'" : '';
            $metinfo .= "<li class='list' {$style}>";
            $metinfo .= "<a href='{$val[url]}' title='{$val[title]}' {$metblank} class='img'><img src='{$val[imgurls]}' alt='{$val[title]}' title='{$val[title]}' width='{$met_img_x}' height='{$met_img_y}' /></a>";
            $metinfo .= "<h3><a href='{$val[url]}' title='{$val[title]}' {$metblank}>{$val[title]}</a></h3>";
            $metinfo .= "</li>";
            $i++;
            if ($i == $l) {
                $i = 0;
            }
        }
    }
    $metinfo .= "</ul>";
    return $metinfo;
}
Esempio n. 2
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;
}