function ip($minIpAddress, $maxIpAddress) { global $_SERVER; $onlineip = empty($_SERVER['REMOTE_ADDR']) ? pb_getenv('REMOTE_ADDR') : $_SERVER['REMOTE_ADDR']; $longip = ip2long($onlineip); if ($this->range($longip, $minIpAddress, $maxIpAddress)) { die("IP FOBIDDEN!"); } }
function showError($msg, $type = null) { global $charset; $host = pb_getenv('HTTP_HOST'); $title = $type == 'db' ? 'Database' : 'System'; echo <<<EOT <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> \t<title>{$host} - {$title} Error</title> \t<meta http-equiv="Content-Type" content="text/html; charset={$charset}" /> \t<meta name="ROBOTS" content="NOINDEX,NOFOLLOW,NOARCHIVE" /> \t<style type="text/css"> \t<!-- \tbody { background-color: white; color: black; } \t#container { width: 650px; } \t#message { width: 650px; color: black; background-color: #FFFFCC; } \t#bodytitle { font: 13pt/15pt verdana, arial, sans-serif; height: 35px; vertical-align: top; } \t.bodytext { font: 8pt/11pt verdana, arial, sans-serif; } \t.help { font: 12px verdana, arial, sans-serif; color: red;} \t.red {color: red;} \ta:link { font: 8pt/11pt verdana, arial, sans-serif; color: red; } \ta:visited { font: 8pt/11pt verdana, arial, sans-serif; color: #4e4e4e; } \t--> \t</style> </head> <body> <table cellpadding="1" cellspacing="5" id="container"> <tr> \t<td id="bodytitle" width="100%">{$host} {$title} Error </td> </tr> EOT; if ($type == 'db') { $helplink = "http://support.phpb2b.com/"; echo <<<EOT <tr> \t<td class="bodytext">The database has encountered a problem. <a href="{$helplink}" target="_blank"><span class="red">Need Help?</span></a></td> </tr> EOT; } else { echo <<<EOT <tr> \t<td class="bodytext">Your request has encountered a problem. </td> </tr> EOT; } echo <<<EOT <tr><td><hr size="1"/></td></tr> <tr><td class="bodytext">Error messages: </td></tr> <tr> \t<td class="bodytext" id="message"> \t\t<ul> {$msg}</ul> \t</td> </tr> EOT; exit; }
/** * [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: 2090 $ */ function smarty_function_get_cache($params, &$smarty) { $op = null; extract($params); if (isset($name)) { switch ($name) { case "language": global $_PB_CACHE; $languages = unserialize($_PB_CACHE['setting']['languages']); if (!empty($languages)) { foreach ($languages as $lang_key => $lang_val) { $tmp = "<a href='" . URL . 'redirect.php?url=' . pb_getenv("PHP_SELF") . "&app_lang=" . $lang_key . "'>"; if (!empty($lang_val['img'])) { $tmp .= "<img src='" . $lang_val['img'] . "' alt='" . $lang_val['title'] . "' />"; } else { $tmp .= $lang_val['title']; } $tmp .= "</a>"; if ($title_li == "list") { $op .= "<li>" . $tmp . "</li>"; } else { $op .= $tmp; } } } break; case "nav": require CACHE_LANG_PATH . "cache_nav.php"; $navs = $_PB_CACHE['nav']['navs']; foreach ($navs as $nav) { $op .= '<li id="mn_' . $nav['id'] . '" class="nav_item nav-item-' . $nav['id'] . ''; $file_name = pb_getenv('REQUEST_URI'); if (strpos($file_name, $nav['url']) !== false && $nav['url'] != 'index.php') { $op .= ' current_nav_item'; } $op .= '">' . $nav['link'] . '</li>'; } break; default: if (is_file(CACHE_LANG_PATH . "cache_" . $name . ".php")) { require CACHE_LANG_PATH . "cache_" . $name . ".php"; } if (empty($var)) { $var = "item"; } $smarty->assign($var, $_PB_CACHE); unset($_PB_CACHE); break; } } return $op; }
function write($sid, $sess_data) { $sess_data = pb_addslashes($sess_data); $expiry = $this->time + $this->lifetime; $sql = "SELECT * FROM {$this->sess_table} WHERE sesskey='{$sid}'"; $result = $this->db->GetRow($sql); if (!empty($result)) { $sql = "UPDATE {$this->sess_table} SET data='{$sess_data}',expiry='{$expiry}',modified='{$this->time}' WHERE sesskey='{$sid}'"; $this->db->Execute($sql); } else { $this->db->Execute("INSERT INTO {$this->sess_table} (sesskey,data,expiry,expireref,created,modified) VALUES('{$sid}', '{$sess_data}', '{$expiry}', '" . pb_getenv('PHP_SELF') . "', '{$this->time}', '{$this->time}')"); } return true; }
function lwrite($message = null) { if (empty($message)) { return; } if (empty($this->log_file)) { $this->log_file = DATA_PATH . 'logs/log'; } if (!$this->fp) { $this->lopen(); } $script_name = basename($_SERVER['PHP_SELF']); $script_name = substr($script_name, 0, -4); $time = date('H:i:s'); fwrite($this->fp, "[{$time}] [{$script_name}] [" . pb_getenv("REMOTE_ADDR") . "] {$message}\r\n"); fclose($this->fp); }
function lwrite($message = null, $pre = 'info') { if (empty($message)) { return; } if (empty($this->log_file)) { $this->log_file = DATA_PATH . 'logs/'; } if (!is_dir($this->log_file)) { pb_create_folder($this->log_file); } $this->log_file = $this->log_file . $pre; if (!$this->fp) { $this->lopen(); } $script_name = $_SERVER['PHP_SELF']; // $script_name = basename($_SERVER['PHP_SELF']); // $script_name = substr($script_name, 0, -4); $time = date('c'); fwrite($this->fp, "{$time} - " . pb_getenv("REMOTE_ADDR") . " {$script_name} {$message}\r\n"); fclose($this->fp); }
/** * Breadcrumb * @since Version 2.0.0 * @access private */ function breadcrumb() { // Creates an array of Directory Structure $this->scriptArray = explode("/", pb_getenv('PHP_SELF')); // Pops the filename off the end and throws it into it's own variable $this->fileName = array_pop($this->scriptArray); // Is this a personal site? if (substr($_SERVER['PHP_SELF'], 1, 1) == '~') { $tmp = explode('/', pb_getenv('PHP_SELF')); $this->personalSite = $tmp[1]; $this->document_root = str_replace(str_replace('/' . $this->personalSite, '', pb_getenv("SCRIPT_NAME")), '', $_SERVER['PATH_TRANSLATED']); } else { $this->document_root = str_replace(pb_getenv("SCRIPT_NAME"), '', $_SERVER['PATH_TRANSLATED']); } #echo $this->document_root.'<Br />'; #echo $_SERVER["SCRIPT_NAME"].'<Br />'; #echo $_SERVER["PATH_TRANSLATED"].'<Br />'; }
function __construct() { $this->_url = pb_getenv('PHP_SELF'); }
/** * [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: 2075 $ */ function smarty_function_pager($params, &$smarty) { // START $show = 'page'; $posvar = 'pos'; $limit = 10; //default you can set 10. $separator = ' «« '; $class_text = 'nav'; $class_num = 'small'; $class_numon = 'big'; $txt_pos = 'middle'; $txt_prev = '«'; // previous $txt_next = '»'; // next $txt_first = 'More'; // archive, more articles $shift = 0; foreach ($params as $key => $value) { $tmps[strtolower($key)] = $value; $tmp = strtolower($key); if (!(${$tmp} = $value)) { ${$tmp} = ''; } } settype($shift, 'integer'); // data check //$minVars = array('limit'); $minVars = array(); if (!empty($minVars)) { foreach ($minVars as $tmp) { if (empty($params[$tmp])) { $smarty->trigger_error('plugin "pager": missing or empty parameter: "' . $tmp . '"'); } } } // END data check if ($txt_pos == 'middle') { $txt_pos = 'side'; } if (!in_array($txt_pos, array('side', 'top', 'bottom'))) { $smarty->trigger_error('plugin "pager": bad value for : "txt_pos"'); } // if there is no need for paging at all if (is_array($rowcount)) { $rowcount = count($rowcount); } elseif (!is_int($rowcount)) { ceil($rowcount); } if ($rowcount <= $limit) { return ''; } if ($limit < 1) { $limit = $rowcount + 1; } if (!empty($no_first)) { unset($txt_first); } // determine the real position if the diplayed numbers were shifted (eg: showing 1 instead of 0) if ($shift > 0) { $pos = $_REQUEST[$posvar] - $shift; if ($pos < 0) { $pos = 0; } } else { $pos = $_REQUEST[$posvar]; } // END INIT // remove these vars from the request_uri - only for beauty $removeVars = array($posvar, '_rc'); // START remove the unwanted variables from the query string parse_str($_SERVER['QUERY_STRING'], $urlVars); // add cache total count $urlVars['total_count'] = $rowcount; // add the forward vars if (!is_array($forwardvars)) { $forwardvars = preg_split('/[,;\\s]/', $forwardvars, -1, PREG_SPLIT_NO_EMPTY); } $urlVars = array_merge($urlVars, $forwardvars); foreach ($urlVars as $key => $value) { if (in_array($key, $removeVars)) { unset($urlVars[$key]); } } // END remove the unwanted variables from the query string // START build up the link $tmp = ''; foreach ($urlVars as $key => $value) { if (is_array($value)) { foreach ($value as $val) { $tmp .= '&' . $key . '[]=' . urlencode($val); } } elseif (!empty($value)) { $tmp .= '&' . $key . '=' . urlencode($value); } else { $tmp .= '&' . $key; } } if (!empty($tmp)) { $url = pb_getenv('PHP_SELF') . '?' . substr($tmp, 1); $link = '&'; } else { $url = pb_getenv('PHP_SELF'); $link = '?'; } // END build up the link // if there is no position (or 0) prepare the link for the second page if ((empty($pos) or $pos < 1) and $rowcount > $limit) { if (!empty($firstpos)) { $short['first'] .= $url . $link . $posvar . '=' . $firstpos; } elseif ($pos == -1) { $short['first'] .= $url . $link . $posvar . '=' . (1 + $shift); } else { $short['first'] = $url . $link . $posvar . '=' . ($limit + $shift); } } // START create data to print if ($rowcount > $limit) { for ($i = 1; $i < $rowcount + 1; $i += $limit) { $pages[$i] = $url . $link . $posvar . '=' . ($i - 1 + $shift); } // previous - next stepping if ($pos >= $limit) { $short['prev'] = $url . $link . $posvar . '=' . ($pos - $limit + $shift); } if ($pos < $rowcount - $limit) { $short['next'] = $url . $link . $posvar . '=' . ($pos + $limit + $shift); } } // END preparing the arrays to print if ($pos >= $limit) { $cache['prev'] = '<a href="' . $short['prev'] . '">' . $txt_prev . '</a>'; } else { $cache['prev'] = ''; } // next if ($pos < $rowcount - $limit) { $cache['next'] = '<a href="' . $short['next'] . '">' . $txt_next . '</a>'; } else { $cache['next'] = ''; } // END prepare the prev and next string/image, make it a link .... $pagenav = null; // START PRININT if ($txt_pos == 'top') { $pagenav .= $cache['prev'] . $cache['next'] . "\n"; } if ($txt_pos == 'side' and !empty($cache['prev'])) { $pagenav .= $cache['prev']; } $total_record = $rowcount; $total_page = ceil($total_record / $limit) - 1; // the last page is not the pos section,should out. $page = floor($pos / $limit); $group_pages = 3; if ($page > 1) { // show page number for paging left $prev_begin = $page - $group_pages <= 0 ? 1 : $page - $group_pages; $prev_end = $page - 1 <= 0 ? 1 : $page - 1; $prevs = range($prev_begin, $prev_end); if ($prev_begin > 1) { $pagenav .= "<a href='" . $pages[1] . "' title='" . L('first_page', 'tpl') . "'>1</a>... "; } foreach ($prevs as $val) { $pagenav .= "<a href='" . $pages[$val * $limit + 1] . "'>{$val}</a>"; } } if ($page > 0) { $pagenav .= "<span class='current'>{$page}</span>"; } if ($page < $total_page) { // page right $next_begin = $page + 1 > $total_page ? $total_page : $page + 1; $next_end = $page + $group_pages > $total_page ? $total_page : $page + $group_pages; $nexts = range($next_begin, $next_end); foreach ($nexts as $val) { $pagenav .= "<a href='" . $pages[$val * $limit + 1] . "'>{$val}</a>"; } } if ($txt_pos == 'side' and !empty($cache['next'])) { $pagenav .= $cache['next']; } // END NUMBERS // START PREVIOUS, NEXT paging if ($txt_pos == 'bottom') { $pagenav .= $cache['prev'] . $cache['next'] . "\n"; } // END PREVIOUS, NEXT paging // END DISPLAY return $pagenav; }
require "../configs/config.inc.php"; require "../libraries/common.inc.php"; require "session_cp.inc.php"; require LIB_PATH . "cache.class.php"; require CLASS_PATH . "string.class.php"; //require(CACHE_LANG_PATH.'lang_emails.php'); uses("setting", "typeoption", "attachment"); $cache = new Caches(); $attachment_controller = new Attachment(); $typeoption = new Typeoption(); $string = new Strings(); $setting = new Settings(); setvar("AskAction", $typeoption->get_cache_type("common_option")); $tpl_file = "setting.basic"; $item = $setting->getValues(); if (preg_match("/iis/", strtolower(pb_getenv("SERVER_SOFTWARE")))) { $is_iis = true; } if (isset($_POST['do'])) { $do = trim($_POST['do']); switch ($do) { case "testemail": require LIB_PATH . 'sendmail.inc.php'; if (!empty($_POST['data']['setting']['testemail'])) { $sended = pb_sendmail(array($_POST['data']['setting']['testemail'], $_POST['data']['setting']['testemail']), L("dear_user", "tpl"), null, L("a_test_email_delete", "tpl", $G['setting']['site_name'])); if (!$sended) { flash("email_sended_false"); } else { flash("email_sended_success"); } } else {
function getDateLink($day, $month, $year) { $s = pb_getenv('SCRIPT_NAME'); $t = am($_GET, array('day' => $day, 'month' => $month, 'year' => $year)); return "{$s}?" . http_build_query($t); }
$sections = array('install', 'javascript'); //da($smarty); $smarty->configLoad('default.conf', $sections); $arrTemplate = $smarty->getConfigVars(); extract($arrTemplate); //:~ $db = new DB_Sql(); $file_cls = new Files(); $pb_protocol = 'http'; if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off') { $pb_protocol = 'https'; } $PHP_SELF = isset($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : preg_replace("/(.*)\\.php(.*)/i", "\\1.php", $_SERVER['PHP_SELF']); $BASESCRIPT = basename($PHP_SELF); list($BASEFILENAME) = explode('.', $BASESCRIPT); $install_url = htmlspecialchars($pb_protocol . "://" . pb_getenv('HTTP_HOST') . preg_replace("/\\/+(api|wap)?\\/*\$/i", '', substr($PHP_SELF, 0, strrpos($PHP_SELF, '/'))) . '/'); $siteUrl = substr($install_url, 0, -(strlen($BASEFILENAME) + 1)); $time_stamp = TIME; if ($_REQUEST) { if (!MAGIC_QUOTES_GPC) { $_REQUEST = pb_addslashes($_REQUEST); if ($_COOKIE) { $_COOKIE = pb_addslashes($_COOKIE); } } extract($_REQUEST, EXTR_SKIP); } if (!isset($_GET['step'])) { $step = '1'; } else { $step = intval($_GET['step']);
function Pages() { $this->_url = pb_getenv('PHP_SELF'); }
function pb_submit_check($var) { $referer = pb_getenv('HTTP_REFERER'); // if (is_file(DATA_PATH.'antispam'.DS.'index.php')) { // require(DATA_PATH.'antispam'.DS.'index.php'); // } if (!empty($_POST[$var]) && $_SERVER['REQUEST_METHOD'] == 'POST') { if ((empty($referer) || preg_replace("/https?:\\/\\/([^\\:\\/]+).*/i", "\\1", $referer) == preg_replace("/([^\\:]+).*/", "\\1", pb_getenv('HTTP_HOST'))) && $_POST['formhash'] == formhash()) { return true; } } header_sent(L("invalid_submit")); exit; }
if (function_exists("ImageCreateFromWBMP")) { $return[] = L('gd_picture_ok', 'tpl', 'WBMP'); } return $return; } } $gd_s = checkGDSupport(); $system_info["GDSupports"] = $gd_ss = !$gd_s ? L('without_this_ext', 'tpl') : implode(",", $gd_s); $rows = $pdb->Execute("SHOW TABLE STATUS"); $dbssize = 0; foreach ($rows as $row) { $dbssize += $row['Data_length'] + $row['Index_length']; } $system_info["PBVersion"] = strtoupper(PHPB2B_VERSION . " ({$charset})"); $system_info["DatabaseSize"] = size_info($dbssize); $system_info["software"] = pb_getenv('SERVER_SOFTWARE'); $system_info["operatingsystem"] = strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' ? "Windows" : "Linux"; setvar("item", $system_info); //check version $support_url = "http://www.phpb2b.com/checkversion.php?version=" . rawurlencode(PHPB2B_VERSION) . "&lang=" . $app_lang . "&release=" . PHPB2B_RELEASE . "&charset={$charset}&dbcharset={$dbcharset}"; if (version_compare(PHP_VERSION, '5.0.0') >= 0) { $opts = array('http' => array('method' => "GET", 'timeout' => 60)); $context = stream_context_create($opts); $file_contents = file_get_contents($support_url, false, $context); } else { $file_contents = file_get_contents($support_url, false); } $has_newversion = false; if (empty($file_contents) || !$file_contents) { } else { //get update alert set
public function init() { global $subdomain_support, $rewrite_able, $pdb, $time_stamp, $tb_prefix, $absolute_uri, $attachment_url, $G, $viewhelper; //espcial done for multi arrTemplate $this->loadModel("space"); $sections = 'space'; $this->view->configLoad('default.conf', $sections); if (isset($_GET['userid'])) { $this->userid = trim(htmlspecialchars($_GET['userid'])); } if ($subdomain_support && $rewrite_able) { $hosts = explode($subdomain_support, pb_getenv('HTTP_HOST')); if ($hosts[0] != "www") { // $this->userid = trim($hosts[0]); } } $G['membergroup'] = cache_read("membergroup"); using("member", "company"); $member = new Members(); $company = new Companies(); $space_name = ''; if (empty($theme_name)) { $theme_name = "default"; $style_name = isset($G['setting']['theme']) && !empty($G['setting']['theme']) ? $G['setting']['theme'] : "default"; $ADODB_CACHE_DIR = DATA_PATH . 'dbcache'; } $this->view->assign("theme_img_path", "templates/" . $theme_name . "/"); $this->view->assign('ThemeName', $theme_name); $cache_data = $push_data = array(); if (!empty($this->userid)) { $userid = $this->userid; $member->setInfoBySpaceName($this->userid); if (!empty($member->info['id'])) { $this->member_id = $member->info['id']; $company->setInfoByMemberId($member->info['id']); } else { $company->setInfoBySpaceName($this->userid); } $push_data['company'] = $company->info; $this->company_id = $company->info['id']; $push_data['member'] = $member->info; } elseif (!empty($_GET['id'])) { $id = intval($_GET['id']); $company->id = $this->company_id = $id; $company->setInfoById($id); if (!empty($company->info['member_id'])) { $member->id = $this->member_id = $company->info['member_id']; } $push_data['company'] = $company->info; $push_data['member'] = $member->info; } if (isset($company->info['status']) && $company->info['status'] === 0) { header_sent(L('company_checking')); exit; } elseif (empty($company->info) || !$company->info) { header_sent(L('data_not_exists')); exit; } $cache_data = $pdb->GetRow("SELECT data2 AS style FROM {$tb_prefix}spacecaches WHERE company_id='" . $company->info['id'] . "'"); if (isset($cache_data['style'])) { $skin_extra_style = $cache_data['style']; } if (!empty($company->info['created'])) { $time_tmp = $time_stamp - $company->info['created']; $company->info['year_sep'] = $time_tmp = ceil($time_tmp / (3600 * 24 * 365)); } if (empty($company->info['email'])) { $company->info['email'] = $G['setting']['service_email']; } if (empty($company->info['picture'])) { $company->info['logo'] = $absolute_uri . pb_get_attachmenturl('', '', 'big'); } else { $company->info['logo'] = $absolute_uri . $attachment_url . $company->info['picture']; } $company->info = pb_lang_split_recursive($company->info); $company->info['description'] = nl2br(strip_tags($company->info['description'])); $is_set_default_skins = false; $member_templet_id = $member->info['templet_id']; if (isset($_GET['force_templet_id'])) { $member_templet_id = intval($_GET['force_templet_id']); } if (!empty($member_templet_id)) { $skin_path_info = $pdb->GetRow("SELECT name,directory FROM {$tb_prefix}templets WHERE type='user' AND status='1' AND id='" . $member_templet_id . "'"); } if (empty($skin_path_info)) { $skin_path_info = $pdb->GetRow("SELECT name,directory FROM {$tb_prefix}templets WHERE type='user' AND is_default='1'"); if (empty($skin_path_info)) { $is_set_default_skins = true; } } elseif (!is_dir(PHPB2B_ROOT . $skin_path_info)) { $is_set_default_skins = true; } if ($is_set_default_skins) { $skin_path_info = array(); $skin_path_info[] = "default"; $skin_path_info[] = "templates/skins/default/"; } list($skin_path, $skin_dir) = $skin_path_info; if (strpos($skin_dir, "templates") === false) { $skin_dir = "templates/" . $skin_dir; //for 4.3 upgrade from 4.3 below,begin 2012.10 } $this->skin_path = $skin_path; $this->skin_dir = $skin_dir; uaAssign(array("SkinName" => $skin_path, "ThemeName" => $skin_path, "SkinPath" => $skin_dir, "COMPANY" => $company->info, "MEMBER" => $member->info)); $this->view->setTemplateDir(PHPB2B_ROOT . "templates" . DS . "skins" . DS); $this->view->setCompileDir(DATA_PATH . "templates_c" . DS . $this->lang . DS . "skin" . DS . $skin_path . DS); if (isset($member->info['id'])) { $this->setLinks($member->info['id']); } $this->setMenu($company->info['cache_spacename'], $this->spaceModules); $product_types = $pdb->GetArray("SELECT *,id as typeid,name as typename FROM {$tb_prefix}producttypes WHERE company_id=" . $company->info['id']); //set and get db cache setvar("ProductTypes", $product_types); $group_info = array(); $group_info['year'] = $time_tmp; if (!empty($member->info['membergroup_id']['name'])) { $group_info['name'] = $G['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 . STATICURL . "images/group/" . $G['membergroup'][$member->info['membergroup_id']]['avatar']; } else { $group_info['image'] = $absolute_uri . STATICURL . "images/group/formal.gif"; } setvar("GROUP", $group_info); //for old version if (isset($member->info['membergroup_id']['name'])) { setvar("GroupName", $G['membergroup'][$member->info['membergroup_id']]['name']); } if (isset($member->info['membergroup_id']['avatar'])) { setvar("GroupImage", $absolute_uri . STATICURL . "images/group/" . $G['membergroup'][$member->info['membergroup_id']]['avatar']); } setvar("Menus", $this->getMenu()); setvar("Links", $this->getLinks()); $space_url = $this->rewrite($company->info['cache_spacename'], $company->info['id']); setvar("space_url", $space_url); setvar("SpaceUrl", $absolute_uri . $skin_dir); $space_extra_style = ''; setvar("SpaceExtraStyle", $space_extra_style); if (!empty($skin_extra_style)) { $space_extra_style = $absolute_uri . $skin_dir . "styles/" . $skin_extra_style . "/"; setvar("SpaceExtraStyle", $space_extra_style); } setvar("BASEMAP", $absolute_uri . $skin_dir); $pdb->Execute("UPDATE {$tb_prefix}companies SET clicked=clicked+1 WHERE id='" . $company->info['id'] . "'"); if (!empty($arrTemplate)) { $this->view->assign($arrTemplate); } if (!empty($_GET['module'])) { $this->module = trim($_GET['module']); } $this->view->assign("cur", "space_" . $this->module); }
/** * [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: 2214 $ */ function smarty_function_get($params, &$smarty) { $op = null; extract($params); global $tb_prefix, $pdb; if (empty($var)) { $var = "item"; } if (!empty($from)) { switch ($from) { case "market": $num = 4; if (isset($params['row'])) { $num = intval($params['row']); } $latest_commend_markets = $industry->GetArray("SELECT * FROM " . $tb_prefix . "markets WHERE if_commend='1' AND status='1' AND picture!='' ORDER BY id DESC LIMIT " . $num); $urls = $infos = $images = array(); if (!empty($latest_commend_markets)) { while (list($key, $val) = each($latest_commend_markets)) { $urls[] = $industry->getPermaLink($val['id'], null, 'market'); $infos[] = pb_lang_split($val['name']); $images[] = pb_get_attachmenturl($val['picture'], '', $size); } $items['url'] = implode("|", $urls); $items['info'] = implode("|", $infos); $items['image'] = implode("|", $images); $return = $items; } break; case "area": if (class_exists("Areas")) { $area = new Areas(); } else { uses("area"); $area = new Areas(); } $return = $area->getLevelAreas(); break; case "industry": //depth if (class_exists("Industries")) { $industry = new Industries(); $obj_controller = new Industry(); } else { uses("industry"); $industry = new Industries(); $obj_controller = new Industry(); } $return = $industry->getCacheIndustry(); break; case "type": if (!empty($name)) { //depth if (class_exists("Industries")) { $industry = new Industries(); $obj_controller = new PbController(); } else { uses("industry"); $industry = new Industries(); $obj_controller = new PbController(); } $name = $obj_controller->pluralize($name); $industry->findIt($name); $return = $industry->params['data'][1]; if (isset($multi)) { $return = $obj_controller->flatten_array($return); } if (empty($var)) { $var = "Items"; } } break; default: $return = cache_read($name, $key); break; } } if (!empty($sql)) { //replace table prefix $pdb->setFetchMode(ADODB_FETCH_ASSOC); $sql = str_replace("pb_", $tb_prefix, $sql); //for secure if (eregi('insert|update|delete|union|into|load_file|outfile|replace', $sql)) { trigger_error('no supported sql.'); } //mysql_escape_string() $return = $industry->GetArray($sql); } if (isset($name)) { switch ($name) { case "language": global $G; $languages = unserialize($G['setting']['languages']); if (!empty($languages)) { if (!isset($echo)) { $smarty->assign($var, $languages); } else { foreach ($languages as $lang_key => $lang_val) { $tmp = "<a href='" . URL . 'redirect.php?url=' . pb_getenv("REQUEST_URI") . "&app_lang=" . $lang_key . "' title='" . $lang_val['title'] . "'>"; if ($image && !empty($lang_val['img'])) { $tmp .= "<img src='" . $lang_val['img'] . "' alt='" . $lang_val['title'] . "' />"; } else { $tmp .= $lang_val['title']; } $tmp .= "</a>"; if ($sep) { $tmp .= $sep; } if (isset($title_li) && $title_li == "list") { $op .= "<li>" . $tmp . "</li>"; } else { $op .= $tmp; } } } } break; case "nav": $_nav = cache_read("nav"); $navs = $_nav['navs']; if (!empty($exclude)) { $_exclude_navs = explode(",", $exclude); foreach ($_exclude_navs as $_exkey => $_exval) { unset($navs[$_exval]); } } if (empty($echo)) { $smarty->assign($var, $navs); } else { foreach ($navs as $nav) { $op .= '<li id="mn_' . $nav['id'] . '" class="nav_item nav-item-' . $nav['id']; $file_name = pb_getenv('REQUEST_URI'); if (strpos($file_name, $nav['url']) !== false && $nav['url'] != 'index.php') { $op .= ' current_nav_item'; } $op .= '"><a href="' . $nav['url'] . '" target="_self"><span>' . pb_lang_split($nav['name']) . '</span></a></li>'; } } break; default: if (is_file(CACHE_COMMON_PATH . "cache_" . $name . ".php")) { require CACHE_COMMON_PATH . "cache_" . $name . ".php"; } if (isset($_PB_CACHE)) { $smarty->assign($var, $_PB_CACHE); } break; } } if (!empty($return)) { $smarty->assign($var, $return); } return $op; }
function pb_submit_check($var) { global $_POST; $referer = pb_getenv('HTTP_REFERER'); if (!empty($_POST[$var]) && $_SERVER['REQUEST_METHOD'] == 'POST') { if ((empty($referer) || preg_replace("/https?:\\/\\/([^\\:\\/]+).*/i", "\\1", $referer) == preg_replace("/([^\\:]+).*/", "\\1", $_SERVER['HTTP_HOST'])) && $_POST['formhash'] == formhash()) { return true; } else { die(L("invalid_submit")); } } else { return false; } }
} if ($dbcharset && mysql_get_server_info() > '4.1') { $pdb->Execute("SET NAMES '{$dbcharset}'"); } if (!file_exists(CACHE_PATH . "cache_setting.php")) { require_once LIB_PATH . "cache.class.php"; $cache = new Caches(); if ($cache->cacheAll()) { $msg .= "<a href='index.php'>" . L("cached_and_refresh") . "</a>"; header_sent($msg); exit; } } $cachelost = (include CACHE_PATH . 'cache_setting.php') ? '' : 'settings'; $phpb2b_auth_key = md5($_PB_CACHE['setting']['auth_key'] . pb_getenv('HTTP_USER_AGENT')); $php_self = pb_getenv('PHP_SELF'); $base_script = basename($php_self); list($basefilename) = explode('.', $base_script); if ($headercharset) { @header('Content-Type: text/html; charset=' . $charset); } //timezone $time_offset = isset($_PB_CACHE['setting']['time_offset']) ? $_PB_CACHE['setting']['time_offset'] : 0; $date_format = isset($_PB_CACHE['setting']['date_format']) ? $_PB_CACHE['setting']['date_format'] : "Y-m-d"; $time_now = array('time' => gmdate("{$date_format} H:i", $time_stamp + 3600 * $time_offset), 'offset' => $time_offset >= 0 ? $time_offset == 0 ? '' : '+' . $time_offset : $time_offset); if (PHP_VERSION > '5.1') { //@date_default_timezone_set('Etc/GMT'.($time_offset > 0 ? '-' : '+').(abs($time_offset))); } else { //@putenv("TZ=GMT".$time_now['offset']); } $viewhelper = new PbView();
function Add() { global $_PB_CACHE, $memberfield, $phpb2b_auth_key, $if_need_check; $error_msg = array(); if (empty($this->params['data']['member']['username']) or empty($this->params['data']['member']['userpass']) or empty($this->params['data']['member']['email'])) { return false; } $space_name = $this->params['data']['member']['username']; $userpass = $this->params['data']['member']['userpass']; $this->params['data']['member']['userpass'] = $this->authPasswd($this->params['data']['member']['userpass']); if (empty($this->params['data']['member']['space_name'])) { $this->params['data']['member']['space_name'] = PbController::toAlphabets($space_name); } //Todo: $uip = pb_ip2long(pb_getenv('REMOTE_ADDR')); if (empty($uip)) { pheader("location:" . URL . "redirect.php?message=" . urlencode(L('sys_error'))); } $this->params['data']['member']['last_login'] = $this->params['data']['member']['created'] = $this->params['data']['member']['modified'] = $this->timestamp; $this->params['data']['member']['last_ip'] = pb_get_client_ip('str'); $email_exists = $this->checkUserExistsByEmail($this->params['data']['member']['email']); if ($email_exists) { flash("email_exists", null, 0); } $if_exists = $this->checkUserExist($this->params['data']['member']['username']); if ($if_exists) { flash('member_has_exists', null, 0); } else { $this->save($this->params['data']['member']); $key = $this->table_name . "_id"; if ($this->ins_passport) { $this->passport(array($this->{$key}, $this->params['data']['member']['username'], $userpass, $this->params['data']['member']['email']), "reg"); } $memberfield->primaryKey = "member_id"; $memberfield->params['data']['memberfield']['member_id'] = $this->{$key}; $memberfield->params['data']['memberfield']['reg_ip'] = $this->params['data']['member']['last_ip']; $memberfield->save($memberfield->params['data']['memberfield']); if (!$if_need_check) { $user_info['id'] = $this->{$key}; $user_info['username'] = $this->params['data']['member']['username']; $user_info['userpass'] = $userpass; $user_info['useremail'] = $this->params['data']['member']['email']; $user_info['lifetime'] = $this->timestamp + 86400; $user_info['is_admin'] = 0; $this->putLoginStatus($user_info); } } return true; }
function render($filename = null, $exit = false) { global $smarty, $viewhelper, $theme_name, $cache_id, $default_html_filename; $return = false; $tmp_themename = ''; //from begin 5.0 $smarty->template_dir = PHPB2B_ROOT . "templates" . DS . "site" . DS; //:~ $smarty->assign('position', $viewhelper->getPosition()); $smarty->assign('page_title', $viewhelper->getTitle()); //get_class($this); $tpl = $theme_name . DS . $filename . $smarty->tpl_ext; $smarty->assign('ThemeName', $tmp_themename ? $tmp_themename : $theme_name); if (!empty($viewhelper->metaDescription)) { $smarty->assign("metadescription", $viewhelper->metaDescription); } if (!empty($viewhelper->metaKeyword)) { $smarty->assign("metakeywords", $viewhelper->metaKeyword); } elseif (!empty($viewhelper->metaDescription)) { $viewhelper->setMetaKeyword($viewhelper->metaDescription); $smarty->assign("metakeywords", $viewhelper->metaKeyword); } if ($smarty->caching) { $cache_id = $_GET['page'] . "|" . $_GET['id'] . "|" . $_GET['pos']; } if (defined("SMARTY_CACHE") && SMARTY_CACHE) { $smarty->caching = 1; } if ($smarty->caching) { $cache_id = substr(md5(pb_getenv('REQUEST_URI') . $cache_id), 0, 16); } $return = $smarty->display($tpl, $cache_id); if ($exit) { exit; } return $return; }
<?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: 2075 $ */ define('ANTI_FORCE', true); define('ANTI_LEVEL', 3); //higher,will be more secure,default 3. if (ANTI_FORCE) { $GLOBALS['log']->lwrite($_SERVER['HTTP_USER_AGENT']); $ip_addr = pb_get_client_ip("long"); if (strpos($referer, pb_getenv('HTTP_HOST')) === false || empty($ip_addr)) { header_sent(L("invalid_submit")); exit; } $client_agent = $_SERVER['HTTP_USER_AGENT']; if (preg_match('/windows 2000/', $client_agent)) { header("Location:" . URL); exit; } $temp = explode('(', $client_agent); $Part = $temp[0]; $ext_info = $temp[1]; $ext_info = explode(')', $ext_info); $temp = explode(';', trim($ext_info[0])); $r_info = array(); if (!empty($ext_info[1])) { $r_info = trim($ext_info[1]);
if (!file_exists(DATA_PATH . "install.lock")) { $msg .= "<br /><a href='" . URL . "install/install.php'>" . L("please_reinstall_program", "msg") . "</a>"; } require CLASS_PATH . "error.class.php"; Errors::showError($msg, 'db'); exit; } if ($dbcharset) { $pdb->Execute("SET NAMES '{$dbcharset}'"); } //caches check if (!file_exists(CACHE_COMMON_PATH . "cache_setting.php")) { require LIB_PATH . "cache.class.php"; $cache = new Caches(); if ($cache->cacheAll()) { $msg .= "<a href='" . pb_getenv('REQUEST_URI') . "'>Cached successfully, please refresh.</a>"; header_sent($msg); exit; } } $cachelost = (include CACHE_COMMON_PATH . 'cache_setting.php') ? '' : 'settings'; $phpb2b_auth_key = $_PB_CACHE['setting']['auth_key']; if ($headercharset) { @header('Content-Type: text/html; charset=' . $charset); } //timezone if (isset($_PB_CACHE['setting']['time_offset'])) { $time_offset = trim($_PB_CACHE['setting']['time_offset']); $date_format = isset($_PB_CACHE['setting']['date_format']) ? $_PB_CACHE['setting']['date_format'] : "Y-m-d"; $time_now = array('time' => gmdate("{$date_format} H:i", $time_stamp + 3600 * $time_offset), 'offset' => $time_offset >= 0 ? $time_offset == 0 ? '' : '+' . $time_offset : $time_offset); if (PHP_VERSION > '5.1') {
function upload_process($type_id = '0') { $attach_info = array(); //init moved here if (empty($this->upload_dir)) { $this->upload_dir = gmdate("Y") . DS . gmdate("m") . DS . gmdate("d"); } $this->out_file_path = PHPB2B_ROOT . $this->attachment_dir . DS . $this->upload_dir . DS; $this->upload_url = str_replace(array(DS, "\\", "\\'"), "/", $this->upload_dir) . '/'; if (isset($_FILES) && $_FILES[$this->upload_form_field]['size'] > 0) { $mimetype = new mimetype(); $file_ext = strtolower(fileext($_FILES[$this->upload_form_field]['name'])); if ($this->is_image) { //check image format if (!in_array($file_ext, $this->imgext)) { return L("format_not_support"); } } if (in_array($file_ext, $this->imgext)) { $this->is_image = 1; $this->allowed_file_ext = $this->imgext; if (!in_array($_FILES[$this->upload_form_field]['type'], $mimetype->image_mimes)) { flash("format_not_support", '', 0); } } require LIB_PATH . "upload.class.php"; $upload = new FileUploads(); $upload->upload_dir = $this->out_file_path; $upload->extensions = $this->allowed_file_ext; $upload->max_file_size = $this->max_file_size; $upload->the_temp_file = $_FILES[$this->upload_form_field]['tmp_name']; $upload->the_file = $_FILES[$this->upload_form_field]['name']; $upload->http_error = $_FILES[$this->upload_form_field]['error']; if ($_FILES[$this->upload_form_field]['size'] > $this->max_file_size) { flash("file_too_big", '', 0, implode(",", $this->allowed_file_ext)); } $isuploaded = $upload->upload($this->rename_file); if (!$isuploaded) { flash("file_too_big", '', 0, implode(",", $this->allowed_file_ext)); } //insert into db. //$_this = & Attachments::getInstance(); $_this = Attachments::getInstance(); $this->file_full_url = $this->upload_url . $upload->file_copy; $this->file_size = $_FILES[$this->upload_form_field]['size']; $this->out_file_name = $upload->file_copy; $this->out_file_full_path = $this->out_file_path . $this->out_file_name; if ($this->is_image) { list($width, $height) = @getimagesize($this->out_file_full_path); $this->width = intval($width); $this->height = intval($height); if ($this->if_orignal) { copy($this->out_file_full_path, $this->out_file_path . $this->rename_file . $this->orignal_file_ext . $upload->file_extension); } if ($this->if_thumb) { require LIB_PATH . "thumb.class.php"; if ($this->if_orignal) { $img = new Image($this->out_file_path . $this->rename_file . $this->orignal_file_ext . $upload->file_extension, $this->out_file_full_path); } else { $img = new Image($this->out_file_path . $this->rename_file . $upload->file_extension, $this->out_file_full_path); } if ($this->if_thumb_middle) { list($width, $height) = $this->getScale("middle"); $img->Thumb($width, $height, '.middle.jpg'); } list($width, $height) = $this->getScale("small"); $img->Thumb($width, $height); } if ($this->if_watermark) { $markimg = new ImageWatermark($file_name = $this->out_file_path . $this->rename_file . $upload->file_extension); $markimg->fontFile = DATA_PATH . "fonts/" . $this->fontFace; if ($this->is_water_image) { $markimg->appendImageMark(PHPB2B_ROOT . STATICURL . 'images/watermark.png'); } else { $waterText = !empty($this->is_water_text) ? $this->is_water_text : pb_getenv('HTTP_HOST'); $markimg->color = !empty($this->water_text_color) ? $this->water_text_color : '#FF0000'; $markimg->angle = 0; //rotate for textwatermark. $markimg->appendTextMark($waterText); } if ($this->width > 150 || $this->height > 150) { $markimg->write($file_name); } } if ($this->if_thumb_large) { list($width, $height) = $this->getScale("large"); $img->Thumb($width, $height, null); } } //save if ($this->insert_new) { $attach_info['attachment'] = $this->file_full_url; $attach_info['created'] = $attach_info['modified'] = $_this->timestamp; $attach_info['title'] = empty($this->title) ? reset(explode(".", $upload->the_file)) : $this->title; $attach_info['description'] = $this->description; $attach_info['file_name'] = $upload->the_file; $attach_info['file_name'] = $this->is_image; $attach_info['file_size'] = $_FILES[$this->upload_form_field]['size']; $attach_info['file_type'] = $_FILES[$this->upload_form_field]['type']; $attach_info['attachmenttype_id'] = $type_id; if (!empty($GLOBALS['pb_user'])) { $attach_info['member_id'] = intval($GLOBALS['pb_user']['pb_userid']); } $this->id = $_this->Add($attach_info); } } }
function setParams($extra = array()) { $params = array(); if (isset($_POST)) { $params['form'] = $_POST; if (ini_get('magic_quotes_gpc') === '1') { $params['form'] = pb_addslashes($params['form']); } if (pb_getenv('HTTP_X_HTTP_METHOD_OVERRIDE')) { $params['form']['_method'] = pb_getenv('HTTP_X_HTTP_METHOD_OVERRIDE'); } if (isset($params['form']['_method'])) { if (isset($_SERVER) && !empty($_SERVER)) { $_SERVER['REQUEST_METHOD'] = $params['form']['_method']; } else { $_ENV['REQUEST_METHOD'] = $params['form']['_method']; } unset($params['form']['_method']); } } $params = array_merge($extra, $params); if (isset($_GET)) { if (ini_get('magic_quotes_gpc') === '1') { $url = stripslashes_deep($_GET); } else { $url = $_GET; } if (isset($params['url'])) { $params['url'] = array_merge($params['url'], $url); } else { $params['url'] = $url; } } if (isset($params['action']) && strlen($params['action']) === 0) { $params['action'] = 'list'; } if (isset($params['form']['data'])) { $params['data'] = $params['form']['data']; unset($params['form']['data']); } $this->params = $params; }
* Copyright (C) 2007-2010, Ualink. All Rights Reserved. * * Licensed under The Languages Packages Licenses. * Support : phpb2b@hotmail.com * * @version $Revision: 121 $ */ define('CURSCRIPT', 'space'); require "libraries/common.inc.php"; $do = null; $space_actions = array("intro", "home", "product", "offer", "hr", "news", "album", "index", "contact", "feedback"); $userid = 0; if (isset($_GET['userid'])) { $userid = $_GET['userid']; } if ($subdomain_support) { $hosts = explode($subdomain_support, pb_getenv('HTTP_HOST')); if ($hosts[0] != "www") { $userid = trim($hosts[0]); } } if (isset($_GET['do'])) { $do = trim($_GET['do']); if ($do == "" || $do == "index" || !in_array($do, $space_actions)) { $do = "home"; } } else { $do = "home"; } require "space/common.inc.php"; require "space/" . $do . ".inc.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. * http://e-mats.org/2009/02/a-plugin-for-paginating-in-smarty/ * * @version $Revision: 2075 $ */ function smarty_function_the_page($params, &$smarty) { $separator = ' ··· '; $page_separator = ' '; $offset = 0; $total_count = $last_record = 0; $hits = 20; $url = $prev = $next = $middle = ''; $current_page = 1; $pages = 1; $title_prefix = 'Page '; $class_active = 'paginator_active'; $class_inactive = 'paginator_inactive'; $url_argument_separator = '?'; $hits_parameter_name = 'limit'; $offset_parameter_name = 'start'; $page_parameter_name = 'page'; $next_page_title = 'Next page'; $previous_page_title = 'Previous page'; if (isset($params['offset'])) { $offset = (int) $params['offset']; } if (isset($_GET[$offset_parameter_name])) { $offset = (int) $_GET[$offset_parameter_name]; } if (isset($params['limit'])) { $params['hits'] = (int) $params['limit']; } if (isset($params['hits'])) { $hits = (int) $params['hits']; } $link = pb_getenv("REQUEST_URI"); $len = strlen($link); $substr = substr($link, $len - 1); if ('&' == $substr) { $link = substr($link, 0, $len - 1); } $pos = strpos($link, '?'); if ($pos) { $link = substr($link, 0, $pos); } if (!empty($_GET)) { $link .= '?'; foreach ($_GET as $k => $v) { if (!in_array(strtolower($k), array($offset_parameter_name, $hits_parameter_name, $page_parameter_name))) { $link .= $k . '=' . $v . '&'; } } $len = strlen($link); $substr = substr($link, $len - 1); if ('&' == $substr) { $link = substr($link, 0, $len - 1); } $url = $link; } if (isset($params['url'])) { $url = $params['url']; } if (!empty($params['rowcount'])) { $params['total_hits'] = intval($params['rowcount']); } if (!empty($params['total_hits'])) { $pages = ceil($params['total_hits'] / $hits); $current_page = floor($offset / $hits) + 1; } if (!empty($params['pages'])) { $pages = max(1, (int) $params['pages']); } if (!empty($params['current'])) { $current_page = max(1, (int) $params['current']); } if (!empty($params['title'])) { $title_prefix = htmlspecialchars($params['title'], ENT_QUOTES); } if (!empty($params['hits_parameter_name'])) { $hits_parameter_name = $params['hits_parameter_name']; } if (!empty($params['offset_parameter_name'])) { $offset_parameter_name = $params['offset_parameter_name']; } if (isset($params['title_prefix'])) { $title_prefix = $params['title_prefix']; } if (isset($params['next_page_title'])) { $next_page_title = $params['next_page_title']; } if (isset($params['previous_page_title'])) { $previous_page_title = $params['previous_page_title']; } if (isset($params['class_inactive'])) { $class_inactive = $params['class_inactive']; } if (isset($params['class_active'])) { $class_active = $params['class_active']; } if (strpos($url, '?') !== false) { if (substr($url, -1, 1) == '?') { $url_argument_separator = ''; } else { $url_argument_separator = '&'; } } $str = $str_middle = ''; $printed_start_middle_separator = false; $printed_middle_end_separator = false; if ($pages > 0) { for ($i = 0; $i < $pages; $i++) { $middle = false; // if we're somewhere in the middle.. if ($i > 2 && $current_page > 2) { // if we've not printed the start, do it now.. if (!$printed_start_middle_separator && $current_page > 5) { $printed_start_middle_separator = true; $str .= $page_separator . $separator; } // check if we're printing an ending here... if (!$printed_middle_end_separator && $current_page > $pages - 5) { $printed_middle_end_separator = true; //$str .= $page_separator . $separator; } // jump to the middle position if we've not been there already.. $i = max($i, $current_page - 2); if ($i < $current_page + 1) { // just so we can handle it below if we're in the middle of our middle-thingie.. $middle = true; } } if ($i > 2 && !$middle) { // if we've come to the end without printing the separator... if (!$printed_middle_end_separator) { $printed_middle_end_separator = true; $str .= $page_separator . $separator; } // jump to the last three if we've not already done so.. $i = max($i, $pages - 1); } if ($i > 0) { $str .= $page_separator; } // the offset for this page.. $this_start = $hits * $i; // initialize the links.. $link_preface = ''; $link_postface = ''; // check if we're linking this page.. if ($i + 1 != $current_page) { $link_preface = "<a href='" . $url . $url_argument_separator . $offset_parameter_name . "=" . $this_start . "&" . $hits_parameter_name . "=" . $hits . "&" . $page_parameter_name . "=" . ($i + 1) . "' title='" . $title_prefix . " " . ($i + 1) . "' class='" . $class_inactive . "'>"; $link_postface = "</a>"; } else { $link_preface = "<a class='" . $class_active . "'>"; $link_postface = "</a>"; $page = $i + 1; } $str .= $link_preface . ($i + 1) . $link_postface; } } $smarty->assign("middle", $str); if ($current_page > 1) { $prev = "<a href='" . $url . $url_argument_separator . $offset_parameter_name . "=" . ($current_page - 2) * $hits . "&" . $hits_parameter_name . "=" . $hits . "&" . $page_parameter_name . "=" . ($page - 1) . "' title='" . $previous_page_title . "'>«</a>" . $page_separator; $str = $prev . $str; } $smarty->assign("prev", $prev); if ($current_page < $pages) { $next = $page_separator . "<a href='" . $url . $url_argument_separator . $offset_parameter_name . "=" . $current_page * $hits . "&" . $hits_parameter_name . "=" . $hits . "&" . $page_parameter_name . "=" . ($page + 1) . "' title='" . $next_page_title . "'>»</a>"; $str .= $next; } $smarty->assign("next", $next); if (isset($params['total_hits'])) { $total_count = $params['total_hits']; } if (isset($_GET['page'])) { $smarty->assign("current", intval($_GET['page'])); } $last_record = $offset + $hits; $last_record = $last_record > $total_count ? $total_count : $last_record; $smarty->assign("pages", $pages); $smarty->assign("count", $total_count); $smarty->assign("start", $offset + 1); $smarty->assign("end", $last_record); if (isset($params['echo'])) { return $str; } else { if (!isset($params['tpl'])) { $smarty->display("element.pages" . $smarty->tpl_ext); } else { $smarty->display($params['tpl'] . $smarty->tpl_ext); } } }
header_sent($msg); exit; } } $cachelost = (include CACHE_PATH . 'cache_setting.php') ? '' : 'settings'; $phpb2b_auth_key = md5($_PB_CACHE['setting']['auth_key'] . pb_getenv('HTTP_USER_AGENT')); if ($headercharset) { @header('Content-Type: text/html; charset=' . $charset); } //STATIC_CHECK, IF DON'T NEED, YOU CAN DELETE ME. //Todo:ARCHIVER $path_parts = pathinfo($php_self); $dir_name = PHPB2B_ROOT . 'archiver' . $path_parts['dirname'] . DS; if (isset($cache_archiver)) { if (isset($htmlize) && !empty($_PB_CACHE['setting']['main_cache'])) { $default_html_filename = $dir_name . CURSCRIPT . '-' . md5(pb_getenv('REQUEST_URI')) . '.htm'; $show_ajax = true; if ($_PB_CACHE['setting']['main_cache_lifetime'] > 0) { //if not the virtual-office and pb-admin,make the static html page. if (!file_exists($default_html_filename)) { $re_create_file = true; } else { $time_sep = time() - @filemtime($default_html_filename); if ($time_sep < $_PB_CACHE['setting']['main_cache_lifetime']) { $contents = file_get_contents($default_html_filename); echo $contents; exit; } } } }