Ejemplo n.º 1
0
 function renewJsonAction()
 {
     $extensions = RM_Environment::getInstance()->getOutOfDateExtensions();
     $pluginModel = new RM_Plugins();
     $pluginManager = new RM_Plugin_Manager($this->_translate);
     $failedPlugins = array();
     foreach ($extensions['plugins'] as $pluginName) {
         $plugin = $pluginModel->fetchByName($pluginName);
         try {
             $pluginManager->autoUpgrade($plugin);
         } catch (Exception $e) {
             $failedPlugins[] = $pluginName;
             continue;
         }
     }
     $moduleModel = new RM_Modules();
     $moduleManager = new RM_Module_Manager($this->_translate);
     $failedModules = array();
     foreach ($extensions['modules'] as $moduleName) {
         $module = $moduleModel->fetchByName($moduleName);
         try {
             $moduleManager->autoUpgrade($module);
         } catch (Exception $e) {
             $failedModules[] = $moduleName;
             continue;
         }
     }
     return array('data' => array('success' => true));
 }
Ejemplo n.º 2
0
 /**
  * Will initialize the full observers structure
  */
 private function _init()
 {
     $model = new RM_Modules();
     $modules = $model->fetchAllEnabled();
     $manager = new RM_Module_Manager();
     foreach ($modules as $module) {
         $moduleObject = $manager->getModule($module->name);
         //We will get the last enabled module in the system
         //that implements one of our internal interfaces
         if ($moduleObject instanceof RM_Notifications_Observer) {
             $this->_observers[] = $moduleObject;
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * Get the modules CSS and combine these
  */
 public function getModuleCSS()
 {
     $cacheDir = RM_Environment::getConnector()->getRootPath() . DIRECTORY_SEPARATOR . 'RM' . DIRECTORY_SEPARATOR . 'userdata' . DIRECTORY_SEPARATOR . 'temp' . DIRECTORY_SEPARATOR . 'css';
     if (is_dir($cacheDir) == false) {
         $rmConfig = new RM_Config();
         $chmodOctal = intval($rmConfig->getValue('rm_config_chmod_value'), 8);
         mkdir($cacheDir, $chmodOctal);
     }
     $cachedCSS = file_exists($cacheDir . DIRECTORY_SEPARATOR . "modules.css");
     if (!$cachedCSS) {
         $newfileContents = "";
         $moduleDAO = new RM_Modules();
         $modules = $moduleDAO->fetchAllEnabled();
         $config = new RM_Module_Config();
         foreach ($modules as $module) {
             $files = RM_Module_Manager::getCssFiles($module->name);
             foreach ($files as $file) {
                 // read in the css and change the relative paths then add to a cached css file that we will load
                 $fileContents = file_get_contents(RM_Environment::getConnector()->getRootURL() . "RM/userdata/modules/" . $module->name . "/" . RM_Module_Config::CSS . '/' . $file);
                 $search = "/url\\(([^\\)]*)\\)/";
                 $replace = "url(../../../userdata/modules/" . $module->name . "/images/\$1)";
                 $newfileContents .= preg_replace($search, $replace, $fileContents);
             }
         }
         $this->_saveCachedCSS($newfileContents, $cacheDir . DIRECTORY_SEPARATOR . "modules.css");
     }
     // return the cached CSS url so it can be included
     return RM_Environment::getConnector()->getRootURL() . "RM/userdata/temp/css/modules.css";
 }
Ejemplo n.º 4
0
 /**
  * Delete languages
  *
  * @param string $iso ISO language code     
  */
 public function deleteLanguage($iso)
 {
     $modules = RM_Module_Manager::getModules();
     foreach ($modules as $module) {
         $module->deleteLanguage($iso);
     }
 }
Ejemplo n.º 5
0
 /**
  * Private constructor that invokes only from 'getInstance' method
  */
 private function __construct()
 {
     $this->_initializeLocale();
     $model = new RM_Modules();
     $allModules = $model->fetchAll();
     $modules = $model->fetchAllEnabled();
     foreach ($modules as $module) {
         $moduleObject = RM_Module_Manager::getModule($module->name);
         //We will get the last enabled module in the system
         //that implements one of our internal interfaces
         if ($moduleObject instanceof RM_Payments_Interface) {
             $this->_paymentSystem = $moduleObject;
         }
         if ($moduleObject instanceof RM_Extras_Interface) {
             $this->_extrasSystems[] = $moduleObject;
         }
         if ($moduleObject instanceof RM_Others_Interface) {
             $this->_othersSystems[] = $moduleObject;
         }
         if ($moduleObject instanceof RM_SEF_Manager_Interface) {
             $this->_sefManager = $moduleObject;
         }
     }
     $pluginModel = new RM_Plugins();
     $allPlugins = $pluginModel->fetchAll();
     $plugins = $pluginModel->fetchAllEnabled();
     $this->_taxSystem = new RM_Taxes_Default();
     foreach ($plugins as $plugin) {
         $pluginObject = RM_Plugin_Manager::getPlugin($plugin->name);
         if ($pluginObject instanceof RM_Taxes_Interface) {
             $this->_taxSystem = $pluginObject;
         }
         if ($pluginObject instanceof RM_Discounts_Plugin_Interface) {
             $this->_discounts[] = $pluginObject;
         }
         //We will assign only one deposit system (the last one enabled)
         if ($pluginObject instanceof RM_Deposit_Plugin_Interface) {
             $this->_depositSystem = $pluginObject;
         }
     }
     $this->_initializeTranslate($allModules, $allPlugins);
 }
Ejemplo n.º 6
0
 /**
  * Initialize autoloading for modules and plugins
  */
 public function initAuloadMP()
 {
     $isSafeMode = $this->isSafeMode();
     $paths = array();
     $modulesDAO = new RM_Modules();
     $modules = $modulesDAO->fetchAll();
     foreach ($modules as $module) {
         if ($isSafeMode && $module->core == 0) {
             continue;
         }
         $bothPath = RM_Module_Manager::getModuleFolderpath($module->name, $this->_rootPath) . DIRECTORY_SEPARATOR;
         $paths[] = $bothPath . RM_Module_Config::CLASSES;
         $paths[] = $bothPath . RM_Module_Config::CONTROLLERS;
     }
     $pluginsDAO = new RM_Plugins();
     $plugins = $pluginsDAO->fetchAll();
     foreach ($plugins as $plugin) {
         if ($isSafeMode && $plugin->core == 0) {
             continue;
         }
         $bothPath = RM_Plugin_Manager::getPluginFolderpath($plugin->name, $this->_rootPath) . DIRECTORY_SEPARATOR;
         $paths[] = $bothPath . RM_Plugin_Config::CLASSES;
         $paths[] = $bothPath . RM_Plugin_Config::CONTROLLERS;
     }
     $MPPathString = implode(PATH_SEPARATOR, $paths);
     set_include_path(get_include_path() . PATH_SEPARATOR . $MPPathString);
 }
Ejemplo n.º 7
0
 public function disableJsonAction()
 {
     $json = new stdClass();
     $json->success = 1;
     $json->msg = array();
     $ids = $this->_getParam('ids', array());
     $manager = new RM_Module_Manager($this->_translate);
     $model = new RM_Modules();
     foreach ($ids as $id) {
         $row = $model->find($id)->current();
         try {
             $manager->disable($row);
         } catch (Exception $e) {
             $json->success = 0;
             $json->msg[] = $e->getMessage();
         }
     }
     return array('data' => $json);
 }
Ejemplo n.º 8
0
 /**
  * Add language to the system, laguage files need to be in there places on language folder
  *
  * @param string $iso
  */
 public function installLanguage($iso, $name)
 {
     $model = new RM_Languages();
     $language = array('iso' => $iso, 'name' => $name, 'icon' => $this->getIconPath($iso));
     $model->insert($language);
     //Here is a list of multilingual code models
     $model = new RM_UnitTypes();
     $model->addLanguage($iso);
     $unitModel = new RM_UnitLanguageDetails();
     $unitModel->addLanguage($iso);
     $templatesModel = new RM_Templates();
     $templatesModel->addLanguage($iso);
     $manager = new RM_Module_Manager();
     $manager->addLanguage($iso);
     $pluginManager = new RM_Plugin_Manager();
     $pluginManager->addLanguage($iso);
 }