/**
 * Smarty {getchromemenu} function plugin
 *
 * Type:     function<br>
 * Name:     getchromemenu<br>
 * Purpose:  display the chrome menu
 *
 * @param         $params
 * @param \Smarty $smarty
 * @return bool
 */
function smarty_function_getchromemenu($params, &$smarty)
{
    global $router, $user;
    $cloc = $smarty->getTemplateVars('__loc');
    $module = $params['module'];
    $list = '<ul class="container-menu">';
    $list .= '<li class="container-info">' . $module->action . ' / ' . str_replace($module->action . '_', '', $module->view) . '</li>';
    if (!empty($params['rank']) && expPermissions::check('order_modules', $cloc)) {
        $uplink = $router->makeLink(array('module' => 'containermodule', 'src' => $cloc->src, 'action' => 'order', 'a' => $params['rank'] - 2, 'b' => $params['rank'] - 1));
        $downlink = $router->makeLink(array('module' => 'containermodule', 'src' => $cloc->src, 'action' => 'order', 'a' => $params['rank'] - 1, 'b' => $params['rank']));
        if ($params['rank'] != 1) {
            //dont show this up arrow if it's the first module in a container
            $list .= '<li><a href="' . $uplink . '" class="mod-up">' . gt("Move Module Up") . '</a></li>';
        }
        if (!$params['last']) {
            //if this is the last module in a container don't show down arrow.
            $list .= '<li><a href="' . $downlink . '" class="mod-down">' . gt("Move Module Down") . '</a></li>';
        }
    }
    $rerank = $params['rerank'];
    if ($rerank == 'false') {
        $rerank = 0;
    } else {
        $rerank = 1;
    }
    if ($user->isAdmin()) {
        $userlink = $router->makeLink(array('module' => expModules::getControllerName($module->info['class']), 'src' => $module->info['source'], 'action' => 'userperms', '_common' => 1));
        $grouplink = $router->makeLink(array('module' => expModules::getControllerName($module->info['class']), 'src' => $module->info['source'], 'action' => 'groupperms', '_common' => 1));
        $list .= '<li><a href="' . $userlink . '" class="user">' . gt("User Permissions") . '</a></li>';
        $list .= '<li><a href="' . $grouplink . '" class="group">' . gt("Group Permissions") . '</a></li>';
    }
    if (!empty($module->id) && expPermissions::check('edit_module', $cloc) && $module->permissions['administrate'] == 1) {
        $editlink = $router->makeLink(array('module' => 'containermodule', 'id' => $module->id, 'action' => 'edit', 'src' => $module->info['source']));
        $list .= '<li><a href="' . $editlink . '" class="config-view">' . gt("Configure Action") . " &amp; " . gt("View") . '</a></li>';
    }
    if ($module->permissions['configure'] == 1) {
        if (expModules::controllerExists($module->info['class'])) {
            $configlink = $router->makeLink(array('module' => expModules::getControllerName($module->info['class']), 'src' => $module->info['source'], 'action' => 'configure', 'hcview' => $module->view));
            $list .= '<li><a href="' . $configlink . '" class="config-mod">' . gt("Configure Settings") . '</a></li>';
        } elseif ($module->info['hasConfig']) {
            $configlink = $router->makeLink(array('module' => $module->info['class'], 'src' => $module->info['source'], 'action' => 'configure', '_common' => 1));
            $list .= '<li><a href="' . $configlink . '" class="config-mod">' . gt("Configure Settings") . '</a></li>';
        }
    }
    if (!empty($module->id) && expPermissions::check('delete_module', $cloc)) {
        $deletelink = $router->makeLink(array('module' => 'containermodule', 'id' => $module->id, 'action' => 'delete', 'rerank' => $rerank));
        $list .= '<li><a href="' . $deletelink . '" class="delete" onclick="alert(\'' . gt("This content is being sent to the Recycle Bin to be recovered later if you wish.") . '\')">' . gt("Remove Module") . '</a></li>';
    }
    if (HELP_ACTIVE) {
        $helplink = help::makeHelpLink(expModules::getControllerName($module->info['class']));
        $list .= '<li><a href="' . $helplink . '" class="helplink" target="_blank">' . gt("Get Help") . '</a></li>';
    }
    $list .= '</ul>';
    expCSS::pushToHead(array("unique" => "container-chrome", "link" => PATH_RELATIVE . "framework/modules/container/assets/css/admin-container.css"));
    expJavascript::pushToFoot(array("unique" => 'container-chrome', "yui3mods" => 'node', "src" => PATH_RELATIVE . "framework/core/assets/js/exp-container.js"));
    echo $list;
}
 function edit_action() {
 	chkpw('template_edit');
     if (front::post('submit')) {
         unset(front::$post['submit']);
         help::$_var[config::get('template_dir') .'_template_note'] = front::$post;
         help::save();
     }
     $dir = ROOT .'/template/'.config::get('template_dir');
     $_dir = dir($dir);
     while ($file = $_dir->read()) {
         if (!preg_match('/^\./',$file) &&is_dir($dir .'/'.$file) &&!preg_match('/[#@]/',$file)  &&!preg_match('/^_/',$file)) {
             $this->view->tps[$file] = '<b>'.$file .'</b>';
             $__dir = dir($dir .'/'.$file);
             while ($_file = $__dir->read()) {
                 if (!preg_match('/^\./',$_file)) {
                     if ($file=='skin'&&!preg_match('/\.(css|js)$/',$_file))
                         continue;
                     $_file = str_replace('.','_',$_file);
                     if (is_dir($dir .'/'.$file .'/'.$_file)){
                         $this->view->tps[$file .'/'.$_file] = "&nbsp;&nbsp;└<b>".$_file .'</b>';
                     }else{
                         $this->view->tps[$file .'/'.$_file] = "&nbsp;&nbsp;└".$_file;
                     }
                 }
             }
         }elseif (!preg_match('/^\./',$file) &&is_file($dir .'/'.$file)) {
             $file = str_replace('.','_',$file);
             $tps[$file] = $file;
         }
     }
     //$this->view->tps = array_merge($tps,$this->view->tps);
     $tps_arr = array_merge($tps,$this->view->tps);
     //分页
     /*$limit = 20;
     if(!front::get('page'))
         $page = 1;
     else
         $page = front::get('page');
     $total = ceil(count($tps_arr)/$limit);
     if($page < 1) $page = 1;
     if($page > $total) $page = $total;
     $start = ($page-1) * $limit;
     $end = $start+$limit-1;
     $tmp = range($start,$end);
     $list_tps_arr = array();
     $i = 0;
     foreach($tps_arr as $k => $v){
     	if(in_array($i++,$tmp)){
     	    $list_tps_arr[$k] = $v;
             }
     }*/
     $this->view->tps = $tps_arr;
     //$this->view->link_str = listPage($total,$limit,$page);
 }
Exemple #3
0
 static function trace($data = '', $file_name = '')
 {
     is_object($data) and $data = help::object_array($data);
     is_array($data) and $data = print_r($data, true);
     empty($file_name) and $file_name = date('Y_m_d') . '.log';
     $file = fopen(LOG_TRACE . $file_name, 'a+');
     flock($file, LOCK_EX);
     fwrite($file, $data . PHP_EOL);
     flock($file, LOCK_UN);
     fclose($file);
 }
/**
 * Smarty {help} function plugin
 *
 * Type:     function<br>
 * Name:     help<br>
 * Purpose:  create a help link
 *
 * @param         $params
 * @param \Smarty $smarty
 * @return bool
 */
function smarty_function_help($params, &$smarty)
{
    if (HELP_ACTIVE) {
        if (empty($params['module'])) {
            $module = $smarty->getTemplateVars('__loc')->mod;
        } else {
            $module = $params['module'];
        }
        // figure out the params
        $text = empty($params['text']) ? '&nbsp' : $params['text'];
        $title = empty($params['title']) ? gt('Get Help') . ' for ' . $params['module'] : $params['title'];
        $class = 'helplink';
        $class .= empty($params['class']) ? '' : $params['class'];
        $link = help::makeHelpLink($module);
        if (!empty($params['page'])) {
            echo '<a class="' . $class . '" ' . $title . ' href="' . HELP_URL . $params['page'] . '" target="_blank">' . $text . '</a>';
        } else {
            echo '<a class="' . $class . '" ' . $title . ' href="' . $link . '" target="_blank">' . $text . '</a>';
        }
        expCSS::pushToHead(array("csscore" => "admin-global"));
    }
}
Exemple #5
0
 function save($data)
 {
     //如果缓存目录不存在则创建
     if (!$this->is_exist(false)) {
         file::folder($this->save_dir);
     }
     if ($this->ext == 'php') {
         $data = '<?php' . PHP_EOL . 'return ' . var_export($data, true) . ';';
     }
     if ($this->ext == 'js') {
         $data = json_encode($data);
     }
     if ($this->ext == 'ini') {
         $data = help::array_ini($data);
     }
     if ($this->ext == 'xml') {
         $data = '<?xml version="1.0" encoding="utf-8"?><data>' . help::data_xml($data) . '</data>';
     }
     if (is_array($data) && $this->ext == 'txt') {
         $data = serialize($data);
     }
     return file_write($this->file_name, $data);
 }
function tpl_function_qishi_resume_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "应届生简历":
                $aset['campu_sresume'] = $a[1];
                break;
            case "院校名称":
                $aset['campusname'] = $a[1];
                break;
            case "更新时间":
                $aset['refreshtime'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "姓名长度":
                $aset['namelen'] = $a[1];
                break;
            case "特长描述长度":
                $aset['specialtylen'] = $a[1];
                break;
            case "意向职位长度":
                $aset['jobslen'] = $a[1];
                break;
            case "专业长度":
                $aset['majorlen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "职位分类":
                $aset['jobcategory'] = trim($a[1]);
                break;
            case "职位大类":
                $aset['category'] = trim($a[1]);
                break;
            case "职位小类":
                $aset['subclass'] = trim($a[1]);
                break;
            case "地区分类":
                $aset['citycategory'] = trim($a[1]);
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "行业":
                $aset['trade'] = trim($a[1]);
                break;
            case "专业":
                $aset['major'] = trim($a[1]);
                break;
            case "标签":
                $aset['tag'] = $a[1];
                break;
            case "学历":
                $aset['education'] = $a[1];
                break;
            case "工作经验":
                $aset['experience'] = $a[1];
                break;
            case "等级":
                $aset['talent'] = $a[1];
                break;
            case "性别":
                $aset['sex'] = $a[1];
                // 添加搜索条件  男 女
                break;
            case "照片":
                $aset['photo'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['paged'] = $a[1];
                break;
            case "页面":
                $aset['showname'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
            case "浏览过的简历":
                $aset['readresume'] = $a[1];
                break;
        }
    }
    if (is_array($aset)) {
        $aset = array_map("get_smarty_request", $aset);
    }
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 20;
    if ($aset['row'] > 20) {
        $aset['row'] = 20;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['namelen'] = isset($aset['namelen']) ? intval($aset['namelen']) : 4;
    $aset['specialtylen'] = isset($aset['specialtylen']) ? intval($aset['specialtylen']) : 0;
    $aset['jobslen'] = isset($aset['jobslen']) ? intval($aset['jobslen']) : 0;
    $aset['majorlen'] = isset($aset['majorlen']) ? intval($aset['majorlen']) : 50;
    $aset['dot'] = isset($aset['dot']) ? $aset['dot'] : null;
    $aset['showname'] = isset($aset['showname']) ? $aset['showname'] : 'QS_resumeshow';
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : 'QS_resumelist';
    $resumetable = table('resume_search_rtime');
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY r.refreshtime {$arr[1]},id desc ";
        }
    } else {
        $orderbysql = " ORDER BY r.refreshtime desc,id desc ";
    }
    if (intval($_CFG['subsite_id']) > 0) {
        $wheresql .= " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
    }
    //应届生简历
    if (isset($aset['campu_sresume']) && !empty($aset['campu_sresume'])) {
        $wheresql .= " AND r.experience='-1' ";
    }
    //指定院校简历
    if (isset($aset['campusname']) && !empty($aset['campusname'])) {
        $joinwheresql_campusname .= " WHERE  school = '{$aset['campusname']}' ";
        $joinsql = "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_education') . " {$joinwheresql_campusname} )AS e ON  r.id=e.pid ";
    }
    //更新时间
    if (isset($aset['refreshtime']) && !empty($aset['refreshtime'])) {
        $refreshtime_min = strtotime("-" . $aset['refreshtime'] . "day");
        $wheresql .= " AND r.refreshtime > {$refreshtime_min} ";
    }
    if (!empty($aset['category']) || !empty($aset['subclass']) || !empty($aset['jobcategory'])) {
        if (!empty($aset['jobcategory'])) {
            $dsql = $xsql = "";
            $arr = explode("_", $aset['jobcategory']);
            $arr = array_unique($arr);
            foreach ($arr as $sid) {
                $cat = explode(".", $sid);
                if (intval($cat[2]) === 0) {
                    $dsql .= " OR category =" . intval($cat[1]);
                } else {
                    $xsql .= " OR subclass =" . intval($cat[2]);
                }
            }
            $joinwheresql .= " WHERE " . ltrim(ltrim($dsql . $xsql), 'OR');
        } else {
            if (!empty($aset['category'])) {
                if (strpos($aset['category'], "-")) {
                    $or = $orsql = "";
                    $arr = explode("-", $aset['category']);
                    $sqlin = implode(",", $arr);
                    if (count($arr) > 10) {
                        exit;
                    }
                    $sqlin = implode(",", $arr);
                    if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                        $joinwheresql .= " AND topclass IN  ({$sqlin}) ";
                    }
                } else {
                    $joinwheresql .= " AND  topclass=" . intval($aset['category']);
                }
            }
            if (!empty($aset['subclass'])) {
                if (strpos($aset['subclass'], "-")) {
                    $or = $orsql = "";
                    $arr = explode("-", $aset['subclass']);
                    if (count($arr) > 10) {
                        exit;
                    }
                    $sqlin = implode(",", $arr);
                    if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                        $joinwheresql .= " AND category IN  ({$sqlin}) ";
                    }
                } else {
                    $joinwheresql .= " AND category=" . intval($aset['subclass']);
                }
            }
            if (!empty($joinwheresql)) {
                $joinwheresql = " WHERE " . ltrim(ltrim($joinwheresql), 'AND');
            }
        }
        $joinsql = "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_jobs') . " {$joinwheresql} )AS j ON  r.id=j.pid ";
    }
    if (!empty($aset['trade'])) {
        if (strpos($aset['trade'], "_")) {
            $or = $orsql = "";
            $arr = explode("_", $aset['trade']);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $joinwheresql_trade .= " AND trade IN  ({$sqlin}) ";
            }
        } else {
            $joinwheresql_trade .= " AND trade=" . intval($aset['trade']);
        }
        if (!empty($joinwheresql_trade)) {
            $joinwheresql_trade = " WHERE " . ltrim(ltrim($joinwheresql_trade), 'AND');
        }
        $joinsql = $joinsql == "" ? "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_trade') . " {$joinwheresql_trade} )AS t ON  r.id=t.pid " : $joinsql . "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_trade') . " {$joinwheresql_trade} )AS t ON  r.id=t.pid ";
    }
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    // major 专业搜索
    if (!empty($aset['major'])) {
        if (strpos($aset['major'], "_")) {
            $or = $orsql = "";
            $arr = explode("_", $aset['major']);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $wheresql .= " AND r.major IN  ({$sqlin}) ";
            }
        } else {
            $wheresql .= " AND r.major=" . intval($aset['major']);
        }
    }
    if (!empty($aset['district']) || !empty($aset['sdistrict']) || !empty($aset['citycategory'])) {
        if (!empty($aset['citycategory'])) {
            $dsql = $xsql = "";
            $arr = explode("_", $aset['citycategory']);
            $arr = array_unique($arr);
            foreach ($arr as $sid) {
                $cat = explode(".", $sid);
                if (intval($cat[1]) === 0) {
                    $dsql .= " OR r.district =" . intval($cat[0]);
                } else {
                    $xsql .= " OR r.sdistrict =" . intval($cat[1]);
                }
            }
            $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
        } else {
            if (isset($aset['district']) && $aset['district'] != '') {
                if (strpos($aset['district'], "-")) {
                    $or = $orsql = "";
                    $arr = explode("-", $aset['district']);
                    $arr = array_unique($arr);
                    if (count($arr) > 10) {
                        exit;
                    }
                    $sqlin = implode(",", $arr);
                    if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                        $wheresql .= " AND r.district IN  ({$sqlin}) ";
                    }
                } else {
                    $wheresql .= " AND r.district=" . intval($aset['district']) . " ";
                }
            }
            if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
                if (strpos($aset['sdistrict'], "-")) {
                    $or = $orsql = "";
                    $arr = explode("-", $aset['sdistrict']);
                    $arr = array_unique($arr);
                    if (count($arr) > 10) {
                        exit;
                    }
                    $sqlin = implode(",", $arr);
                    if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                        $wheresql .= " AND r.sdistrict IN  ({$sqlin}) ";
                    }
                } else {
                    $wheresql .= " AND r.sdistrict=" . intval($aset['sdistrict']) . " ";
                }
            }
        }
    }
    if (isset($aset['experience']) && !empty($aset['experience'])) {
        $wheresql .= " AND r.experience=" . intval($aset['experience']) . " ";
    }
    if (isset($aset['education']) && !empty($aset['education'])) {
        $wheresql .= " AND r.education=" . intval($aset['education']) . " ";
    }
    if (isset($aset['talent']) && !empty($aset['talent'])) {
        $wheresql .= " AND r.talent=" . intval($aset['talent']) . " ";
    }
    if (isset($aset['sex']) && !empty($aset['sex'])) {
        $wheresql .= " AND r.sex=" . intval($aset['sex']) . " ";
        // 添加搜索条件  男 女
    }
    if (isset($aset['photo']) && !empty($aset['photo'])) {
        $wheresql .= " AND r.photo='" . intval($aset['photo']) . "' ";
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        if ($_CFG['resumesearch_purview'] == '2') {
            if ($_SESSION['username'] == '') {
                header("Location: " . url_rewrite('QS_login') . "?url=" . urlencode($_SERVER["REQUEST_URI"]));
            }
        }
        $key = help::addslashes_deep(trim($aset['key']));
        if ($_CFG['resumesearch_type'] == '1') {
            $akey = explode(' ', $key);
            if (count($akey) > 1) {
                $akey = array_filter($akey);
                $akey = array_slice($akey, 0, 2);
                $akey = array_map("fulltextpad", $akey);
                $key = '+' . implode(' +', $akey);
                $mode = ' IN BOOLEAN MODE';
            } else {
                $key = fulltextpad($key);
                $mode = ' ';
            }
            $wheresql .= " AND  MATCH (r.`key`) AGAINST ('{$key}'{$mode}) ";
        } else {
            $wheresql .= " AND r.likekey LIKE '%{$key}%' ";
        }
        $resumetable = table('resume_search_key');
    }
    if (!empty($aset['tag'])) {
        if (strpos($aset['tag'], ",")) {
            $or = $orsql = "";
            $arr = explode(",", $aset['tag']);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $joinwheresql_tag .= " AND tag IN  ({$sqlin}) ";
            }
        } else {
            $joinwheresql_tag .= " AND tag=" . intval($aset['tag']);
        }
        if (!empty($joinwheresql_tag)) {
            $joinwheresql_tag = " WHERE " . ltrim(ltrim($joinwheresql_tag), 'AND');
        }
        $joinsql = $joinsql == "" ? "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_tag') . " {$joinwheresql_tag} )AS g ON  r.id=g.pid " : $joinsql . "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('resume_tag') . " {$joinwheresql_tag} )AS g ON  r.id=g.pid ";
    }
    /* 搜索 时间范围 */
    $moth = intval($_CFG['search_time']);
    if ($moth > 0) {
        $moth_time = $moth * 3600 * 24 * 30;
        $time = time() - $moth_time;
        $wheresql .= " AND r.refreshtime>{$time} ";
    }
    $wheresql .= " AND r.display='1' AND r.audit='1' ";
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['paged'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT  COUNT(*) AS num  FROM  {$resumetable} AS r " . $joinsql . $wheresql;
        $total_count = $db->get_total($total_sql);
        if (intval($_CFG['resume_list_max']) > 0) {
            $total_count > intval($_CFG['resume_list_max']) && ($total_count = intval($_CFG['resume_list_max']));
        }
        //如果是浏览过的简历 总数应该算cookie中的
        if ($aset['readresume']) {
            $total_count = count($_COOKIE['QS']['view_resume_log']);
        }
        //echo $total_sql;
        //echo "SELECT  COUNT(DISTINCT r.id) AS num  FROM  ".table('resume')." AS r ".$wheresql;
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(8));
            $smarty->assign('pagemin', $page->show(7));
            $smarty->assign('pagenow', $page->show(6));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $idresult = $db->query("SELECT id FROM {$resumetable}  AS r" . $joinsql . $wheresql . $orderbysql . $limit);
    //echo "SELECT id FROM {$resumetable}  AS r".$joinsql.$wheresql.$orderbysql.$limit;
    // 如果是浏览过的简历,从cookie中获取简历的id
    if ($aset['readresume']) {
        foreach ($_COOKIE['QS']['view_resume_log'] as $value) {
            $id[] = $value;
        }
    } else {
        while ($row = $db->fetch_array($idresult)) {
            $id[] = $row['id'];
        }
    }
    if (!empty($id)) {
        $wheresql = " WHERE id IN (" . implode(',', $id) . ") and display!=3 ";
        $result = $db->query("SELECT id,subsite_id,uid,display,display_name,nature_cn,fullname,sex,major_cn,specialty,intention_jobs,trade_cn,photo,photo_img,photo_display,refreshtime,birthdate,tag_cn,talent,education_cn,sex_cn,wage_cn,experience_cn,district_cn,current_cn FROM " . table('resume') . "  AS r " . $joinsql . $wheresql . $orderbysql);
        while ($row = $db->fetch_array($result)) {
            if ($row['display_name'] == "2") {
                $row['fullname'] = "N" . str_pad($row['id'], 7, "0", STR_PAD_LEFT);
                $row['fullname_'] = $row['fullname'];
            } elseif ($row['display_name'] == "3") {
                if ($row['sex'] == 1) {
                    $row['fullname'] = cut_str($row['fullname'], 1, 0, "先生");
                } elseif ($row['sex'] == 2) {
                    $row['fullname'] = cut_str($row['fullname'], 1, 0, "女士");
                } else {
                    $row['fullname'] = cut_str($row['fullname'], 1, 0, "**");
                }
            } else {
                $row['fullname_'] = $row['fullname'];
                $row['fullname'] = cut_str($row['fullname'], $aset['namelen'], 0, $aset['dot']);
            }
            if (in_array($row['id'], $_COOKIE['QS']['view_resume_log'])) {
                $row['checked'] = true;
            } else {
                $row['checked'] = false;
            }
            $row['specialty_'] = strip_tags($row['specialty']);
            if ($aset['specialtylen'] > 0) {
                $row['specialty'] = cut_str(strip_tags($row['specialty']), $aset['specialtylen'], 0, $aset['dot']);
            }
            $row['intention_jobs_'] = $row['intention_jobs'];
            if ($aset['jobslen'] > 0) {
                $row['intention_jobs'] = cut_str(strip_tags($row['intention_jobs']), $aset['jobslen'], 0, $aset['dot']);
            }
            if ($aset['majorlen'] > 0) {
                $row['major_cn'] = cut_str(strip_tags($row['major_cn']), $aset['majorlen'], 0, $aset['dot']);
            }
            $row['trade_cn_'] = $row['trade_cn'];
            $row['trade_cn'] = cut_str(strip_tags($row['trade_cn']), 10, 0, "..");
            $row['resume_url'] = url_rewrite($aset['showname'], array('id' => $row['id']), 1, $row['subsite_id']);
            $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
            $row['age'] = date("Y") - $row['birthdate'];
            if ($row['tag_cn']) {
                $tag_cn = explode(',', $row['tag_cn']);
                $row['tag_cn'] = $tag_cn;
            } else {
                $row['tag_cn'] = array();
            }
            // 照片显示方式
            if ($row['photo'] == "1") {
                if ($row['photo_display'] == "1") {
                    $row['photosrc'] = $_CFG['resume_photo_dir_thumb'] . $row['photo_img'];
                } else {
                    $row['photosrc'] = $_CFG['resume_photo_dir_thumb'] . "no_photo_display.gif";
                }
            } else {
                $row['photosrc'] = $_CFG['resume_photo_dir_thumb'] . "no_photo.gif";
            }
            //判断手机是否验证
            $is_audit_phone = $db->getone("SELECT mobile_audit FROM " . table('members') . " WHERE uid={$row['uid']}  LIMIT 1 ");
            $row['is_audit_mobile'] = $is_audit_phone['mobile_audit'];
            //语言能力
            $language = $db->getall("SELECT * FROM " . table('resume_language') . " WHERE pid={$row['id']} ");
            $row['language'] = $language;
            $list[] = $row;
        }
    } else {
        $list = array();
    }
    $smarty->assign($aset['listname'], $list);
}
Exemple #7
0
 static function mystrip_tags($string)
 {
     $string = help::new_html_special_chars($string);
     $string = help::remove_xss($string);
     return $string;
 }
function tpl_function_qishi_news_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "图片":
                $aset['img'] = $a[1];
                break;
            case "属性":
                $aset['attribute'] = $a[1];
                break;
            case "资讯大类":
                $aset['parentid'] = $a[1];
                break;
            case "资讯小类":
                $aset['type_id'] = $a[1];
                break;
            case "标题长度":
                $aset['titlelen'] = $a[1];
                break;
            case "摘要长度":
                $aset['infolen'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "分页显示":
                $aset['paged'] = $a[1];
                break;
            case "页面":
                $aset['showname'] = $a[1];
                break;
            case "列表页":
                $aset['listpang'] = $a[1];
                break;
        }
    }
    if (is_array($aset)) {
        $aset = array_map("get_smarty_request", $aset);
    }
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['row'] = isset($aset['row']) ? intval($aset['row']) : 10;
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['titlelen'] = isset($aset['titlelen']) ? intval($aset['titlelen']) : 15;
    $aset['infolen'] = isset($aset['infolen']) ? intval($aset['infolen']) : 0;
    $aset['showname'] = isset($aset['showname']) ? $aset['showname'] : 'QS_newsshow';
    $aset['listpang'] = isset($aset['listpang']) ? $aset['listpang'] : 'QS_newslist';
    if ($aset['displayorder']) {
        if (strpos($aset['displayorder'], '>')) {
            $arr = explode('>', $aset['displayorder']);
            // 排序字段
            if ($arr[0] == 'click') {
                $arr[0] = "click";
            } elseif ($arr[0] == "id") {
                $arr[0] = "id";
            } elseif ($arr[0] = 'article_order') {
                $arr[0] = 'article_order';
            } else {
                $arr[0] = "";
            }
            // 排序方式
            if ($arr[1] == 'desc') {
                $arr[1] = "desc";
            } elseif ($arr[1] == "asc") {
                $arr[1] = "asc";
            } else {
                $arr[1] = "";
            }
            if ($arr[0] && $arr[1]) {
                $orderbysql = " ORDER BY " . $arr[0] . " " . $arr[1];
            }
            if ($arr[0] == "article_order") {
                $orderbysql .= " ,id DESC ";
            }
        }
    }
    $wheresql = " WHERE is_display=1";
    isset($aset['parentid']) ? $wheresql .= " AND parentid=" . intval($aset['parentid']) . " " : '';
    isset($aset['type_id']) ? $wheresql .= " AND type_id=" . intval($aset['type_id']) . " " : '';
    isset($aset['attribute']) ? $wheresql .= " AND focos=" . intval($aset['attribute']) . " " : '';
    isset($aset['img']) ? $wheresql .= " AND Small_img<>'' " : '';
    if (isset($aset['settr'])) {
        $settr_val = strtotime("-" . intval($aset['settr']) . " day");
        $wheresql .= " AND addtime > " . $settr_val;
    }
    if (!empty($aset['key'])) {
        $key = help::addslashes_deep(trim($aset['key']));
        $wheresql .= " AND title like '%{$key}%'";
    }
    if (isset($aset['paged'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('article') . $wheresql;
        $total_count = $db->get_total($total_sql);
        $pagelist = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpang'], 'getarray' => $_GET));
        $currenpage = $pagelist->nowindex;
        $aset['start'] = ($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $pagelist->show(3));
        } else {
            $smarty->assign('page', '');
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT " . abs($aset['start']) . ',' . $aset['row'];
    $result = $db->query("SELECT id,type_id,parentid,title,content,tit_color,tit_b,Small_img,author,source,focos,is_url,seo_description,seo_keywords,click,addtime FROM " . table('article') . " " . $wheresql . $orderbysql . $limit);
    $list = array();
    while ($row = $db->fetch_array($result)) {
        $row['title_'] = $row['title'];
        $style_color = $row['tit_color'] ? "color:" . $row['tit_color'] . ";" : '';
        $style_font = $row['tit_b'] == "1" ? "font-weight:bold;" : '';
        $row['title'] = cut_str($row['title'], $aset['titlelen'], 0, $aset['dot']);
        if ($style_color || $style_font) {
            $row['title'] = "<span style=" . $style_color . $style_font . ">" . $row['title'] . "</span>";
        }
        if (!empty($row['is_url']) && $row['is_url'] != 'http://') {
            $row['url'] = $row['is_url'];
        } else {
            $row['url'] = url_rewrite($aset['showname'], array('id' => $row['id']));
        }
        $row['content'] = str_replace('&nbsp;', '', $row['content']);
        $row['briefly_'] = strip_tags($row['content']);
        if ($aset['infolen'] > 0) {
            $row['briefly'] = cut_str(strip_tags($row['content']), $aset['infolen'], 0, $aset['dot']);
        }
        $row['img'] = $_CFG['thumb_dir'] . $row['Small_img'];
        $row['bimg'] = $_CFG['upfiles_dir'] . $row['Small_img'];
        $row['isimg'] = $row['Small_img'];
        // 不带路径,判断是否有缩略图,在news.htm页面用到
        $list[] = $row;
    }
    $smarty->assign($aset['listname'], $list);
}
Exemple #9
0
 function comment($id, $name, $error)
 {
     echo "<fieldset><legend>Erl&auml;uterungen</legend>";
     echo "<textarea class='{$error}' name='comment' cols='45' rows='5' ";
     echo help::show("comment-field", "");
     if (right::write()) {
         echo ">";
     } else {
         echo " readonly>";
     }
     echo $name;
     echo "</textarea>";
     // display legend for comment area
     if (session::get("legend")) {
         echo form::link("help-off", "no help", "index.php?action=legendoff", "nolegend");
         form::legend();
     } else {
         echo form::link("help-on", "help", "index.php?action=legendon", "nolegend");
     }
     echo "</fieldset>";
 }
function tpl_function_qishi_shop_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "标题长度":
                $aset['titlelen'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "分类ID":
                $aset['scategory'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "推荐":
                $aset['recommend'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['paged'] = $a[1];
                break;
            case "积分区间":
                $aset['points_interval'] = $a[1];
                //0|1000
                break;
            case "会员积分":
                $aset['user_points'] = $a[1];
                //我能兑换的
                break;
        }
    }
    if (is_array($aset)) {
        $aset = array_map("get_smarty_request", $aset);
    }
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['row'] = isset($aset['row']) ? intval($aset['row']) : 10;
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['titlelen'] = isset($aset['titlelen']) ? intval($aset['titlelen']) : 15;
    $aset['dot'] = isset($aset['dot']) ? $aset['dot'] : '';
    $aset['recommend'] = isset($aset['recommend']) ? intval($aset['recommend']) : 1;
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "shop_points") {
            $orderbysql = " ORDER BY shop_points {$arr[1]},id desc ";
        } elseif ($arr[0] == "click") {
            $orderbysql = " ORDER BY click {$arr[1]},id desc ";
        } else {
            if ($aset['recommend'] > 0) {
                $orderbysql = " ORDER BY recommend desc,addtime {$arr[1]},id desc ";
            } else {
                $orderbysql = " ORDER BY addtime {$arr[1]},id desc ";
            }
        }
    }
    // 积分区间
    if (isset($aset['points_interval']) && !empty($aset['points_interval'])) {
        $points_arr = explode('-', $aset['points_interval']);
        $points_min = $points_arr[0];
        $points_max = $points_arr[1];
        $wheresql .= " AND shop_points>{$points_min} AND shop_points<{$points_max} ";
    }
    // 我能兑换的 user_points
    if (isset($aset['user_points']) && !empty($aset['user_points'])) {
        $user_points = intval($aset['user_points']);
        $wheresql .= " AND shop_points<{$user_points} ";
    }
    if ($aset['scategory']) {
        $wheresql .= " AND scategory=" . intval($aset['scategory']) . " ";
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        $key = help::addslashes_deep(trim($aset['key']));
        $wheresql .= " AND shop_title LIKE '%{$key}%' ";
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['paged'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT  COUNT(*) AS num  FROM " . table("shop_goods") . $wheresql;
        $total_count = $db->get_total($total_sql);
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(3));
            $smarty->assign('pagemin', $page->show(7));
        }
        $smarty->assign('total', $total_count);
        $smarty->assign('pagenow', $page->show(6));
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $result = $db->query("SELECT * FROM " . table('shop_goods') . " " . $wheresql . $orderbysql . $limit);
    $list = array();
    $config = get_cache('config');
    while ($row = $db->fetch_array($result)) {
        $row['shop_title_'] = cut_str($row['shop_title'], $aset['titlelen'], 0, $aset['dot']);
        $row['shop_url'] = url_rewrite('QS_shop_show', array('id' => $row['id']));
        $list[] = $row;
    }
    $smarty->assign($aset['listname'], $list);
}
Exemple #11
0
 function form($searchString)
 {
     if (session::get("hyrarchy")) {
         echo "<div id='search' class='search'>";
     } else {
         echo "<div id='searchbig' class='search'>";
     }
     echo "<form method='GET' action='index.php' name='search'>";
     echo "<b>Suche in</b><br>";
     // Freie Suche
     if (!session::get("searchstart") and !session::get("searchexact")) {
         $checkString = " checked='checked'";
     } else {
         $checkString = "";
     }
     echo form::field("radio", "searchtype", 0, "", $checkString, "", "frei", "search-free");
     // Suche am Wortanfang
     if (session::get("searchstart")) {
         $checkString = " checked='checked'";
     } else {
         $checkString = "";
     }
     echo form::field("radio", "searchtype", 1, "", $checkString, "", "Wortanfang", "search-start");
     // exakte Suche
     if (session::get("searchexact")) {
         $checkString = " checked='checked'";
     } else {
         $checkString = "";
     }
     echo form::field("radio", "searchtype", 2, "", $checkString, "", "exact", "search-exact");
     // search in comment field
     if (session::get("searchcom")) {
         $checkString = " checked='checked'";
     } else {
         $checkString = "";
     }
     echo form::field("checkbox", "searchcom", 1, "", $checkString, "", "Erl&auml;uterungen", "search-comment");
     // search only for ordered entries
     // create array for selector
     $typeArray = thesaurus::get_type_list();
     $statusArray = thesaurus::get_status_list();
     $ownerArray = user::get_users("entry");
     if (count($statusArray)) {
         echo "<br>";
         echo form::selector("searchentrytype", $typeArray, 1, "", session::get("searchentrytype"), "", " Begriffstype ", "searchtype", "");
         echo form::selector("searchstatus", $statusArray, 1, "", session::get("searchstatus"), "", " Status ", "searchstatus", "");
         echo form::selector("searchowner", $ownerArray, 1, "", session::get("searchowner"), "", " Eigentümer mit Einträgen ", "searchowner", "");
     } else {
         echo form::link("", "<span class='small'>Keine beantragten Einträge</span>", "", "no-ordered");
     }
     // search field
     echo "<p><input type='text' size='35' name='searchString' value='" . session::get("search") . "' ";
     echo help::show("search-field", "");
     echo ">";
     echo form::field("submit", "action", "suchen", "", "", " ", "", "search");
     echo form::field("submit", "reset", "zurücksetzen", "", "", " ", "", "newsearch");
     echo "</form></p>";
     echo "</div>";
 }
function tpl_function_qishi_simple_resume_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "姓名长度":
                $aset['unamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "关键字类型":
                $aset['keytype'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "页面":
                $aset['simpleresumeshow'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
        }
    }
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['row'] = isset($aset['row']) ? intval($aset['row']) : 10;
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['unamelen'] = isset($aset['unamelen']) ? intval($aset['unamelen']) : 8;
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $aset['simpleresumeshow'] = isset($aset['simpleresumeshow']) ? $aset['simpleresumeshow'] : 'QS_simpleresumeshow';
    if (isset($aset['displayorder'])) {
        if (strpos($aset['displayorder'], '>')) {
            $arr = explode('>', $aset['displayorder']);
            // 排序字段
            if ($arr[0] == 'refreshtime') {
                $arr[0] = "refreshtime";
            } elseif ($arr[0] == "id") {
                $arr[0] = "id";
            } elseif ($arr[0] == "click") {
                $arr[0] == "click";
            } else {
                $arr[0] = "";
            }
            // 排序方式
            if ($arr[1] == 'desc') {
                $arr[1] = "desc";
            } elseif ($arr[1] == "asc") {
                $arr[1] = "asc";
            } else {
                $arr[1] = "";
            }
            if ($arr[0] && $arr[1]) {
                $orderbysql = " ORDER BY  `is_hot`  {$arr[1]} , {$arr[0]} {$arr[1]}";
            }
        }
    } else {
        $orderbysql = " ORDER BY   `is_hot`  DESC";
    }
    $wheresql = " AND audit=1 ";
    if (intval($_CFG['subsite_id']) > 0) {
        $wheresql .= " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
    }
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        $aset['key'] = help::addslashes_deep(trim($aset['key']));
        if ($aset['keytype'] == "1" || $aset['keytype'] == "") {
            $wheresql .= " AND  likekey like '%{$aset['key']}%'";
            $orderbysql = "";
        } elseif ($aset['keytype'] == "2") {
            $wheresql .= " AND  MATCH (`key`) AGAINST ('" . fulltextpad($aset['key']) . "') ";
            $orderbysql = "";
        }
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('simple_resume') . $wheresql;
        //echo $total_sql;
        $total_count = $db->get_total($total_sql);
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => 'QS_simpleresumelist', 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = ($currenpage - 1) * $aset['row'];
        $smarty->assign('page', $page->show(3));
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT " . abs($aset['start']) . ',' . $aset['row'];
    $result = $db->query("SELECT id,subsite_id,uname,detailed,refreshtime,category,is_hot,sex,age,experience_cn,deadline,district_cn,sdistrict_cn FROM " . table('simple_resume') . " " . $wheresql . $orderbysql . $limit);
    $list = array();
    //echo "SELECT * FROM ".table('jobs')." ".$wheresql.$orderbysql.$limit;
    while ($row = $db->fetch_array($result)) {
        $row['uname_'] = $row['uname'];
        $row['uname'] = cut_str($row['uname'], $aset['unamelen'], 0, $aset['dot']);
        $row['detailed_'] = strip_tags($row['detailed']);
        if ($aset['brieflylen'] > 0) {
            $row['detailed'] = cut_str($row['detailed_'], $aset['brieflylen'], 0, $aset['dot']);
        } else {
            $row['detailed'] = $row['detailed_'];
        }
        if (strlen($row['detailed_']) > $aset['brieflylen'] * 2) {
            $row['show_detail'] = true;
        } else {
            $row['show_detail'] = false;
        }
        // $row['comname_']=$row['comname'];
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        // $row['comname']=cut_str($row['comname'],$aset['companynamelen'],0,$aset['dot']);
        $row['simple_url'] = url_rewrite($aset['simpleresumeshow'], array('id' => $row['id']), 1, $row['subsite_id']);
        $row['intention_jobs'] = $row['category'];
        $list[] = $row;
    }
    $smarty->assign($aset['listname'], $list);
}
 /**
  * Hack to try and determine page which help doc is assoc with
  * @static
  * @param $params
  * @return null|void
  */
 public static function getSection($params)
 {
     global $db;
     $h = new help();
     $hv = $db->selectValue('help_version', 'id', 'version=' . $params['version']);
     $help = $h->find('first', 'help_version_id=' . $hv . ' and sef_url=\'' . $params['title'] . '\'');
     $sessec = expSession::get('last_section') ? expSession::get('last_section') : 1;
     $sid = $help->section != 0 ? $help->section : $sessec;
     if (!expSession::get('last_section')) {
         expSession::set('last_section', $sid);
     }
     $section = $db->selectObject('section', 'id=' . intval($sid));
     return $section;
 }
Exemple #14
0
 static function index()
 {
     $captcha = help::get_code(5);
     session::set('captcha', $captcha);
     s_picture::code($captcha, 90, 44);
 }
 function display($parent, $depth, $pos, $errorArray)
 {
     // V2.0
     // starting on thesaurus level
     if ($parent == 0) {
         $elementArray = thesaurus::get_thesaurus_list();
         // get thesauri
     } else {
         $elementArray = thesaurus::get_child($parent);
     }
     // get children
     // entries found
     if (is_array($elementArray)) {
         $cntElements = count($elementArray);
         // start new line
         if (!isset($pos)) {
             $pos = 0;
         }
         // set position to 0
         $line = new line();
         // ****************************************************************
         // start array
         $lineCnt = 0;
         foreach ($elementArray as $id) {
             // don't display if
             // non descriptor
             // or not visible
             //        if ((thesaurus::is_descriptor($id) or session::get("descriptor"))
             //          and (thesaurus::is_visible($id) or session::get("visible"))
             //          )
             if (thesaurus::is_visible($id) or session::get("visible")) {
                 $cntParents = thesaurus::parent_num($id);
                 $equivArray = thesaurus::get_equiv($id, "BS");
                 if (is_array($equivArray)) {
                     $cntEquiv = count($equivArray);
                 } else {
                     $cntEquiv = 0;
                 }
                 // get count and list of subentries
                 $childrenArray = thesaurus::get_child($id);
                 $cntChildren = thesaurus::child_num($id, session::get(descriptor));
                 // get entry details
                 $entry = thesaurus::get_descriptor($id);
                 // ECHO ENTRY
                 // space in front
                 $x = 0;
                 while ($x < $pos - 1) {
                     $line->insert(grafik::disp("line", "|", 20), 20);
                     // insert line-grafik
                     $x++;
                 }
                 // search elements in next level enabled
                 if ($depth > $pos or $depth == -1) {
                     // display tree grafik
                     if ($pos > 0) {
                         if ($lineCnt++ < $cntElements - 1) {
                             $line->insert(grafik::disp("subtree", "|", 20), 20);
                         } else {
                             $line->insert(grafik::disp("subend", "|", 20), 20);
                         }
                         // insert sub end icon
                     }
                     // display open / close icon if subobjects
                     if ($cntChildren != 0) {
                         // subobjects found -> display icon to open / close
                         if (thesaurus::is_open($id)) {
                             if ($pos > 0) {
                                 $tempString = form::link("minus", "[+]", "index.php?id={$id}&amp;action=close", "close");
                             } else {
                                 $tempString = form::link("thesaurus-open", "[+]", "index.php?id={$id}&amp;action=close", "close");
                             }
                         } else {
                             if ($pos > 0) {
                                 $tempString = form::link("plus", "[+]", "index.php?id={$id}&amp;action=open", "open");
                             } else {
                                 $tempString = form::link("thesaurus", "[T]", "index.php?id={$id}&amp;action=open", "open");
                             }
                         }
                     } else {
                         $tempString = grafik::disp("space", " ", 20);
                     }
                     $line->insert($tempString, 20);
                     // insert navigation symbols
                     $tempString = "";
                     // Display parent and child link icon
                     if (session::get("show")) {
                         // display parent arrow
                         if (thesaurus::is_child_of(session::get("show"), $id) and session::get("show")) {
                             $line->insert(grafik::arrow("right", "blue", 15), 20);
                             // display parent arrow
                         }
                         // display link-arrow
                         if (thesaurus::is_parent_of(session::get("show"), $id)) {
                             $line->insert(grafik::arrow("right", "orange", 15), 20);
                         }
                         // display associate links
                         if (thesaurus::is_assoc_of(session::get("show"), $id)) {
                             $line->insert(grafik::disp("assoc", "=", 20), 20);
                         }
                     }
                     // entry name
                     $textLength = strlen($entry[name]) * 15;
                     $textString = $entry[name];
                     // set style for selection
                     $styleString = "";
                     if (thesaurus::is_equivalent($id)) {
                         $styleString = "class='bright'";
                     }
                     if (thesaurus::is_descriptor($id)) {
                         $textString = strtoupper($textString);
                     }
                     if ($id == session::get("show")) {
                         $styleString = "class='select'";
                     } elseif ($cntParents > 1) {
                         $styleString = "class='multiple'";
                     }
                     if (!thesaurus::is_visible($id)) {
                         $styleString = "class='red'";
                     }
                     if (thesaurus::is_deleted($id)) {
                         $styleString = "class='through'";
                     }
                     // draw name with link
                     if ($pos == 0) {
                         $tempString .= form::link("", "<b><span {$styleString}>" . $textString . "</span></b>", "index.php?id={$id}&amp;action=show", "name", "", $id);
                     } else {
                         $tempString .= form::link("", "<span {$styleString}>" . $textString . "</span>", "index.php?id={$id}&amp;action=show", "name", "", $id);
                     }
                     // number of sub-objects
                     if ($cntChildren) {
                         $subText = "";
                         $listCnt = 0;
                         foreach ($childrenArray as $entry) {
                             $subText .= thesaurus::get_name($entry) . "<br>";
                         }
                         $tempString .= "<span ";
                         $tempString .= help::show("elementcount", $subText) . ">";
                         $tempString .= "<i class='small'>";
                         if ($cntChildren) {
                             $tempString .= " ({$cntChildren} UB)</i>";
                         }
                         $tempString .= "</span>";
                     }
                     // number of equiv-objects
                     if ($cntEquiv) {
                         $equivText = "";
                         $listCnt = 0;
                         foreach ($equivArray as $entry) {
                             $equivText .= thesaurus::get_name($entry) . "<br>";
                         }
                         $tempString .= "<span ";
                         $tempString .= help::show("equivcount", $equivText) . ">";
                         $tempString .= "<i class='small'>";
                         if ($cntEquiv) {
                             $tempString .= " ({$cntEquiv} BS)</i>";
                         }
                         $tempString .= "</span>";
                     }
                     // Count of containing elements
                     // show owner
                     $ownerID = thesaurus::get_owner($entry[ID]);
                     $infoText = "ID: " . $id;
                     $infoText .= "<br>Status: " . thesaurus::get_status_name(thesaurus::get_status($id));
                     //              $infoText .= "<br>Begriffstyp: " . thesaurus::get_entrytype_name(thesaurus::get_entrytype($id));
                     $infoText .= "<br>Ersteller: " . user::name($ownerID);
                     $tempString .= " " . form::link("", "?", "", "owner", $infoText);
                     // Edit Link
                     $tempString .= form::link("add", "add", "index.php?parent={$id}&amp;action=add", "add");
                     // Delete Link
                     if ($cntChildren == 0) {
                         $javaText = "Wollen Sie " . $entry[name] . " wirklich l&ouml;schen? Es werden auch alle Links zu diesem Eintrag gelöscht";
                         $tempString .= form::link("delete", "x", "javascript:get_confirm(&#34;{$javaText}&#34;,&#34;index.php?action=deleteid&id={$id}&#34;);", "delete");
                     }
                     // Link Link
                     if (session::get("link") and $id != session::get("link")) {
                         if (!thesaurus::is_parent_of(session::get("link"), $id) or session::get(linkaction) == "change") {
                             $linkType = "do" . thesaurus::get_type_name(session::get("linktype"));
                             $tempString .= form::link($linkType, "L", "index.php?id={$id}&amp;linkaction=linkdo", "{$linkType}");
                         }
                     }
                     $line->insert($tempString);
                     // Insert text in line
                     $tempString = "";
                     // recursive display subtree
                     if (thesaurus::is_open($id)) {
                         // recursive call of level
                         if (thesaurus::child_num($id, 1)) {
                             hyrarchy::display_line($line);
                             hyrarchy::display($id, $depth, $pos + 1, $errorArray);
                         }
                     }
                 }
                 // display line
                 hyrarchy::display_line($line);
             }
         }
     }
 }
function tpl_function_qishi_hunter_jobs_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "职位名长度":
                $aset['jobslen'] = $a[1];
                break;
            case "企业名长度":
                $aset['companynamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "职位分类":
                $aset['jobcategory'] = $a[1];
                break;
            case "职位大类":
                $aset['category'] = $a[1];
                break;
            case "职位小类":
                $aset['subclass'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "学历":
                $aset['education'] = $a[1];
                break;
            case "工作经验":
                $aset['experience'] = $a[1];
                break;
            case "年龄":
                $aset['age'] = $a[1];
                break;
            case "工资":
                $aset['wage'] = $a[1];
                break;
            case "行业":
                $aset['trade'] = $a[1];
                break;
            case "公司规模":
                $aset['scale'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "推荐":
                $aset['recommend'] = $a[1];
                break;
            case "关键字类型":
                $aset['keytype'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "会员UID":
                $aset['uid'] = $a[1];
                break;
            case "公司页面":
                $aset['companyshow'] = $a[1];
                break;
            case "职位页面":
                $aset['jobsshow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
        }
    }
    $timenow = time();
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : "QS_hunter_jobslist";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 10;
    if ($aset['row'] > 30) {
        $aset['row'] = 30;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['jobslen'] = isset($aset['jobslen']) ? intval($aset['jobslen']) : 8;
    $aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 15;
    $aset['recommend'] = isset($aset['recommend']) ? intval($aset['recommend']) : '';
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $aset['companyshow'] = isset($aset['companyshow']) ? $aset['companyshow'] : 'QS_companyshow';
    $aset['jobsshow'] = isset($aset['jobsshow']) ? $aset['jobsshow'] : 'QS_hunter_jobsshow';
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        } elseif ($arr[0] == "atime") {
            $orderbysql = " ORDER BY addtime {$arr[1]}";
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY click {$arr[1]}";
        } elseif ($arr[0] == "scale") {
            $orderbysql = " ORDER BY scale {$arr[1]},refreshtime {$arr[1]}";
        } elseif ($arr[0] == "wage") {
            $orderbysql = " ORDER BY wage {$arr[1]},refreshtime {$arr[1]}";
        } else {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        }
    }
    if (intval($_CFG['subsite_id']) > 0) {
        $wheresql .= " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
    }
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['uid']) && $aset['uid'] != '') {
        $wheresql .= " AND uid=" . intval($aset['uid']);
    }
    if (isset($aset['recommend']) && $aset['recommend'] != '') {
        $wheresql .= " AND recommend=" . intval($aset['recommend']);
    }
    if (isset($aset['education']) && $aset['education'] != '') {
        $wheresql .= " AND education=" . intval($aset['education']);
    }
    if (isset($aset['scale']) && $aset['scale'] != '') {
        $wheresql .= " AND scale=" . intval($aset['scale']);
    }
    if (isset($aset['wage']) && $aset['wage'] != '') {
        $wheresql .= " AND wage=" . intval($aset['wage']);
    }
    if (isset($aset['experience']) && $aset['experience'] != '') {
        $wheresql .= " AND experience=" . intval($aset['experience']);
    }
    if (isset($aset['age']) && $aset['age'] != '') {
        $wheresql .= " AND age=" . intval($aset['age']);
    }
    if (isset($aset['trade']) && $aset['trade'] != '') {
        if (strpos($aset['trade'], "_")) {
            $or = $orsql = "";
            $arr = explode("_", $aset['trade']);
            $arr = array_unique($arr);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $wheresql .= " AND trade IN  ({$sqlin}) ";
            }
        } else {
            $wheresql .= " AND trade=" . intval($aset['trade']) . " ";
        }
    }
    if (!empty($aset['jobcategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['jobcategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR category =" . intval($cat[0]);
            } else {
                $xsql .= " OR subclass =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['category']) && $aset['category'] != '') {
            if (strpos($aset['category'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['category']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND category IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND category = " . intval($aset['category']);
            }
        }
        if (isset($aset['subclass']) && $aset['subclass'] != '') {
            if (strpos($aset['subclass'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['subclass']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND subclass IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND subclass = " . intval($aset['subclass']);
            }
        }
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        if ($_CFG['hunterjobsearch_purview'] == '2') {
            if ($_SESSION['username'] == '') {
                header("Location: " . url_rewrite('QS_login') . "?url=" . urlencode($_SERVER["REQUEST_URI"]));
            }
        }
        $key = help::addslashes_deep(trim($aset['key']));
        if ($_CFG['hunterjobsearch_type'] == '1') {
            $akey = explode(' ', $key);
            if (count($akey) > 1) {
                $akey = array_filter($akey);
                $akey = array_slice($akey, 0, 2);
                $akey = array_map("fulltextpad", $akey);
                $key = '+' . implode(' +', $akey);
                $mode = ' IN BOOLEAN MODE';
            } else {
                $key = fulltextpad($key);
                $mode = ' ';
            }
            $wheresql .= " AND  MATCH (`key`) AGAINST ('{$key}'{$mode}) ";
        } else {
            $wheresql .= " AND likekey LIKE '%{$key}%' ";
        }
        $jobstable = table('jobs_search_key');
    }
    if ($_CFG['operation_hunter_mode'] == '1') {
        $wheresql .= "  AND audit=1  AND display=1 ";
    } elseif ($_CFG['operation_hunter_mode'] == '2') {
        $wheresql .= "  AND audit=1 AND display=1 AND setmeal_id>0 AND (setmeal_deadline>{$timenow} OR setmeal_deadline=0)";
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    //echo "SELECT * FROM ".table('hunter_jobs')." ".$wheresql.$orderbysql.$limit;
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('hunter_jobs') . " {$wheresql}";
        //echo $total_sql;
        //echo "<br>";
        $total_count = $db->get_total($total_sql);
        if ($_CFG['hunter_list_max'] > 0) {
            $total_count > intval($_CFG['hunter_list_max']) && ($total_count = intval($_CFG['hunter_list_max']));
        }
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(8));
            $smarty->assign('pagemin', $page->show(7));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $result = $db->query("SELECT id,subsite_id,jobs_name,contents,jobs_qualified,companyname,refreshtime,district_cn,wage_cn FROM " . table('hunter_jobs') . $wheresql . $orderbysql . $limit);
    while ($row = $db->fetch_array($result)) {
        $row['jobs_name_'] = $row['jobs_name'];
        $row['jobs_name'] = cut_str($row['jobs_name'], $aset['jobslen'], 0, $aset['dot']);
        if ($aset['brieflylen'] > 0) {
            $row['briefly'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
            $row['jobs_qualified'] = cut_str(strip_tags($row['jobs_qualified']), $aset['brieflylen'], 0, $aset['dot']);
        } else {
            $row['briefly'] = strip_tags($row['contents']);
            $row['jobs_qualified'] = strip_tags($row['jobs_qualified']);
        }
        $row['amount'] = $row['amount'] == "0" ? '若干' : $row['amount'];
        $row['briefly_'] = strip_tags($row['contents']);
        $row['companyname_'] = $row['companyname'];
        $row['companyname'] = cut_str($row['companyname'], $aset['companynamelen'], 0, $aset['dot']);
        $row['jobs_url'] = url_rewrite($aset['jobsshow'], array('id' => $row['id']), 1, $row['subsite_id']);
        $row['company_url'] = url_rewrite($aset['companyshow'], array('id' => $row['company_id']));
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        $list[] = $row;
    }
    $smarty->assign($aset['listname'], $list);
}
Exemple #17
0
 static function download($data, $save_name, $is_path = false)
 {
     $extension = preg_replace('/.*\\./', '', $save_name);
     $mime_type = config($extension, 'mime_type');
     empty($mime_type) and $mime_type = 'application/octet-stream';
     $file_name = help::process_download_file_name($save_name);
     if ($is_path) {
         if (is_file($data) && ($fp = fopen($data, 'rb')) !== false) {
             self::send_download_file_header($mime_type, filesize($data), $file_name);
             if (ob_get_level() !== 0 && ob_end_clean() === false) {
                 ob_clean();
             }
             while (!feof($fp) && ($source = fread($fp, 1048576)) !== false) {
                 echo $source;
             }
             fclose($fp);
             exit;
         }
         throw new Exception('read download file fail', 108);
     }
     self::send_download_file_header($mime_type, strlen($data), $file_name);
     exit($data);
 }
Exemple #18
0
 function getone($sql, $type = MYSQL_ASSOC)
 {
     $query = $this->query($sql, $this->linkid);
     $row = mysql_fetch_array($query, $type);
     foreach ($row as $key => $value) {
         $row[$key] = $value;
     }
     return help::htmlspecialchars_($row);
 }
 public static function getInstance() {
     if (self::$instance === null) {
         self::$instance=new setting();
     }
     return self::instance;
 }
Exemple #20
0
 function descriptor($id, $highlight = "", $view = "")
 {
     echo "<div id='export'>";
     $dataArray = thesaurus::get_descriptor($id);
     $linkArray = thesaurus::get_link($id, session::get(descriptor));
     $separator = FALSE;
     $isDescriptor = thesaurus::is_descriptor($id);
     //------------------------------------------------------------------------------
     // icons for actions
     echo "<p>";
     if ($view) {
         echo "<div id='box'>";
         echo "<table width='100%'><tr>";
         echo "<td>";
         echo form::link("opentree", "[+]", "index.php?action=showhyrarchy&amp;id={$id}", "opentree");
         // open hyrarchy tree
         echo " " . form::link("edit", "edit", "index.php?action=edit&amp;id={$id}", "edit");
         // link icons
         echo " " . form::link("link", "OB", "index.php?linkaction=link&amp;link={$id}&amp;id={$id}&amp;linktype=1", "newlink_1");
         echo " " . form::link("equiv", "BS", "index.php?linkaction=link&amp;link={$id}&amp;id={$id}&amp;linktype=2", "newlink_2");
         echo " " . form::link("assoc", "VB", "index.php?linkaction=link&amp;link={$id}&amp;id={$id}&amp;linktype=3", "newlink_3");
         echo " " . form::link("add", "add", "index.php?action=add&amp;parent={$id}", "add");
         echo "</td>";
         // print tree
         echo "<td>";
         echo " " . form::link("", "txt", "csv.php?id={$id}&amp;type=txt", "csv");
         echo "</td>";
         // print csv
         echo "<td>";
         echo " " . form::link("", "csv", "csv.php?id={$id}&amp;type=csv", "csv");
         echo "</td>";
         echo "<td align='right'>";
         // export Adlib
         echo "<td>";
         echo " " . form::link("", "adlib", "csv.php?id={$id}&amp;type=adlib", "adlib");
         echo "</td>";
         // set link
         $linkType = session::get(linktype);
         $linkIcon = array("", "dolink", "doequiv", "doassoc");
         if (session::get(link) != $id and session::get(link)) {
             echo "mit <b>'" . thesaurus::name(session::get(link)) . "'</b>' verknüpfen";
             echo " " . form::link($linkIcon[$linkType], $linkType, "index.php?linkaction=linkdo&amp;id={$id}", $linkIcon[$linkType]);
             echo " " . form::link("delete", "end", "index.php?linkaction=linkend", "end-linking");
         }
         echo "</td>";
         echo "</tr></table>";
         echo "</div>";
     }
     echo "</p>";
     //------------------------------------------------------------------------------
     // display name
     echo "<p>";
     echo "<span class='exporthead'><b>";
     $tempString = highlight($highlight, $dataArray[name], $isDescriptor);
     echo "<a href='index.php?action=show&amp;id={$id}'>";
     echo $tempString;
     // if javascript -> direkt edit
     if (session::get(JS)) {
     }
     echo grafik::disp("edit", "edit", 15);
     echo "</a>";
     echo "</b>";
     // display status of descriptor
     echo " <i>(" . thesaurus::get_status_name(thesaurus::get_status($id)) . ")</i>";
     // mark if kandidate
     if (!thesaurus::is_visible($id)) {
         echo "<br><span class='red'>versteckt</span>";
     }
     echo "</span>";
     // display type of descriptor
     echo "<br><i>" . thesaurus::get_name(thesaurus::get_thesaurus($id)) . "</i>";
     echo "</p>";
     //------------------------------------------------------------------------------
     // display comment
     echo "<p>";
     if ($dataArray[comment]) {
         echo "<tr><td></td>";
         echo "<td class='export'>";
         echo nl2br(highlight($highlight, $dataArray[comment]));
         echo "</td></tr>";
     }
     echo "</p>";
     //------------------------------------------------------------------------------
     // get link data for descriptor
     $parentArray = $linkArray[parent];
     $childArray = $linkArray[child];
     $assocArray = $linkArray[assoc];
     $equivArray = $linkArray[equiv];
     //------------------------------------------------------------------------------
     // list synonyms
     echo "<table>";
     if ($equivArray) {
         // sort for use and used for
         $x = $y = 0;
         foreach ($equivArray as $entry) {
             if ($entry > 0) {
                 $forArray[$x++] = $entry;
             } else {
                 $retArray[$x++] = abs($entry);
             }
         }
         if ($forArray) {
             echo "<tr><td valign='top'>BS</td>";
             echo "<td class='export'>";
             export::list_names($forArray, $highlight);
             echo "</td></tr>";
         }
         if ($retArray) {
             echo "<tr><td valign='top'>BF</td>";
             echo "<td class='export'>";
             export::list_names($retArray, $highlight);
             echo "</td></tr>";
         }
     }
     echo "</p>";
     //------------------------------------------------------------------------------
     // list parents
     if ($parentArray) {
         echo "<tr><td valign='top'>";
         echo "<a href='javascript:void();'";
         echo help::show("OB", "");
         echo ">OB</a>";
         echo "</td>";
         echo "<td class='export'>";
         export::list_names($parentArray, $highlight);
         echo "</td></tr>";
     }
     //------------------------------------------------------------------------------
     // list childs
     if ($childArray) {
         echo "<tr><td valign='top'>";
         echo "<a href='javascript:void();'";
         echo help::show("UB", "");
         echo ">UB</a>";
         echo "</td>";
         echo "<td class='export'>";
         export::list_names($childArray, $highlight);
         echo "</td></tr>";
     }
     //------------------------------------------------------------------------------
     // list associative links
     if ($assocArray) {
         echo "<tr><td valign='top'>";
         echo "<a href='javascript:void();'";
         echo help::show("VB", "");
         echo ">VB</a>";
         echo "</td>";
         echo "<td class='export'>";
         export::list_names($assocArray, $highlight);
         echo "</td></tr>";
     }
     echo "</table>";
     echo "</div>";
 }
Exemple #21
0
         if ($subclass != '') {
             $wheresql .= " AND `subclass` = " . $subclass;
         }
     }
 }
 if ($wage != '') {
     $wheresql .= " AND `wage` = " . $wage;
 }
 if ($recommend != '') {
     $wheresql .= " AND `recommend` = " . $recommend;
 }
 if ($emergency != '') {
     $wheresql .= " AND `emergency` = " . $emergency;
 }
 if (!empty($key)) {
     $key = help::addslashes_deep(trim($key));
     if ($_CFG['jobsearch_type'] == '1') {
         $akey = explode(' ', $key);
         if (count($akey) > 1) {
             $akey = array_filter($akey);
             $akey = array_slice($akey, 0, 2);
             $akey = array_map("fulltextpad", $akey);
             $key = '+' . implode(' +', $akey);
             $mode = ' IN BOOLEAN MODE';
         } else {
             $key = fulltextpad($key);
             $mode = ' ';
         }
         $wheresql .= " AND  MATCH (`key`) AGAINST ('{$key}'{$mode}) ";
     } else {
         $wheresql .= " AND likekey LIKE '%{$key}%' ";
function tpl_function_qishi_company_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "企业名长度":
                $aset['companynamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "行业":
                $aset['trade'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "企业性质":
                $aset['nature'] = $a[1];
                break;
            case "黄页":
                $aset['yellowpages'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['paged'] = $a[1];
                break;
            case "公司页面":
                $aset['companyshow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
            case "规模":
                $aset['scale'] = $a[1];
                break;
        }
    }
    if (is_array($aset)) {
        $aset = array_map("get_smarty_request", $aset);
    }
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['row'] = !empty($aset['row']) ? intval($aset['row']) : 10;
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 16;
    $aset['dot'] = isset($aset['dot']) ? $aset['dot'] : '';
    $aset['companyshow'] = isset($aset['companyshow']) ? $aset['companyshow'] : 'QS_companyshow';
    $aset['listpage'] = !empty($aset['listpage']) ? $aset['listpage'] : 'QS_companylist';
    if ($aset['displayorder']) {
        if (strpos($aset['displayorder'], '>')) {
            $arr = explode('>', $aset['displayorder']);
            // 排序字段
            if ($arr[0] == 'click') {
                $arr[0] = "click";
            } elseif ($arr[0] == "id") {
                $arr[0] = "id";
            } else {
                $arr[0] = "";
            }
            // 排序方式
            if ($arr[1] == 'desc') {
                $arr[1] = "desc";
            } elseif ($arr[1] == "asc") {
                $arr[1] = "asc";
            } else {
                $arr[1] = "";
            }
            if ($arr[0] && $arr[1]) {
                $orderbysql = " ORDER BY `" . $arr[0] . "` " . $arr[1];
            }
        }
    }
    if (isset($aset['trade']) && intval($aset['trade']) > 0) {
        $wheresql .= " AND trade=" . intval($aset['trade']);
    }
    if (isset($aset['nature']) && intval($aset['nature']) > 0) {
        $wheresql .= " AND nature=" . intval($aset['nature']);
    }
    if (isset($aset['scale']) && intval($aset['scale']) > 0) {
        $wheresql .= " AND scale=" . intval($aset['scale']);
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode(",", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (!empty($aset['key'])) {
        $key = help::addslashes_deep(trim($aset['key']));
        $wheresql .= " AND companyname like '%{$key}%'";
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['paged'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('company_profile') . $wheresql;
        $total_count = $db->get_total($total_sql);
        $pagelist = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $pagelist->nowindex;
        $aset['start'] = ($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $pagelist->show(3));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT " . abs($aset['start']) . ',' . $aset['row'];
    $result = $db->query("SELECT id,companyname,contents,logo,audit,trade_cn,district_cn,nature_cn FROM " . table('company_profile') . " " . $wheresql . $orderbysql . $limit);
    $list = array();
    if (intval($_CFG['subsite_id']) > 0) {
        $countwheresql = ' and subsite_id=' . intval($_CFG['subsite_id']);
    } else {
        $countwheresql = '';
    }
    while ($row = $db->fetch_array($result)) {
        $row['companyname_'] = $row['companyname'];
        $row['companyname'] = cut_str($row['companyname'], $aset['companynamelen'], 0, $aset['dot']);
        $row['url'] = url_rewrite($aset['companyshow'], array('id' => $row['id']));
        $row['contents'] = str_replace('&nbsp;', '', $row['contents']);
        $row['briefly_'] = strip_tags($row['contents']);
        $row['briefly'] = strip_tags($row['briefly_']);
        if ($aset['brieflylen'] > 0) {
            $row['briefly'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
        }
        if ($row['logo']) {
            $row['logo'] = $_CFG['site_dir'] . "data/logo/" . $row['logo'];
        } else {
            $row['logo'] = $_CFG['site_dir'] . "data/logo/no_logo.gif";
        }
        $row['jobs_num'] = $db->get_total("select count(*) as num from " . table('jobs') . " where company_id=" . $row['id'] . $countwheresql);
        $row['comment_num'] = $db->get_total("select count(*) as num from " . table('comment') . " where company_id=" . $row['id'] . " and audit=1");
        $list[] = $row;
    }
    $smarty->assign($aset['listname'], $list);
}
function tpl_function_qishi_curriculum_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "课程名长度":
                $aset['courselen'] = $a[1];
                break;
            case "机构名长度":
                $aset['trainnamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "课程类别":
                $aset['coursecategory'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "上课班制":
                $aset['classtype'] = $a[1];
                break;
            case "推荐":
                $aset['recommend'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "关键字类型":
                $aset['keytype'] = $a[1];
                break;
            case "日期范围":
                $aset['refre'] = $a[1];
                break;
            case "开课时间":
                $aset['starttime'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "会员UID":
                $aset['uid'] = $a[1];
                break;
            case "机构页面":
                $aset['trainshow'] = $a[1];
                break;
            case "课程页面":
                $aset['courseshow'] = $a[1];
                break;
            case "讲师页面":
                $aset['teachershow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
        }
    }
    $timenow = time();
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : "QS_courselist";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 10;
    if ($aset['row'] > 30) {
        $aset['row'] = 30;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['courselen'] = isset($aset['courselen']) ? intval($aset['courselen']) : 8;
    $aset['trainnamelen'] = isset($aset['trainnamelen']) ? intval($aset['trainnamelen']) : 15;
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $aset['recommend'] = isset($aset['recommend']) ? intval($aset['recommend']) : '';
    $aset['trainshow'] = isset($aset['trainshow']) ? $aset['trainshow'] : 'QS_train_agencyshow';
    $aset['courseshow'] = isset($aset['courseshow']) ? $aset['courseshow'] : 'QS_train_curriculumshow';
    $aset['teachershow'] = isset($aset['teachershow']) ? $aset['teachershow'] : 'QS_train_lecturershow';
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        } elseif ($arr[0] == "atime") {
            $orderbysql = " ORDER BY addtime {$arr[1]}";
        } elseif ($arr[0] == "stime") {
            $orderbysql = " ORDER BY starttime {$arr[1]}";
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY click {$arr[1]}";
        } else {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        }
    }
    if (intval($_CFG['subsite_id']) > 0) {
        $wheresql .= " AND subsite_id=" . intval($_CFG['subsite_id']) . " ";
    }
    if (isset($aset['refre']) && $aset['refre'] != '') {
        $settr = intval($aset['refre']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['refre'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['starttime']) && $aset['starttime'] != '') {
        $trart = intval($aset['starttime']);
        if ($trart > 0) {
            $trart_val = intval(strtotime("+" . $aset['starttime'] . " day"));
            $wheresql .= " AND starttime>{$timenow} AND starttime<" . $trart_val;
        }
    }
    if (isset($aset['uid']) && $aset['uid'] != '') {
        $wheresql .= " AND uid=" . intval($aset['uid']);
    }
    if (isset($aset['recommend']) && $aset['recommend'] != '') {
        $wheresql .= " AND recommend=" . intval($aset['recommend']);
    }
    if (isset($aset['classtype']) && $aset['classtype'] != '') {
        $wheresql .= " AND classtype=" . intval($aset['classtype']) . " ";
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    //不支持多个类型搜索
    if (!empty($aset['coursecategory']) && $aset['coursecategory'] != '') {
        $wheresql .= " AND category =" . intval($aset['coursecategory']);
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        if ($_CFG['courseearch_purview'] == '2') {
            if ($_SESSION['username'] == '') {
                header("Location: " . url_rewrite('QS_login') . "?url=" . urlencode($_SERVER["REQUEST_URI"]));
            }
        }
        $key = help::addslashes_deep(trim($aset['key']));
        if ($_CFG['courseearch_type'] == '1') {
            $akey = explode(' ', $key);
            if (count($akey) > 1) {
                $akey = array_filter($akey);
                $akey = array_slice($akey, 0, 2);
                $akey = array_map("fulltextpad", $akey);
                $key = '+' . implode(' +', $akey);
                $mode = ' IN BOOLEAN MODE';
            } else {
                $key = fulltextpad($key);
                $mode = ' ';
            }
            $wheresql .= " AND  MATCH (`key`) AGAINST ('{$key}'{$mode}) ";
        } else {
            $wheresql .= " AND likekey LIKE '%{$key}%' ";
        }
    }
    $wheresql .= $_CFG['outdated_course'] == '1' ? " AND deadline > {$timenow} " : ' ';
    if ($_CFG['operation_train_mode'] == '1') {
        $wheresql .= "  AND audit=1  AND display=1 AND add_mode=1 ";
    } elseif ($_CFG['operation_train_mode'] == '2') {
        $wheresql .= "  AND audit=1  AND display=1 AND add_mode=2 AND setmeal_id>0 AND (setmeal_deadline>{$timenow} OR setmeal_deadline=0)";
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('course') . " {$wheresql}";
        //echo $total_sql;
        //echo "<br>";
        $total_count = $db->get_total($total_sql);
        if ($_CFG['course_list_max'] > 0) {
            $total_count > intval($_CFG['course_list_max']) && ($total_count = intval($_CFG['course_list_max']));
        }
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(3));
            $smarty->assign('pagemin', $page->show(7));
            $smarty->assign('pagenow', $page->show(6));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $result = $db->query("SELECT id,subsite_id,course_name,refreshtime,starttime,contents,trainname,train_id,teacher_id,teacher_cn,category_cn,classtype_cn,train_expenses,favour_expenses,district_cn,classhour FROM " . table('course') . $wheresql . $orderbysql . $limit);
    while ($row = $db->fetch_array($result)) {
        $row['course_name_'] = $row['course_name'];
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        $row['starttime_cn'] = date("Y-m-d", $row['starttime']);
        $row['course_name'] = cut_str($row['course_name'], $aset['courselen'], 0, $aset['dot']);
        if ($aset['brieflylen'] > 0) {
            $row['briefly'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
        } else {
            $row['briefly'] = strip_tags($row['contents']);
        }
        $row['briefly_'] = strip_tags($row['contents']);
        $row['trainname_'] = $row['trainname'];
        $row['trainname'] = cut_str($row['trainname'], $aset['trainnamelen'], 0, $aset['dot']);
        $row['course_url'] = url_rewrite($aset['courseshow'], array('id' => $row['id']), 1, $row['subsite_id']);
        $row['train_url'] = url_rewrite($aset['trainshow'], array('id' => $row['train_id']));
        $row['teacher_url'] = url_rewrite($aset['teachershow'], array('id' => $row['teacher_id']));
        $list[] = $row;
    }
    $smarty->assign($aset['listname'], $list);
}
 function __construct()
 {
     parent::__construct();
 }
function tpl_function_qishi_hunter_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "猎头名长度":
                $aset['hunterlen'] = $a[1];
                break;
            case "公司名长度":
                $aset['companynamelen'] = $a[1];
                break;
            case "擅长行业长度":
                $aset['goodtradelen'] = $a[1];
                break;
            case "擅长职能长度":
                $aset['goodcategorylen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "猎头头衔":
                $aset['rank'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "会员UID":
                $aset['uid'] = $a[1];
                break;
            case "猎头页面":
                $aset['huntershow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
        }
    }
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : "QS_hunterlist";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 10;
    if ($aset['row'] > 30) {
        $aset['row'] = 30;
    }
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['hunterlen'] = isset($aset['hunterlen']) ? intval($aset['hunterlen']) : 8;
    $aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 15;
    $aset['goodtradelen'] = isset($aset['goodtradelen']) ? intval($aset['goodtradelen']) : 13;
    $aset['goodcategorylen'] = isset($aset['goodcategorylen']) ? intval($aset['goodcategorylen']) : 13;
    $aset['rank'] = isset($aset['rank']) ? intval($aset['rank']) : 0;
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $orderbysql = " ORDER BY refreshtime desc ";
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        } elseif ($arr[0] == "atime") {
            $orderbysql = " ORDER BY addtime {$arr[1]}";
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY click {$arr[1]}";
        } else {
            $orderbysql = " ORDER BY refreshtime {$arr[1]}";
        }
    }
    $wheresql .= " AND audit=1 ";
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['uid']) && $aset['uid'] != '') {
        $wheresql .= " AND uid=" . intval($aset['uid']);
    }
    if (isset($aset['rank']) && $aset['rank'] != '') {
        $wheresql .= " AND rank=" . intval($aset['rank']) . " ";
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        $key = help::addslashes_deep(trim($aset['key']));
        $akey = explode(' ', $key);
        if (count($akey) > 1) {
            $akey = array_filter($akey);
            $akey = array_slice($akey, 0, 2);
            $akey = array_map("fulltextpad", $akey);
            $key = '+' . implode(' +', $akey);
            $mode = ' IN BOOLEAN MODE';
        } else {
            $key = fulltextpad($key);
            $mode = ' ';
        }
        $wheresql .= " AND  MATCH (`key`) AGAINST ('{$key}'{$mode}) ";
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM " . table('hunter_profile') . " {$wheresql}";
        $total_count = $db->get_total($total_sql);
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        $countpage = $total_count % $aset['row'] == 0 ? $total_count / $aset['row'] : intval($total_count / $aset['row']) + 1;
        $smarty->assign('countpage', $countpage);
        $smarty->assign('page', $page->show(3));
        $smarty->assign('pagemin', $page->show(4));
        $smarty->assign('currenpage', $currenpage);
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = array();
    $result = $db->query("SELECT id,uid,refreshtime,huntername,companyname,contents,goodtrade_cn,goodcategory_cn,worktime_start,photo_img,district_cn FROM " . table('hunter_profile') . $wheresql . $orderbysql . $limit);
    while ($row = $db->fetch_array($result)) {
        $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
        $row['huntername'] = cut_str($row['huntername'], $aset['hunterlen'], 0, $aset['dot']);
        $row['companyname'] = cut_str($row['companyname'], $aset['companynamelen'], 0, $aset['dot']);
        if ($aset['brieflylen'] > 0) {
            $row['contents'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
        } else {
            $row['contents'] = strip_tags($row['contents']);
        }
        if ($aset['goodtradelen'] > 0) {
            $row['goodtrade_cn'] = cut_str(strip_tags($row['goodtrade_cn']), $aset['goodtradelen'], 0, $aset['dot']);
        } else {
            $row['goodtrade_cn'] = strip_tags($row['goodtrade_cn']);
        }
        if ($aset['goodcategorylen'] > 0) {
            $row['goodcategory_cn'] = cut_str(strip_tags($row['goodcategory_cn']), $aset['goodcategorylen'], 0, $aset['dot']);
        } else {
            $row['goodcategory_cn'] = strip_tags($row['goodcategory_cn']);
        }
        $row['companyname_'] = $row['companyname'];
        $row['huntername_'] = $row['huntername'];
        $row['years'] = date('Y') + 1 - $row['worktime_start'];
        if ($row['photo_img']) {
            $row['photosrc'] = $_CFG['hunter_photo_dir'] . $row['photo_img'];
        } else {
            $row['photosrc'] = $_CFG['hunter_photo_dir'] . "no_photo.gif";
        }
        $timenow = time();
        if ($_CFG['operation_mode'] == '1') {
            $wheresql1 .= "  AND audit=1  AND display=1 ";
        } elseif ($_CFG['operation_train_mode'] == '2') {
            $wheresql1 .= "  AND audit=1 AND display=1 AND setmeal_id>0 AND (setmeal_deadline>{$timenow} OR setmeal_deadline=0)";
        }
        $row['countjobs'] = $db->get_total("select count(*) as num from " . table('hunter_jobs') . " where uid=" . $row['uid'] . " " . $wheresql1);
        $jobs = $db->getall("select id,jobs_name,refreshtime from " . table('hunter_jobs') . " where uid=" . $row['uid'] . " " . $wheresql1 . " limit 4");
        foreach ($jobs as $key => $value) {
            $row['jobslist'][$key]['jobs_name'] = cut_str($value['jobs_name'], 10, 0, "..");
            $row['jobslist'][$key]['refreshtime'] = date("Y-m-d", $value['refreshtime']);
            $row['jobslist'][$key]['jobs_url'] = url_rewrite("QS_hunter_jobsshow", array("id" => $value['id']));
        }
        $timenow = time();
        if ($_CFG['operation_mode'] == '1') {
            $wheresql1 .= "  AND audit=1  AND display=1 ";
        } elseif ($_CFG['operation_train_mode'] == '2') {
            $wheresql1 .= "  AND audit=1 AND display=1 AND setmeal_id>0 AND (setmeal_deadline>{$timenow} OR setmeal_deadline=0)";
        }
        $row['countjobs'] = $db->get_total("select count(*) as num from " . table('hunter_jobs') . " where uid=" . $row['uid'] . " " . $wheresql1);
        $list[] = $row;
        unset($row);
    }
    $smarty->assign($aset['listname'], $list);
}
Exemple #26
0
                    </td>
                    <td  width="31%" style="padding-left:10px;">
                        <input type="text" name="<?php 
    echo $tpl;
    ?>
_name" class="input_d" value="<?php 
    echo @help::tpl_name($tpl);
    ?>
">
                    </td>
                    <td width="31%" style="padding-left:10px;">
                        <input type="text" name="<?php 
    echo $tpl;
    ?>
_note" class="input_d" value="<?php 
    echo @help::tpl_note($tpl);
    ?>
">
                    </td>
                </tr>
            </tbody>
        </table>

        <!--dir-->
        <div  id="<?php 
    echo $tpt;
    ?>
" style="display:none">
            <table border="0" cellspacing="0" cellpadding="0" name="table1" id="table1" width="100%">
                <tbody>
                    <tr class="s_out" >
Exemple #27
0
session_save_path('/data/tmp/session/');
session_start();
require_once QISHI_ROOT_PATH . 'data/config.php';
header("Content-Type:text/html;charset=" . QISHI_CHARSET);
require_once QISHI_ROOT_PATH . 'include/help.class.php';
require_once QISHI_ROOT_PATH . 'include/common.fun.php';
require_once QISHI_ROOT_PATH . 'include/74cms_version.php';
$QSstarttime = exectime();
if (!empty($_GET)) {
    $_GET = help::addslashes_deep($_GET);
}
if (!empty($_POST)) {
    $_POST = help::addslashes_deep($_POST);
}
$_COOKIE = help::addslashes_deep($_COOKIE);
$_REQUEST = help::addslashes_deep($_REQUEST);
date_default_timezone_set("PRC");
$timestamp = time();
$online_ip = getip();
$ip_address = convertip($online_ip);
$_NAV = get_cache('nav');
$_PAGE = get_cache('page');
$_CFG = get_cache('config');
$_SUBSITE = get_cache('subsite');
$_M_SUBSITE = get_cache('m_subsite');
$_CFG['statistics'] = htmlspecialchars_decode($_CFG['statistics']);
$_PLUG = get_cache('plug');
if ($_CFG['uc_open'] == "1") {
    require_once QISHI_ROOT_PATH . 'data/cache_uc_config.php';
}
$QS_cookiedomain = get_cookiedomain();
function tpl_function_qishi_jobs_list($params, &$smarty)
{
    global $db, $_CFG;
    $arrset = explode(',', $params['set']);
    foreach ($arrset as $str) {
        $a = explode(':', $str);
        switch ($a[0]) {
            case "列表名":
                $aset['listname'] = $a[1];
                break;
            case "显示数目":
                $aset['row'] = $a[1];
                break;
            case "开始位置":
                $aset['start'] = $a[1];
                break;
            case "职位名长度":
                $aset['jobslen'] = $a[1];
                break;
            case "企业名长度":
                $aset['companynamelen'] = $a[1];
                break;
            case "描述长度":
                $aset['brieflylen'] = $a[1];
                break;
            case "填补字符":
                $aset['dot'] = $a[1];
                break;
            case "应届生职位":
                $aset['graduate'] = $a[1];
                break;
            case "职位分类":
                $aset['jobcategory'] = $a[1];
                break;
            case "职位大类":
                $aset['category'] = $a[1];
                break;
            case "职位小类":
                $aset['subclass'] = $a[1];
                break;
            case "地区分类":
                $aset['citycategory'] = $a[1];
                break;
            case "地区大类":
                $aset['district'] = $a[1];
                break;
            case "地区小类":
                $aset['sdistrict'] = $a[1];
                break;
            case "道路":
                $aset['street'] = $a[1];
                break;
            case "写字楼":
                $aset['officebuilding'] = $a[1];
                break;
            case "标签":
                $aset['tag'] = $a[1];
                break;
            case "行业":
                $aset['trade'] = $a[1];
                break;
            case "学历":
                $aset['education'] = $a[1];
                break;
            case "工作经验":
                $aset['experience'] = $a[1];
                break;
            case "工资":
                $aset['wage'] = $a[1];
                break;
            case "职位性质":
                $aset['nature'] = $a[1];
                break;
            case "公司规模":
                $aset['scale'] = $a[1];
                break;
            case "紧急招聘":
                $aset['emergency'] = $a[1];
                break;
            case "悬赏招聘":
                $aset['reward'] = $a[1];
                break;
            case "推荐":
                $aset['recommend'] = $a[1];
                break;
            case "关键字":
                $aset['key'] = $a[1];
                break;
            case "关键字类型":
                $aset['keytype'] = $a[1];
                break;
            case "日期范围":
                $aset['settr'] = $a[1];
                break;
            case "排序":
                $aset['displayorder'] = $a[1];
                break;
            case "分页显示":
                $aset['page'] = $a[1];
                break;
            case "会员UID":
                $aset['uid'] = $a[1];
                break;
            case "公司页面":
                $aset['companyshow'] = $a[1];
                break;
            case "职位页面":
                $aset['jobsshow'] = $a[1];
                break;
            case "列表页":
                $aset['listpage'] = $a[1];
                break;
            case "合并":
                $aset['mode'] = $a[1];
                break;
            case "公司列表名":
                $aset['comlistname'] = $a[1];
                break;
            case "公司职位页面":
                $aset['companyjobs'] = $a[1];
                break;
            case "单个公司显示职位数":
                $aset['companyjobs_row'] = $a[1];
                break;
            case "浏览过的职位":
                $aset['view_jobs'] = $a[1];
                break;
            case "风格模板":
                $aset['tpl_compnay'] = $a[1];
                break;
        }
    }
    $aset = array_map("get_smarty_request", $aset);
    $aset['listname'] = isset($aset['listname']) ? $aset['listname'] : "list";
    $aset['listpage'] = isset($aset['listpage']) ? $aset['listpage'] : "QS_jobslist";
    $aset['row'] = intval($aset['row']) > 0 ? intval($aset['row']) : 20;
    if ($aset['row'] > 20) {
        $aset['row'] = 20;
    }
    $aset['companyjobs_row'] = intval($aset['companyjobs_row']) > 0 ? intval($aset['companyjobs_row']) : 3;
    $aset['start'] = isset($aset['start']) ? intval($aset['start']) : 0;
    $aset['jobslen'] = isset($aset['jobslen']) ? intval($aset['jobslen']) : 8;
    $aset['companynamelen'] = isset($aset['companynamelen']) ? intval($aset['companynamelen']) : 15;
    $aset['brieflylen'] = isset($aset['brieflylen']) ? intval($aset['brieflylen']) : 0;
    $aset['companyshow'] = isset($aset['companyshow']) ? $aset['companyshow'] : 'QS_companyshow';
    $aset['jobsshow'] = isset($aset['jobsshow']) ? $aset['jobsshow'] : 'QS_jobsshow';
    $aset['companyjobs'] = isset($aset['companyjobs']) ? $aset['companyjobs'] : 'QS_companyjobs';
    $aset['mode'] = isset($aset['mode']) ? intval($aset['mode']) : 0;
    $openorderby = false;
    if (isset($aset['displayorder'])) {
        $arr = explode('>', $aset['displayorder']);
        // 排序方式
        if ($arr[1] == 'desc') {
            $arr[1] = "desc";
        } elseif ($arr[1] == "asc") {
            $arr[1] = "asc";
        } else {
            $arr[1] = "desc";
        }
        if ($arr[0] == "rtime") {
            $orderbysql = " ORDER BY  refreshtime {$arr[1]} , setmeal_id {$arr[1]}";
            $jobstable = table('jobs_search_rtime');
        } elseif ($arr[0] == "stickrtime") {
            $orderbysql = " ORDER BY stick {$arr[1]} , refreshtime {$arr[1]}  , setmeal_id {$arr[1]} ";
            $jobstable = table('jobs_search_stickrtime');
        } elseif ($arr[0] == "hot") {
            $orderbysql = " ORDER BY  click {$arr[1]} , setmeal_id {$arr[1]}";
            $jobstable = table('jobs_search_hot');
        } elseif ($arr[0] == "scale") {
            $orderbysql = " ORDER BY scale {$arr[1]} , refreshtime {$arr[1]} , setmeal_id {$arr[1]}  ";
            $jobstable = table('jobs_search_scale');
        } elseif ($arr[0] == "wage") {
            $orderbysql = " ORDER BY  wage {$arr[1]} ,refreshtime {$arr[1]}  , setmeal_id {$arr[1]}";
            $jobstable = table('jobs_search_wage');
        } elseif ($arr[0] == "key") {
            $jobstable = table('jobs_search_key');
        } elseif ($arr[0] == "null") {
            $orderbysql = "";
            $jobstable = table('jobs_search_rtime');
        } else {
            $orderbysql = " ORDER BY stick {$arr[1]} , setmeal_id {$arr[1]} , refreshtime {$arr[1]}";
            $jobstable = table('jobs_search_stickrtime');
        }
    } else {
        $orderbysql = " ORDER BY stick DESC , refreshtime DESC , setmeal_id desc ";
        $jobstable = table('jobs_search_stickrtime');
    }
    //应届生职位
    if (isset($aset['graduate']) && !empty($aset['graduate'])) {
        $wheresql .= " AND graduate=1 ";
    }
    if (isset($aset['settr']) && $aset['settr'] != '') {
        $settr = intval($aset['settr']);
        if ($settr > 0) {
            $settr_val = intval(strtotime("-" . $aset['settr'] . " day"));
            $wheresql .= " AND refreshtime>" . $settr_val;
        }
    }
    if (isset($aset['uid']) && $aset['uid'] != '') {
        $wheresql .= " AND uid=" . intval($aset['uid']);
    }
    if (isset($aset['emergency']) && $aset['emergency'] != '') {
        $wheresql .= " AND emergency=" . intval($aset['emergency']);
    }
    if (isset($aset['reward']) && $aset['reward'] != '') {
        $wheresql .= " AND reward=" . intval($aset['reward']);
    }
    if (isset($aset['recommend']) && $aset['recommend'] != '') {
        $wheresql .= " AND recommend=" . intval($aset['recommend']);
    }
    if (isset($aset['nature']) && $aset['nature'] != '') {
        if (strpos($aset['nature'], "-")) {
            $or = $orsql = "";
            $arr = explode("-", $aset['nature']);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $wheresql .= " AND nature IN  (" . $sqlin . ") ";
            }
        } else {
            $wheresql .= " AND nature=" . intval($aset['nature']) . " ";
        }
    }
    if (isset($aset['scale']) && $aset['scale'] != '') {
        $wheresql .= " AND scale=" . intval($aset['scale']);
    }
    if (isset($aset['education']) && $aset['education'] != '') {
        $wheresql .= " AND education=" . intval($aset['education']);
    }
    if (isset($aset['wage']) && $aset['wage'] != '') {
        $wheresql .= " AND wage=" . intval($aset['wage']);
    }
    if (isset($aset['experience']) && $aset['experience'] != '') {
        $wheresql .= " AND experience=" . intval($aset['experience']);
    }
    if (isset($aset['trade']) && $aset['trade'] != '') {
        if (strpos($aset['trade'], "_")) {
            $or = $orsql = "";
            $arr = explode("_", $aset['trade']);
            $arr = array_unique($arr);
            if (count($arr) > 10) {
                exit;
            }
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $wheresql .= " AND trade IN  ({$sqlin}) ";
            }
        } else {
            $wheresql .= " AND trade=" . intval($aset['trade']) . " ";
        }
    }
    if (!empty($aset['citycategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['citycategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[1]) === 0) {
                $dsql .= " OR district =" . intval($cat[0]);
            } else {
                $xsql .= " OR sdistrict =" . intval($cat[1]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['district']) && $aset['district'] != '') {
            if (strpos($aset['district'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['district']);
                $arr = array_unique($arr);
                if (count($arr) > 20) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND district IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND district =" . intval($aset['district']);
            }
        }
        if (isset($aset['sdistrict']) && $aset['sdistrict'] != '') {
            if (strpos($aset['sdistrict'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['sdistrict']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND sdistrict IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND sdistrict =" . intval($aset['sdistrict']);
            }
        }
    }
    if (isset($aset['street']) && $aset['street'] != '') {
        $wheresql .= " AND street=" . intval($aset['street']);
    }
    if (isset($aset['officebuilding']) && $aset['officebuilding'] != '') {
        $wheresql .= " AND officebuilding=" . intval($aset['officebuilding']);
    }
    if (!empty($aset['jobcategory'])) {
        $dsql = $xsql = "";
        $arr = explode("_", $aset['jobcategory']);
        $arr = array_unique($arr);
        if (count($arr) > 10) {
            exit;
        }
        foreach ($arr as $sid) {
            $cat = explode(".", $sid);
            if (intval($cat[2]) === 0) {
                $dsql .= " OR category =" . intval($cat[1]);
            } else {
                $xsql .= " OR subclass =" . intval($cat[2]);
            }
        }
        $wheresql .= " AND  (" . ltrim(ltrim($dsql . $xsql), 'OR') . ") ";
    } else {
        if (isset($aset['category']) && $aset['category'] != '') {
            if (strpos($aset['category'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['category']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND topclass IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND topclass = " . intval($aset['category']);
            }
        }
        if (isset($aset['subclass']) && $aset['subclass'] != '') {
            if (strpos($aset['subclass'], "-")) {
                $or = $orsql = "";
                $arr = explode("-", $aset['subclass']);
                $arr = array_unique($arr);
                if (count($arr) > 10) {
                    exit;
                }
                $sqlin = implode(",", $arr);
                if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                    $wheresql .= " AND category IN  ({$sqlin}) ";
                }
            } else {
                $wheresql .= " AND category = " . intval($aset['subclass']);
            }
        }
    }
    if (isset($aset['key']) && !empty($aset['key'])) {
        if ($_CFG['jobsearch_purview'] == '2') {
            if ($_SESSION['username'] == '') {
                header("Location: " . url_rewrite('QS_login') . "?url=" . urlencode($_SERVER["REQUEST_URI"]));
            }
        }
        $key = help::addslashes_deep(trim($aset['key']));
        if ($_CFG['jobsearch_type'] == '1') {
            $akey = explode(' ', $key);
            if (count($akey) > 1) {
                $akey = array_filter($akey);
                $akey = array_slice($akey, 0, 2);
                $akey = array_map("fulltextpad", $akey);
                $key = '+' . implode(' +', $akey);
                $mode = ' IN BOOLEAN MODE';
            } else {
                $key = fulltextpad($key);
                $mode = ' ';
            }
            $wheresql .= " AND  MATCH (`key`) AGAINST ('{$key}'{$mode}) ";
        } else {
            $wheresql .= " AND likekey LIKE '%{$key}%' ";
        }
        $orderbysql = " ORDER BY refreshtime DESC,id desc ";
        $jobstable = table('jobs_search_key');
    }
    /* 搜索 时间范围 */
    $moth = intval($_CFG['search_time']);
    if ($moth > 0) {
        $moth_time = $moth * 3600 * 24 * 30;
        $time = time() - $moth_time;
        $wheresql .= " AND refreshtime>{$time} ";
    }
    if (!empty($aset['tag'])) {
        $jobstable = $jobstable . ' as r ';
        if (strpos($aset['tag'], ",")) {
            $or = $orsql = "";
            $arr = explode(",", $aset['tag']);
            $sqlin = implode(",", $arr);
            if (preg_match("/^(\\d{1,10},)*(\\d{1,10})\$/", $sqlin)) {
                $joinwheresql_tag .= " AND tag IN  ({$sqlin}) ";
            }
        } else {
            $joinwheresql_tag .= " AND tag=" . intval($aset['tag']);
        }
        if (!empty($joinwheresql_tag)) {
            $joinwheresql_tag = " WHERE " . ltrim(ltrim($joinwheresql_tag), 'AND');
        }
        $joinsql = $joinsql == "" ? "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('jobs_tag') . " {$joinwheresql_tag} ) AS g ON  r.id=g.pid " : $joinsql . "  INNER  JOIN  ( SELECT DISTINCT pid FROM " . table('jobs_tag') . " {$joinwheresql_tag} )AS g ON  r.id=g.pid ";
    }
    if (!empty($wheresql)) {
        $wheresql = " WHERE " . ltrim(ltrim($wheresql), 'AND');
    }
    if (isset($aset['page'])) {
        require_once QISHI_ROOT_PATH . 'include/page.class.php';
        $total_sql = "SELECT COUNT(*) AS num FROM {$jobstable} {$joinsql} {$wheresql}";
        //echo $total_sql;
        $total_count = $db->get_total($total_sql);
        if ($_CFG['jobs_list_max'] > 0) {
            $total_count > intval($_CFG['jobs_list_max']) && ($total_count = intval($_CFG['jobs_list_max']));
        }
        //如果是浏览过的职位 总数应该算cookie中的
        if ($aset['view_jobs']) {
            $total_count = count($_COOKIE['QS']['view_jobs_log']);
        }
        $page = new page(array('total' => $total_count, 'perpage' => $aset['row'], 'alias' => $aset['listpage'], 'getarray' => $_GET));
        $currenpage = $page->nowindex;
        $aset['start'] = abs($currenpage - 1) * $aset['row'];
        if ($total_count > $aset['row']) {
            $smarty->assign('page', $page->show(8));
            $smarty->assign('pagemin', $page->show(7));
            $smarty->assign('pagenow', $page->show(6));
        }
        $smarty->assign('total', $total_count);
    }
    $limit = " LIMIT {$aset['start']} , {$aset['row']}";
    $list = $id = $com_list = array();
    $idresult = $db->query("SELECT id FROM {$jobstable} " . $joinsql . $wheresql . $orderbysql . $limit);
    //echo "SELECT id FROM {$jobstable} ".$wheresql.$orderbysql.$limit;
    // 如果是浏览过的职位,从cookie中获取职位的id
    if ($aset['view_jobs']) {
        foreach ($_COOKIE['QS']['view_jobs_log'] as $value) {
            $id[] = $value;
        }
    } else {
        while ($row = $db->fetch_array($idresult)) {
            $id[] = $row['id'];
        }
    }
    if (!empty($id)) {
        $wheresql = " WHERE id IN (" . implode(',', $id) . ") ";
        $result = $db->query("SELECT id,jobs_name,recommend,emergency,stick,highlight,companyname,company_id,company_audit,nature_cn,sex_cn,age,amount,category_cn,graduate,trade_cn,scale,scale_cn,district_cn,street_cn,tag_cn,education_cn,experience_cn,wage,wage_cn,contents,setmeal_id,setmeal_name,refreshtime,click FROM " . table('jobs') . " AS r " . $joinsql . $wheresql . $orderbysql);
        while ($row = $db->fetch_array($result)) {
            $row['jobs_name_'] = $row['jobs_name'];
            $row['refreshtime_cn'] = daterange(time(), $row['refreshtime'], 'Y-m-d', "#FF3300");
            $row['jobs_name'] = cut_str($row['jobs_name'], $aset['jobslen'], 0, $aset['dot']);
            if (!empty($row['highlight'])) {
                $row['jobs_name'] = "<span style=\"color:{$row['highlight']}\">{$row['jobs_name']}</span>";
            }
            if ($aset['brieflylen'] > 0) {
                $row['briefly'] = cut_str(strip_tags($row['contents']), $aset['brieflylen'], 0, $aset['dot']);
            } else {
                $row['briefly'] = strip_tags($row['contents']);
            }
            $row['amount'] = $row['amount'] == "0" ? '若干' : $row['amount'];
            $row['briefly_'] = strip_tags($row['contents']);
            $row['companyname_'] = $row['companyname'];
            $row['companyname'] = cut_str($row['companyname'], $aset['companynamelen'], 0, $aset['dot']);
            $row['jobs_url'] = url_rewrite($aset['jobsshow'], array('id' => $row['id'], 'style' => $aset['tpl_compnay']));
            $row['company_url'] = url_rewrite($aset['companyshow'], array('id' => $row['company_id']));
            $row['wage_newcn'] = str_replace("元/月", "", $row['wage_cn']);
            if (isset($aset['reward']) && $aset['reward'] != '') {
                $rs = $db->getone("SELECT  cp_json from " . table("promotion") . " where cp_promotionid=5 and cp_jobid={$row['id']} ");
                $json = str_replace('&quot;', '"', trim($rs["cp_json"]));
                $row['block_balance'] = json_decode($json)->block_balance;
            }
            if ($row['tag_cn']) {
                $tag_cn = explode(',', $row['tag_cn']);
                $row['tag_cn'] = $tag_cn;
            } else {
                $row['tag_cn'] = array();
            }
            //合并公司 显示模式
            if ($aset['mode'] == 1) {
                //统计单个公司符合条件职位数
                $count_com = $db->get_total("SELECT COUNT(*) AS num FROM " . table('jobs') . "  WHERE  company_id=" . $row['company_id']);
                $row['count'] = $count_com;
                $row['count_url'] = $row['company_url'];
                $list[$row['company_id']][] = $row;
            } else {
                $list[] = $row;
            }
        }
    } else {
        $list = array();
    }
    $smarty->assign($aset['listname'], $list);
}