Exemple #1
0
 function InstallLog($_str, $_path)
 {
     static $_isFirst = true;
     if ($_isFirst) {
         $_date = date('d/m/Y H:i:s');
     } else {
         $_date = @date('H:i:s') . '.' . (int) (ap_AddUtils::getmicrosec() * 1000);
     }
     @error_log(($_isFirst ? AP_CRLF : '') . '[' . $_date . '] ' . $_str . AP_CRLF, 3, $_path . '/logs/' . AP_INSTALL_LOG_FILE);
 }
Exemple #2
0
 function _initPath()
 {
     $_result = true;
     if (@file_exists(CAdminPanel::RootPath() . '/' . AP_CFG_FILE)) {
         $settings_path = null;
         include CAdminPanel::RootPath() . '/' . AP_CFG_FILE;
         if (isset($settings_path)) {
             if (is_array($settings_path) && count($settings_path) > 0) {
                 foreach ($settings_path as $_name => $_path) {
                     if (is_string($_path)) {
                         $this->_cfg[$_name . '_path'] = ap_AddUtils::GetFullPath($_path, CAdminPanel::RootPath());
                     }
                 }
                 $dataPath = null;
                 if (isset($this->_cfg['webmail_web_path'])) {
                     if (@file_exists($this->_cfg['webmail_web_path'] . '/inc_settings_path.php')) {
                         include $this->_cfg['webmail_web_path'] . '/inc_settings_path.php';
                     }
                     if (isset($dataPath) && $dataPath !== null) {
                         $dataPath = ap_AddUtils::GetFullPath($dataPath, $this->_cfg['webmail_web_path']);
                         if (!isset($this->_cfg['adminpanel_data_path'])) {
                             $this->_cfg['adminpanel_data_path'] = $dataPath;
                         }
                         $this->_cfg['webmail_data_path'] = $dataPath;
                     }
                 }
                 if (isset($this->_cfg['adminpanel_data_path'])) {
                     define('AP_DATA_FOLDER', $this->_cfg['adminpanel_data_path']);
                 }
                 unset($dataPath);
             }
         }
         unset($settings_path);
     } else {
         $_result = false;
     }
     if (!$_result) {
         $this->_ge();
     }
 }
Exemple #3
0
 /**
  * @return	bool
  */
 function _loadSettings()
 {
     $_ap =& $this->GetAp();
     $_webPath = $_ap->GetCfg('webmail_web_path');
     if ($_webPath === false) {
         return false;
     } else {
         if (!defined('CM_WEB_DIR')) {
             define('CM_WEB_DIR', $_webPath);
         }
     }
     unset($_webPath);
     if (@file_exists(CM_WEB_DIR . '/inc_settings_path.php')) {
         $dataPath = null;
         include CM_WEB_DIR . '/inc_settings_path.php';
         if ($dataPath !== null) {
             $dataPath = ap_AddUtils::GetFullPath($dataPath, CM_WEB_DIR);
             defined('CM_INI_DIR') || define('CM_INI_DIR', $dataPath);
         } else {
             return false;
         }
         unset($dataPath);
     } else {
         return false;
     }
     $this->_wm_settings = new WebMail_Settings(CM_INI_DIR, CM_WEB_DIR);
     return $this->_wm_settings && $this->_wm_settings->isLoad;
 }
Exemple #4
0
 /**
  * @return array|false
  */
 function InitPath(&$_initPathError)
 {
     $_cfg = array();
     $_result = true;
     if (@file_exists(RootPath() . '/' . AP_CFG_FILE)) {
         $settings_path = null;
         if (@(include RootPath() . '/' . AP_CFG_FILE) && isset($settings_path)) {
             if (is_array($settings_path) && count($settings_path) > 0) {
                 foreach ($settings_path as $_name => $_path) {
                     if (is_string($_path)) {
                         $_cfg[$_name . '_path'] = ap_AddUtils::GetFullPath($_path, RootPath());
                     }
                 }
                 $dataPath = null;
                 if (@isset($_cfg['webmail_web_path'])) {
                     if (@file_exists($_cfg['webmail_web_path'] . '/inc_settings_path.php')) {
                         if (@(include $_cfg['webmail_web_path'] . '/inc_settings_path.php') && isset($dataPath) && $dataPath !== null) {
                             $_cfg['webmail_data_path'] = ap_AddUtils::GetFullPath($dataPath, $_cfg['webmail_web_path']);
                         } else {
                             $_initPathError = 'Installer can\'t include ' . $_cfg['webmail_web_path'] . '/inc_settings_path.php file (probably, because PHP process does not have permissions to access inc_settings_path.php file or the file\'s content is incorrect).';
                         }
                     } else {
                         $_initPathError = $_cfg['webmail_web_path'] . '/inc_settings_path.php file doesn\'t exist (or PHP process does not have permissions to check this file for existance).';
                     }
                 } else {
                     $_initPathError = RootPath() . '/' . AP_CFG_FILE . ' file\'s content is incorrect.';
                 }
                 unset($dataPath);
             }
         } else {
             $_initPathError = 'Installer can\'t include ' . RootPath() . '/' . AP_CFG_FILE . ' file (probably, because PHP process does not have permissions to access ' . AP_CFG_FILE . ' file or the file\'s content is incorrect).';
         }
         unset($settings_path);
     } else {
         $_initPathError = RootPath() . '/' . AP_CFG_FILE . ' file doesn\'t exist (or PHP process does not have permissions to check this file for existance).';
         $_result = false;
     }
     return $_result ? $_cfg : false;
 }