示例#1
0
 function RestoreModules()
 {
     $arBackup = CControllerClient::GetBackup();
     if (isset($arBackup["modules"])) {
         $oModule = new CModule();
         $arWasInstalled = $arBackup["modules"];
         $arNowInstalled = array();
         $arm = CModule::_GetCache();
         foreach ($arm as $module_id => $tr) {
             $arNowInstalled[] = $module_id;
         }
         foreach ($arNowInstalled as $module_id) {
             if (!in_array($module_id, $arWasInstalled)) {
                 $oModule->MODULE_ID = $module_id;
                 $oModule->Remove();
             } else {
                 unset($arWasInstalled[array_search($module_id, $arWasInstalled)]);
             }
         }
         foreach ($arWasInstalled as $module_id) {
             $oModule->MODULE_ID = $module_id;
             $oModule->Add();
         }
         unset($arBackup["modules"]);
         CControllerClient::SetBackup($arBackup);
     }
 }
示例#2
0
 /**
  * Makes module classes and function available. Returns true on success.
  *
  * @param string $module_name
  * @return bool
  */
 public static function IncludeModule($module_name)
 {
     /** @noinspection PhpUnusedLocalVariableInspection */
     global $DB, $MESS;
     if (defined("SM_SAFE_MODE") && SM_SAFE_MODE === true) {
         if (!in_array($module_name, array("main", "fileman"))) {
             return false;
         }
     }
     if (isset(self::$includedModules[$module_name])) {
         return self::$includedModules[$module_name];
     }
     if (!self::$installedModules) {
         CModule::_GetCache();
     }
     if (!array_key_exists($module_name, self::$installedModules)) {
         self::$includedModules[$module_name] = false;
         return false;
     }
     if (!file_exists($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/" . $module_name . "/include.php")) {
         self::$includedModules[$module_name] = false;
         return false;
     }
     $res = (include_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/" . $module_name . "/include.php");
     if ($res === false) {
         self::$includedModules[$module_name] = false;
         return false;
     }
     self::$includedModules[$module_name] = true;
     return true;
 }
示例#3
0
 function IncludeModule($module_name)
 {
     global $DB, $MAIN_MODULE_INCLUDED, $MESS;
     if (defined("SM_SAFE_MODE") && SM_SAFE_MODE === true) {
         if (!in_array($module_name, array("main", "fileman"))) {
             return false;
         }
     }
     if (isset($MAIN_MODULE_INCLUDED[$module_name])) {
         return $MAIN_MODULE_INCLUDED[$module_name];
     }
     $arModules = CModule::_GetCache();
     if (!array_key_exists($module_name, $arModules)) {
         $MAIN_MODULE_INCLUDED[$module_name] = false;
         return false;
     }
     if (!file_exists($_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/" . $module_name . "/include.php")) {
         $MAIN_MODULE_INCLUDED[$module_name] = false;
         return false;
     }
     $res = (include_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/" . $module_name . "/include.php");
     if ($res === false) {
         $MAIN_MODULE_INCLUDED[$module_name] = false;
         return false;
     }
     $MAIN_MODULE_INCLUDED[$module_name] = true;
     return true;
 }
示例#4
0
 function GetList()
 {
     $result = new CDBResult();
     $result->InitFromArray(CModule::_GetCache());
     return $result;
 }