function saveConfigModuls() { global $mainPath; global $configModuls; //reindex the array $reordered = array(); foreach ($configModuls['moduls'] as $data) { unset($data['class']); $reordered[] = $data; } $configModuls['moduls'] = $reordered; //save the module data file_put_contents($mainPath . "/_py/config.moduls.json", json_encode($configModuls)); //reinit module classes initModules(); }
require 'class.permissionsMgr.php'; require 'class.absModule.php'; require 'class.modulesMgr.php'; require 'class.templatesMgr.php'; if (!class_exists('StructureManager')) { trigger_error('Required class [StructureManager] not found', PM_FATAL); } if (!class_exists('ModulesManager')) { trigger_error('Required class [ModulesManager] not found', PM_FATAL); } if (!class_exists('TemplatesManager')) { trigger_error('Required class [TemplatesManager] not found', PM_FATAL); } initStructure(); //$structureMgr will be created initModules(); //$modulesMgr will be created initTemplates(); //$templatesMgr will be created // initNotifications(); //$ntfMgr will be created initCache(); //$cacheMgr will be created initAuthentication(); //$authenticationMgr will be created initPermissions(); //$permissionsMgr will be created processRequest(); if (isset($_errors) && !GetCfg('SuppressErrors') && !empty($_errors)) { echoErrorBlock($_errors); } $stime = round(get_microtime() - $stime, 3);
<?php $params = array_merge(require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'); require __DIR__ . '/../../common/config/modules.php'; return ['id' => 'app-backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\\controllers', 'bootstrap' => ['log'], 'modules' => initModules('backend'), 'components' => ['user' => ['identityClass' => 'common\\models\\User', 'enableAutoLogin' => true], 'log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'flushInterval' => 1, 'targets' => [['class' => 'backend\\utils\\WMLogTarget', 'levels' => ['error', 'warning'], 'exportInterval' => 1]]], 'urlManager' => ['enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => ['api/mobile/check-bind' => 'mobile/check-bind', 'api/mobile/check-bind/<type>/<param:.*>' => 'mobile/check-bind', 'api/mobile/user-info' => 'mobile/user-info', 'api/mobile/user-info/<type>/<param:.*>' => 'mobile/user-info', 'api/mobile/openid' => 'mobile/openid', 'api/mobile/openid/<type>/<param:.*>' => 'mobile/openid', 'POST api/<controller:[\\w-]+>s' => '<controller>/create', 'api/<controller:[\\w-]+>s' => '<controller>/index', 'PUT api/<controller:[\\w-]+>/<id:[\\w\\d,]{24}>' => '<controller>/update', 'DELETE api/<controller:[\\w-]+>/<id:[\\w\\d]{24}(,[\\w\\d]{24})*>' => '<controller>/delete', 'api/<controller:[\\w-]+>/<id:[\\w\\d,]{24}>' => '<controller>/view', 'POST api/<module:\\w+>/<controller:[\\w-]+>s' => '<module>/<controller>/create', 'api/<module:\\w+>/<controller:[\\w-]+>s' => '<module>/<controller>/index', 'PUT api/<module:\\w+>/<controller:[\\w-]+>/<id:[\\w\\d,]{24}>' => '<module>/<controller>/update', 'DELETE api/<module:\\w+>/<controller:[\\w-]+>/<id:[\\w\\d]{24}(,[\\w\\d]{24})*>' => '<module>/<controller>/delete', 'api/<module:\\w+>/<controller:[\\w-]+>/<id:[\\w\\d,]{24}>' => '<module>/<controller>/view', 'api/<controller:[\\w-]+>/<action:[\\w-]+>/<id:[\\w\\d,]{24}>' => '<controller>/<action>', 'api/<module:\\w+>/<controller:[\\w-]+>/<action:[\\w-]+>/<id:[\\w\\d,]{24}(,[\\w\\d]{24})*>' => '<module>/<controller>/<action>', 'api/<module:\\w+>/<submodule:\\w+>/<controller:[\\w-]+>/<action:[\\w-]+>/<id:[\\w\\d,]{24}>' => '<module>/<submodule>/<controller>/<action>', 'api/<controller:[\\w-]+>/<action:[\\w-]+>' => '<controller>/<action>', 'api/<module:\\w+>/<controller:[\\w-]+>/<action:[\\w-]+>' => '<module>/<controller>/<action>', 'api/<module:\\w+>/<submodule:\\w+>/<controller:[\\w-]+>/<action:[\\w-]+>' => '<module>/<submodule>/<controller>/<action>']], 'urlService' => ['class' => '\\backend\\components\\UrlService', 'shortUrlDomain' => SHORT_URL_DOMAIN], 'staticPageService' => ['class' => '\\backend\\components\\page\\StaticPageService'], 'mail' => ['class' => '\\backend\\components\\mail\\Mailer', 'api_user' => SENDCLOUD_API_USER, 'api_key' => SENDCLOUD_API_KEY, 'from' => SENDCLOUD_FROM, 'fromname' => SENDCLOUD_FROM_NAME], 'response' => ['format' => yii\web\Response::FORMAT_JSON, 'charset' => 'UTF-8'], 'curl' => ['class' => '\\backend\\components\\Curl', 'options' => [CURLOPT_MAXREDIRS => 1]], 'tuisongbao' => ['class' => 'backend\\components\\Tuisongbao', 'domain' => TUISONGBAO_DOMAIN, 'appId' => TUISONGBAO_APP_ID, 'secret' => TUISONGBAO_SECRET, 'pushAppId' => TUISONGBAO_PUSH_APP_ID, 'pushSecret' => TUISONGBAO_PUSH_SECRET], 'weiboConnect' => ['class' => '\\backend\\components\\WeiboConnect', 'appKey' => WEIBO_APP_KEY, 'appSecret' => WEIBO_APP_SECRET, 'redirectUri' => WEIBO_REDIRECT_URI, 'sinaOauthDomain' => 'https://api.weibo.com/oauth2'], 'webhook' => ['class' => '\\backend\\components\\Webhook', 'domain' => WEBHOOK_DOMAIN], 'tradeService' => ['class' => 'backend\\components\\TradeService', 'weconnectDomain' => WECONNECT_DOMAIN]], 'params' => $params];
/** * @param string The position * @param int The style. 0=normal, 1=horiz, -1=no wrapper */ function mosLoadModules($position = 'left', $style = 0) { global $mosConfig_gzip, $mosConfig_absolute_path, $database, $my, $Itemid, $mosConfig_caching; $tp = mosGetParam($_GET, 'tp', 0); if ($tp) { echo '<div style="height:50px;background-color:#eee;margin:2px;padding:10px;border:1px solid #f00;color:#700;">'; echo $position; echo '</div>'; return; } $style = intval($style); $cache =& mosCache::getCache('com_content'); require_once 'includes/frontend.html.php'; /* $query = "SELECT id, title, module, position, content, showtitle, params" ."\nFROM #__modules AS m, #__modules_menu AS mm" . "\nWHERE m.published='1' AND m.access <= '$my->gid' AND m.position='$position' AND m.client_id='0'" . "\nAND mm.moduleid=m.id" . "\nAND (mm.menuid = '$Itemid' OR mm.menuid = '0')" . "\nORDER BY ordering"; $database->setQuery( $query ); $modules = $database->loadObjectList(); if($database->getErrorNum()) { echo "MA ".$database->stderr(true); return; } */ $allModules =& initModules(); if (isset($GLOBALS['_MOS_MODULES'][$position])) { $modules = $GLOBALS['_MOS_MODULES'][$position]; } else { $modules = array(); } if (count($modules) < 1) { $style = 0; } if ($style == 1) { echo "<table cellspacing=\"1\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n"; echo "<tr>\n"; } $prepend = $style == 1 ? "<td valign=\"top\">\n" : ''; $postpend = $style == 1 ? "</td>\n" : ''; foreach ($modules as $module) { $params =& new mosParameters($module->params); echo $prepend; if (substr("{$module->module}", 0, 4) == "mod_") { if ($params->get('cache') == 1 && $mosConfig_caching == 1) { $cache->call('modules_html::module2', $module, $params, $Itemid, $style); } else { modules_html::module2($module, $params, $Itemid, $style); } } else { if ($params->get('cache') == 1 && $mosConfig_caching == 1) { $cache->call('modules_html::module', $module, $params, $Itemid, $style); } else { modules_html::module($module, $params, $Itemid, $style); } } echo $postpend; } if ($style == 1) { echo "</tr>\n</table>\n"; } }
<?php $params = array_merge(require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'); require __DIR__ . '/../../common/config/modules.php'; return ['id' => 'app-console', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'controllerNamespace' => 'console\\controllers', 'modules' => initModules('console'), 'components' => ['log' => ['targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error']]]], 'urlService' => ['class' => '\\backend\\components\\UrlService', 'shortUrlDomain' => SHORT_URL_DOMAIN], 'curl' => ['class' => '\\backend\\components\\Curl', 'options' => [CURLOPT_MAXREDIRS => 1]], 'tuisongbao' => ['class' => 'backend\\components\\Tuisongbao', 'domain' => TUISONGBAO_DOMAIN, 'appId' => TUISONGBAO_APP_ID, 'secret' => TUISONGBAO_SECRET, 'pushAppId' => TUISONGBAO_PUSH_APP_ID, 'pushSecret' => TUISONGBAO_PUSH_SECRET], 'i18n' => ['translations' => ['*' => ['class' => 'yii\\i18n\\PhpMessageSource', 'sourceLanguage' => 'en-US', 'basePath' => '@backend/messages']]]], 'params' => $params];
/** * @param string The position * @param int The style. 0=normal, 1=horiz, -1=no wrapper */ function mosLoadModules($position = 'left', $style = 0) { global $mosConfig_gzip, $mosConfig_absolute_path, $database, $my, $Itemid, $mosConfig_caching; $tp = intval(mosGetParam($_GET, 'tp', 0)); if ($tp) { echo '<div style="height:50px;background-color:#eee;margin:2px;padding:10px;border:1px solid #f00;color:#700;">'; echo $position; echo '</div>'; return; } $style = intval($style); $cache =& mosCache::getCache('com_content'); require_once $mosConfig_absolute_path . '/includes/frontend.html.php'; $allModules =& initModules(); if (isset($GLOBALS['_MOS_MODULES'][$position])) { $modules = $GLOBALS['_MOS_MODULES'][$position]; } else { $modules = array(); } if (count($modules) < 1) { $style = 0; } if ($style == 1) { echo "<table cellspacing=\"1\" cellpadding=\"0\" border=\"0\" width=\"100%\">\n"; echo "<tr>\n"; } $prepend = $style == 1 ? "<td valign=\"top\">\n" : ''; $postpend = $style == 1 ? "</td>\n" : ''; $count = 1; foreach ($modules as $module) { $params = new mosParameters($module->params); echo $prepend; if (substr("{$module->module}", 0, 4) == 'mod_') { // normal modules if ($params->get('cache') == 1 && $mosConfig_caching == 1) { // module caching $cache->call('modules_html::module2', $module, $params, $Itemid, $style, $my->gid); } else { modules_html::module2($module, $params, $Itemid, $style, $count); } } else { // custom or new modules if ($params->get('cache') == 1 && $mosConfig_caching == 1) { // module caching $cache->call('modules_html::module', $module, $params, $Itemid, $style, 0, $my->gid); } else { modules_html::module($module, $params, $Itemid, $style); } } echo $postpend; $count++; } if ($style == 1) { echo "</tr>\n</table>\n"; } }
<?php $params = array_merge(require __DIR__ . '/../../common/config/params.php', require __DIR__ . '/../../common/config/params-local.php', require __DIR__ . '/params.php', require __DIR__ . '/params-local.php'); require __DIR__ . '/../../common/config/modules.php'; return ['id' => 'app-webapp', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'modules' => initModules('webapp'), 'components' => ['log' => ['traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [['class' => 'yii\\log\\FileTarget', 'levels' => ['error', 'warning']]]], 'urlManager' => ['enablePrettyUrl' => true, 'enableStrictParsing' => true, 'showScriptName' => false, 'rules' => ['webapp/common/pay/<module:[\\w\\/-]+>' => '<module>/<module>/pay', 'webapp/<module:\\w+>/<controller:[\\w-]+>/<action:[\\w-]+>/<id:[\\w\\d,]{24}(,[\\w\\d]{24})*>' => '<module>/<controller>/<action>', 'webapp/<module:\\w+>/<submodule:\\w+>/<controller:[\\w-]+>/<action:[\\w-]+>/<id:[\\w\\d,]{24}>' => '<module>/<submodule>/<controller>/<action>', 'webapp/<module:\\w+>/<controller:[\\w-]+>/<action:[\\w-]+>/<page:[\\w\\/-]+>' => '<module>/<controller>/<action>', 'webapp/<module:\\w+>/<submodule:\\w+>/<controller:[\\w-]+>/<action:[\\w-]+>/<page:[\\w\\/-]+>' => '<module>/<submodule>/<controller>/<action>', 'webapp/<module:\\w+>/<controller:[\\w-]+>/<action:[\\w-]+>' => '<module>/<controller>/<action>', 'webapp/<module:\\w+>/<submodule:\\w+>/<controller:[\\w-]+>/<action:[\\w-]+>' => '<module>/<submodule>/<controller>/<action>']], 'curl' => ['class' => '\\backend\\components\\Curl', 'options' => [CURLOPT_MAXREDIRS => 1]]], 'params' => $params];