本文整理汇总了PHP中bpBase类的典型用法代码示例。如果您正苦于以下问题:PHP bpBase类的具体用法?PHP bpBase怎么用?PHP bpBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了bpBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
public function login()
{
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
if (strtolower($_SESSION['validCode']) != strtolower(trim($_POST['validCode']))) {
//记录日志
$logInfo['success'] = 0;
$logInfo['password'] = '';
$user_loginlog_db->insert($logInfo);
//echo SITE_NAME.':验证码输入错误,<a href="login.php?user='.$_POST['email'].'">返回重新登录</a>';
echo '<script>window.location.href=\'?user=' . $_POST['email'] . '&error=errorcode\';</script>';
exit;
} else {
$userObj = bpBase::loadAppCLass('userObj', 'user');
$rt = $userObj->adminLoginWithEmail($_POST['email'], $_POST['password']);
if ($rt > 0) {
//记录日志
$logInfo['success'] = 1;
$logInfo['password'] = '';
$user_loginlog_db->insert($logInfo);
//
if (!isah()) {
$thisUser = $userObj->getUserByUID($rt);
setcookie('jsusername', escape($thisUser->username), SYS_TIME + 2592000, '/', DOMAIN_ROOT);
$r = setcookie('autousername', $thisUser->username, SYS_TIME + 2592000, '/', DOMAIN_ROOT);
} else {
if (isset($_COOKIE['jsusername'])) {
setcookie('jsusername', '', 0);
setcookie('jsusername', '', 0, '/', DOMAIN_ROOT);
setcookie('jsusername', '', 0, '/', $_SERVER['HTTP_HOST']);
}
}
delCache('rigthsOf' . $rt);
delCache('citysOf' . $rt);
$_SESSION['autoAdminUid'] = $rt;
//session_regenerate_id();
$_SESSION['cmsuid'] = $rt;
//session_regenerate_id();
//echo '<span style="font-size:12px;">登录成功,正在转向...如果您的浏览器不能自动跳转,<a href="index.php" style="font-size:12px;">请点击</a>';
echo '<script>window.location.href=\'index.php\';</script></span>';
exit;
} else {
//记录日志
$logInfo['success'] = 0;
$user_loginlog_db->insert($logInfo);
//
$_SESSION['autoAdminUid'] = null;
unset($_SESSION['autoAdminUid']);
//echo SITE_NAME.':登录失败,<a href="login.php?user='.$_POST['email'].'">返回重新登录</a>';
echo '<script>window.location.href=\'?user=' . $_POST['email'] . '&error=notmatch\';</script>';
exit;
}
}
} else {
$m = empty($m) ? ROUTE_MODEL : $m;
if (empty($m)) {
return false;
}
include ABS_PATH . MANAGE_DIR . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $m . DIRECTORY_SEPARATOR . 'templates' . DIRECTORY_SEPARATOR . 'login.tpl.php';
}
}
示例2: load
/**
* 加载缓存驱动
* @param $cache_type 缓存类型
* @return object
*/
public function load($cache_type)
{
$object = null;
if (isset($cache_type)) {
switch ($cache_type) {
default:
case 'zendfile':
$object = bpBase::loadSysClass('cache_zendfile');
break;
case 'file':
$object = bpBase::loadSysClass('cache_file');
break;
case 'memcache':
define('MEMCACHE_HOST', $this->cache_config['hostname']);
define('MEMCACHE_PORT', $this->cache_config['port']);
define('MEMCACHE_TIMEOUT', $this->cache_config['timeout']);
define('MEMCACHE_DEBUG', $this->cache_config['debug']);
$object = bpBase::loadSysClass('cache_memcache');
break;
case 'apc':
$object = bpBase::loadSysClass('cache_apc');
break;
}
} else {
$object = bpBase::loadSysClass('cache_zendfile');
}
return $object;
}
示例3: createSitemap
function createSitemap($type, $showMessage = 1)
{
$sitemapConfig = loadConfig('sitemap');
$articleCount = $sitemapConfig['articleCount'] ? $sitemapConfig['articleCount'] : 500;
$ucarCount = $sitemapConfig['ucarCount'] ? $sitemapConfig['ucarCount'] : 500;
$datas = array();
switch ($type) {
default:
case 'news':
$article_db = bpBase::loadModel('article_model');
$articles = $article_db->select(array('ex' => 0), 'link,time,title,keywords', '0,' . $articleCount, 'time DESC');
if ($articles) {
foreach ($articles as $a) {
if (!strExists($a['link'], 'http://')) {
$a['link'] = MAIN_URL_ROOT . $a['link'];
}
if ($a['keywords'] == ',') {
$a['keywords'] = '';
}
array_push($datas, array('url' => $a['link'], 'time' => $a['time'], 'keywords' => $a['keywords']));
}
}
break;
}
$this->_createSitemap($type, $datas, $showMessage);
}
示例4: getValue
function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
{
//<stl:***></stl:***>
$channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
//
$siteID = $avs['site'] == null ? $siteID : $avs['site'];
//
$upLevel = $avs['upLevel'] == null ? 0 : intval($avs['upLevel']);
if ($avs['channelIndex']) {
$thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
$channels = $channelObj->getChannelsByParentID($thisChannel->id);
} else {
switch ($upLevel) {
case 0:
break;
case 1:
$currentChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
$channels = $channelObj->getChannelsByParentID($currentChannel->parentid);
break;
}
}
//
$returnStr = '';
if ($channels) {
$middleStr = parent::getMiddleBody($str, 'channels', $this->gTag);
$i = 0;
foreach ($channels as $c) {
$start = intval($avs['startNum']) - 1;
$count = intval($avs['totalNum']);
if (!$count) {
$count = count($channels);
}
if ($i == $start || $i > $start) {
if ($i < $count) {
$rs = str_replace(array('[stl.channel.id]', '[stl.channel.name]', '[stl.channel.link]', '[stl.channel.num]', '<stl:contents'), array($c->id, $c->name, $c->link, $i + intval($avs['numStart']), '<stl:contents channelIndex="' . $c->cindex . '"'), $middleStr);
//current class
if ($channelID == $c->id) {
$rs = str_replace('[stl.channel.currentItemClass]', $avs['currentItemClass'], $rs);
} else {
$rs = str_replace('[stl.channel.currentItemClass]', '', $rs);
}
$returnStr .= $rs;
}
}
$i++;
}
}
//处理stl:contents
if (strExists($returnStr, '<stl:contents')) {
$template = bpBase::loadAppClass('template', 'template');
$now = SYS_TIME;
$returnStr = $template->parseStr($returnStr, $now);
@unlink(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $now . '.parsed.tpl.php');
@unlink(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $now . '.tags.tpl.php');
}
//
return $returnStr;
}
示例5: __construct
function __construct()
{
//$this->update_log_db = bpBase::loadModel('update_log_model');
parent::__construct();
$checkAccess = $this->exitWithoutAccess('system', 'manage');
$this->dbConfig = array('default' => array('hostname' => DB_HOSTNAME, 'database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'tablepre' => TABLE_PREFIX, 'charset' => DB_CHARSET, 'type' => 'mysql', 'debug' => DEBUG, 'pconnect' => 0, 'autoconnect' => 0));
bpBase::loadSysClass('db_factory');
$this->db = db_factory::get_instance($this->dbConfig)->get_database('default');
}
示例6: getValue
function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
{
//<stl:***></stl:***>
$siteID = $avs['siteID'] == null ? $siteID : $avs['siteID'];
$site = bpBase::loadAppClass('siteObj', 'site', 1);
$thisSite = $site->getSiteByID($siteID);
//
$type = strtolower($avs['type']);
return $thisSite->{$type};
}
示例7: getValue
function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0, $pagination = array('pageSize' => 20, 'totalCount' => 0, 'currentPage' => 1, 'urlPrefix' => '', 'urlSuffix' => ''))
{
//<stl:***></stl:***>
$articleObj = bpBase::loadAppClass('articleObj', 'article');
$thisContent = $articleObj->getContentByID($contentID);
if ($thisContent->pagecount > 1) {
$currentPage = intval($pagination['currentPage']);
if (!$thisContent->title) {
$sep = '';
for ($i = 0; $i < $thisContent->pagecount; $i++) {
$thisContent->titles .= $sep . '';
$sep = '|';
}
}
$titles = explode('|', $thisContent->titles);
$str = '';
$ah_str_l = '';
$ah_str_r = '';
if ($titles) {
$i = 0;
foreach ($titles as $t) {
$nextI = $i + 1;
if ($i == 0) {
$link = $pagination['urlPrefix'] . $pagination['urlSuffix'];
} else {
$link = $pagination['urlPrefix'] . '-' . $nextI . $pagination['urlSuffix'];
}
if ($pagination['currentPage'] != $nextI) {
$style = '';
} else {
$style = ' style="color:red"';
}
if (!isah()) {
$str .= '<li><a title="' . $t . '" href="' . $link . '"' . $style . '>第' . $nextI . '页:' . $t . '</a></li>';
} else {
$s = '<a title="' . $t . '" href="' . $link . '"' . $style . '>第' . $nextI . '页:' . $t . '</a><br>';
if ($i % 2 == 0) {
$ah_str_l .= $s;
} else {
$ah_str_r .= $s;
}
}
$i++;
}
}
}
if ($titles) {
if (!isah()) {
return '<div class="contentTitleNav"><h2>“' . $thisContent->title . '”导航</h2><div id="titles"><ul>' . $str . '<div class="clear"></div></ul><div class="clear" style="width:100%;height:1px"></div></div></div>';
} else {
return '<dl class="article_nav"><dt>文章导航条</dt><dd>' . $ah_str_l . '</dd><dd class="last">' . $ah_str_r . '</dd></dl>';
}
}
}
示例8: currentCityInfo
function currentCityInfo()
{
$geoObj = bpBase::loadAppClass('geoObj', 'geo', 1);
$ipGeo = $geoObj->getGeoByIP(ip());
if (!$ipGeo) {
$geo_db = bpBase::loadModel('geo_model');
$defaultChildLocation = $geo_db->getDefaultChildLocation();
$ipGeo = $defaultChildLocation;
}
echo '{"city":[{"name":"' . $ipGeo->name . '","id":"' . $ipGeo->id . '","geoindex":"' . $ipGeo->geoindex . '"}]}';
}
示例9: __construct
public function __construct()
{
parent::__construct();
/***********uid*******************/
$uid = isset($_GET['uid']) && intval($_GET['uid']) > 0 ? intval($_GET['uid']) : 0;
//设置uid为request的数值
$uid = $uid > 0 ? $uid : $this->uid;
$this->assign('uid', $uid);
if (!$uid) {
header('Location:/');
exit;
}
$thisUser = $this->user;
$this->assign('user', $thisUser);
/**********************************************************/
if ($this->uid == $uid) {
$sub = '我';
$my = 1;
} else {
$sub = '他(她)';
$my = 0;
}
$this->uid = $uid;
$this->assign('sub', $sub);
$this->assign('my', $my);
/*********************判断是不是各种经销商***************************/
$storeUserIndependent = 0;
//经销商用户是否单独建表存储
if (intval(loadConfig('store', 'storeUserIndependent'))) {
$storeUserIndependent = 1;
//经销商用户是否单独建表存储
}
if ($uid == $this->uid) {
$this->assign('canManage', 1);
}
if ($uid == $this->uid && !$storeUserIndependent) {
$store_db = bpBase::loadModel('store_model');
$is4sStore = 0;
if ($store_db->select(array('storetype' => 1, 'uid' => $this->uid))) {
$is4sStore = 1;
}
$this->assign('is4sStore', $is4sStore);
//carRental
$isRentalStore = 0;
if ($store_db->select(array('storetype' => 3, 'uid' => $this->uid))) {
$isRentalStore = 1;
}
$this->assign('isRentalStore', $isRentalStore);
//ucar
$ucar_store_db = bpBase::loadModel('usedcar_store_model');
$thisUcarStore = $ucar_store_db->select(array('uid' => $this->uid));
$this->assign('isUcarStore', $thisUcarStore ? 1 : 0);
}
}
示例10: getValue
function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
{
//<stl:***></stl:***>
//properties
$id = $avs['ID'];
$sindex = $avs['index'];
//
$geoid = intval($avs['cityid']);
if (!$site) {
$site = 1;
}
//
$adset_db = bpBase::loadModel('adset_model');
if ($id) {
$thisAdSet = $adset_db->singleADSet($id);
} elseif ($sindex) {
$thisAdSet = $adset_db->singleADSetByIndex($sindex, $site);
$id = $thisAdSet->set_id;
}
//
$str = '';
$ad_db = bpBase::loadModel('ad_model');
$ads = $ad_db->adsOfSet($id, 1, $site, 1, $geoid);
switch ($avs['type']) {
case 'couplet':
$bianju = 26;
//距离浏览器边的宽度
$mtop = 50;
//上边距
//左侧广告
switch ($ads[0]->type) {
case 'flash':
$str .= '<div id="couplet_l" style="position:fixed;top:' . $mtop . 'px;_position:absolute;left:' . $bianju . 'px"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' . $ads[0]->width . '" height="' . $ads[0]->height . '"><param name="movie" value="' . $ads[0]->path . '"><param name="quality" value="high"><embed src="' . $ads[0]->path . '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' . $ads[0]->width . '" height="' . $ads[0]->height . '"></embed></object><div style="cursor:pointer;margin:5px 0 0 0;text-align:right;" onclick="$(\'couplet_l\').dispose()">关闭</div></div>';
break;
case 'image':
$str .= '<div id="couplet_l" style="position:fixed;top:' . $mtop . 'px;_position:absolute;left:' . $bianju . 'px"><a href="' . $ads[0]->link . '" target="_blank"><img src="' . $ads[0]->path . '" width="' . $ads[0]->width . '" height="' . $ads[0]->height . '" border="0" /></a><div style="cursor:pointer;margin:5px 0 0 0;text-align:right;" onclick="$(\'couplet_l\').dispose()">关闭</div></div>';
break;
}
//右侧广告
switch ($ads[1]->type) {
case 'flash':
$str .= '<div id="couplet_r" style="position:fixed;top:' . $mtop . 'px;_position:absolute;right:' . $bianju . 'px"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="' . $ads[1]->width . '" height="' . $ads[1]->height . '"><param name="movie" value="' . $ads[1]->path . '"><param name="quality" value="high"><embed src="' . $ads[1]->path . '" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' . $ads[1]->width . '" height="' . $ads[1]->height . '"></embed></object><div style="cursor:pointer;margin:5px 0 0 0;text-align:right;" onclick="$(\'couplet_r\').dispose()">关闭</div></div>';
break;
case 'image':
$str .= '<div id="couplet_r" style="position:fixed;top:' . $mtop . 'px;_position:absolute;right:' . $bianju . 'px"><a href="' . $ads[1]->link . '" target="_blank"><img src="' . $ads[1]->path . '" width="' . $ads[1]->width . '" height="' . $ads[1]->height . '" border="0" /></a><div style="cursor:pointer;margin:5px 0 0 0;text-align:right;" onclick="$(\'couplet_r\').dispose()">关闭</div></div>';
break;
}
$str .= '';
break;
}
return $str;
}
示例11: parse
function parse($siteid, $str = '')
{
//<stl:include></stl:include>
$siteid = intval($siteid);
$siteClass = bpBase::loadAppClass('siteObj', 'site', 1);
$thisSite = $siteClass->getSiteByID($siteid);
$filePath = ABS_PATH . str_replace('@', '', parent::getAttributeValue($str, $this->attributes[0]));
$filePath = str_replace('{siteIndex}', $thisSite->siteindex, $filePath);
if (file_exists($filePath)) {
return file_get_contents($filePath);
} else {
return '';
}
}
示例12: __construct
public function __construct()
{
bpBase::loadAppFunc('global', 'manage');
//access
//$_SESSION['token']='tokenvalue';
if (!isset($_SESSION['token']) || !strlen($_SESSION['token'])) {
header('Location:/index.php?g=User&m=Index&a=index');
}
$this->token = $_SESSION['token'];
//
$site_db = M('site');
$this->site = $site_db->getSiteByToken($this->token);
$this->siteid = intval($this->site['id']);
}
示例13: __construct
/**
* 构造函数
*
*/
public function __construct($dbObj = null)
{
if (!$dbObj) {
$this->db = bpBase::loadModel('session_model');
} else {
//autoDB;
$this->db = $dbObj;
$this->oldSys = 1;
$this->table = TABLE_PREFIX . 'session';
}
$this->lifetime = loadConfig('site', 'session_ttl');
$this->lifetime = $this->lifetime == '' ? 3600 : $this->lifetime;
session_set_save_handler(array(&$this, 'open'), array(&$this, 'close'), array(&$this, 'read'), array(&$this, 'write'), array(&$this, 'destroy'), array(&$this, 'gc'));
session_start();
}
示例14: getValue
function getValue($str = '', $avs, $siteID = 0, $channelID = 0, $contentID = 0)
{
//<stl:***></stl:***>
$str = parent::removeProperties($str, $this->attributes);
$middleStr = parent::getMiddleBody($str, 'a', $this->gTag);
if (isset($avs['contentID']) && $avs['contentID']) {
$articleObj = bpBase::loadAppClass('articleObj', 'article', 1);
$thisContent = $articleObj->getContentByID($avs['contentID']);
$valueStr = str_replace('[stl.content.title]', $thisContent->title, $middleStr);
$link = $thisContent->link;
} elseif (isset($avs['channelIndex']) && $avs['channelIndex']) {
$channelObj = bpBase::loadAppClass('channelObj', 'channel', 1);
if ($avs['site']) {
//指定了站点
$siteID = intval($avs['site']);
}
$thisChannel = $channelObj->getChannelByIndex($avs['channelIndex'], $siteID);
//
$valueStr = str_replace('[stl.channel.name]', $thisChannel->name, $middleStr);
if ($avs['site'] || $siteID > 0) {
//指定了站点
$siteObj = bpBase::loadAppClass('siteObj', 'site', 1);
$thisSite = $siteObj->getSiteByID($avs['site']);
if (strExists($link, 'http://') || $thisChannel->externallink) {
$link = $thisChannel->link;
} else {
$link = $thisSite->url . $thisChannel->link;
}
} else {
if (strExists($link, 'http://') || $thisChannel->externallink) {
$link = $thisChannel->link;
} else {
$link = MAIN_URL_ROOT . $thisChannel->link;
}
}
} elseif (isset($avs['siteID']) && $avs['siteID']) {
$siteObj = bpBase::loadAppClass('siteObj', 'site', 1);
$thisSite = $siteObj->getSiteByID($avs['siteID']);
//
$valueStr = str_replace('[stl.site.name]', $thisSite->name, $middleStr);
$link = $thisSite->url;
}
$str = str_replace('<stl:a', '<a href="' . $link . '"', $str);
$str = str_replace('</stl:a', '</a', $str);
$str = str_replace($middleStr, $valueStr, $str);
return $str;
}
示例15: getValue
function getValue($str = '', $avs, $csiteID = 0, $thisChannelID = 0, $contentID = 0)
{
//<stl:***></stl:***>
$articleObj = bpBase::loadAppClass('articleObj', 'article');
$site = bpBase::loadAppClass('siteObj', 'site');
$content_db = bpBase::loadModel('article_model');
$totalNum = $avs['totalNum'] ? $avs['totalNum'] : 10;
$cat = $avs['cat'] ? $avs['cat'] : 'news';
$cats = array('video', 'news', 'guide', 'comment', 'market');
if (!in_array($cat, $cats)) {
$cat = 'news';
}
$startNum = $avs['startNum'] ? intval($avs['startNum']) : 1;
$startI = $startNum - 1;
$totalNum = $startI + $totalNum;
$orderBy = $avs['orderBy'] ? $avs['orderBy'] : 'viewcount';
$contents = $articleObj->viewRanksByCat($cat, $totalNum, $orderBy);
$returnStr = '';
if ($contents) {
$i = 0;
$middleStr = parent::getMiddleBody($str, 'articleRanks', $this->gTag);
$tags = array('[stl.content.link]', '[stl.content.title]', '[stl.content.thumb]');
$count = 0;
foreach ($contents as $c) {
if ($i > $startI - 1 && $count < $totalNum) {
$replaces = array($c->link, $c->title, $c->thumb);
$valueStr = str_replace($tags, $replaces, $middleStr);
//time
$valueStr = str_replace('[stl.content.time]', date($avs['dateFormat'], $c->time), $valueStr);
//other thumb
$valueStr = str_replace('[stl.content.thumb2]', str_replace('.jpg', '_small.jpg', $c->thumb), $valueStr);
$valueStr = str_replace('[stl.content.thumb3]', str_replace('.jpg', '_middle.jpg', $c->thumb), $valueStr);
$valueStr = str_replace('[stl.content.thumb4]', str_replace('.jpg', '_big.jpg', $c->thumb), $valueStr);
//num
$valueStr = str_replace('[stl.content.num]', $count + $startNum, $valueStr);
//
$returnStr .= $valueStr;
$count++;
}
$i++;
}
}
return $returnStr;
}