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'); } }
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); }
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); }
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); }
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); }
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); } }
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); } }
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); }
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); } }
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);
$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);
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);
$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);
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);
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");
// $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);
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"); }
$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);
<?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");
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);
function raisedbystudent($uid, &$tvc) { $w1vendortotal = 0; $w2vendortotal = 0; $w3vendortotal = 0; $trk = dbGetObj("select * from tracking where user_id={$uid}"); $pro = dbGetObj("select * from progress where user_id={$uid}"); $wk = getfld("week", "users", "where id={$uid}"); $errors = 0; $space = " "; if ($wk > 1) { $w1vendorcost = $trk->w1cost; $w1vendortotal = 0; $w1multiplier = 0; if ($w1vendorcost > 0) { $w1vendor = $trk->w1vendor; $w1vendortotal = 25000; //Max amount a vendor can raise //determine how much of the max amount the vendor actually raised $vnum = getvnum(1, $w1vendor, $w1vendorcost); if ($vnum == 1) { $w1multiplier = 1.0; } else { if ($vnum == 2) { $w1multiplier = 0.75; } else { if ($vnum == 3) { $w1multiplier = 0.5; } else { if ($vnum == 4) { $w1multiplier = 0.25; } else { $errors++; rerr("tsk1: student id={$uid} {$space} w1vendor=\"{$w1vendor}\" {$space} w1vendorcost={$w1vendorcost}"); $w1multiplier = 0.625; } } } } //Determine the adjusted vendortotal $w1vendortotal *= $w1multiplier; $w1vendortotal -= $w1vendorcost; } //Dock them for hiring an extra vendor if (substr($pro->w1nlc_utt, 0, 1) == "c") { $w1vendortotal -= 3000; } } if ($wk > 2) { $w2vendorcost = $trk->w2cost; $w2vendortotal = 0; $w2multiplier = 0; if ($w2vendorcost > 0) { $w2vendor = $trk->w2vendor; $w2vendortotal = 50000; //Max amount a vendor can raise $vnum = getvnum(2, $w2vendor, $w2vendorcost); if ($vnum == 1) { $w2multiplier = 1.0; } else { if ($vnum == 2) { $w2multiplier = 0.75; } else { if ($vnum == 3) { $w2multiplier = 0.5; } else { if ($vnum == 4) { $w2multiplier = 0.25; } else { $errors++; rerr("tsk2: student id={$uid} {$space} w2vendor=\"{$w2vendor}\" {$space} w2vendorcost={$w2vendorcost}"); $w2multiplier = 0.625; } } } } //Determine the adjusted vendortotal $w2vendortotal *= $w2multiplier; $w2vendortotal -= $w2vendorcost; } //Dock them for getting insurance if (substr($pro->w2nlc_utt, 0, 1) == "c") { $w2vendortotal -= 1500; } } if ($wk > 3) { $w3vendorcost = $trk->w3cost; $w3vendortotal = -12500; $w3vendor = $trk->w3vendor; if (substr($w3vendor, 0, 7) == "Ramblin") { $w3vendor = substr($w3vendor, 0, 7); } //if($w3vendor != null) //p("$uid - w3vendor = $w3vendor"); //else //p("w3vendor = null"); if ($w3vendor != "" && $w3vendor != null) { $vnum = getvnum(3, $w3vendor, $w3vendorcost); // p("  vnum = $vnum"); if ($vnum < 4) { $w3vendortotal = -8000; // Arrested wrong vendor } else { if ($vnum == 4) { $w3vendortotal = 0; // Arrested the correct vendor } else { $errors++; rerr("tsk3: student id={$uid} {$space} w3vendor=\"{$w3vendor}'\" {$space} w3vendorcost={$w3vendorcost}"); } } //p("&emsp w3vendortotal = $w3vendortotal"); //p(""); } //Dock them for hiring an assistant if (substr($pro->w3nlc_utt, 0, 1) == "c") { $w3vendortotal -= 1500; } dbexec("update tracking set w3cost={$w3vendortotal} where user_id={$uid}"); } // Test Calculation /*if(($w1vendortotal+$w2vendortotal+$w3vendortotal) > 0){ p("$uid - w1raised = $w1vendortotal - w2raised = $w2vendortotal - w3raised = $w3vendortotal"); p("Total = ".($w1vendortotal+$w2vendortotal+$w3vendortotal)); }*/ // =========================== $raised = $w1vendortotal + $w2vendortotal + $w3vendortotal; dbExec("update tracking set raisedmoney={$raised}, errors={$errors} where user_id=" . $uid); setvar($uid, 'RAISED', $raised); dbExec("update results set raised={$raised} where uid={$uid}"); $tvc = $w1vendorcost + $w2vendorcost; // xxx currently not used ? if ($w1vendor == "") { $w1vendor = "no one"; } if ($w2vendor == "") { $w2vendor = "no one"; } if ($w3vendor == "") { $w3vendor = "no one"; } return $raised; }
$vals = array(); $vals['link_man'] = $_POST['company']['link_man']; $vals['tel'] = $company->getPhone($_POST['data']['telcode'], $_POST['data']['telzone'], $_POST['data']['tel']); $vals['fax'] = $company->getPhone($_POST['data']['faxcode'], $_POST['data']['faxzone'], $_POST['data']['fax']); $vals['name'] = strip_tags($_POST['company']['name']); $vals['mobile'] = strip_tags($_POST['company']['mobile']); $vals['email'] = $_POST['company']['email']; $vals['address'] = $_POST['company']['address']; $company->primaryKey = "id"; if (!empty($_POST['maplocation'])) { list($longi, $lati) = explode(",", $_POST['maplocation']); $pdb->Execute("REPLACE INTO {$tb_prefix}companyfields SET company_id=" . $companyinfo['id'] . ",map_longitude='{$longi}',map_latitude='{$lati}'"); } $result = $company->save($vals, "update", $companyinfo['id']); if ($result) { $member->clearCache($the_memberid); $member->updateMemberCaches($the_memberid); flash("success"); } else { flash("action_failed"); } } if (!empty($companyinfo['name'])) { list(, $companyinfo['telcode'], $companyinfo['telzone'], $companyinfo['tel']) = $company->splitPhone($companyinfo['tel']); list(, $companyinfo['faxcode'], $companyinfo['faxzone'], $companyinfo['fax']) = $company->splitPhone($companyinfo['fax']); } $companyfield->primaryKey = "company_id"; $companyfield_info = $companyfield->read("*", $companyinfo['id']); $companyinfo = am($companyinfo, $companyfield_info); setvar("item", $companyinfo); template($tpl_file);
require "session_cp.inc.php"; require LIB_PATH . "cache.class.php"; include CACHE_PATH . "cache_type.php"; $cache = new Caches(); $tpl_file = "industrytype"; 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}industrytypes (id,name) VALUES " . implode(",", $ins_arr) . ";"; $pdb->Execute($ins_str); } if ($cache->updateTypes()) { flash("success"); } else { flash(); } } } if (!empty($_PB_CACHE['industrytype'])) { setvar("sorts", implode("\r\n", $_PB_CACHE['industrytype'])); } template($tpl_file);
foreach ($menus as $key => $val) { if (in_array($key, $allowed_permissions)) { $menus[$key]['check'] = 1; foreach ($val['children'] as $key1 => $val1) { if (in_array($key1, $allowed_permissions)) { $menus[$key]['children'][$key1]['check'] = 1; } } } } setvar("item", $res); } setvar("Privileges", $menus); $tpl_file = "adminer.edit"; template($tpl_file); exit; } if ($do == "password") { $tpl_file = "adminer.password"; template($tpl_file); exit; } } $adminer_result = $pdb->GetArray("SELECT m.username,af.first_name,af.last_login,af.last_ip,af.last_name,m.id,af.member_id FROM {$tb_prefix}adminfields af LEFT JOIN {$tb_prefix}members m ON m.id=af.member_id"); if (!empty($adminer_result)) { for ($i = 0; $i < count($adminer_result); $i++) { $adminer_result[$i]['groupname'] = $pdb->GetOne("SELECT ar.name FROM {$tb_prefix}roleadminers ra LEFT JOIN {$tb_prefix}adminroles ar ON ra.adminrole_id=ar.id WHERE ra.adminer_id=" . $adminer_result[$i]['member_id']); } } setvar("Items", $adminer_result); template($tpl_file);
if (empty($sim)) { //content if (preg_match($remote_content_match, $temp, $match)) { $content = addslashes(trim($match[1])); } $u++; $sql[] = "('" . $title . "','" . $content . "','" . $_POST['data']['type_id'] . "'," . $time_stamp . ")"; } } else { //content if (preg_match($remote_content_match, $temp, $match)) { $content = addslashes(trim($match[1])); } $u++; $sql[] = "('" . $title . "','" . $content . "','" . $_POST['data']['type_id'] . "'," . $time_stamp . ")"; } } $sql = array_filter($sql); if (!empty($sql)) { $ins_str = "INSERT INTO {$tb_prefix}newses (title,content,type_id,created) VALUES " . implode(",", $sql); $result = $pdb->Execute($ins_str); } if ($result) { flash("success"); } else { flash(); } } setvar("NewstypeOptions", $newstype->getTypeOptions()); setvar("AskAction", $typeoption->get_cache_type("common_option")); template($tpl_file);
$attachment = new Attachments(); if (empty($_GET['aid'])) { flash(); } $attach_id = authcode(rawurldecode($_GET['aid']), "DECODE"); if (empty($attach_id)) { flash(); } require LIB_PATH . "func.download.php"; require LIB_PATH . "js.class.php"; $filename = rawurlencode($attachment->getAttachFileName($attach_id)); $filename = $attachment->file_url; if (!sendFile($filename)) { exit('Error occured when get files.'); } else { JS::Close(); } break; default: break; } } if (empty($_GET['id'])) { $picture_src = URL . "images/watermark.png"; } if (isset($_GET['source'])) { $file_source = trim(rawurldecode($_GET['source'])); $picture_src = URL . $attachment_url . $file_source; } setvar("img_src", $picture_src); render("attachment");
template($tpl_file); exit; } if ($do == "search" && !empty($_GET['q'])) { $conditions[] = "Tag.name like '%" . trim($_GET['q']) . "%'"; } if ($do == "del" && !empty($id)) { $tag->del($id); } } if (isset($_POST['del']) && !empty($_POST['id'])) { $tag->del($_POST['id']); } if (isset($_POST['save']) && !empty($_POST['data']['tag'])) { if (isset($_POST['id'])) { $id = intval($_POST['id']); } if ($id) { $tag->save($_POST['data']['tag'], "update", $id); } else { $tag->save($_POST['data']['tag']); } } $amount = $tag->findCount(null, $conditions); $page = new Pages(); $page->setPagenav($amount); //$joins[] = "LEFT JOIN {$tb_prefix}members m ON m.id=Tag.member_id"; $result = $tag->findAll("Tag.*", $joins, $conditions, "Tag.id DESC ", $page->firstcount, $page->displaypg); setvar("Items", $result); setvar("ByPages", $page->getPagenav()); template($tpl_file);
<?php /** * PHPB2B : Opensource B2B Script (http://www.phpb2b.com/) * Copyright (C) 2007-2010, Ualink. All Rights Reserved. * * Licensed under The Languages Packages Licenses. * Support : phpb2b@hotmail.com * * @version $Revision: 1393 $ */ require "../libraries/common.inc.php"; require "room.share.php"; $tplname = "invite"; $invitecode = authcode($_SESSION['MemberID'] . $time_stamp . pb_radom(6)); setvar("InviteCode", $invitecode); template($tplname);
setvar("ProductTypes", $product_types); $group_info = array(); $group_info['year'] = $time_tmp; if (!empty($member->info['membergroup_id']['name'])) { $group_info['name'] = $_PB_CACHE['membergroup'][$member->info['membergroup_id']]['name']; } else { $group_info['name'] = L("undefined_image", "tpl"); } if (!empty($member->info['membergroup_id']['avatar'])) { $group_info['image'] = $absolute_uri . "images/group/" . $_PB_CACHE['membergroup'][$member->info['membergroup_id']]['avatar']; } else { $group_info['image'] = $absolute_uri . "images/group/formal.gif"; } setvar("GROUP", $group_info); //for old version if (isset($member->info['membergroup_id']['name'])) { setvar("GroupName", $_PB_CACHE['membergroup'][$member->info['membergroup_id']]['name']); } if (isset($member->info['membergroup_id']['avatar'])) { setvar("GroupImage", $absolute_uri . "images/group/" . $_PB_CACHE['membergroup'][$member->info['membergroup_id']]['avatar']); } //:~ setvar("Menus", $space->getMenu()); setvar("Links", $space->getLinks()); $space_url = $space->rewrite($company->info['cache_spacename'], $company->info['id']); setvar("space_url", $space_url); setvar("SpaceUrl", $absolute_uri . $skin_dir); setvar("BASEMAP", $absolute_uri . $skin_dir); if (!empty($arrTemplate)) { $smarty->assign($arrTemplate); }
function post() { require CLASS_PATH . "validation.class.php"; $validate = new Validation(); if (isset($_POST['save_service'])) { pb_submit_check('service'); $vals = array(); $vals['status'] = 0; $vals['member_id'] = 0; $vals['content'] = $_POST['service']['content']; if (isset($_POST['service']['nick_name'])) { $vals['nick_name'] = $_POST['service']['nick_name']; } $vals['email'] = $_POST['service']['email']; $vals['type_id'] = $_POST['service']['type_id']; $vals['created'] = $time_stamp; $vals['user_ip'] = pb_get_client_ip(); $vals['title'] = $_POST['service']['title']; $this->service->doValidation($vals); if (!empty($this->service->validationErrors)) { setvar("item", $vals); setvar("Errors", $validate->show($service)); render("service/index"); } else { if (empty($vals['title'])) { $vals['title'] = L("comments_and_suggestions", "tpl"); } if ($this->service->save($vals)) { flash('thanks_for_advise', URL); } else { flash(); } } } else { flash("pls_enter_your_advise", "index.php"); } }