• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP setvar函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中setvar函数的典型用法代码示例。如果您正苦于以下问题:PHP setvar函数的具体用法?PHP setvar怎么用?PHP setvar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setvar函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: adminLogin

function adminLogin()
{
    $reservename = getvar('username', 'post');
    $pass = getvar('pass', 'post');
    if (strlen($reservename) >= 5 && strlen($pass) > 5) {
        $admin = new Admin();
        $row = $admin->findOne($reservename, md5($pass));
        if ($row) {
            setvar('admin', $row['username']);
            //session
            if (getvar('rememberme', 'post')) {
                setcookie('username', $reservename, time() + 3600 * 24 * 7);
            }
            //账号默认保存七天
            setHint('欢迎管理员');
            redirect('usershow');
        } else {
            setHint('账号或密码有误');
            redirect('login');
        }
    } else {
        setHint('账号或密码不符合要求');
        redirect('login');
    }
}
开发者ID:jinghuizhai,项目名称:weixin,代码行数:25,代码来源:handle.php


示例2: index

 function index()
 {
     global $smarty, $viewhelper, $tpl_dir;
     $this->loadModel("userpage");
     $smarty->setTemplateDir(PHPB2B_ROOT . $tpl_dir . DS, 'pages');
     $conditions = array();
     $tpl_file = "pages/default";
     !empty($_GET) && ($_GET = clear_html($_GET));
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
         $conditions[] = "id=" . $id;
     } elseif (!empty($_GET['name'])) {
         $conditions[] = "name='" . trim($_GET['name']) . "' OR title='" . trim($_GET['name']) . "'";
     } elseif (!empty($_GET['title'])) {
         $conditions[] = "title='" . trim($_GET['title']) . "' OR name='" . trim($_GET['title']) . "'";
     }
     $this->userpage->setCondition($conditions);
     $result = $this->userpage->dbstuff->GetRow("SELECT * FROM {$this->userpage->table_prefix}userpages " . $this->userpage->getCondition());
     if (!empty($result)) {
         $title = $result['title'];
         $viewhelper->setTitle($title);
         $viewhelper->setPosition($title);
         if (!empty($result['templet_name'])) {
             $tpl_file = "pages/" . $result['templet_name'];
         } elseif ($viewhelper->tpl_exists($smarty->template_dir . "pages/" . $result['name'] . $smarty->tpl_ext)) {
             $tpl_file = "pages/" . $result['name'];
         }
         setvar("item", pb_lang_split_recursive($result));
     } else {
         setvar("item", array());
     }
     $smarty->assign('position', $viewhelper->getPosition());
     $smarty->assign('page_title', $viewhelper->getTitle());
     $smarty->display($tpl_file . $smarty->tpl_ext);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:35,代码来源:page_controller.php


示例3: detail

 function detail()
 {
     global $G;
     using("area", "industry");
     $area = new Areas();
     $industry = new Industries();
     $tpl_file = "company/detail";
     $this->viewhelper->setTitle(L("yellow_page", "tpl"));
     $this->viewhelper->setPosition(L("yellow_page", "tpl"), "index.php?do=company");
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
         $result = $area->dbstuff->GetRow("SELECT * FROM {$area->table_prefix}companies WHERE id='" . $id . "'");
         if (!empty($result)) {
             $login_check = 1;
             //default open
             if (isset($G['setting']['company_logincheck'])) {
                 $login_check = $G['setting']['company_logincheck'];
             }
             $this->viewhelper->setTitle($result['name']);
             $this->viewhelper->setPosition($result['name']);
             $result['tel'] = pb_hidestr(preg_replace('/\\((.+?)\\)/i', '', $result['tel']));
             $result['fax'] = pb_hidestr(preg_replace('/\\((.+?)\\)/i', '', $result['fax']));
             $result['mobile'] = pb_hidestr($result['mobile']);
             $result['industry_names'] = $industry->disSubNames($result['industry_id'], null, true, "company");
             $result['area_names'] = $area->disSubNames($result['area_id'], null, true, "company");
             setvar("item", $result);
             setvar("LoginCheck", $login_check);
         }
     }
     render($tpl_file, 1);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:company_controller.php


示例4: lists

 function lists()
 {
     global $viewhelper, $pos;
     using("industry", "area");
     $area = new Areas();
     $industry = new Industries();
     $conditions[] = "Job.status=1";
     $viewhelper->setTitle(L("hr_information", "tpl"));
     $viewhelper->setPosition(L("hr_information", "tpl"), "index.php?do=job&action=" . __FUNCTION__);
     if (!empty($_GET['q'])) {
         $title = trim($_GET['q']);
         $conditions[] = "Job.name like '%" . $title . "%'";
     }
     if (!empty($_GET['data']['salary_id'])) {
         $conditions[] = "Job.salary_id=" . intval($_GET['data']['salary_id']);
     }
     if (!empty($_GET['data']['area_id'])) {
         $conditions[] = "Job.area_id=" . intval($_GET['data']['area_id']);
     }
     if (isset($_GET['industryid'])) {
         $industry_id = intval($_GET['industryid']);
         $tmp_info = $industry->setInfo($industry_id);
         if (!empty($tmp_info)) {
             $conditions[] = "Job.industry_id=" . $tmp_info['id'];
             $viewhelper->setTitle($tmp_info['name']);
             $viewhelper->setPosition($tmp_info['name'], "index.php?do=job&action=" . __FUNCTION__ . "&industryid=" . $tmp_info['id']);
         }
     }
     if (isset($_GET['areaid'])) {
         $area_id = intval($_GET['areaid']);
         $tmp_info = $area->setInfo($area_id);
         if (!empty($tmp_info)) {
             $conditions[] = "Job.area_id=" . $tmp_info['id'];
             $viewhelper->setTitle($tmp_info['name']);
             $viewhelper->setPosition($tmp_info['name'], "index.php?do=job&action=" . __FUNCTION__ . "&areaid=" . $tmp_info['id']);
         }
     }
     $amount = $this->job->findCount(null, $conditions, "Job.id");
     $result = $this->job->findAll("Job.*,Job.cache_spacename AS userid,Job.created AS pubdate,(select Company.name from " . $this->job->table_prefix . "companies Company where Company.id=Job.id) AS companyname", null, $conditions, "Job.id DESC", $pos, $this->displaypg);
     $viewhelper->setTitle(L("search", "tpl"));
     $viewhelper->setPosition(L("search", "tpl"));
     setvar("items", $result);
     setvar("paging", array('total' => $amount));
     render("job/list", 1);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:45,代码来源:job_controller.php


示例5: detail

 function detail()
 {
     global $viewhelper;
     $tpl_file = "help/detail";
     $viewhelper->setTitle(L("help_center", "tpl"));
     $viewhelper->setPosition(L("help_center", "tpl"), "index.php?do=help");
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
         $help_result = $this->help->dbstuff->GetRow("SELECT * FROM {$this->help->table_prefix}helps WHERE id=" . $id);
         if (!empty($help_result)) {
             $title = pb_lang_split($help_result['title']);
             $viewhelper->setTitle($title);
             $viewhelper->setPosition($title);
             setvar("item", $help_result);
         }
     }
     render($tpl_file);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:18,代码来源:help_controller.php


示例6: redirect

 function redirect($code = null)
 {
     global $smarty, $theme_name;
     $codes = array(100 => "Continue", 101 => "Switching Protocols", 200 => "OK", 201 => "Created", 202 => "Accepted", 203 => "Non-Authoritative Information", 204 => "No Content", 205 => "Reset Content", 206 => "Partial Content", 300 => "Multiple Choices", 301 => "Moved Permanently", 302 => "Found", 303 => "See Other", 304 => "Not Modified", 305 => "Use Proxy", 307 => "Temporary Redirect", 400 => "Bad Request", 401 => "Unauthorized", 402 => "Payment Required", 403 => "Forbidden", 404 => "Not Found", 405 => "Method Not Allowed", 406 => "Not Acceptable", 407 => "Proxy Authentication Required", 408 => "Request Time-out", 409 => "Conflict", 410 => "Gone", 411 => "Length Required", 412 => "Precondition Failed", 413 => "Request Entity Too Large", 414 => "Request-URI Too Large", 415 => "Unsupported Media Type", 416 => "Requested range not satisfiable", 417 => "Expectation Failed", 500 => "Internal Server Error", 501 => "Not Implemented", 502 => "Bad Gateway", 503 => "Service Unavailable", 504 => "Gateway Time-out");
     $dir = $smarty->template_dir . $theme_name . DS;
     $msg = !empty($this->message) ? $this->message : $codes[$this->code];
     @header("HTTP/1.1 " . $this->code . " " . $msg);
     $qs = !empty($_SERVER['REDIRECT_URL']) ? $_SERVER['REDIRECT_URL'] : $_SERVER['QUERY_STRING'];
     if (strpos($qs, '404;') !== false) {
         $qs = str_replace('404;', '', $qs);
         $qs = substr($qs, strpos($qs, ':80') + 3);
     }
     setvar("url", $qs);
     setvar("msg", $code . " " . urldecode($msg));
     if (file_exists($dir . $this->code . $smarty->tpl_ext)) {
         render($code, true);
     } else {
         render("error", true);
     }
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:20,代码来源:url_controller.php


示例7: updateBreathe

 function updateBreathe($id)
 {
     global $smarty;
     $result = $this->read("*", $id);
     if (!empty($result) && $result['style'] == 1) {
         $tmp_arr = array();
         $xml_template = DATA_PATH . "examples" . DS . "breathe.xml";
         $cache_datafile = DATA_PATH . "appcache/breathe-" . $id . ".xml";
         $ad_result = $this->dbstuff->GetArray("SELECT * FROM " . $this->table_prefix . "adses WHERE status='1' AND state='1' AND adzone_id=" . $id . " ORDER BY priority ASC");
         if (!empty($ad_result)) {
             for ($i = 0; $i < count($ad_result); $i++) {
                 $tmp_arr[$i]['link'] = !empty($ad_result[$i]['target_url']) ? $ad_result[$i]['target_url'] : URL;
                 $tmp_arr[$i]['image'] = $ad_result[$i]['source_url'];
             }
         }
         $data = $tmp_arr;
         setvar("Items", $data);
         $xml_data = $smarty->fetch("file:" . $xml_template);
         file_put_contents($cache_datafile, $xml_data);
     }
 }
开发者ID:renduples,项目名称:alibtob,代码行数:21,代码来源:adzone.php


示例8: lists

 function lists()
 {
     global $viewhelper, $pos;
     $conditions = array();
     $viewhelper->setPosition(L("dictionary", "tpl"), "index.php?do=dict");
     $viewhelper->setTitle(L("dictionary", "tpl"));
     if (!empty($_GET['q'])) {
         $conditions[] = "word like '%" . $_GET['q'] . "%'";
     }
     if (isset($_GET['typeid'])) {
         $type_id = intval($_GET['typeid']);
         $conditions[] = "dicttype_id='" . $type_id . "'";
     }
     $amount = $this->dict->findCount(null, $conditions);
     $result = $this->dict->findAll("Dict.*,dp.name AS typename", array("LEFT JOIN {$this->dict->table_prefix}dicttypes dp ON dp.id=Dict.dicttype_id"), $conditions, "Dict.id DESC", $pos, $this->displaypg);
     if (!empty($result)) {
         setvar("items", $result);
         setvar("paging", array('total' => $amount));
     }
     render("dict/list", true);
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:21,代码来源:dict_controller.php


示例9: reactive

 function reactive()
 {
     global $G;
     if (!empty($_GET['em'])) {
         //check em
         $email = $_GET['em'];
         $result = $this->member->checkUserExistsByEmail($email);
         if (!$result) {
             flash("member_not_exists", null, 0);
         } else {
             $member_reg_auth = $G['setting']['new_userauth'];
             $id = $this->member->field("id", "email='" . $email . "'");
             $member_info = $this->member->getInfoById($id);
             require LIB_PATH . "sendmail.inc.php";
             require CACHE_LANG_PATH . "lang_emails.php";
             if ($member_reg_auth == 1) {
                 $if_need_check = true;
                 $exp_time = $this->member->timestamp + 86400;
                 $tmp_username = $member_info['username'];
                 $hash = authcode("{$tmp_username}\t" . $exp_time, "ENCODE");
                 //$hash = str_replace(array("+", "|"), array("|", "_"), $hash);
                 $hash = rawurlencode($hash);
                 setvar("hash", $hash);
                 setvar("expire_date", date("Y-m-d H:i", strtotime("+1 day")));
                 $sended = pb_sendmail(array($email, $member_info['username']), $member_info['username'] . "," . $arrTemplate["_pls_active_your_account"], "activite");
                 if (empty($G['setting']['reg_filename'])) {
                     $gopage = URL . 'register.php?action=done&em=' . urlencode($email);
                 } else {
                     $gopage = URL . $G['setting']['reg_filename'] . '?action=done&em=' . urlencode($email);
                 }
                 pheader("location:" . $gopage);
             }
         }
     } else {
         flash("invalid_request", null, 0);
     }
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:37,代码来源:member_controller.php


示例10: flash

    if (!$result) {
        flash();
    }
}
if (isset($_POST['del']) && !empty($_POST['id'])) {
    $result = $goods->del($_POST['id']);
}
if (isset($_GET['do'])) {
    $do = trim($_GET['do']);
    if (!empty($_GET['id'])) {
        $id = intval($_GET['id']);
    }
    if ($do == "del" && !empty($id)) {
        $result = $goods->del($_GET['id']);
    }
    if ($do == "edit") {
        if (!empty($id)) {
            $result = $goods->read("*", $id);
            setvar("item", $result);
        }
        $tpl_file = "goods.edit";
        template($tpl_file);
        exit;
    }
}
$amount = $goods->findCount();
$page->setPagenav($amount);
$result = $goods->findAll("*", null, $conditions, "id desc", $page->firstcount, $page->displaypg);
setvar("Items", $result);
setvar("ByPages", $page->pagenav);
template($tpl_file);
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:goods.php


示例11: array

            $header_style = array('bold' => 1, 'size' => '10', 'color' => '#FFFFFF', 'bgcolor' => '#4F81BD');
            $excel->add_style('header', $header_style);
            $table_name = PbController::pluralize($_POST['tb_name']);
            $record_amount = intval($_POST['record_amount']);
            if (empty($record_amount)) {
                $record_amount = 1000;
            }
            $result = $pdb->GetArray("SELECT * FROM " . $tb_prefix . $table_name . " ORDER BY id DESC LIMIT {$record_amount};");
            $xml = simplexml_to_array(simplexml_load_file(DATA_PATH . "exchange" . DS . $_POST['tb_name'] . ".xml", "SimpleXMLElement", LIBXML_NOCDATA));
            $rows = array_keys($xml['items']);
            $excel->add_row($xml['items'], 'header');
            foreach ($result as $key => $val) {
                foreach ($rows as $key1 => $val1) {
                    $cols[$val1] = htmlspecialchars($val[$val1]);
                }
                $excel->add_row($cols);
            }
            $excel->create_worksheet($_POST['tb_name']);
            $excel->download($_POST['tb_name'] . date("YmdH") . '.xls');
            break;
        default:
            break;
    }
}
if (!empty($_PB_CACHE['companytype'])) {
    setvar("sorts", implode("\r\n", $_PB_CACHE['companytype']));
}
if (!empty($items)) {
    setvar("FileItems", array_map_recursive("pb_lang_split", $items));
}
template($tpl_file);
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:data_exchange.php


示例12: array

        case "query":
            $tpl_file = "db.query";
            break;
        case "restore":
            $smarty->register_modifier('get_custom_size', 'size_info');
            $narray = array();
            $dir = DATA_PATH . "backup_" . $backupdir . DS;
            if (is_dir($dir)) {
                $backed_dir = dir($dir);
                $i = -1;
                while ($entry = $backed_dir->read()) {
                    if (!in_array($entry, array('.', '..', '.svn'))) {
                        $narray[] = array('name' => $entry, 'directory' => DATA_PATH . "backup_" . $backupdir . DS . $entry, 'filemtime' => date("Y-m-d H:i:s", @filemtime($dir . DS . $entry)), 'filesize' => @filesize($dir . DS . $entry));
                    }
                }
            }
            uasort($narray, 'filemtimesort');
            if (!empty($narray)) {
                setvar("Items", $narray);
            }
            $tpl_file = "db.restore";
            break;
        default:
            break;
    }
}
$lastbackup_time = $pdb->GetOne("SELECT valued FROM {$tb_prefix}settings WHERE variable='last_backup'");
if ($lastbackup_time) {
    setvar("LastbackupTime", date("Y-m-d H:i", $lastbackup_time));
}
template($tpl_file);
开发者ID:renduples,项目名称:alibtob,代码行数:31,代码来源:db.php


示例13: explode

        $member->Delete($id);
    }
}
$fields = "id,username,CONCAT(mf.first_name,mf.last_name) AS NickName,mf.reg_ip,last_ip,points,credits,membergroup_id,status,created AS pubdate,last_login,trusttype_ids";
$amount = $member->findCount(null, $conditions);
$page->setPagenav($amount);
$joins[] = "LEFT JOIN {$tb_prefix}memberfields mf ON Member.id=mf.member_id";
$result = $member->findAll($fields, $joins, $conditions, "Member.id DESC ", $page->firstcount, $page->displaypg);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        $tmp_img = null;
        if ($result[$i]['id'] != $administrator_id) {
            $result[$i]['candelete'] = 1;
        } else {
            $result[$i]['candelete'] = 0;
        }
        if (!empty($result[$i]['trusttype_ids'])) {
            $tmp_str = explode(",", $result[$i]['trusttype_ids']);
            foreach ($tmp_str as $key => $val) {
                $tmp_img .= "<img src='" . URL . STATICURL . "images/icon/" . $G['trusttype'][$val]['avatar'] . "' alt='" . $G['trusttype'][$val]['name'] . "' />";
            }
            $result[$i]['trust_image'] = $tmp_img;
        }
        if (!empty($result[$i]['membergroup_id'])) {
            $result[$i]['group_image'] = URL . STATICURL . "images/group/" . $member_groups[$result[$i]['membergroup_id']]['avatar'];
        }
    }
    setvar("Items", $result);
}
uaAssign(array("MemberStatus" => $typeoption->get_cache_type("check_status"), "ByPages" => $page->pagenav));
template($tpl_file);
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:member.php


示例14: trim

        if (isset($_GET['newstype']['name'])) {
            $conditions[] = "Newstype.name like '%" . trim($_GET['newstype']['name']) . "%'";
        }
    }
    if ($do == "del" && !empty($id)) {
        $newstype->del($id);
    }
    if ($do == "edit") {
        setvar("NewstypeOptions", $newstype->getTypeOptions());
        if (!empty($id)) {
            $res = $newstype->read("*", $id);
            setvar("item", $res);
        }
        $tpl_file = "newstype.edit";
        template($tpl_file);
        exit;
    }
}
$amount = $newstype->findCount(null, $conditions);
$page->setPagenav($amount);
$sql = "SELECT nt.*,(SELECT count(n.id)) AS news_amount FROM " . $tb_prefix . "newstypes nt LEFT JOIN " . $tb_prefix . "newses n ON n.type_id=nt.id GROUP BY nt.id ORDER BY nt.id DESC LIMIT {$page->firstcount},{$page->displaypg}";
$newstype_list = $pdb->GetArray($sql);
setvar("Items", $newstype_list);
uaAssign(array("ByPages" => $page->pagenav));
if (isset($_POST['del']) && is_array($_POST['id'])) {
    $deleted = $newstype->del($_POST['id']);
    if (!$deleted) {
        flash();
    }
}
template($tpl_file);
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:newstype.php


示例15: define

define('CURSCRIPT', 'index');
require "../libraries/common.inc.php";
require "../share.inc.php";
require CACHE_PATH . "cache_industry.php";
require CACHE_PATH . 'cache_type.php';
$index_latest_industry_ids = 10;
$data = array();
uses("product", "industry");
$product = new Products();
$industry = new Industries();
$ProductSorts = $_PB_CACHE['productsort'];
$result = $product->GetArray($sql = "SELECT distinct industry_id AS iid FROM {$tb_prefix}products WHERE status=1 ORDER BY id DESC LIMIT 0,{$index_latest_industry_ids}");
if (!empty($result)) {
    foreach ($result as $key => $val) {
        $data[$val['iid']]['id'] = $val['iid'];
        if (isset($_PB_CACHE['industry'][1][$val['iid']])) {
            $data[$val['iid']]['name'] = $_PB_CACHE['industry'][1][$val['iid']];
        }
        $tmp_result = $pdb->GetArray("SELECT id,name,picture,sort_id,industry_id FROM {$tb_prefix}products WHERE status=1 AND industry_id=" . $val['iid'] . " ORDER BY id DESC LIMIT 0,5");
        if (!empty($tmp_result)) {
            foreach ($tmp_result as $key1 => $val1) {
                $data[$val['iid']]['sub'][$val1['id']]['id'] = $val1['id'];
                $data[$val['iid']]['sub'][$val1['id']]['name'] = $val1['name'];
                $data[$val['iid']]['sub'][$val1['id']]['sort'] = $ProductSorts[$val1['sort_id']];
                $data[$val['iid']]['sub'][$val1['id']]['image'] = pb_get_attachmenturl($val1['picture'], '', 'small');
            }
        }
    }
    setvar("IndustryProducts", $data);
}
render("product/index");
开发者ID:renduples,项目名称:alibtob,代码行数:31,代码来源:index.php


示例16: file_put_contents

            //			$pattern = "/(http){1}\:\/\/[w]{3}[\.]yourdomain[\.]com[\/]/";
            //			$replacement = URL;
            //			$file = preg_replace($pattern,$replacement,$files);
            file_put_contents(PHPB2B_ROOT . '.htaccess', $file);
        }
    } else {
        @unlink(PHPB2B_ROOT . '.htaccess');
        @unlink(PHPB2B_ROOT . 'httpd.ini');
    }
    if ($data['subdomain_support'] == 1 && $data['subdomain'] != '') {
        $subdomain = $data['subdomain'];
        if (file_exists(PHPB2B_ROOT . '.htaccess')) {
            $rewrite_file = PHPB2B_ROOT . '.htaccess';
        } else {
            $rewrite_file = $example_dir . '_.htaccess';
        }
        $files = file_get_contents($rewrite_file);
        $pattern = "/[\\.]yourdomain[\\.]com/";
        $replacement = $subdomain;
        $file = preg_replace($pattern, $replacement, $files);
        file_put_contents(PHPB2B_ROOT . '.htaccess', $file);
    }
    $updated = edit_function($data);
    if ($updated) {
        flash("success");
    } else {
        flash();
    }
}
setvar("item", $item);
template($tpl_file);
开发者ID:reboxhost,项目名称:phpb2b,代码行数:31,代码来源:setting.php


示例17: detail

 function detail()
 {
     global $viewhelper;
     using("tag", "meta");
     $tag = new Tags();
     $meta = new Metas();
     $conditions = array();
     $viewhelper->setTitle(L("info", "tpl"));
     $viewhelper->setPosition(L("info", "tpl"), "index.php?do=news");
     if (isset($_GET['title'])) {
         $title = trim($_GET['title']);
         $res = $this->news->findByTitle($title);
         $id = $res['id'];
     }
     if (isset($_GET['id'])) {
         $id = intval($_GET['id']);
     }
     if (!empty($id)) {
         $_PB_CACHE['newstype'] = cache_read("type", "newstype");
         $this->news->clicked($id);
         $info = $this->news->read("*", $id);
         if (empty($info) or !$info) {
             flash("data_not_exists", '', 0);
         }
         if (!empty($info['tag_ids'])) {
             $the_tags = $tag->getTagsByIds($info['tag_ids'], true);
             $tmp = null;
             $info['tag'] = $tag->tag;
             foreach ($the_tags as $key => $val) {
                 $tmp .= "<a href='" . $this->url(array("module" => "search", "do" => "news", "q" => urlencode($val))) . "'>" . $val . "</a> ";
             }
             $info['tag_link'] = $tmp;
         }
         if (!empty($info['picture'])) {
             $info['image'] = pb_get_attachmenturl($info['picture'], '', 'small');
         }
         $info['pubdate'] = df($info['created']);
         $info['typename'] = $_PB_CACHE['newstype'][$info['type_id']];
         $viewhelper->setTitle($info['typename']);
         $viewhelper->setPosition($info['typename'], $this->url(array("module" => "search", "do" => "news", "typeid" => $info['type_id'])));
         //seo info
         $meta_info = $meta->getSEOById($id, 'news', false);
         empty($meta_info['title']) ? $viewhelper->setTitle($info['title']) : $viewhelper->setTitle($meta_info['title']);
         empty($meta_info['description']) ? $viewhelper->setMetaDescription($info['content']) : $viewhelper->setMetaDescription($meta_info['description']);
         if (isset($meta_info['keyword'])) {
             $viewhelper->setMetaKeyword($meta_info['keyword']);
         }
         $viewhelper->setPosition($info['title']);
         if (!empty($info['require_membertype'])) {
             $require_ids = explode(",", $info['require_membertype']);
             if (!empty($pb_userinfo['pb_userid'])) {
                 $membertype_id = $this->news->dbstuff->GetOne("SELECT membertype_id FROM {$tb_prefix}members WHERE id='" . $pb_user['pb_userid'] . "'");
                 if (!in_array($membertype_id, $require_ids)) {
                     $info['content'] = L("news_membertype_not_allowed", "tpl");
                 }
             } else {
                 $info['content'] = L("news_membertype_not_allowed", "tpl");
             }
         }
         if ($info['type'] == 1) {
             $info['source'] = L("company_news", "tpl");
             $info['content'] = "<a href='" . $info['content'] . "'>" . $info['content'] . "</a>";
         }
         if (!empty($info['picture'])) {
             $info['image_url'] = pb_get_attachmenturl($info['picture']);
         }
         $neighbour_info = $this->news->getNeighbour($id, "id,title");
         if (!empty($neighbour_info['prev'])) {
             $title = pb_lang_split($neighbour_info['prev']['title']);
             $info['prev_link'] = "<a href='" . $this->url(array("module" => "news", "id" => $neighbour_info['prev']['id'])) . "'>" . $title . "</a>";
             $info['prev_title'] = $title;
         } else {
             $info['prev_link'] = L("nothing", "tpl");
         }
         if (!empty($neighbour_info['next'])) {
             $title = pb_lang_split($neighbour_info['next']['title']);
             $info['next_link'] = "<a href='" . $this->url(array("module" => "news", "id" => $neighbour_info['next']['id'])) . "'>" . $title . "</a>";
             $info['next_title'] = $title;
         } else {
             $info['next_link'] = L("nothing", "tpl");
         }
         setvar("item", pb_lang_split_recursive($info));
     } else {
         flash();
     }
     setvar("Newstypes", $_PB_CACHE['newstype']);
     render("detail.default");
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:88,代码来源:news_controller.php


示例18: flash

        $vals['modified'] = $time_stamp;
        $result = $job->save($vals, "update", $id, null, "member_id=" . $the_memberid);
    } else {
        if ($g['max_job'] && $now_job_amount >= $g['max_job']) {
            flash('one_day_max');
        }
        $vals['created'] = $vals['modified'] = $time_stamp;
        $vals['company_id'] = $companyinfo['id'];
        $vals['member_id'] = $the_memberid;
        $vals['cache_spacename'] = $pdb->GetOne("SELECT space_name FROM {$tb_prefix}members WHERE id=" . $the_memberid);
        $result = $job->save($vals);
    }
    if (!$result) {
        flash();
    } else {
        flash($message_info);
    }
}
$result = $job->findAll("*", null, "Job.member_id=" . $the_memberid, "id DESC", 0, 10);
if (!empty($result)) {
    for ($i = 0; $i < count($result); $i++) {
        $result[$i]['pubdate'] = df($result[$i]['created']);
        $result[$i]['expire_date'] = df($result[$i]['expire_time']);
    }
    setvar("Items", $result);
}
$job_status = explode(",", L('product_status', 'tpl'));
setvar("CheckStatus", $job_status);
setvar("Worktype", $typeoption->get_cache_type("work_type"));
setvar("Salary", $typeoption->get_cache_type("salary"));
template($tpl_file);
开发者ID:renduples,项目名称:alibtob,代码行数:31,代码来源:job.php


示例19: exit

<?php

/**
 *      [PHPB2B] Copyright (C) 2007-2099, Ualink Inc. All Rights Reserved.
 *      The contents of this file are subject to the License; you may not use this file except in compliance with the License. 
 *
 *      @version $Revision: 2048 $
 */
if (!defined('IN_PHPB2B')) {
    exit('Not A Valid Entry Point');
}
uses("trade", "tradefield");
$trade = new Trades();
$trade_controller = new Trade();
$conditions = array();
$conditions[] = "Trade.status=1";
if (!empty($member->info['id'])) {
    $conditions[] = "Trade.member_id='" . $member->info['id'] . "'";
}
if (!empty($company->info['id'])) {
    $conditions[] = "Trade.company_id='" . $company->info['id'] . "'";
}
$amount = $trade->findCount(null, $conditions, "Trade.id");
setvar("TradeTypes", $tradetypes = $trade_controller->getTradeTypes());
setvar("TradeNames", $tradenames = $trade_controller->getTradeTypeNames());
setvar("paging", array('total' => $amount));
$space->render("offer");
开发者ID:renduples,项目名称:alibtob,代码行数:27,代码来源:offer.inc.php


示例20: Caches

require "session_cp.inc.php";
require LIB_PATH . "cache.class.php";
include CACHE_PATH . "cache_type.php";
$cache = new Caches();
$tpl_file = "areatype";
if (isset($_POST['do'])) {
    $do = trim($_POST['do']);
    if ($do == "save") {
        $ins_arr = array();
        $tmp_arr = explode("\r\n", $_POST['data']['sort']);
        array_filter($tmp_arr);
        $i = 1;
        foreach ($tmp_arr as $key => $val) {
            $ins_arr[$i] = "(" . $i . ",'" . $val . "')";
            $i++;
        }
        if (!empty($ins_arr)) {
            $ins_str = "REPLACE INTO {$tb_prefix}areatypes (id,name) VALUES " . implode(",", $ins_arr) . ";";
            $pdb->Execute($ins_str);
        }
        if ($cache->updateTypes()) {
            flash("success");
        } else {
            flash();
        }
    }
}
if (!empty($_PB_CACHE['areatype'])) {
    setvar("sorts", implode("\r\n", $_PB_CACHE['areatype']));
}
template($tpl_file);
开发者ID:renduples,项目名称:alibtob,代码行数:31,代码来源:areatype.php



注:本文中的setvar函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP sf函数代码示例发布时间:2022-05-24
下一篇:
PHP setup_userdata函数代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap