当前位置: 首页>>代码示例>>PHP>>正文


PHP config::saveCount方法代码示例

本文整理汇总了PHP中config::saveCount方法的典型用法代码示例。如果您正苦于以下问题:PHP config::saveCount方法的具体用法?PHP config::saveCount怎么用?PHP config::saveCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在config的用法示例。


在下文中一共展示了config::saveCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: write

 function write()
 {
     if (bff::$isAjax) {
         $nUserID = $this->security->getUserID();
         $p = $this->input->postm(array('email' => TYPE_STR, 'phone' => TYPE_NOHTML, 'message' => TYPE_NOHTML, 'captcha' => TYPE_STR));
         if (!$nUserID) {
             if (empty($p['email']) || !Func::IsEmailAddress($p['email'])) {
                 $this->errors->set('wrong_email');
             }
         }
         $p['phone'] = func::cleanComment($p['phone']);
         if (empty($p['phone'])) {
             $this->errors->set('no_phone');
         }
         $p['message'] = func::cleanComment($p['message']);
         if (empty($p['message'])) {
             $this->errors->set('no_message');
         }
         if (!$nUserID) {
             $oProtection = new CCaptchaProtection();
             if (!$oProtection->valid(isset($_SESSION['c2']) ? $_SESSION['c2'] : '', $p['captcha'])) {
                 $this->errors->set('wrong_captcha');
             }
         }
         if ($this->errors->no()) {
             unset($_SESSION['c2']);
             $this->db->execute('INSERT INTO ' . TABLE_CONTACTS . ' (user_id, email, phone, message, created) 
                            VALUES (' . $nUserID . ', ' . $this->db->str2sql($p['email']) . ', 
                                    ' . $this->db->str2sql($p['phone']) . ', ' . $this->db->str2sql(nl2br($p['message'])) . ', 
                                    ' . $this->db->getNOW() . ')');
             $nRecordID = $this->db->insert_id(TABLE_CONTACTS, 'id');
             if ($nRecordID) {
                 config::saveCount('contacts_new', 1);
                 bff::sendMailTemplate(array('user' => !$nUserID ? 'Аноним' : $this->security->getUserEmail(), 'email' => !$nUserID ? $p['email'] : $this->security->getUserEmail(), 'phone' => $p['phone'], 'message' => nl2br($p['message'])), 'admin_contacts', config::get('mail_admin', BFF_EMAIL_SUPPORT));
             }
         }
         $this->ajaxResponse(Errors::SUCCESS);
     }
     config::set('title', 'Связь с редактором - ' . config::get('title', ''));
     return $this->tplFetch('write.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:41,代码来源:contacts.class.php

示例2: ajax

 function ajax()
 {
     switch (func::GET('act')) {
         case 'item-u-update':
             $this->input->postm(array('id' => TYPE_UINT, 'uid' => TYPE_UINT, 'p' => TYPE_STR), $p);
             $nUserID = $this->security->getUserID();
             $nItemID = $p['id'];
             if (!$nItemID || empty($p['p']) || !$nUserID) {
                 $this->ajaxResponse(Errors::ACCESSDENIED);
             }
             $aItem = $this->db->one_array('SELECT id, cat1_id FROM ' . TABLE_BBS_ITEMS . ' 
                 WHERE id = ' . $nItemID . ' AND status = ' . BBS_STATUS_NEW . ' 
                     AND pass = ' . $this->security->encodeBBSEditPass($p['p']));
             if (!empty($aItem)) {
                 $this->db->execute('UPDATE ' . TABLE_BBS_ITEMS . ' SET user_id = ' . $nUserID . ' WHERE id = ' . $nItemID);
                 // закрепляем за пользователем
                 $this->db->execute('UPDATE ' . TABLE_USERS . ' SET items = items+1 WHERE user_id = ' . $nUserID);
                 // обновляем счетчик объявлений пользователя
             }
             $sUID = $this->security->getUID(false, 'post');
             $bPayPublication = !$this->checkFreePublicationsLimit($aItem['cat1_id'], $nUserID, $sUID);
             $this->ajaxResponse(array('res' => !empty($aItem), 'pp' => $bPayPublication));
             break;
         case 'item-edit-pass':
             $p = $this->input->postm(array('id' => TYPE_UINT, 'pass' => TYPE_STR));
             $aResponse = array();
             do {
                 if (!$p['id']) {
                     $this->errors->set(Errors::IMPOSSIBLE);
                     break;
                 }
                 if (empty($p['pass'])) {
                     $this->errors->set('editpass_empty');
                     break;
                 }
                 if ($this->isEditPassGranted($p['id'])) {
                     $aResponse['result'] = true;
                     break;
                 }
                 $aData = $this->db->one_array('SELECT id, user_id FROM ' . TABLE_BBS_ITEMS . ' 
                           WHERE id = ' . $p['id'] . ' AND pass = ' . $this->security->encodeBBSEditPass($p['pass']));
                 if (empty($aData)) {
                     $this->errors->set(Errors::ACCESSDENIED);
                     break;
                 } else {
                     if ($aData['user_id'] > 0) {
                         $userID = $this->security->getUserID();
                         if ($userID > 0) {
                             if ($aData['user_id'] != $userID) {
                                 $this->errors->set('editpass_not_owner');
                             } else {
                                 $aResponse['result'] = true;
                                 break;
                             }
                         } else {
                             $this->errors->set('editpass_auth');
                         }
                     } else {
                         $this->grantEditPass($p['id']);
                         $aResponse['result'] = true;
                     }
                 }
             } while (false);
             $aResponse['errno'] = $this->errors->no();
             $this->ajaxResponse($aResponse);
             break;
         case 'item-claim':
             $p = $this->input->postm(array('id' => TYPE_UINT, 'reasons' => TYPE_ARRAY_UINT, 'comment' => TYPE_STR, 'captcha' => TYPE_STR));
             $p['comment'] = func::cleanComment($p['comment']);
             $aResponse = array();
             do {
                 if (!$p['id']) {
                     $this->errors->set(Errors::IMPOSSIBLE);
                     break;
                 }
                 if (empty($p['reasons']) && $p['comment'] == '') {
                     $this->errors->set('enter_claim_reason');
                     break;
                 }
                 $nUserID = $this->security->getUserID();
                 if (!$nUserID) {
                     $oProtection = new CCaptchaProtection();
                     if (!$oProtection->valid(isset($_SESSION['c2']) ? $_SESSION['c2'] : '', $p['captcha'])) {
                         $aResponse['captcha_wrong'] = 1;
                         $this->errors->set('claim_wrong_captcha');
                         break;
                     }
                 }
                 unset($_SESSION['c2']);
                 $nReasons = array_sum($p['reasons']);
                 $res = $this->db->execute('INSERT INTO ' . TABLE_BBS_ITEMS_CLAIMS . ' (item_id, user_id, comment, reasons, ip, created)
                     VALUES(' . $p['id'] . ', ' . $nUserID . ', ' . $this->db->str2sql($p['comment']) . ', ' . $nReasons . ', :ip, ' . $this->db->getNOW() . ')
                 ', array(':ip' => func::getRemoteAddress()));
                 if ($res) {
                     config::saveCount('bbs_items_claims', 1);
                     bff::sendMailTemplate(array('user' => !$nUserID ? 'Аноним' : $this->security->getUserEmail(), 'claim' => $this->getItemClaimText($nReasons, nl2br($p['comment'])), 'item_url' => SITEURL . '/item/' . $p['id']), 'admin_bbs_claim', config::get('mail_admin', BFF_EMAIL_SUPPORT));
                 }
             } while (false);
             $aResponse['result'] = $this->errors->no();
             $this->ajaxResponse($aResponse);
//.........这里部分代码省略.........
开发者ID:Sywooch,项目名称:dobox,代码行数:101,代码来源:bbs.class.php

示例3: items_complaints

 function items_complaints()
 {
     if (!$this->haveAccessTo('items-complaints-listing')) {
         return $this->showAccessDenied();
     }
     if (bff::$isAjax) {
         switch (func::GET('act')) {
             case 'delete':
                 if (!$this->haveAccessTo('items-complaints-edit')) {
                     $this->ajaxResponse(Errors::ACCESSDENIED);
                 }
                 $nClaimID = $this->input->id('id', 'p');
                 if ($nClaimID) {
                     $aData = $this->db->one_array('SELECT id, viewed FROM ' . TABLE_BBS_ITEMS_CLAIMS . ' WHERE id = ' . $nClaimID);
                     if (empty($aData)) {
                         $this->ajaxResponse(Errors::IMPOSSIBLE);
                     }
                     $aResponse = array('counter_update' => false);
                     $res = $this->db->execute('DELETE FROM ' . TABLE_BBS_ITEMS_CLAIMS . ' WHERE id = ' . $nClaimID);
                     if ($res && !$aData['viewed']) {
                         config::saveCount('bbs_items_claims', -1);
                         $aResponse['counter_update'] = true;
                     }
                     $aResponse['res'] = $res;
                     $this->ajaxResponse($aResponse);
                 }
                 break;
             case 'view':
                 if (!$this->haveAccessTo('items-complaints-edit')) {
                     $this->ajaxResponse(Errors::ACCESSDENIED);
                 }
                 $nClaimID = $this->input->id('id', 'p');
                 if ($nClaimID) {
                     $res = $this->db->execute('UPDATE ' . TABLE_BBS_ITEMS_CLAIMS . ' SET viewed = 1 WHERE id = ' . $nClaimID);
                     if ($res) {
                         config::saveCount('bbs_items_claims', -1);
                     }
                     $this->ajaxResponse(Errors::SUCCESSFULL);
                 }
                 break;
         }
         $this->ajaxResponse(Errors::IMPOSSIBLE);
     }
     $this->input->getm(array('item' => TYPE_UINT, 'page' => TYPE_UINT, 'perpage' => TYPE_UINT), $aData);
     $sqlWhere = array();
     if ($aData['item']) {
         $sqlWhere[] = 'CL.item_id = ' . $aData['item'];
     }
     $sqlWhere = !empty($sqlWhere) ? 'WHERE ' . join(' AND ', $sqlWhere) : '';
     $nCount = $this->db->one_data('SELECT COUNT(CL.id) FROM ' . TABLE_BBS_ITEMS_CLAIMS . ' CL ' . $sqlWhere);
     $this->prepareOrder($orderBy, $orderDirection, 'CL.created,desc', array('CL.created' => 'desc'));
     $aPerpage = $this->preparePerpage($aData['perpage'], array(20, 40, 60));
     $aData['order'] = "{$orderBy},{$orderDirection}";
     $sFilter = http_build_query($aData);
     unset($aData['page']);
     $this->generatePagenation($nCount, $aData['perpage'], "index.php?s={$this->module_name}&ev=items_complaints&{$sFilter}&{pageId}", $sqlLimit);
     $aData['f'] = $sFilter;
     if ($nCount > 0) {
         $aData['complaints'] = $this->db->select('SELECT CL.*, 0 as other
                     FROM ' . TABLE_BBS_ITEMS_CLAIMS . ' CL
                     ' . $sqlWhere . "\n                        ORDER BY {$orderBy} {$orderDirection} {$sqlLimit}");
     } else {
         $aData['complaints'] = array();
     }
     $compl =& $aData['complaints'];
     $reasons = $this->getItemClaimReasons();
     if (!empty($compl) && !empty($reasons)) {
         foreach ($compl as $k => $v) {
             $r = $v['reasons'];
             if ($r == 0) {
                 continue;
             }
             $r_text = array();
             foreach ($reasons as $rk => $rv) {
                 if ($rk != 32 && $rk & $r) {
                     $r_text[] = $rv;
                 }
             }
             $compl[$k]['reasons_text'] = join(', ', $r_text);
             $compl[$k]['other'] = $r & 32;
         }
     }
     $aData['perpage'] = $aPerpage;
     $this->adminIsListing();
     $this->tplAssignByRef('aData', $aData);
     return $this->tplFetch('admin.items.complaints.listing.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:87,代码来源:bbs.adm.class.php


注:本文中的config::saveCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。