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


PHP func::POST方法代码示例

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


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

示例1: ajax

 function ajax()
 {
     if (!$this->haveAccessTo('edit') || !bff::$isAjax) {
         $this->ajaxResponse(Errors::ACCESSDENIED);
     }
     switch (func::GET('act')) {
         case 'del':
             $nContactID = func::POST('rec', false, true);
             if ($nContactID <= 0) {
                 $this->ajaxResponse(Errors::IMPOSSIBLE);
             }
             $this->db->execute('DELETE FROM ' . TABLE_CONTACTS . ' WHERE id = ' . $nContactID);
             $this->ajaxResponse(Errors::SUCCESSFULL);
             break;
         case 'send':
             $nType = func::POST('type', false, true);
             switch ($nType) {
                 case CONTACTS_TYPE_CONTACT:
                     //
                     break;
             }
             $this->ajaxResponse(Errors::IMPOSSIBLE);
             break;
     }
     $this->ajaxResponse(Errors::IMPOSSIBLE);
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:26,代码来源:contacts.adm.class.php

示例2: users

 function users()
 {
     if (!$this->haveAccessTo('ban')) {
         return $this->showAccessDenied();
     }
     $aData = array();
     if (Func::isPostMethod()) {
         if (Func::POST('action') == 'massdel') {
             $mBanID = func::POST('banid', false);
             $this->removeBan($mBanID);
         } else {
             $sMode = Func::POST('banmode');
             if (empty($sMode)) {
                 $sMode = 'ip';
             }
             $ban = func::POST('ban_' . $sMode, true);
             $nBanPeriod = func::POST('banlength', false, true);
             $nBanPeriodDate = func::POST('bandate', true);
             $nExclude = func::POST('exclude') ? 1 : 0;
             $sDescription = func::POST('description', true);
             $sReason = func::POST('reason', true);
             if (!empty($ban)) {
                 $this->createBan($sMode, $ban, $nBanPeriod, $nBanPeriodDate, $nExclude, $sDescription, $sReason);
                 $this->adminRedirect(Errors::SUCCESSFULL, 'users');
             }
         }
     }
     $aBanEndText = array(0 => 'бессрочно', 30 => '30 минут', 60 => '1 час', 360 => '6 часов', 1440 => '1 день', 10080 => '7 дней', 20160 => '2 недели', 40320 => '1 месяц');
     /*                                     
        `uid` int(11) unsigned NOT NULL default '0',
        `ip` varchar(40) NOT NULL default '',
        `email` varchar(100) NOT NULL default '',
        `started` int(11) unsigned NOT NULL default '0',
        `finished` int(11) unsigned NOT NULL default '0',
        `exclude` tinyint(1) unsigned NOT NULL default '0',
        `description` varchar(255) NOT NULL default '',
        `reason` varchar(255) NOT NULL default '',
        `status` tinyint(1) unsigned NOT NULL default '0',  
     */
     $aData['bans'] = $this->db->select('SELECT B.* 
                                    FROM ' . TABLE_USERS_BANLIST . ' B
                                    WHERE (B.finished >= ' . time() . ' OR B.finished = 0) 
                                    ORDER BY B.ip, B.email');
     foreach ($aData['bans'] as $key => &$ban) {
         $timeLength = $ban['finished'] ? ($ban['finished'] - $ban['started']) / 60 : 0;
         $ban['till'] = isset($aBanEndText[$timeLength]) ? $aBanEndText[$timeLength] : '';
         $ban['finished_formated'] = date('Y-m-d H:i:s', $ban['finished']);
         //0000-00-00 00:00:00
     }
     $this->tplAssign('aData', $aData);
     $this->adminCustomCenterArea();
     return $this->tplFetch('admin.listing.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:53,代码来源:ban.adm.class.php

示例3: edit

 function edit()
 {
     if (!$this->haveAccessTo('edit')) {
         return $this->showAccessDenied();
     }
     $aData = array('content' => '', 'title' => '', 'filename' => '');
     $nRecordID = func::POSTGET('rec', false, true);
     if ($nRecordID <= 0) {
         $this->adminRedirect(Errors::IMPOSSIBLE);
     }
     if (func::isPostMethod()) {
         $sFilename = func::POST('filename', true);
         $sTitle = func::POST('title', true);
         $sMetaDescription = func::POST('mdescription', true);
         $sMetaKeywords = func::POST('mkeywords', true);
         $sContent = stripslashes(func::POST('content'));
         $sContent = eregi_replace('\\\\"', '"', $sContent);
         $sContent = eregi_replace('\\"', '"', $sContent);
         $sContent = eregi_replace('\\"', '"', $sContent);
         $sFilename = $this->db->one_data('SELECT filename FROM ' . TABLE_PAGES . ' WHERE id=' . $nRecordID . ' LIMIT 1');
         if ($this->errors->no()) {
             CDir::putFileContent(PAGES_PATH . $sFilename . PAGES_EXTENSION, $sContent);
             if (BFF_GENERATE_META_AUTOMATICALY) {
                 if ((empty($sMetaKeywords) || empty($sMetaDescription)) && !empty($sContent)) {
                     func::generateMeta($sContent, $aData);
                     if (empty($sMetaDescription)) {
                         $sMetaDescription = $aData['mdescription'];
                     }
                     if (empty($sMetaKeywords)) {
                         $sMetaKeywords = $aData['mkeywords'];
                     }
                 }
             }
             $this->db->execute('UPDATE ' . TABLE_PAGES . '
                              SET title = ' . $this->db->str2sql($sTitle) . ', 
                                  mkeywords = ' . $this->db->str2sql($sMetaKeywords) . ',
                                  mdescription = ' . $this->db->str2sql($sMetaDescription) . ", \n                                     modified = {$this->db->getNOW()}\n                                 WHERE id={$nRecordID}");
             $this->adminRedirect(Errors::SUCCESSFULL);
         }
         $aData = $_POST;
     } else {
         $aData = $this->db->one_array('SELECT * FROM ' . TABLE_PAGES . ' WHERE id=' . $nRecordID . ' LIMIT 1');
         $aData['content'] = CDir::getFileContent(PAGES_PATH . $aData['filename'] . PAGES_EXTENSION);
     }
     $this->tplAssign('aData', $aData);
     return $this->tplFetch('admin.form.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:47,代码来源:pages.adm.class.php

示例4: sendspam

 function sendspam()
 {
     if (!$this->haveAccessTo('admin-message')) {
         return $this->showAccessDenied();
     }
     //get sender information
     $nUserID = $this->security->getUserID();
     $aSenderInfo = bff::i()->Users_getUserInfo($nUserID, false);
     //получаем список пользователей (members)
     $nCount = bff::i()->Users_getGroupUsersCount(USERS_GROUPS_MEMBER, '');
     //generate pagenation
     $this->generatePagenation($nCount, 20, $this->adminCreateLink('sendspam&{pageId}'), $sqlLimit);
     if (func::isPostMethod()) {
         $aRecipients = func::POST('recipients', false);
         $sMessage = func::POST('message', true);
         $all = func::POST('all', false, true);
         if (!$sMessage) {
             $this->errors->set('no_message');
         }
         if ($aRecipients == false && !$all) {
             $this->errors->set('no_recipient');
         }
         if ($this->errors->no()) {
             if ($all) {
                 $this->sendMessageToUsersGroupFromAdmin($sMessage, USERS_GROUPS_MEMBER);
             } else {
                 $this->sendMessage($aRecipients, $sMessage, false);
             }
             //Сообщение успешно отправлено
             $this->adminRedirect(Errors::SUCCESSFULL, 'sendspam');
         } else {
             $this->tplAssign('message', $sMessage);
         }
     }
     $this->tplAssign('user_info', $aSenderInfo);
     $this->tplAssign('aData', bff::i()->Users_getGroupUsers(USERS_GROUPS_MEMBER, $sqlLimit));
     return $this->tplFetch('admin.sendspam.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:38,代码来源:internalmail.adm.class.php

示例5: ajax


//.........这里部分代码省略.........
                                     WHERE id = ' . $nItemID);
             }
             $this->ajaxResponse(array('success' => true, 'filename' => $sFilename, 'id' => $nItemID), 1);
             break;
         case 'img-delete':
             $nUserID = $this->security->getUserID();
             $nItemID = $this->input->id('id', 'p');
             if ($nItemID > 0) {
                 $aData = $this->db->one_array('SELECT user_id, uid, img, imgcnt, status, moderated FROM ' . TABLE_BBS_ITEMS . ' WHERE id = ' . $nItemID);
                 if (empty($aData)) {
                     $aFailResponse['error'] = 'Редактируемое объявление не найдено';
                     $this->ajaxResponse($aFailResponse);
                 }
                 if ($aData['status'] == BBS_STATUS_BLOCKED && $aData['moderated'] == 0) {
                     $aFailResponse['error'] = 'Объявление ожидает проверки модератора';
                     $this->ajaxResponse($aFailResponse);
                 }
                 // доступ к редактированию объявления возможен только по паролю
                 if ($aData['user_id'] == 0) {
                     if (!$this->isEditPassGranted($nItemID)) {
                         $aFailResponse['error'] = 'В доступе отказано';
                         $this->ajaxResponse($aFailResponse);
                     }
                 } else {
                     // автор объявления = загеристрированный пользователь
                     if (!$nUserID || $nUserID > 0 && $aData['user_id'] != $nUserID) {
                         $aFailResponse['error'] = 'Вы не является владельцем данного объявления.';
                         $this->ajaxResponse($aFailResponse);
                     }
                 }
             } else {
                 // удалять фотографии(без привязки к объявлению) можно без ограничений
             }
             if (!($sFilename = func::POST('filename'))) {
                 $this->ajaxResponse(Errors::IMPOSSIBLE);
             }
             $this->initImages()->deleteImageFileCustom($this->items_images_path, $nItemID, $sFilename);
             $this->ajaxResponse(Errors::SUCCESS);
             break;
         case 'regions':
             $p = $this->input->postm(array('pid' => TYPE_UINT, 'form' => TYPE_STR, 'empty' => TYPE_STR));
             if (!$p['pid']) {
                 break;
             }
             $result = false;
             if ($p['form'] == 'options') {
                 $result = $this->regionsOptions(0, $p['pid'], true, !empty($p['empty']) ? $p['empty'] : 'Выбрать...');
             }
             $this->ajaxResponse($result);
             break;
         case 'sub-cats':
             $p = $this->input->postm(array('pid' => TYPE_UINT, 'dp' => TYPE_BOOL, 'dp_form' => TYPE_STR, 'format' => TYPE_STR, 'type' => TYPE_STR));
             if (!$p['pid']) {
                 break;
             }
             $returnTypes = 0;
             $returnSubTypes = 0;
             // Dirty. We get here category for our custom subtype
             if ($p['type'] == 'type') {
                 $type = $this->db->select('SELECT T.cat_id FROM ' . TABLE_BBS_CATEGORIES_TYPES . ' T WHERE T.id = ' . $p['pid'] . ' LIMIT 1');
                 $p['pid'] = $type[0]['cat_id'];
             }
             $aParentInfo = $this->db->one_array('SELECT id, numlevel, numleft, numright, prices, prices_sett, regions FROM ' . TABLE_BBS_CATEGORIES . ' WHERE id = ' . $p['pid']);
             $aDynprops = array();
             $aCats = $this->db->select('SELECT id, title, numlevel FROM ' . TABLE_BBS_CATEGORIES . ' WHERE pid = ' . $p['pid'] . ' AND enabled = 1 ORDER BY numleft');
             if ($p['type'] == 'type') {
开发者ID:Sywooch,项目名称:dobox,代码行数:67,代码来源:bbs.class.php

示例6: subscriber_edit

 function subscriber_edit()
 {
     if (!$this->haveAccessTo('subscribers-edit')) {
         return $this->showAccessDenied();
     }
     $nRecordID = func::POSTGET('rec', false, true);
     if (!$nRecordID) {
         $this->adminRedirect(Errors::IMPOSSIBLE, 'subscriber_listing');
     }
     $aData = $this->db->one_array('SELECT * FROM ' . DB_PREFIX . 'subscribers WHERE id=' . $nRecordID . ' LIMIT 1');
     if (!$aData) {
         $this->adminRedirect(Errors::IMPOSSIBLE, 'subscriber_listing');
     }
     if (func::isPostMethod()) {
         $sName = $aData['name'] = func::POST('name');
         $sEmail = $aData['email'] = func::POST('email');
         if (!$sName) {
             $aErrors[] = $this->errors->set('no_subscriber_name');
         }
         if (!$sEmail) {
             $this->errors->set('no_subscriber_email');
         } elseif (!func::IsEmailAddress($sEmail)) {
             $this->errors->set('subscriber_wrong_email');
         } elseif ($aData['email'] != $sEmail && $this->isSubscribed($sEmail)) {
             $this->errors->set('subscriber_email_exists');
         }
         if ($this->errors->no()) {
             $this->db->execute('UPDATE ' . DB_PREFIX . 'subscribers
                            SET name=' . $this->db->str2sql($sName) . ', email=' . $this->db->str2sql($sEmail) . ', create_datetime=' . $this->db->getNOW() . '
                            WHERE id=' . $nRecordID);
             $this->adminRedirect(Errors::SUCCESSFULL, 'subscriber_listing');
         }
     }
     $this->tplAssign('rec', $nRecordID);
     $this->tplAssign('aData', $aData);
     return $this->tplFetch('admin.subscriber.form.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:37,代码来源:sendmail.adm.class.php

示例7: cities_listing

 function cities_listing($nOnlyMain = 0)
 {
     if (!$this->haveAccessTo('cities')) {
         return $this->showAccessDenied();
     }
     if (bff::$isAjax) {
         //$cache = Cache::singleton();
         switch (func::GET('act')) {
             case 'toggle-enabled':
                 if (!($nRecordID = $this->input->id())) {
                     $this->ajaxResponse(Errors::UNKNOWNRECORD);
                 }
                 $res = $this->db->execute('UPDATE ' . TABLE_CITY . ' SET enabled=(1-enabled) WHERE city_id=' . $nRecordID);
                 if ($res) {
                     //$cache->delete('geo-сities-all');
                     //$cache->delete('geo-сities-main');
                 }
                 $this->ajaxResponse($res ? Errors::SUCCESS : Errors::IMPOSSIBLE);
                 break;
             case 'toggle-main':
                 if (!($nRecordID = $this->input->id())) {
                     $this->ajaxResponse(Errors::UNKNOWNRECORD);
                 }
                 $res = $this->db->execute('UPDATE ' . TABLE_CITY . ' SET main=(1-main) WHERE city_id=' . $nRecordID);
                 if ($res) {
                     //$cache->delete('geo-сities-main');
                 }
                 $this->ajaxResponse($res ? Errors::SUCCESS : Errors::IMPOSSIBLE);
                 break;
             case 'main-add':
                 if (!($nRecordID = $this->input->id('city', 'p'))) {
                     $this->ajaxResponse(Errors::UNKNOWNRECORD);
                 }
                 $res = $this->db->execute('UPDATE ' . TABLE_CITY . ' SET main=1 WHERE city_id=' . $nRecordID);
                 if ($res) {
                     //$cache->delete('geo-сities-main');
                 }
                 $this->ajaxResponse($res ? Errors::SUCCESS : Errors::IMPOSSIBLE);
                 break;
             case 'rotate':
                 $f = func::GET('f');
                 $f = $f == 'num' ? 'num' : 'numreg';
                 $res = $this->db->rotateTablednd(TABLE_CITY, '', 'city_id', $f);
                 if ($res) {
                     //$cache->delete('geo-сities-all');
                     //$cache->delete('geo-сities-main');
                     $this->ajaxResponse(Errors::SUCCESS);
                 } else {
                     $this->ajaxResponse(Errors::IMPOSSIBLE);
                 }
                 break;
             case 'notmain-list':
                 $sQ = func::POST('q', true);
                 //получаем список подходящих по названию городов, исключая
                 //- основные города
                 $aResult = $this->db->select('SELECT C.city_id as id, C.title FROM ' . TABLE_CITY . ' C 
                               WHERE C.main=0 AND C.title LIKE (' . $this->db->str2sql($sQ . '%') . ')
                               ORDER BY C.title');
                 $aCities = array();
                 foreach ($aResult as $c) {
                     $aCities[$c['id']] = $c['title'];
                 }
                 unset($aResult);
                 $this->ajaxResponse($aCities);
                 break;
         }
         $this->ajaxResponse(Errors::IMPOSSIBLE);
     }
     $aData = array('main' => $nOnlyMain, 'users' => func::GET('users'), 'region' => func::GET('region', false, true));
     $aData['rotate'] = ($aData['main'] || $aData['region']) && !($aData['main'] && $aData['region']) && !$aData['users'] ? 1 : 0;
     $aData['rotate_field'] = $aData['rotate'] ? $aData['main'] ? 'num' : 'numreg' : 'title';
     $aData['cities'] = $this->db->select('SELECT C.*, C.city_id as id, COUNT(U.user_id) as users 
         FROM ' . TABLE_CITY . ' C
             LEFT JOIN ' . TABLE_USERS . ' U ON U.city_id=C.city_id
         WHERE 1=1 ' . ($aData['region'] ? ' AND C.region_id = ' . $aData['region'] . ' ' : '') . ' 
                   ' . ($aData['main'] ? ' AND C.main = 1 ' : '') . '
         GROUP BY C.city_id
        ' . ($aData['users'] ? ' HAVING users > 0 ' : '') . '
         ORDER BY C.' . $aData['rotate_field']);
     $aData['regions_options'] = $this->geoOblastOptions($aData['region'], $aRegions);
     $aData['regions'] = func::array_transparent($aRegions, 'region_id', true);
     $this->tplAssignByRef('aData', $aData);
     $this->includeJS(array('tablednd', 'autocomplete'));
     return $this->tplFetch('admin.cities.listing.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:85,代码来源:sites.adm.class.php

示例8: settings

 function settings()
 {
     if (!$this->haveAccessTo('settings')) {
         return $this->showAccessDenied();
     }
     $configPrefix = $this->module_name . '_';
     $sCurrentTab = func::POSTGET('tab');
     if (empty($sCurrentTab)) {
         $sCurrentTab = 'general';
     }
     if (bff::$isPost && func::POST('save') == 1) {
         $confTmp = func::POST('config', false);
         $this->input->clean_array($confTmp, array('items_perpage' => TYPE_UINT, 'items_freepubl_category_limit' => TYPE_UINT, 'items_freepubl_category_limit_reg' => TYPE_UINT, 'adtxt_limit' => TYPE_UINT, 'svc_up_price' => TYPE_NUM, 'svc_mark_price' => TYPE_NUM, 'svc_premium_price' => TYPE_NUM, 'svc_press_price' => TYPE_NUM, 'svc_up_desc' => TYPE_STR, 'svc_mark_desc' => TYPE_STR, 'svc_premium_desc' => TYPE_STR, 'svc_press_desc' => TYPE_STR, 'images_limit' => TYPE_UINT, 'images_limit_reg' => TYPE_UINT, 'add_instruct1' => TYPE_STR, 'add_instruct2' => TYPE_STR, 'add_instruct3' => TYPE_STR, 'add_instruct4' => TYPE_STR));
         $conf = array();
         foreach ($confTmp as $k => $v) {
             $conf[$configPrefix . $k] = $v;
         }
         bff::i()->Sites_saveConfig($conf, false);
         //в БД
         $configAll = config::getAll();
         bff::i()->Sites_saveConfig(array_merge($configAll, $conf), true);
         //в файл
         $this->adminRedirect(Errors::SUCCESS, 'settings&tab=' . $sCurrentTab);
     }
     $aConfig = config::getWithPrefix($this->module_name . '_');
     $aConfig = array_map('stripslashes', $aConfig);
     $aConfig['options'] = array();
     $aConfig['options']['limit10'] = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10, 11 => 11, 12 => 12, 13 => 13, 14 => 14, 15 => 15);
     $aData = $aConfig;
     $aData['tabs'] = array('general' => array('t' => 'Общие настройки', 'a' => 0), 'files' => array('t' => 'Загрузка файлов', 'a' => 0), 'add_instruction' => array('t' => 'Инструкция при добавлении', 'a' => 0));
     $aData['tabs'][$sCurrentTab]['a'] = 1;
     $this->tplAssign('tab', $sCurrentTab);
     $this->tplAssignByRef('aData', $aData);
     $this->adminCustomCenterArea();
     $this->includeJS('wysiwyg');
     return $this->tplFetch('admin.settings.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:37,代码来源:bbs.adm.class.php

示例9: login

 function login()
 {
     if ($this->security->haveAccessToAdminPanel()) {
         $this->adminRedirect(null, 'profile');
     }
     $sLogin = '';
     if (bff::$isPost) {
         $sLogin = func::POST('login', true);
         if (!$sLogin) {
             $this->errors->set('no_login');
         }
         $sPassword = func::POST('password', true);
         if (!$sPassword) {
             $this->errors->set('no_password');
         }
         if ($this->errors->no()) {
             $sPassword = $this->security->getUserPasswordMD5($sPassword);
             $sQuery = 'SELECT user_id, login, email, name, avatar, admin, cat FROM ' . TABLE_USERS . '
                        WHERE login = ' . $this->db->str2sql($sLogin) . ' AND password = ' . $this->db->str2sql($sPassword) . '
                        LIMIT 1';
             $aUserData = $this->db->one_array($sQuery);
             if (!$aUserData) {
                 $this->errors->set('login_and_password_unknow', '', false, $sLogin);
             } else {
                 $nUserID = $aUserData['user_id'];
                 if (bff::i()->Ban_checkBan(Func::getRemoteAddress(), false, false, true)) {
                     $this->errors->set(Errors::ACCESSDENIED);
                 } else {
                     if (!$this->security->haveAccessToAdminPanel($nUserID)) {
                         $this->errors->set(Errors::ACCESSDENIED);
                     }
                 }
                 if ($this->errors->no()) {
                     $aUserGroups = $this->getUserGroups($nUserID, true);
                     //стартуем сессию администратора
                     session_set_cookie_params(0, '/admin/');
                     $this->security->sessionStart('a', false);
                     //update login_last_datetime, login_datetime to current time
                     $this->db->execute('UPDATE ' . TABLE_USERS . '
                                SET login_last_ts=login_ts, login_ts=' . $this->db->getNOW() . ', ip_login= ' . Func::getRemoteAddress(true) . ',
                                     session_id=' . $this->db->str2sql(session_id()) . '
                                WHERE user_id=' . $nUserID);
                     $this->security->setUserInfo($nUserID, $aUserData['login'], $aUserData['email'], $aUserGroups, array('avatar' => $aUserData['avatar'], 'name' => $aUserData['name'], 'surname' => $aUserData['surname'], 'admin' => $aUserData['admin'], 'cat' => explode(',', $aUserData['cat'])));
                     Func::JSRedirect('index.php');
                 }
             }
         }
     }
     $this->errors->assign();
     $this->tplAssign('login', $sLogin);
     $this->tplDisplay('login.tpl', TPL_PATH, '', '');
     exit(0);
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:53,代码来源:users.adm.class.php

示例10: rotateTablednd

 function rotateTablednd($sPrefix = 'dnd-')
 {
     do {
         /*
          * dragged  - перемещаемый елемент
          * target   - елемент 'до' или 'после' которого, оказался перемещаемый елемент (сосед)
          * position - новая позиция перемещаемого елемента относительно 'target' елемента
          */
         $nDraggedID = intval(str_replace($sPrefix, '', !empty($_POST['dragged']) ? $_POST['dragged'] : ''));
         if ($nDraggedID <= 0) {
             break;
         }
         $nNeighboorID = intval(str_replace($sPrefix, '', !empty($_POST['target']) ? $_POST['target'] : ''));
         if ($nNeighboorID <= 0) {
             break;
         }
         if (!($sPosition = func::POST('position', true))) {
             break;
         } elseif (!in_array($sPosition, array('after', 'before'))) {
             break;
         }
         $FirstNode = $this->getNodeInfo($nDraggedID);
         $aSecondNode = $this->getNodeInfo($nNeighboorID);
         return $this->changePosiotionAll($FirstNode, $aSecondNode, $sPosition);
     } while (false);
     return false;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:27,代码来源:nestedsets.php

示例11: categories_delete

 function categories_delete()
 {
     if (!$this->haveAccessTo('categories-edit')) {
         return $this->showAccessDenied();
     }
     if (($nRecordID = func::GETPOST('rec', false, true)) <= 0) {
         $this->adminRedirect(Errors::IMPOSSIBLE, 'categories_listing');
     }
     $aData = $this->db->one_array('SELECT FC.id, FC.title, COUNT(F.id) as cnt_items 
                FROM ' . TABLE_FAQ_CATEGORIES . ' FC
                     LEFT JOIN ' . TABLE_FAQ . ' F on FC.id=F.category_id
                WHERE FC.id=' . $nRecordID . '
                GROUP BY FC.id 
                LIMIT 1');
     if (!$aData) {
         $this->adminRedirect(Errors::IMPOSSIBLE, 'categories_listing');
     }
     if (func::isPostMethod()) {
         $nNextCategoryID = func::POST('next', false, true);
         if ($nNextCategoryID > 0) {
             //проверяем: ее ID не равен ID удаляемой, категория не является подкатегорией
             $nResultID = $this->db->one_data('SELECT id FROM ' . TABLE_FAQ_CATEGORIES . ' WHERE id=' . $nNextCategoryID . ' LIMIT 1');
             if ($nResultID != $nNextCategoryID || $nNextCategoryID == $nRecordID) {
                 $this->adminRedirect(Errors::IMPOSSIBLE, 'categories_listing');
             }
             //перемещаем вопросы
             $this->db->execute('UPDATE ' . TABLE_FAQ . ' SET category_id=' . $nNextCategoryID . ' WHERE category_id=' . $nRecordID);
             //удаляем категорию
             $this->db->execute('DELETE FROM ' . TABLE_FAQ_CATEGORIES . ' WHERE id=' . $nRecordID);
         } else {
             if ($aData['cnt_items']) {
                 //удаляем вопросы
                 $this->db->execute('DELETE FROM ' . TABLE_FAQ . ' WHERE category_id = ' . $nRecordID);
                 //удаляем категорию
                 $this->db->execute('DELETE FROM ' . TABLE_FAQ_CATEGORIES . ' WHERE id=' . $nRecordID);
             } else {
                 //удаляем категорию
                 $this->db->execute('DELETE FROM ' . TABLE_FAQ_CATEGORIES . ' WHERE id=' . $nRecordID);
             }
         }
         $this->adminRedirect(Errors::SUCCESSFULL, 'categories_listing');
     }
     $aData['categories'] = $this->getCategoriesOptions(0, false, array($nRecordID));
     $this->tplAssign('aData', $aData);
     return $this->tplFetch('admin.categories.delete.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:46,代码来源:faq.adm.class.php

示例12: forgotpass

 function forgotpass()
 {
     if (bff::$isAjax) {
         switch (func::POST('act')) {
             case 'changepass':
                 $p = $this->input->postm(array('c' => TYPE_STR, 'pass' => TYPE_STR, 'uid' => TYPE_UINT));
                 if (empty($p['c']) || strlen($p['c']) != 10 || !$p['uid']) {
                     $this->ajaxResponse(Errors::IMPOSSIBLE);
                 }
                 if (empty($p['pass']) || strlen($p['pass']) < 3) {
                     $this->errors->set('password_short');
                     //пароль слишком короткий
                     $this->ajaxResponse(null);
                 }
                 $aUserData = $this->db->one_array('SELECT user_id, activated, email FROM ' . TABLE_USERS . ' 
                                                 WHERE activatekey=' . $this->db->str2sql($p['c']) . ' AND user_id = ' . $p['uid'] . ' AND activated = 1 
                                                 LIMIT 1');
                 if (empty($aUserData)) {
                     $this->errors->set('password_link_not_valid');
                     $this->ajaxResponse(null);
                 } else {
                     $this->db->execute('UPDATE ' . TABLE_USERS . ' 
                                         SET activatekey = ' . $this->db->str2sql('') . ',
                                             password = ' . $this->db->str2sql($this->security->getUserPasswordMD5($p['pass'])) . '
                                         WHERE user_id = ' . $p['uid']);
                     $this->ajaxResponse(Errors::SUCCESSFULL);
                 }
                 break;
         }
         $this->ajaxResponse(Errors::IMPOSSIBLE);
     }
     $sCode = $this->input->get('c', TYPE_STR);
     $aUserData = array('user_id' => 0);
     do {
         if (empty($sCode) || strlen($sCode) != 10) {
             $this->errors->set('password_link_not_valid');
             break;
         }
         $aUserData = $this->db->one_array('SELECT user_id, email FROM ' . TABLE_USERS . ' 
                                         WHERE activatekey=' . $this->db->str2sql($sCode) . ' AND activated = 1 
                                         LIMIT 1');
         if (empty($aUserData)) {
             $this->errors->set('password_link_not_valid');
             break;
         }
     } while (false);
     $aUserData['c'] = $sCode;
     $this->errors->assign();
     $this->tplAssign('forgotData', $aUserData);
     return $this->tplFetch('forgotpass.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:51,代码来源:users.class.php

示例13: module_create

 function module_create()
 {
     if (!FORDEV) {
         return $this->showAccessDenied();
     }
     //получаем список существующих модулей
     $aModules = CDir::getDirs(PATH_MODULES, false, false, false);
     foreach ($aModules as $k => $v) {
         if ($v[0] != '.' && $v[0] != '_') {
             $aModules[$v] = $v;
         }
         unset($aModules[$k]);
     }
     $aData = array('modules' => $aModules, 'title' => '', 'languages' => '');
     if (func::isPostMethod()) {
         $aData['title'] = mb_strtolower(func::POST('title', true));
         $aData['languages'] = func::POST('languages', true);
         $aData['aLanguages'] = !empty($aData['languages']) ? explode(',', $aData['languages']) : array(LANG_DEFAULT);
         do {
             if (empty($aData['title'])) {
                 $this->errors->set('no_title');
                 break;
             }
             if (in_array($aData['title'], $aData['modules'])) {
                 $this->errors->set('title_exists');
                 break;
             }
             $sModuleName = ucfirst($aData['title']);
             $sModuleFileName = mb_strtolower($sModuleName);
             $sModulesPath = PATH_MODULES;
             if (file_exists($sModulesPath . $sModuleFileName . DIRECTORY_SEPARATOR . $sModuleName . '.class.php')) {
                 $this->errors->set('title_exists');
                 break;
             }
             $sModuleDirectory = $sModulesPath . $sModuleFileName . DIRECTORY_SEPARATOR;
             if (!@mkdir($sModuleDirectory, 0666)) {
                 $this->errors->set('create_dir_error', '', false, $sModulesPath . $sModuleFileName);
                 break;
             }
             //create Template Directories
             if (!@mkdir($sModuleDirectory . 'tpl', 0666)) {
                 $this->errors->set('create_dir_error', '', false, $sModuleDirectory . 'tpl');
                 break;
             }
             foreach ($aData['aLanguages'] as $lng) {
                 @mkdir($sModuleDirectory . 'tpl' . DIRECTORY_SEPARATOR . $lng . DIRECTORY_SEPARATOR, 0666);
             }
             //create Language Files [+directory]
             if (!@mkdir($sModuleDirectory . 'lang', 0666)) {
                 $this->errors->set('create_dir_error', '', false, $sModuleDirectory . 'lang');
                 break;
             }
             foreach ($aData['aLanguages'] as $lng) {
                 CDir::putFileContent($sModuleDirectory . 'lang' . DIRECTORY_SEPARATOR . "{$lng}.inc.php", "<?php\n" . ($lng != 'def' ? "include_once 'def.inc.php';" : '') . "\n\n");
             }
             //create BL file
             if (!CDir::putFileContent($sModuleDirectory . $sModuleFileName . '.bl.class.php', "<?php\n\nabstract class {$sModuleName}Base extends Module\n{\n    var \$securityKey = '" . md5(uniqid($sModuleName)) . "';\n}\n")) {
                 $this->errors->set('create_file_error', '', false, $sModuleFileName . '.bl.class.php');
                 break;
             }
             //create Menu file
             if (!CDir::putFileContent($sModuleDirectory . 'm.' . $sModuleFileName . '.class.php', "<?php\n\nclass M_{$sModuleName}\n{\n    function declareAdminMenu()\n    {\n        global \$oMenu;\n\n        \$oMenu->assign('{$sModuleName}', 'Список', '{$sModuleFileName}', 'listing', true, 1);\n\n    }\n\n}\n")) {
                 $this->errors->set('create_file_error', '', false, 'm.' . $sModuleFileName . '.class.php');
                 break;
             }
             //create Install.SQL file
             if (!CDir::putFileContent($sModuleDirectory . 'install.sql', "")) {
                 $this->errors->set('create_file_error', '', false, 'install.sql');
                 break;
             }
             //[create Admin directory]
             $sModuleAdmDirectory = $sModuleDirectory;
             //create Admin file
             if (!CDir::putFileContent($sModuleAdmDirectory . $sModuleFileName . '.adm.class.php', "<?php\n\nclass {$sModuleName} extends {$sModuleName}Base\n{\n\n\n}\n")) {
                 $this->errors->set('create_file_error', '', false, $sModuleFileName . '.adm.class.php');
                 break;
             }
             //create Frontend file
             if (!CDir::putFileContent($sModuleDirectory . $sModuleFileName . '.class.php', "<?php\n\nclass {$sModuleName} extends {$sModuleName}Base\n{\n\n\n}\n")) {
                 $this->errors->set('create_file_error', '', false, $sModuleFileName . '.class.php');
                 break;
             }
             $this->adminRedirect(Errors::SUCCESSFULL, 'module_create');
         } while (false);
     }
     $this->tplAssign('aData', $aData);
     return $this->tplFetch('admin.module.create.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:88,代码来源:dev.adm.class.php

示例14: rotateTablednd

 function rotateTablednd($sTable, $sAdditionalQuery = '', $sIDField = 'id', $sOrderField = 'num', $bTree = false, $sPIDField = 'pid')
 {
     do {
         /*
          * dragged  - перемещаемый елемент
          * target   - елемент 'до' или 'после' которого, оказался перемещаемый елемент (сосед)
          * position - новая позиция перемещаемого елемента относительно 'target' елемента
          */
         $nDraggedID = intval(str_replace('dnd-', '', !empty($_POST['dragged']) ? $_POST['dragged'] : ''));
         if ($nDraggedID <= 0) {
             break;
         }
         $nNeighboorID = intval(str_replace('dnd-', '', !empty($_POST['target']) ? $_POST['target'] : ''));
         if ($nNeighboorID <= 0) {
             break;
         }
         if (!($sPosition = func::POST('position', true))) {
             break;
         } elseif (!in_array($sPosition, array('after', 'before'))) {
             break;
         }
         //сортируем
         $aNeighboorData = $this->one_array("SELECT {$sIDField}, {$sOrderField}" . ($bTree ? ", {$sPIDField}" : '') . " FROM {$sTable} WHERE {$sIDField}={$nNeighboorID} {$sAdditionalQuery} LIMIT 1");
         if (!$aNeighboorData) {
             return false;
         }
         if ($sPosition == 'before') {
             //before
             $this->execute("UPDATE {$sTable} SET {$sOrderField} = (CASE WHEN {$sIDField}={$nDraggedID} THEN {$aNeighboorData[$sOrderField]} ELSE {$sOrderField}+1 END) \n                                WHERE ({$sOrderField}>={$aNeighboorData[$sOrderField]} OR {$sIDField}={$nDraggedID}) \n                                      " . ($bTree ? " AND {$sPIDField} = " . $aNeighboorData[$sPIDField] : '') . " {$sAdditionalQuery}");
         } else {
             // after
             $this->execute("UPDATE {$sTable} SET {$sOrderField} = (CASE WHEN {$sIDField}={$nDraggedID} THEN {$aNeighboorData[$sOrderField]}+1 ELSE {$sOrderField}+1 END) \n                                WHERE ({$sOrderField}>{$aNeighboorData[$sOrderField]} OR {$sIDField}={$nDraggedID}) \n                                      " . ($bTree ? " AND {$sPIDField} = " . $aNeighboorData[$sPIDField] : '') . " {$sAdditionalQuery}");
         }
         return true;
     } while (false);
     return false;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:37,代码来源:database.php


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