function processing()
 {
     $oModules = new BxDolModuleDb();
     $aModules = $oModules->getModules();
     $aResult = array();
     foreach ($aModules as $aModule) {
         $aCheckInfo = BxDolInstallerUi::checkForUpdates($aModule);
         if (isset($aCheckInfo['version'])) {
             $aResult[] = _t('_adm_txt_modules_update_text_ext', $aModule['title'], $aCheckInfo['version']);
         }
     }
     if (empty($aResult)) {
         return;
     }
     $aAdmins = $GLOBALS['MySQL']->getAll("SELECT * FROM `Profiles` WHERE `Role`&" . BX_DOL_ROLE_ADMIN . "<>0 AND `EmailNotify`='1'");
     if (empty($aAdmins)) {
         return;
     }
     $oEmailTemplate = new BxDolEmailTemplates();
     $sMessage = implode('<br />', $aResult);
     foreach ($aAdmins as $aAdmin) {
         $aTemplate = $oEmailTemplate->getTemplate('t_ModulesUpdates', $aAdmin['ID']);
         sendMail($aAdmin['Email'], $aTemplate['Subject'], $aTemplate['Body'], $aAdmin['ID'], array('MessageText' => $sMessage));
     }
 }
 function getNotInstalled($sResult)
 {
     //--- Get Items ---//
     $oModules = new BxDolModuleDb();
     $aModules = $oModules->getModules();
     $aInstalled = array();
     foreach ($aModules as $aModule) {
         $aInstalled[] = $aModule['path'];
     }
     $aNotInstalled = array();
     $sPath = BX_DIRECTORY_PATH_ROOT . 'modules/';
     if ($rHandleVendor = opendir($sPath)) {
         while (($sVendor = readdir($rHandleVendor)) !== false) {
             if (substr($sVendor, 0, 1) == '.' || !is_dir($sPath . $sVendor)) {
                 continue;
             }
             if ($rHandleModule = opendir($sPath . $sVendor)) {
                 while (($sModule = readdir($rHandleModule)) !== false) {
                     if (!is_dir($sPath . $sVendor . '/' . $sModule) || substr($sModule, 0, 1) == '.' || in_array($sVendor . '/' . $sModule . '/', $aInstalled)) {
                         continue;
                     }
                     $sConfigPath = $sPath . $sVendor . '/' . $sModule . '/install/config.php';
                     if (!file_exists($sConfigPath)) {
                         continue;
                     }
                     include $sConfigPath;
                     $aNotInstalled[$aConfig['title']] = array('name' => $aConfig['home_uri'], 'value' => $aConfig['home_dir'], 'title' => _t('_adm_txt_modules_title_module', $aConfig['title'], !empty($aConfig['version']) ? $aConfig['version'] : $this->_sDefVersion, $aConfig['vendor']), 'can_update' => '0', 'update' => '');
                 }
                 closedir($rHandleModule);
             }
         }
         closedir($rHandleVendor);
     }
     ksort($aNotInstalled);
     //--- Get Controls ---//
     $aButtons = array('modules-install' => _t('_adm_btn_modules_install'), 'modules-delete' => _t('_adm_btn_modules_delete'));
     $oZ = new BxDolAlerts('system', 'admin_modules_buttons', 0, 0, array('place' => 'uninstalled', 'buttons' => &$aButtons));
     $oZ->alert();
     $sControls = BxTemplSearchResult::showAdminActionsPanel('modules-not-installed-form', $aButtons, 'pathes');
     if (!empty($sResult)) {
         $sResult = MsgBox(_t($sResult), 10);
     }
     return $sResult . $GLOBALS['oAdmTemplate']->parseHtmlByName('modules_list.html', array('type' => 'not-installed', 'bx_repeat:items' => !empty($aNotInstalled) ? array_values($aNotInstalled) : MsgBox(_t('_Empty')), 'controls' => $sControls));
 }
 function _recompileLanguageForAllModules($iLangId)
 {
     $oDb = new BxDolModuleDb();
     $aLanguage = $GLOBALS['MySQL']->getRow("SELECT `ID` AS `id`, `Name` AS `name`, `Title` AS `title` FROM `sys_localization_languages` WHERE `ID` = {$iLangId}");
     if (!$aLanguage) {
         return false;
     }
     // save class properties
     $aSave['config'] = $this->_aConfig;
     $aSave['home_path'] = $this->_sHomePath;
     $aSave['module_path'] = $this->_sModulePath;
     $aModules = $oDb->getModules();
     foreach ($aModules as $a) {
         $aConfig = false;
         $bInclude = @(include BX_DIRECTORY_PATH_MODULES . $a['path'] . 'install/config.php');
         if (!$bInclude || !$aConfig) {
             continue;
         }
         $this->_aConfig = $aConfig;
         $this->_sHomePath = $this->_sBasePath . $aConfig['home_dir'];
         $this->_sModulePath = $this->_sBasePath . $aConfig['home_dir'];
         $b = $this->_updateLanguage(true, $aLanguage);
     }
     // restore class properties
     $this->_aConfig = $aSave['config'];
     $this->_sHomePath = $aSave['home_path'];
     $this->_sModulePath = $aSave['module_path'];
     return true;
 }
 protected function _checkPermissionsModules(&$aMessages)
 {
     $bRet = true;
     $oDbModules = new BxDolModuleDb();
     $aModules = $oDbModules->getModules();
     foreach ($aModules as $a) {
         if (empty($a['path']) || !(include BX_DIRECTORY_PATH_MODULES . $a['path'] . 'install/config.php')) {
             continue;
         }
         if (empty($aConfig['install_permissions']) || !is_array($aConfig['install_permissions']['writable'])) {
             continue;
         }
         foreach ($aConfig['install_permissions']['writable'] as $sPath) {
             $s = basename(BX_DIRECTORY_PATH_MODULES) . '/' . $a['path'] . $sPath;
             $sType = $this->_getFileType($s);
             $isOk = BX_DOL_PERM_EXE ? $this->isExecutable($s) : $this->isWritable($s);
             $aMessages[$s] = array('res' => $isOk ? BX_DOL_PERM_OK : BX_DOL_PERM_FAIL, 'type' => $sType);
             if (!$isOk && $bRet) {
                 $bRet = false;
             }
         }
     }
     return $bRet;
 }
 /**
  * Generate permissions table for modules
  * @param $iType - 1: folder, 2: file
  * @return HTML 
  */
 function GenPermTableForModules($iType)
 {
     $aList = array();
     bx_import('BxDolModuleDb');
     $oDbModules = new BxDolModuleDb();
     $aModules = $oDbModules->getModules();
     foreach ($aModules as $a) {
         if (empty($a['path']) || !(include BX_DIRECTORY_PATH_MODULES . $a['path'] . 'install/config.php')) {
             continue;
         }
         if (empty($aConfig['install_permissions']) || !is_array($aConfig['install_permissions']['writable'])) {
             continue;
         }
         foreach ($aConfig['install_permissions']['writable'] as $sPath) {
             if (1 == $iType && is_dir(BX_DIRECTORY_PATH_MODULES . $a['path'] . $sPath)) {
                 $aList[] = basename(BX_DIRECTORY_PATH_MODULES) . '/' . $a['path'] . $sPath;
             } elseif (2 == $iType && is_file(BX_DIRECTORY_PATH_MODULES . $a['path'] . $sPath)) {
                 $aList[] = basename(BX_DIRECTORY_PATH_MODULES) . '/' . $a['path'] . $sPath;
             }
         }
     }
     return $this->GenArrElemPerm($aList, $iType);
 }