Example #1
0
 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='******'email'].'">返回重新登录</a>';
             echo '<script>window.location.href=\'?user='******'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='******'email'].'">返回重新登录</a>';
                 echo '<script>window.location.href=\'?user='******'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';
     }
 }
 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>';
         }
     }
 }
Example #3
0
 function createIndexPage($siteid = 1)
 {
     $siteid = intval($siteid);
     if (!ABS_PATH . 'templatesCache' && !is_dir(ABS_PATH . 'templatesCache')) {
         mkdir(ABS_PATH . 'templatesCache', 777);
     }
     if ($siteid < 100) {
         //站点
         $template = $this->getDefaultTemplate($siteid, 1);
         //获取首页模板的数据库信息
         if (!$template) {
             showMessage('没有默认的模板,请在模板管理里面设置', '?m=template&c=m_template&a=templates&siteid=' . $siteid, 2000);
             exit;
         }
         //如果缓存不存在则分析模板
         if (!file_exists(ABS_PATH . 'templatesCache' . DIRECTORY_SEPARATOR . $template['id'] . '.parsed.tpl.php')) {
             $templateInfo = $this->getTemplateInfoByPath($template['path']);
             //parse first layer tags
             $this->addIDtoFirstLayerTagInTemplate($siteid, $template['id'], $templateInfo['absPath']);
         }
         $this->parseFirstLayerTag($template['id'], $siteid, 0, 0);
         //生成静态首页
         if (defined('NEW_INDEX') && NEW_INDEX && !loadConfig('index', 'notToHtml')) {
             $sitePage = bpBase::loadAppClass('sitePage', 'site');
             $sitePage->index(0);
         } else {
             if ((loadConfig('site', 'tohtml') || !loadConfig('index', 'notToHtml')) && $siteid == 1) {
                 $snoopy = bpBase::loadSysClass('Snoopy', '', 1);
                 if (!strpos(MAIN_URL_ROOT, 'localhost')) {
                     //echo 'st';
                     $snoopy->fetch('http://' . $_SERVER['HTTP_HOST'] . '/index.php');
                 } else {
                     $snoopyRt = $snoopy->fetch('http://127.0.0.1/index.php');
                 }
                 //file_put_contents(ABS_PATH.'/index.html',$snoopy->result);
             }
         }
         if (isah()) {
             $this->createSinglePage(193);
         }
         if ($siteid > 1) {
             //ah子站
             $site = bpBase::loadAppClass('siteObj', 'site');
             $thisSite = $site->getSiteByID($siteid);
             $child_siteMoudleClass = bpBase::loadAppClass('sitePage', 'site');
             $geo_db = bpBase::loadModel('geo_model');
             $thisGeo = $geo_db->get_one(array('geoindex' => $thisSite->siteindex));
             if ($thisGeo) {
                 $child_siteMoudleClass->childSiteIndex($thisGeo['id']);
             }
         }
     } else {
         //专题
         $special_db = bpBase::loadModel('special_model');
         $thisSpecial = $special_db->get_one(array('id' => $siteid));
         if (!$thisSpecial['templateid']) {
             showMessage('没有选择模板,请设置模板后再操作', '?m=special&c=m_special&a=specialSet&id=' . $siteid, 2000);
             exit;
         }
         $template_db = bpBase::loadModel('template_model');
         $template = $template_db->get_one(array('id' => $thisSpecial['templateid']));
         if (!$template) {
             showMessage('模板不存在,请在模板管理里面设置', '?m=template&c=m_template&a=templates&siteid=' . $siteid . '&type=5', 2000);
             exit;
         }
         //如果缓存不存在则分析模板
         //if (!file_exists(ABS_PATH.'templatesCache'.DIRECTORY_SEPARATOR.$template['id'].'.parsed.tpl.php')){
         $templateInfo = $this->getTemplateInfoByPath($template['path']);
         //parse first layer tags
         $this->addIDtoFirstLayerTagInTemplate($siteid, $template['id'], $templateInfo['absPath']);
         //}
         $this->parseFirstLayerTag($template['id'], $siteid, 0, 0);
         //更新专题url
         $specialConfig = loadConfig('special');
         $thisSpecial['urlformat'] = $thisSpecial['urlformat'] ? $thisSpecial['urlformat'] : $specialConfig['urlFormate'];
         $url = $this->specialPathReplace($thisSpecial['urlformat'], $thisSpecial['catid'], $thisSpecial);
         $special_db->update(array('url' => $url), array('id' => $siteid));
         delCache('c_special_' . $siteid);
     }
 }