/** * AJAX: the api to recive the file posted through ajax. * * @param string $uid * @access public * @return array */ public function ajaxUpload($uid) { if (RUN_MODE == 'front' and !commonModel::isAvailable('forum')) { exit; } if (!$this->loadModel('file')->canUpload()) { $this->send(array('error' => 1, 'message' => $this->lang->file->uploadForbidden)); } $file = $this->file->getUpload('imgFile'); $file = $file[0]; if ($file) { if (!$this->file->checkSavePath()) { $this->send(array('error' => 1, 'message' => $this->lang->file->errorUnwritable)); } if (!in_array(strtolower($file['extension']), $this->config->file->imageExtensions)) { $this->send(array('error' => 1, 'message' => $this->lang->fail)); } move_uploaded_file($file['tmpname'], $this->file->savePath . $file['pathname']); if (in_array(strtolower($file['extension']), $this->config->file->imageExtensions) !== false) { $this->file->compressImage($this->file->savePath . $file['pathname']); $imageSize = $this->file->getImageSize($this->file->savePath . $file['pathname']); $file['width'] = $imageSize['width']; $file['height'] = $imageSize['height']; } $url = $this->file->webPath . $file['pathname']; $file['addedBy'] = $this->app->user->account; $file['addedDate'] = helper::now(); $file['editor'] = 1; unset($file['tmpname']); $this->dao->insert(TABLE_FILE)->data($file)->exec(); $_SESSION['album'][$uid][] = $this->dao->lastInsertID(); die(json_encode(array('error' => 0, 'url' => $url))); } }
/** * The index page of admin panel, print the sites. * * @access public * @return void */ public function index() { $this->app->loadConfig('product'); $messages = new stdclass(); if (commonModel::isAvailable('forum')) { $this->view->threads = $this->loadModel('thread')->getThreads(); $this->view->threadReply = $this->loadModel('reply')->getReplies(); } if (commonModel::isAvailable('message')) { $messages->comment = $this->loadModel('message')->getMessages('comment'); $messages->message = $this->loadModel('message')->getMessages('message'); $messages->reply = $this->loadModel('message')->getMessages('reply'); } if (commonModel::isAvailable('order')) { $this->view->orders = $this->loadModel('order')->getOrders(); } if (commonModel::isAvailable('contribution')) { $this->view->contributions = $this->loadModel('article')->getContributions(); } $this->view->articleCategories = $this->loadModel('tree')->getOptionMenu('article', 0, $removeRoot = true); $this->view->todayReport = $this->loadModel('stat')->getTodayReport(); $this->view->yestodayReport = $this->loadModel('stat')->getYestodayReport(); $this->view->ignoreUpgrade = isset($this->config->global->ignoreUpgrade) and $this->config->global->ignoreUpgrade; $this->view->checkLocation = $this->loadModel('user')->checkAllowedLocation(); $this->view->currencySymbol = $this->config->product->currencySymbol; $this->view->messages = $messages; $this->display(); }
/** * Get order list. * * @param string $mode * @param mix $value * @param string $orderBy * @param object $pager * @access public * @return array */ public function getList($mode, $value, $orderBy = 'id_desc', $pager = null) { $days = $this->config->shop->confirmLimit; if ($days) { $deliveryDate = date('Y-m-d H:i:s', time() - 24 * 60 * 60 * $days); $this->dao->update(TABLE_ORDER)->set('deliveryStatus')->eq('confirmed')->where('deliveryStatus')->eq('send')->andWhere('deliveriedDate')->le($deliveryDate)->exec(); } $orders = $this->dao->select('*')->from(TABLE_ORDER)->beginIf($mode == 'account')->where('account')->eq($value)->fi()->beginIf($mode == 'status')->where('status')->eq($value)->fi()->beginIf(!commonModel::isAvailable('score'))->andWhere('type')->ne('score')->fi()->beginIf(!commonModel::isAvailable('shop'))->andWhere('type')->ne('shop')->fi()->orderBy($orderBy)->page($pager)->fetchAll('id'); $products = $this->dao->select('*')->from(TABLE_ORDER_PRODUCT)->where('orderID')->in(array_keys($orders))->fetchGroup('orderID'); foreach ($orders as $order) { $order->products = isset($products[$order->id]) ? $products[$order->id] : array(); } return $orders; }
/** * Nav admin function * * @param string $top * @access public * @return void */ public function admin($type = '') { if ($type == '' and $this->config->site->type == 'portal') { $type = $this->device . '_top'; } if ($type == '' and $this->config->site->type == 'blog') { $type = $this->device . '_blog'; } foreach ($this->lang->nav->system as $module => $name) { if (!commonModel::isAvailable($module)) { unset($this->lang->nav->system->{$module}); } } if ($_POST) { $navs = $this->post->nav; foreach ($navs as $key => $nav) { $navs[$key] = $this->nav->organizeNav($nav); } if (isset($navs[2])) { $navs[2] = $this->nav->group($navs[2]); if (isset($navs[3])) { $navs[3] = $this->nav->group($navs[3]); } foreach ($navs[2] as &$navList) { foreach ($navList as &$nav) { $nav['children'] = isset($navs[3][$nav['key']]) ? $navs[3][$nav['key']] : array(); } } } foreach ($navs[1] as &$nav) { $nav['children'] = isset($navs[2][$nav['key']]) ? $navs[2][$nav['key']] : array(); } $settings = array($type => helper::jsonEncode($navs[1])); $result = $this->loadModel('setting')->setItems('system.common.nav', $settings); if ($result) { $this->send(array('result' => 'success', 'message' => $this->lang->setSuccess)); } $this->send(array('result' => 'fail', 'message' => $this->lang->failed)); } $this->view->title = $this->lang->nav->setNav; $this->view->navs = $this->nav->getNavs($type); $this->view->type = $type; $this->view->types = $this->lang->nav->types; $this->view->articleTree = $this->loadModel('tree')->getOptionMenu('article'); $this->display(); }
/** * Set currency and stock. * * @access public * @return void */ public function setting() { unset($this->lang->product->menu); $this->lang->menuGroups->product = 'orderSetting'; if (commonModel::isAvailable('shop')) { $this->app->loadLang('order'); } if ($_POST) { $result = $this->product->saveSetting(); if (!$result) { $this->send(array('result' => 'fail', 'message' => dao::getError())); } if (commonModel::isAvailable('shop')) { $this->send($this->loadModel('order')->saveSetting()); } $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess)); } $this->view->title = $this->lang->product->setting; $this->display(); }
?> <div class='col-md-2'> <ul class='nav nav-primary nav-stacked user-control-nav'> <li class='nav-heading'><?php echo $lang->user->control->common; ?> </li> <?php ksort($lang->user->control->menus); foreach ($lang->user->control->menus as $menu) { $class = ''; list($label, $module, $method) = explode('|', $menu); if (in_array($method, array('thread', 'reply')) && !commonModel::isAvailable('forum')) { continue; } if ($method == 'message' && !commonModel::isAvailable('message')) { continue; } if ($module == $this->app->getModuleName() && $method == $this->app->getMethodName()) { $class .= 'active'; } echo '<li class="' . $class . '">' . html::a($this->createLink($module, $method), $label) . '</li>'; } ?> <li> <a href="<?php echo $siteRoot . 'user-logout.html'; ?> "> <i class="icon-mail-reply"></i> 退出 <i class="icon-chevron-right"></i> </a>
?> </div> <?php } else { ?> <div id='siteName'><h2><?php echo $config->site->name; ?> </h2></div> <?php } ?> </div> </div> <?php if (commonModel::isAvailable('search')) { ?> <div id='searchbar'> <form action='<?php echo helper::createLink('search'); ?> ' method='get' role='search'> <div class='input-group'> <?php $keywords = $this->app->getModuleName() == 'search' ? $this->session->serachIngWord : ''; ?> <?php echo html::input('words', $keywords, "class='form-control' placeholder=''"); ?> <?php if ($this->config->requestType == 'GET') {
if ($this->config->requestType == 'GET') { echo html::hidden($this->config->moduleVar, 'search') . html::hidden($this->config->methodVar, 'index'); } ?> <div class='input-group-btn'> <button class='btn default' type='submit'><i class='icon icon-search'></i></button> </div> </div> </form> </div> </div> <?php } ?> <?php if (commonModel::isAvailable('shop')) { ?> <a class='btn with-badge' href='<?php echo $this->createLink('cart', 'browse'); ?> '><i class='icon icon-shopping-cart'></i><strong class='cart-count badge small text-danger circle hide'>12</strong></a> <?php } ?> <div class='dropdown'> <button type='button' class='btn' data-toggle='dropdown'><i class='icon-bars circle'></i></button> <ul class='dropdown-menu dropdown-menu-right'> <?php echo commonModel::printTopBar(true); ?> <?php
if (!empty($threadReply) and $threadReply != '0') { ?> <tr> <?php $threadReplyTitle = sprintf($lang->admin->threadReply, $threadReply); ?> <td><?php commonModel::printLink('reply', 'admin', "order=id_desc&tab=feedback", $threadReplyTitle, "target='_blank'"); ?> </td> </tr> <?php } ?> <?php if (commonModel::isAvailable('contribution') and $newContributions != '0') { ?> <?php $contributionTitle = sprintf($lang->admin->contribution, $newContributions); ?> <tr> <td><?php commonModel::printLink('article', 'admin', 'type=contribution&tab=feedback', $contributionTitle, "target='_blank'"); ?> </td> </tr> <?php } ?> <?php if (!empty($todayReportTitle)) {
/** * Print the top bar. * * @param boolean $asListItem * @access public * @return void */ public static function printTopBar($asListItem = false) { if (!commonModel::isAvailable('user')) { return ''; } global $app, $config; if ($app->session->user->account != 'guest') { if ($asListItem) { echo "<li class='menu-user-center text-center'>" . html::a(helper::createLink('user', 'control'), "<div class='user-avatar'><i class='icon icon-user avatar icon-s2 bg-primary circle'></i><strong class='user-name'>{$app->session->user->realname}</strong></div>") . '</li>'; echo "<li>" . html::a(helper::createLink('user', 'control'), $app->lang->dashboard) . '</li>'; echo '<li>' . html::a(helper::createLink('user', 'logout'), $app->lang->logout) . '</li>'; } else { printf('<span class="login-msg"></span>'); echo html::a(helper::createLink('user', 'control'), "<i class='icon-user icon-small'> </i>" . $app->session->user->realname); echo "<span id='msgBox' class='hiding'></span>"; $referer = helper::safe64encode(trim($_SERVER['REQUEST_URI'], '/')); $visualEditLink = $config->webRoot . getAdminEntry() . "?m=visual&f=index&referer={$referer}"; if ($app->session->user->admin == 'super') { echo html::a($visualEditLink, $app->lang->editMode, "class='text-important' id='visualEditBtn'"); } echo html::a(helper::createLink('user', 'logout'), $app->lang->logout); } } else { if ($asListItem) { echo '<li>' . html::a(helper::createLink('user', 'login'), $app->lang->login) . '</li>'; echo '<li>' . html::a(helper::createLink('user', 'register'), $app->lang->register) . '</li>'; } else { echo html::a(helper::createLink('user', 'login'), $app->lang->login); echo html::a(helper::createLink('user', 'register'), $app->lang->register); } } }
/** * Delete a reply. * * @param string $replyID * @access public * @return void */ public function delete($replyID, $null = null) { $author = $this->dao->select('author')->from(TABLE_REPLY)->where('id')->eq($replyID)->fetch('author'); $thread = $this->dao->select('t2.id, t2.board')->from(TABLE_REPLY)->alias('t1')->leftJoin(TABLE_THREAD)->alias('t2')->on('t1.thread = t2.id')->where('t1.id')->eq($replyID)->fetch(); $this->dao->delete()->from(TABLE_REPLY)->where('id')->eq($replyID)->exec(); if (dao::isError()) { return false; } /* Update thread and board stats. */ $this->loadModel('thread')->updateStats($thread->id); $this->loadModel('forum')->updateBoardStats($thread->board); if (commonModel::isAvailable('score')) { $this->loadModel('score')->punish($author, 'delReply', $this->config->score->counts->delReply, 'reply', $replyID); } return !dao::isError(); }
/** * print speaker. * * @param object $speaker * @access public * @return string */ public function printSpeaker($speaker) { $this->app->loadLang('forum'); if (isset($speaker->join)) { $speaker->join = substr($speaker->join, 0, 10); } if (isset($speaker->last)) { $speaker->last = substr($speaker->last, 0, 10); } $moderatorClass = ($speaker->admin == 'super' or $speaker->isModerator) ? "text-danger" : ''; $moderatorTitle = ($speaker->admin == 'super' or $speaker->isModerator) ? "title='{$this->lang->forum->owners}'" : ''; if (commonModel::isAvailable('score')) { echo <<<EOT <strong class='thread-author {$moderatorClass}' {$moderatorTitle}><i class='icon-user'></i> {$speaker->realname}</strong> <ul class='list-unstyled'> <li><small>{$this->lang->user->visits}: </small><span>{$speaker->visits}</span></li> <li><small>{$this->lang->user->join}: </small><span>{$speaker->join}</span></li> <li><small>{$this->lang->user->last}: </small><span>{$speaker->last}</span></li> <li><small>{$this->lang->user->myScore}: </small><span>{$speaker->score}</span></li> </ul> EOT; } else { echo <<<EOT <strong class='thread-author {$moderatorClass}' {$moderatorTitle}><i class='icon-user'></i> {$speaker->realname}</strong> <ul class='list-unstyled'> <li><small>{$this->lang->user->visits}: </small><span>{$speaker->visits}</span></li> <li><small>{$this->lang->user->join}: </small><span>{$speaker->join}</span></li> <li><small>{$this->lang->user->last}: </small><span>{$speaker->last}</span></li> </ul> EOT; } }
$lang->user->control->menus[20] = '<i class="icon-comments-alt"></i> 我的消息 <i class="icon-chevron-right"></i>|user|message'; if (RUN_MODE != 'install' and commonModel::isAvailable('contribution')) { $lang->user->control->menus[21] = '<i class="icon-envelope-alt"></i> 我的投稿 <i class="icon-chevron-right"></i>|article|contribution'; } if (RUN_MODE != 'install' and commonModel::isAvailable('score')) { $lang->user->control->menus[30] = '<i class="icon-sun"></i> 积分详情 <i class="icon-chevron-right"></i>|user|score'; if (strpos($this->config->shop->payment, 'alipay') !== false) { $lang->user->control->menus[40] = '<i class="icon-bolt"></i> 积分充值 <i class="icon-chevron-right"></i>|score|buyscore'; } } $lang->user->control->menus[50] = '<i class="icon-comment"></i> 我的主题 <i class="icon-chevron-right"></i>|user|thread'; $lang->user->control->menus[60] = '<i class="icon-mail-reply"></i> 我的回帖 <i class="icon-chevron-right"></i>|user|reply'; if (RUN_MODE != 'install' and commonModel::isAvailable('order')) { $lang->user->control->menus[25] = '<i class="icon-shopping-cart"></i> 我的订单 <i class="icon-chevron-right"></i>|order|browse'; } if (RUN_MODE != 'install' and commonModel::isAvailable('shop')) { $lang->user->control->menus[26] = '<i class="icon-map-marker"> </i> 地址管理 <i class="icon-chevron-right"></i>|address|browse'; } $lang->user->log = new stdclass(); $lang->user->log->common = '日志'; $lang->user->log->list = '管理员登录日志'; $lang->user->log->id = 'ID'; $lang->user->log->account = '用户'; $lang->user->log->browser = '浏览器'; $lang->user->log->ip = 'IP'; $lang->user->log->location = '登录地址'; $lang->user->log->date = '登录时间'; $lang->user->log->desc = '描述'; $lang->user->ipDenied = '登录IP受限,请按提示操作。'; $lang->user->locationDenied = '登录地区受限,请按提示操作。'; $lang->user->loginLocationChanged = '登录地址发生变化,请按提示操作。';
/** * Print the top bar. * * @access public * @return void */ public static function printTopBar() { if (!commonModel::isAvailable('user')) { return ''; } global $app; if ($app->session->user->account != 'guest') { printf('<span class="login-msg">' . $app->lang->welcome . '</span>', $app->session->user->realname); echo html::a(helper::createLink('user', 'control'), $app->lang->dashboard); echo "<span id='msgBox' class='hiding'></span>"; echo html::a(helper::createLink('user', 'logout'), $app->lang->logout); } else { echo html::a(helper::createLink('user', 'login'), $app->lang->login); echo html::a(helper::createLink('user', 'register'), $app->lang->register); } }
foreach ($this->config->user->navGroups as $group => $items) { ?> <li class='nav-parent'> <?php echo html::a('###', $lang->user->navGroups->{$group}); ?> <ul class='nav'> <?php $navs = explode(',', $items); ?> <?php foreach ($navs as $nav) { $class = ''; $menu = zget($lang->user->control->menus, $nav); list($label, $module, $method) = explode('|', $menu); if (!commonModel::isAvailable($module)) { continue; } if ($module == $this->app->getModuleName() && $method == $this->app->getMethodName()) { $class .= 'active'; } echo '<li class="' . $class . '">' . html::a($this->createLink($module, $method), $label) . '</li>'; } ?> </ul> </li> <?php } ?> </ul> </div>
/** * Approve an contribution. * * @param int $articleID * @access public * @return void */ public function approve($articleID, $type, $categories) { $this->processCategories($articleID, $type, $categories); $this->dao->update(TABLE_ARTICLE)->set('type')->eq($type)->set('contribution')->eq(2)->where('id')->eq($articleID)->exec(); $article = $this->getByID($articleID); if (commonModel::isAvailable('score')) { $this->loadModel('score')->earn('approveContribution', 'article', $articleID, '', $article->addedBy); } $this->loadModel('search')->save($article->type, $article); $this->loadModel('message')->send($this->app->user->account, $article->addedBy, sprintf($this->lang->article->approveMessage, $article->title, $this->config->score->counts->approveContribution)); return !dao::isError(); }
/** * setting function. * * @access public * @return void */ public function setting() { if (!commonModel::isAvailable('shop')) { unset($this->lang->order->menu->express); unset($this->lang->order->paymentList['COD']); } if ($_POST) { $return = $this->order->saveSetting(); $this->send($return); } $this->display(); }
<?php if (!$product->unsaleable) { if ($product->promotion != 0) { echo "<strong class='text-muted'>" . '</strong>'; echo "<strong class='text-danger'>" . $this->lang->product->currencySymbols[$this->config->product->currency] . $product->promotion . '</strong> '; } else { if ($product->price != 0) { echo "<strong class='text-danger'>" . $this->lang->product->currencySymbols[$this->config->product->currency] . $product->price . '</strong> '; } } } ?> </td> <td class="w-100px"> <?php if (!$product->unsaleable and commonModel::isAvailable('order')) { ?> <?php echo html::a(inlink('view', "id={$product->id}", "category={$product->category->alias}&name={$product->alias}"), $lang->product->buyNow, "class='btn btn-xs btn-success'"); ?> <?php } else { ?> <?php echo html::a(inlink('view', "id={$product->id}", "category={$product->category->alias}&name={$product->alias}"), $lang->product->detail, "class='btn btn-xs btn-success'"); ?> <?php } ?> </td> </tr>
?> </ul> <?php } ?> </li> <?php } ?> </ul> </div> <?php } ?> <?php if (commonModel::isAvailable('book') && !empty($books)) { ?> <div class='clearfix sitemap-tree'> <h4><?php echo $lang->sitemap->books; ?> </h4> <ul class='tree'> <?php foreach ($books as $book) { ?> <li><?php echo html::a(helper::createLink('book', 'browse', "nodeID={$book->id}", "book={$book->alias}"), $book->title); ?> </li> <?php
<?php if ($extView = $this->getExtViewFile(__FILE__)) { include $extView; return helper::cd(); } ?> <div class='col-md-2'> <ul class='nav nav-primary nav-stacked user-control-nav'> <li class='nav-heading'><?php echo $lang->user->control->common; ?> </li> <?php ksort($lang->user->control->menus); foreach ($lang->user->control->menus as $menu) { $class = ''; list($label, $module, $method) = explode('|', $menu); if (in_array($method, array('thread', 'reply')) && !commonModel::isAvailable('forum')) { continue; } if ($module == $this->app->getModuleName() && $method == $this->app->getMethodName()) { $class .= 'active'; } echo '<li class="' . $class . '">' . html::a($this->createLink($module, $method), $label) . '</li>'; } ?> </ul> </div>
<?php if (!$product->unsaleable) { if ($product->promotion != 0) { echo "<strong class='text-muted'>" . '</strong>'; echo "<strong class='text-danger'>" . $this->lang->product->currencySymbols[$this->config->product->currency] . $product->promotion . '</strong> '; } else { if ($product->price != 0) { echo "<strong class='text-danger'>" . $this->lang->product->currencySymbols[$this->config->product->currency] . $product->price . '</strong> '; } } } ?> </td> <td class="w-100px"> <?php if (!$product->unsaleable and commonModel::isAvailable('shop')) { ?> <?php echo html::a(inlink('view', "id={$product->id}", "category={$product->category->alias}&name={$product->alias}"), $lang->product->buyNow, "class='btn btn-xs btn-success'"); ?> <?php } else { ?> <?php echo html::a(inlink('view', "id={$product->id}", "category={$product->category->alias}&name={$product->alias}"), $lang->product->detail, "class='btn btn-xs btn-success'"); ?> <?php } ?> </td> </tr>
/** * Manage article contribution. * * @access public * @return void */ public function contribution($orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { if (!commonModel::isAvailable('contribution')) { die; } $this->app->loadLang('user'); $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); $articles = $this->dao->select('*')->from(TABLE_ARTICLE)->where('contribution')->ne(0)->andWhere('addedBy')->eq($this->app->user->account)->orderBy('id_desc')->page($pager)->fetchall('id'); $this->view->title = $this->lang->article->contribution; $this->view->articles = $articles; $this->view->pager = $pager; $this->view->orderBy = $orderBy; $this->view->mobileURL = helper::createLink('article', 'contribution', '', '', 'mhtml'); $this->view->desktopURL = helper::createLink('article', 'contribution', '', '', 'html'); $this->display(); }
</li> <?php } else { ?> <li class='next disabled'><a href='###'> <?php print $lang->article->none; ?> <i class='icon-arrow-right'></i></a></li> <?php } ?> </ul> </footer> </div> <?php if (commonModel::isAvailable('message')) { ?> <div id='commentBox'><?php echo $this->fetch('message', 'comment', "objectType=article&objectID={$article->id}"); ?> </div> <?php } ?> <div class='row blocks' data-region='blog_view-bottom'><?php $this->block->printRegion($layouts, 'blog_view', 'bottom', true); ?> </div> </div> <div class='col-md-3 col-side'> <side class='page-side'>
?> <span class='caret'></span></a> <ul class='dropdown-menu' role='menu' aria-labelledby='dLabel'> <?php foreach ($lang->thread->sticks as $stick => $label) { if ($thread->stick != $stick) { echo '<li>' . html::a(inlink('stick', "thread={$thread->id}&stick={$stick}"), $label, "class='stickJsoner'") . '</li>'; } else { echo '<li class="active"><a href="###">' . $label . '</a></li>'; } } ?> </ul> </span> <?php if (commonModel::isAvailable('score')) { ?> <?php $account = helper::safe64Encode($thread->author); ?> <?php echo html::a(inlink('addScore', "account={$account}&objectType=thread&objectID={$thread->id}"), $lang->thread->score, "data-toggle=modal"); ?> <?php } ?> <?php if ($thread->hidden) { echo html::a(inlink('switchstatus', "threadID={$thread->id}"), '<i class="icon-eye-open"></i> ' . $lang->thread->show, "class='switcher'"); } else { echo html::a(inlink('switchstatus', "threadID={$thread->id}"), '<i class="icon-eye-close"></i> ' . $lang->thread->hide, "class='switcher'");
/** * Score list for a user. * * @param int $recTotal * @param int $recPerPage * @param int $pageID * @access public * @return void */ public function score($recTotal = 0, $recPerPage = 20, $pageID = 1) { if (!commonModel::isAvailable('score')) { die; } if ($this->app->user->account == 'guest') { $this->locate(inlink('login')); } $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); $this->view->scores = $this->loadModel('score')->getByUser($this->app->user->account, $pager); $this->view->user = $this->user->getByAccount($this->app->user->account); $this->view->pager = $pager; $this->display(); }
<?php if (!defined("RUN_MODE")) { die; } if (commonModel::isAvailable('stat')) { $referer = $this->server->http_referer; if (!empty($referer)) { $refererInfo = parse_url($referer); if ($this->server->http_host == $refererInfo['host']) { $referer = ''; } } ?> <script> var referer = "<?php echo helper::safe64encode($referer); ?> "; var browserLanguage = navigator.language || navigator.userLanguage; var resolution = screen.availWidth + ' X ' + screen.availHeight; $.get(createLink('log', 'record'), {referer:referer, browserLanguage:browserLanguage, resolution:resolution}); </script> <?php }
/** * Identify a user. * * @param string $account the account * @param string $password the password the plain password or the md5 hash * @access public * @return object if is valid user, return the user object. */ public function identify($account, $password) { if (!$account or !$password) { return false; } /* First get the user from database by account or email. */ $user = $this->dao->setAutolang(false)->select('*')->from(TABLE_USER)->beginIF(validater::checkEmail($account))->where('email')->eq($account)->fi()->beginIF(!validater::checkEmail($account))->where('account')->eq($account)->fi()->fetch(); /* Then check the password hash. */ if (!$user) { return false; } /* Can not login before ten minutes when user is locked. */ if ($user->locked != '0000-00-00 00:00:00') { $dateDiff = (strtotime($user->locked) - time()) / 60; /* Check the type of lock and show it. */ if ($dateDiff > 0 && $dateDiff <= 3) { $this->lang->user->loginFailed = sprintf($this->lang->user->locked, '3' . $this->lang->date->minute); return false; } elseif ($dateDiff > 3) { $dateDiff = ceil($dateDiff / 60 / 24); $this->lang->user->loginFailed = $dateDiff <= 30 ? sprintf($this->lang->user->locked, $dateDiff . $this->lang->date->day) : $this->lang->user->lockedForEver; return false; } else { $user->fails = 0; $user->locked = '0000-00-00 00:00:00'; } } /* The password can be the plain or the password after md5. */ if (!$this->compareHashPassword($password, $user) and $user->password != $this->createPassword($password, $user->account)) { /* Save login log if user is admin. */ if ($user->admin == 'super' or $user->admin == 'common') { $this->saveLog($user->account, 'fail'); } $user->fails++; if ($user->fails > 2 * 4) { $user->locked = date('Y-m-d H:i:s', time() + 3 * 60); } $this->dao->setAutolang(false)->update(TABLE_USER)->data($user)->where('id')->eq($user->id)->exec(); return false; } /* Update user data. */ $user->ip = $this->server->remote_addr; $user->last = helper::now(); $user->fails = 0; $user->visits++; /* Save login log if user is admin. */ if ($user->admin == 'super' or $user->admin == 'common') { $this->saveLog($user->account, 'success'); } $this->dao->setAutolang(false)->update(TABLE_USER)->data($user)->where('account')->eq($account)->exec(); $user->realname = $this->computeRealname($user); $user->shortLast = substr($user->last, 5, -3); $user->shortJoin = substr($user->join, 5, -3); unset($_SESSION['random']); if (commonModel::isAvailable('score')) { $viewType = $this->app->getViewType(); if ($user) { $this->app->user->account = $account; if ($user->maxLogin > 0) { $this->app->loadConfig('score'); $login = $this->config->score->counts->login; $this->dao->update(TABLE_USER)->set('maxLogin = maxLogin - ' . $login)->where('account')->eq($account)->exec(); $this->loadModel('score')->earn('login', '', '', 'LOGIN'); } } } return $user; }
<?php } ?> <?php if (commonModel::isAvailable('shop')) { ?> <a class='btn with-badge' href='<?php echo $this->createLink('cart', 'browse'); ?> '><i class='icon icon-shopping-cart'></i><strong class='cart-count badge small text-danger circle hide'>12</strong></a> <?php } ?> <?php $isMultiLangAvailable = count(explode(',', $config->site->lang)) > 1; $isUserAvailable = commonModel::isAvailable('user'); ?> <?php if ($isUserAvailable || $isMultiLangAvailable) { ?> <div class='dropdown'> <button type='button' class='btn' data-toggle='dropdown'><i class='icon-bars circle'></i></button> <ul class='dropdown-menu dropdown-menu-right'> <?php if ($isUserAvailable) { echo commonModel::printTopBar(true); } if ($isUserAvailable && $isMultiLangAvailable) { echo "<li class='divider'></li>"; } if ($isMultiLangAvailable) {
<?php /** * The browse view file of company module of chanzhiEPS. * * @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com) * @license ZPLV12 (http://zpl.pub/page/zplv12.html) * @author Xiying Guan <*****@*****.**> * @package company * @version $Id$ * @link http://www.chanzhi.org */ include '../../common/view/header.admin.html.php'; include '../../common/view/kindeditor.html.php'; js::set('score', commonModel::isAvailable('score')); js::set('setCounts', $lang->site->setCounts); $displayAll = $display === 'all'; ?> <div class='panel display-<?php echo $display; ?> '> <div class='panel-heading'><strong><i class='icon-building'></i> <?php echo $lang->company->setBasic; ?> </strong></div> <div class='panel-body'> <form method='post' id='ajaxForm' class='ve-form'> <table class='table table-form'> <tr data-row='name'> <th class='w-100px'><?php
$lang->user->oauth->lblUnbindFailed = "解除綁定失敗!"; $lang->user->oauth->lblBindFailed = "綁定賬戶失敗!"; $lang->user->oauth->ignore = "忽略"; $lang->user->statusList = new stdclass(); $lang->user->statusList->locked = "<label class='label label-danger'>鎖定</label>"; $lang->user->statusList->forbidden = "<label class='label label-danger'>禁用</label>"; $lang->user->statusList->normal = "<label class='label label-success'>正常</label>"; $lang->user->control = new stdclass(); $lang->user->control->common = '用戶中心'; $lang->user->control->welcome = '歡迎您,<strong>%s</strong>'; $lang->user->control->lblPassword = "******"; $lang->user->control->menus[10] = '<i class="icon-user"></i> 個人信息 <i class="icon-chevron-right"></i>|user|profile'; $lang->user->control->menus[20] = '<i class="icon-comments-alt"></i> 我的消息 <i class="icon-chevron-right"></i>|user|message'; $lang->user->control->menus[30] = '<i class="icon-share"></i> 我的主題 <i class="icon-chevron-right"></i>|user|thread'; $lang->user->control->menus[40] = '<i class="icon-mail-reply"></i> 我的回帖 <i class="icon-chevron-right"></i>|user|reply'; if (RUN_MODE != 'install' and commonModel::isAvailable('order')) { $lang->user->control->menus[25] = '<i class="icon-shopping-cart"></i> 我的訂單 <i class="icon-chevron-right"></i>|order|browse'; $lang->user->control->menus[26] = '<i class="icon-map-marker"> </i> 地址管理 <i class="icon-chevron-right"></i>|address|browse'; } $lang->user->log = new stdclass(); $lang->user->log->common = '日誌'; $lang->user->log->list = '管理員登錄日誌'; $lang->user->log->id = 'ID'; $lang->user->log->account = '用戶'; $lang->user->log->browser = '瀏覽器'; $lang->user->log->ip = 'IP'; $lang->user->log->location = '登錄地址'; $lang->user->log->date = '登錄時間'; $lang->user->log->desc = '描述'; $lang->user->ipDenied = '登錄IP受限,請按提示操作。'; $lang->user->locationDenied = '登錄地區受限,請按提示操作。';