本文整理汇总了PHP中commonModel::isAvailable方法的典型用法代码示例。如果您正苦于以下问题:PHP commonModel::isAvailable方法的具体用法?PHP commonModel::isAvailable怎么用?PHP commonModel::isAvailable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类commonModel
的用法示例。
在下文中一共展示了commonModel::isAvailable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ajaxUpload
/**
* 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)));
}
}
示例2: index
/**
* 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();
}
示例3: getList
/**
* 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;
}
示例4: admin
/**
* 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();
}
示例5: setting
/**
* 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();
}
示例6: ksort
?>
<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>
示例7:
?>
</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') {
示例8:
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
示例9: sprintf
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)) {
示例10: printTopBar
/**
* 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);
}
}
}
示例11: delete
/**
* 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();
}
示例12: printSpeaker
/**
* 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;
}
}
示例13: stdclass
$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 = '登录地址发生变化,请按提示操作。';
示例14: printTopBar
/**
* 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);
}
}
示例15: foreach
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>