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


PHP func::isPostMethod方法代码示例

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


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

示例1: init

 /**
  * @return bffBase object
  */
 function init($isFrontend = true)
 {
     global $oDb, $oSm, $oSecurity;
     self::$isFrontend = $isFrontend;
     self::$isAjax = func::isAjaxRequest();
     self::$isPost = func::isPostMethod();
     if ($isFrontend) {
         define('TPL_PATH', PATH_BASE . 'tpl/main/');
         $oSm->template_dir = TPL_PATH;
     } else {
         define('TPL_PATH', PATH_BASE . 'tpl/main/admin/');
         define('THEME_URL', SITEURL . '/styles/default');
         //default admin theme!
         $oSm->template_dir = TPL_PATH;
     }
     spl_autoload_register(array('bffBase', 'autoload'));
     $oSecurity->checkExpired();
     if (!defined('THEME_URL')) {
         define('THEME_URL', SITEURL . '/styles/' . THEMES_DEFAULTTHEME_KEY);
     }
     $oSm->assign('theme_url', THEME_URL);
     $oSm->assign('class', self::$class = substr(strtolower(func::GETPOST('s')), 0, 30));
     $oSm->assign('event', self::$event = substr(strtolower(func::GETPOST('ev')), 0, 30));
     $oSm->assign_by_ref('tplJSIncludes', self::$includesJS);
     $oSm->assign_by_ref('tplCSSIncludes', self::$includesCSS);
     bff::initApp($isFrontend);
     return $this;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:31,代码来源:bff.base.php

示例2: group_edit

 function group_edit()
 {
     if (!FORDEV && !$this->manageNonSystemGroups) {
         return $this->showAccessDenied();
     }
     if (!$this->haveAccessTo('groups-edit')) {
         return $this->showAccessDenied();
     }
     $aData = array();
     if (!($nGroupID = $this->input->id())) {
         $this->adminRedirect(Errors::IMPOSSIBLE, 'group_listing');
     }
     $aGroupInfo = $this->getGroup($nGroupID);
     if ($aGroupInfo && $aGroupInfo['issystem'] && !FORDEV) {
         return $this->showAccessDenied();
     }
     if (func::isPostMethod()) {
         $this->input->postm(array('title' => TYPE_STR, 'keyword' => TYPE_STR, 'adminpanel' => TYPE_BOOL, 'color' => TYPE_STR, 'issystem' => TYPE_BOOL), $aData);
         if (!$aData['title']) {
             $this->errors->set('no_group_title');
         }
         if (empty($aData['keyword'])) {
             $this->errors->set('no_group_keyword');
         } else {
             $aData['keyword'] = mb_strtolower($aData['keyword']);
             if ($this->isGroupKeywordExists($aData['keyword'])) {
                 $this->errors->set('group_keyword_exists');
             }
         }
         if (empty($aData['color'])) {
             $aData['color'] = '#000';
         }
         if ($this->errors->no()) {
             $sQueryAdd = '';
             if (isset($aData['keyword']) && $aData['keyword']) {
                 $sQueryAdd .= ' keyword = ' . $this->db->str2sql($aData['keyword']) . ', ';
             }
             $this->db->execute('UPDATE ' . TABLE_USERS_GROUPS . '
                         SET title = ' . $this->db->str2sql($aData['title']) . ',
                             color = ' . $this->db->str2sql($aData['color']) . ',
                             adminpanel = ' . $aData['adminpanel'] . ',
                             ' . (FORDEV ? 'issystem = ' . $this->db->str2sql($aData['issystem']) . ', ' : '') . '
                             ' . $sQueryAdd . ' modified = ' . $this->db->getNOW() . '
                         WHERE group_id=' . $nGroupID);
             $this->adminRedirect(Errors::SUCCESSFULL, 'group_listing');
         }
     } else {
         $aData = $aGroupInfo;
     }
     $aData['deletable'] = !in_array($nGroupID, array(self::GROUPID_MEMBER, self::GROUPID_MODERATOR, self::GROUPID_SUPERADMIN));
     $this->tplAssign('aData', $aData);
     return $this->tplFetch('admin.group.form.tpl', PATH_CORE . 'modules/users/tpl/' . LANG_DEFAULT . '/');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:53,代码来源:users.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: subscribe

 function subscribe()
 {
     $aData = array();
     if (func::isPostMethod()) {
         $this->input->postm(array('name' => TYPE_NOHTML, 'email' => TYPE_NOHTML), $aData);
         $sEmail =& $aData['email'];
         if (!$aData['name']) {
             $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 ($this->isSubscribed($sEmail)) {
             $this->errors->set('subscriber_email_exists');
         }
         if ($this->errors->no()) {
             $this->db->execute('INSERT INTO ' . DB_PREFIX . 'subscribers (name, email, create_datetime)
                         VALUES (' . $this->db->str2sql($aData['name']) . ', ' . $this->db->str2sql($sEmail) . ', ' . $this->db->getNOW() . ')');
         }
     }
     Func::JSRedirect('/');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:23,代码来源:sendmail.class.php

示例5: 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

示例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_regions

 function cities_regions()
 {
     if (!$this->haveAccessTo('cities')) {
         return $this->showAccessDenied();
     }
     $nCityID = $this->input->id('city');
     if (bff::$isAjax) {
         $nRegionID = $this->input->id('region', 'p');
         if (!$nCityID || !$nRegionID) {
             $this->ajaxResponse(Errors::IMPOSSIBLE);
         }
         switch (func::GET('act')) {
             case 'edit':
                 $aRegionData = $this->db->one_array('SELECT * FROM ' . TABLE_REGION . ' WHERE region_id=' . $nRegionID . ' AND city_id=' . $nCityID);
                 $this->ajaxResponse($aRegionData);
                 break;
             case 'delete':
                 $this->db->execute('DELETE FROM ' . TABLE_REGION . ' WHERE region_id=' . $nRegionID . ' AND city_id=' . $nCityID);
                 $this->geoRegionsCacheDelete($nCityID);
                 $this->ajaxResponse(Errors::SUCCESS);
                 break;
         }
         $this->ajaxResponse(Errors::IMPOSSIBLE);
     }
     if ($nCityID && func::isPostMethod()) {
         switch (func::POSTGET('act')) {
             case 'add':
                 $sYBounds = Func::POSTGET('ybounds', true);
                 $sYPoly = Func::POSTGET('ypoly', true);
                 $sTitle = func::POSTGET('title', true);
                 if (empty($sTitle)) {
                     $this->errors->set('empty:title');
                 }
                 if ($this->errors->no()) {
                     $this->db->execute('INSERT INTO ' . TABLE_REGION . ' (city_id, title, ybounds, ypoly) 
                         VALUES(' . $nCityID . ',' . $this->db->str2sql($sTitle) . ',' . $this->db->str2sql($sYBounds) . ',' . $this->db->str2sql($sYPoly) . ')');
                     $this->geoRegionsCacheDelete($nCityID);
                 }
                 break;
             case 'add_many':
                 $aRegionBounds = Func::POSTGET('regionbounds', false);
                 $aRegionPoly = Func::POSTGET('regionpoly', false);
                 if (!empty($aRegionBounds)) {
                     $aRegions = array();
                     foreach ($aRegionBounds as $k => $v) {
                         $aRegions[$k] = array('ybounds' => $v, 'ypoly' => isset($aRegionPoly[$k]) ? $aRegionPoly[$k] : '');
                     }
                     $aExistentRegions = $this->db->select_one_column('SELECT title FROM ' . TABLE_REGION . ' WHERE city_id=' . $nCityID);
                     $aQueryRegions = array();
                     foreach ($aRegions as $title => $v) {
                         if (!in_array($title, $aExistentRegions)) {
                             $aQueryRegions[] = '(' . $nCityID . ',' . $this->db->str2sql($title) . ',' . $this->db->str2sql($v['ybounds']) . ',' . $this->db->str2sql($v['ypoly']) . ')';
                         }
                     }
                     if (!empty($aQueryRegions)) {
                         $this->db->execute('INSERT INTO ' . TABLE_REGION . ' (city_id, title, ybounds, ypoly) 
                             VALUES' . implode(',', $aQueryRegions));
                         $this->geoRegionsCacheDelete($nCityID);
                     }
                 }
                 break;
             case 'edit':
                 $this->input->postm(array('region' => TYPE_UINT, 'title' => TYPE_STR, 'ybounds' => TYPE_STR, 'ypoly' => TYPE_STR), $aData, array('title'));
                 if (!$nRegionID) {
                     $this->errors->set(Errors::UNKNOWNRECORD);
                 }
                 if ($this->errors->no()) {
                     $this->db->execute('UPDATE ' . TABLE_REGION . ' 
                         SET title = ' . $this->db->str2sql($aData['title']) . ',
                             ybounds = ' . $this->db->str2sql($aData['ybounds']) . ',
                             ypoly = ' . $this->db->str2sql($aData['ypoly']) . '
                         WHERE region_id=' . $aData['region'] . ' AND city_id = ' . $nCityID);
                     $this->geoRegionsCacheDelete($nCityID);
                 }
                 break;
         }
         $this->adminRedirect('', 'cities_edit&rec=' . $nCityID);
     }
     $this->adminRedirect(Errors::IMPOSSIBLE, 'cities_edit&rec=' . $nCityID);
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:80,代码来源:sites.adm.class.php

示例8: member_edit

 function member_edit()
 {
     if (!$this->haveAccessTo('members-edit')) {
         return $this->showAccessDenied();
     }
     if (!($nRecordID = $this->input->id())) {
         $this->adminRedirect(Errors::IMPOSSIBLE, 'listing');
     }
     $sTUID = func::GET('tuid');
     if (!$this->checkTUID($sTUID, $nRecordID)) {
         return $this->showAccessDenied();
     }
     $aData = array('admin' => 0);
     if (func::isPostMethod()) {
         $this->input->postm(array('name' => TYPE_STR, 'email' => TYPE_STR, 'changepass' => TYPE_BOOL, 'password' => TYPE_STR, 'skype' => TYPE_STR, 'email2' => TYPE_STR, 'phone' => TYPE_STR), $aData);
         if (empty($aData['email'])) {
             $this->errors->set('empty:email');
         } elseif (!func::IsEmailAddress($aData['email'])) {
             $this->errors->set('wrong:email');
         }
         if ($aData['changepass']) {
             if (empty($aData['password'])) {
                 $this->errors->set('empty:password');
             } else {
                 $aData['password'] = $this->security->getUserPasswordMD5($aData['password']);
             }
         } else {
             unset($aData['password']);
         }
         //            if($aData['city_id']<=0)
         //                $this->errors->set('wrong:city');
         $aData['email_hash'] = func::getEmailHash($aData['email']);
         if ($this->isEmailExists($aData['email_hash'], $nRecordID)) {
             $this->errors->set('email_exist');
         }
         if ($this->errors->no()) {
             #update user data
             unset($aData['changepass']);
             $aData['member'] = 1;
             $aData['login'] = $aData['email'];
             $this->userUpdate($nRecordID, $aData);
             $avatar = new CAvatar(TABLE_USERS, USERS_AVATAR_PATH, 'avatar', 'user_id');
             $avatar->update($nRecordID, true, true);
             $this->adminRedirect(Errors::SUCCESSFULL, (!func::GET('members') ? 'admin_' : '') . 'listing');
         }
     }
     $aUserInfo = $this->db->one_array('SELECT U.*, C.title as city, R.region_id, R.title as region 
                                     FROM ' . TABLE_USERS . ' U
                                     LEFT JOIN ' . TABLE_CITY . ' C   ON U.city_id=C.city_id
                                     LEFT JOIN ' . TABLE_REGION . ' R ON C.region_id=R.region_id
                                    WHERE U.user_id=' . $nRecordID . ' LIMIT 1');
     $aData = func::array_2_htmlspecialchars(array_merge($aUserInfo, $aData), null, true);
     $aData['social_link'] = '';
     if ($aData['social']) {
         switch ($aData['social']) {
             case 'vk':
                 $aData['social_link'] = 'http://vkontakte.ru/id' . $aData['vk_id'];
         }
     }
     $aData['tuid'] = $sTUID;
     $aData['edit'] = true;
     $this->tplAssignByRef('aData', $aData);
     return $this->tplFetch('admin.member.form.tpl');
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:64,代码来源:users.adm.class.php

示例9: 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

示例10: uploadImages

 /** 
  * Загрузка файлов изображений, при помощи input=file
  * @param integer ID записи
  * @param integer кол-во букв в сгенерированном имени файла
  * @return string имена загруженных файлов @example: '1.jpg,2.jpg' (CSV)
  */
 function uploadImages($ID, $nGenerateLettersCount = 5)
 {
     $aFilenames = array();
     if (func::isPostMethod()) {
         $ID = intval($ID);
         if (empty($nGenerateLettersCount)) {
             $nGenerateLettersCount = 5;
         }
         foreach ($_FILES as $sInputName => $aFile) {
             if ($aFile['name'] != '') {
                 $pUpload = new Upload($sInputName);
                 $aImageSize = getimagesize($pUpload->getFilenameUploaded());
                 if ($aImageSize !== FALSE && $pUpload->isSuccessfull() && in_array($aImageSize[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
                     $sExtension = func::image_type_to_extension($aImageSize[2], false);
                     $sFilename = Func::generateRandomName($nGenerateLettersCount, false, true);
                     $sFilenameFull = "{$sFilename}.{$sExtension}";
                     if ($this->saveImageFile($ID, $sFilenameFull, $pUpload, array('name' => $sFilename, 'ext' => $sExtension))) {
                         $aFilenames[] = $sFilenameFull;
                     }
                 }
             }
         }
     }
     if (count($aFilenames) > 0) {
         $sFilenames = implode(',', $aFilenames);
     }
     return isset($sFilenames) ? $sFilenames : '';
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:34,代码来源:imagesfield.php

示例11: 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


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