case "validate":
     $errorCorrected = false;
     //correct first error of the array
     $errors = CMS_session::getSessionVar('patchErrors');
     $error = $errors[0];
     switch ($error['no']) {
         case 5:
             //try to update a protected file (UPDATE.DENY)
             if ($_POST["updated_file"]) {
                 $installParams = array_map("trim", explode("\t", $error['command']));
                 $updatedFile = new CMS_file(PATH_TMP_FS . $installParams[1]);
                 $updatedFile->setContent(trim($_POST["updated_file"]));
                 //add a flag file to mark file is updated
                 $flagFile = new CMS_file(PATH_TMP_FS . $installParams[1] . '.updated');
                 $flagFile->setContent('ok');
                 if ($updatedFile->writeToPersistence() && $flagFile->writeToPersistence()) {
                     $errorCorrected = true;
                 }
             } else {
                 $cms_message .= $cms_language->getMessage(MESSAGE_FORM_ERROR_MANDATORY_FIELDS);
             }
             break;
         default:
             $cms_message .= $cms_language->getMessage(MESSAGE_PAGE_ERROR_CANT_CORRECT);
             break;
     }
     if ($errorCorrected && !$cms_message) {
         unset($errors[0]);
     }
     if (!sizeof($errors)) {
         $dialog = new CMS_dialog();
Exemple #2
0
        }
    } else {
        $actionsTodo .= '- Add the following config in config.php file <br/>';
        $actionsTodo .= 'define("PATH_PAGES_HTML_WR", "' . PATH_REALROOT_WR . '/html");<br/>';
    }
}
# Create config for /automne_modules_files
if (is_dir(PATH_REALROOT_FS . '/automne_modules_files') && PATH_MODULES_FILES_FS == PATH_REALROOT_FS . '/files') {
    if ($configWritable) {
        $configFile = new CMS_file(PATH_REALROOT_FS . '/config.php');
        if ($configFile->exists()) {
            $configContent = $configFile->getContent();
            if (strpos($configContent, 'PATH_MODULES_FILES_WR') === false) {
                $configContent = str_replace('?>', '//Modules files dir (DO NOT CHANGE)' . "\n" . 'define("PATH_MODULES_FILES_WR", "' . PATH_REALROOT_WR . '/automne_modules_files");' . "\n" . '?>', $configContent);
                $configFile->setContent($configContent);
                $configFile->writeToPersistence();
                $actionsDone .= '- Add modules files directory constant PATH_MODULES_FILES_WR in config.php file <br/>';
            }
        }
    } else {
        $actionsTodo .= '- Add the following config in config.php file <br/>';
        $actionsTodo .= 'define("PATH_MODULES_FILES_WR", "' . PATH_REALROOT_WR . '/automne_modules_files");<br/>';
    }
}
if ($actionsTodo) {
    $content .= '<fieldset style="padding:3px;margin:3px;"><legend>/!\\ Warning : Remaining actions to be done manually to complete update :</legend>' . $actionsTodo . '</fieldset><br />';
}
if ($actionsDone) {
    $content .= '<fieldset style="padding:3px;margin:3px;"><legend>Update actions done :</legend>' . $actionsDone . '</fieldset><br />';
}
$content .= 'Directories successfuly updated.<br/><br/>';
Exemple #3
0
 /**
  * Write to disk the linx file, i.e. the content for the specified page.
  * Doesn't translates the atm-linx tags.
  * Also writes the "print" linx file
  *
  * @return boolean true on success, false on failure to write the content to this file.
  * @access private
  */
 function writeLinxFile()
 {
     $defaultLanguage = CMS_languagesCatalog::getDefaultLanguage();
     //get public page content (without linxes process)
     $pageContent = $this->getContent($defaultLanguage, PAGE_VISUALMODE_HTML_PUBLIC);
     //then write the page linx file
     $linxFile = new CMS_file($this->getLinxFilePath());
     $linxFile->setContent($pageContent);
     if (!$linxFile->writeToPersistence()) {
         $this->raiseError("Can't write linx file : " . $this->getLinxFilePath());
         return false;
     }
     //writes the "print" linx file if any
     if (USE_PRINT_PAGES && $this->_template->getPrintingClientSpaces()) {
         //get print page content (without linxes process)
         $printPageContent = $this->getContent($defaultLanguage, PAGE_VISUALMODE_PRINT);
         //then write the print page linx file
         $linxFile = new CMS_file($this->getLinxFilePath() . ".print", CMS_file::FILE_SYSTEM, CMS_file::TYPE_FILE);
         $linxFile->setContent($printPageContent);
         if (!$linxFile->writeToPersistence()) {
             $this->raiseError("Can't write print linx file : " . $this->getLinxFilePath() . ".print");
             return false;
         }
     }
     return true;
 }
Exemple #4
0
 /**
  * Parse the definition file as to get the client spaces
  *
  * @param CMS_modulesTags $modulesTreatment tags object treatment
  * @return string The error string from the parser, false if no error
  * @access private
  */
 protected function _parseDefinitionFile(&$modulesTreatment, $convert = null)
 {
     global $cms_language;
     if (!$this->_definitionFile) {
         return false;
     }
     $filename = PATH_TEMPLATES_FS . "/" . $this->_definitionFile;
     $tpl = new CMS_file(PATH_TEMPLATES_FS . "/" . $this->_definitionFile);
     if (!$tpl->exists()) {
         $this->raiseError('Can not found template file ' . PATH_TEMPLATES_FS . "/" . $this->_definitionFile);
         return false;
     }
     $definition = $tpl->readContent();
     //we need to remove doctype if any
     $definition = trim(preg_replace('#<!doctype[^>]*>#siU', '', $definition));
     $modulesTreatment->setDefinition($definition);
     //get client spaces modules codename
     $this->_clientSpacesTags = $modulesTreatment->getTags(array('atm-clientspace'), true);
     if (is_array($this->_clientSpacesTags)) {
         $modules = array();
         foreach ($this->_clientSpacesTags as $cs_tag) {
             if ($cs_tag->getAttribute("module")) {
                 $modules[] = $cs_tag->getAttribute("module");
             }
         }
         $blocks = $modulesTreatment->getTags(array('block'), true);
         foreach ($blocks as $block) {
             if ($block->getAttribute("module")) {
                 $modules[] = $block->getAttribute("module");
             } else {
                 return $cms_language->getMessage(self::MESSAGE_TPL_SYNTAX_ERROR, array($cms_language->getMessage(self::MESSAGE_BLOCK_SYNTAX_ERROR)));
             }
         }
         $modules = array_unique($modules);
         $this->_modules->emptyStack();
         foreach ($modules as $module) {
             $this->_modules->add($module);
         }
         if ($convert !== null) {
             $tplConverted = false;
             foreach ($modules as $moduleCodename) {
                 if (CMS_modulesCatalog::isPolymod($moduleCodename)) {
                     $tplConverted = true;
                     $module = CMS_modulesCatalog::getByCodename($moduleCodename);
                     $definition = $module->convertDefinitionString($definition, $convert == self::CONVERT_TO_HUMAN);
                 }
             }
             if ($tplConverted) {
                 //check definition parsing
                 $parsing = new CMS_polymod_definition_parsing($definition, true, CMS_polymod_definition_parsing::CHECK_PARSING_MODE);
                 $errors = $parsing->getParsingError();
                 if ($errors) {
                     return $cms_language->getMessage(self::MESSAGE_TPL_SYNTAX_ERROR, array($errors));
                 }
                 $filename = $this->getDefinitionFile();
                 $file = new CMS_file(PATH_TEMPLATES_FS . "/" . $filename);
                 $file->setContent($definition);
                 $file->writeToPersistence();
             }
         }
         return true;
     } else {
         $this->raiseError("Malformed definition file : " . $this->_definitionFile . "<br />" . $modulesTreatment->getParsingError());
         return $modulesTreatment->getParsingError();
     }
 }
Exemple #5
0
 /**
  * Sets the definition from a string. Must write the definition to file and try to parse it
  * The file must be in a specific directory : PATH_TEMPLATES_ROWS_FS (see constants from rc file)
  *
  * @param string $definition The definition
  * @param boolean $haltOnPolymodParsing Stop setting definition if error on polymod parsing are found (default : true)
  * @return boolean true on success, false on failure
  * @access public
  */
 function setDefinition($definition, $haltOnPolymodParsing = true)
 {
     global $cms_language;
     $defXML = new CMS_DOMDocument();
     try {
         $defXML->loadXML($definition);
     } catch (DOMException $e) {
         return $cms_language->getMessage(self::MESSAGE_PAGE_ROW_SYNTAX_ERROR, array($e->getMessage()));
     }
     $blocks = $defXML->getElementsByTagName('block');
     $modules = array();
     foreach ($blocks as $block) {
         if ($block->hasAttribute("module")) {
             $modules[] = $block->getAttribute("module");
         } else {
             return $cms_language->getMessage(self::MESSAGE_PAGE_ROW_SYNTAX_ERROR, array($cms_language->getMessage(self::MESSAGE_PAGE_BLOCK_SYNTAX_ERROR)));
         }
     }
     $modules = array_unique($modules);
     $this->_modules->emptyStack();
     foreach ($modules as $module) {
         $this->_modules->add($module);
     }
     //check if rows use a polymod block, if so pass to module for variables conversion
     $rowConverted = false;
     foreach ($this->getModules(false) as $moduleCodename) {
         if (CMS_modulesCatalog::isPolymod($moduleCodename)) {
             $rowConverted = true;
             $module = CMS_modulesCatalog::getByCodename($moduleCodename);
             $definition = $module->convertDefinitionString($definition, false);
         }
     }
     if ($rowConverted) {
         //check definition parsing
         $parsing = new CMS_polymod_definition_parsing($definition, true, CMS_polymod_definition_parsing::CHECK_PARSING_MODE);
         $errors = $parsing->getParsingError();
         if ($errors && $haltOnPolymodParsing) {
             return $cms_language->getMessage(self::MESSAGE_PAGE_ROW_SYNTAX_ERROR, array($errors));
         }
     }
     $filename = $this->getDefinitionFileName();
     if (!$filename) {
         //must write it to persistence to have its ID
         if (!$this->_id) {
             $this->writeToPersistence();
         }
         //build the filename
         $filename = "r" . $this->_id . "_" . SensitiveIO::sanitizeAsciiString($this->_label) . ".xml";
     }
     $rowFile = new CMS_file(PATH_TEMPLATES_ROWS_FS . "/" . $filename);
     $rowFile->setContent($definition);
     $rowFile->writeToPersistence();
     $this->_definitionFile = $filename;
     return true;
 }
Exemple #6
0
 /**
  * Export module datas
  * 
  * @param string $format, the export format in : php (default), xml, patch
  * @return mixed : the exported datas
  */
 function export($format = 'php')
 {
     $aExport = array();
     if ($this->_hasExport) {
         //force default language loading to overwrite user language
         global $cms_language;
         $oModule = CMS_modulesCatalog::getByCodename($this->_module);
         if (!$oModule->hasError()) {
             $aModule = $oModule->asArray($this->_parameters, $files);
             //append files to exported module datas
             $aModule['files'] = array();
             if ($files) {
                 $aModule['files'] = $files;
             }
             //create export datas
             $aExport = array('version' => AUTOMNE_VERSION, 'language' => $cms_language->getCode(), 'description' => isset($this->_parameters['description']) ? $this->_parameters['description'] : '', 'modules' => array($aModule));
         }
         $return = '';
         switch ($format) {
             case 'php':
                 $return = $aExport;
                 break;
             case 'xml':
                 $array2Xml = new CMS_array2Xml($aExport, "export");
                 $return = $array2Xml->getXMLString();
                 break;
             case 'patch':
                 //create patch datas
                 $archiveFile = PATH_TMP_FS . '/' . $this->_module . '-' . date('Ymd-His') . '.tgz';
                 $archive = new CMS_gzip_file(substr($archiveFile, strlen(PATH_REALROOT_FS) + 1));
                 $archive->set_options(array('basedir' => PATH_REALROOT_FS . '/'));
                 if (isset($aExport['modules'])) {
                     foreach ($aExport['modules'] as $moduleDatas) {
                         if (isset($moduleDatas['files'])) {
                             foreach ($moduleDatas['files'] as $file) {
                                 if (file_exists(PATH_REALROOT_FS . $file)) {
                                     $archive->add_files(array(substr($file, 1)));
                                 }
                             }
                         }
                     }
                 }
                 $array2Xml = new CMS_array2Xml($aExport, "export");
                 $sOutput = $array2Xml->getXMLString();
                 $datas = new CMS_file(PATH_REALROOT_FS . '/export.xml');
                 $datas->setContent($sOutput);
                 $datas->writeToPersistence();
                 $archive->add_files(array('export.xml'));
                 //create archive
                 if ($archive->create_archive()) {
                     $return = $archiveFile;
                 } else {
                     $this->raiseError('Error during archive creation ...');
                 }
                 //delete tmp file
                 $datas->delete();
                 break;
             default:
                 $this->raiseError('Unknown format : ' . $format);
                 return false;
                 break;
         }
     }
     return $return;
 }
Exemple #7
0
 /**
  * Create modules files directories for current module
  *
  * @return boolean
  * @access public
  */
 function createModuleFiles()
 {
     $moduledir = new CMS_file(PATH_MODULES_FILES_FS . '/' . $this->_codename, CMS_file::FILE_SYSTEM, CMS_file::TYPE_DIRECTORY);
     $moduleDeleted = new CMS_file(PATH_MODULES_FILES_FS . '/' . $this->_codename . '/deleted', CMS_file::FILE_SYSTEM, CMS_file::TYPE_DIRECTORY);
     $moduleEdited = new CMS_file(PATH_MODULES_FILES_FS . '/' . $this->_codename . '/edited', CMS_file::FILE_SYSTEM, CMS_file::TYPE_DIRECTORY);
     $modulePublic = new CMS_file(PATH_MODULES_FILES_FS . '/' . $this->_codename . '/public', CMS_file::FILE_SYSTEM, CMS_file::TYPE_DIRECTORY);
     if ($moduledir->writeToPersistence() && $moduleDeleted->writeToPersistence() && $moduleEdited->writeToPersistence() && $modulePublic->writeToPersistence()) {
         CMS_file::copyTo(PATH_HTACCESS_FS . '/htaccess_no', PATH_MODULES_FILES_FS . '/' . $this->_codename . '/deleted/.htaccess');
         CMS_file::chmodFile(FILES_CHMOD, PATH_MODULES_FILES_FS . '/' . $this->_codename . '/deleted/.htaccess');
         return true;
     } else {
         return false;
     }
 }
             $log = new CMS_log();
             $log->logMiscAction(CMS_log::LOG_ACTION_TEMPLATE_EDIT_FILE, $cms_user, "File : " . $node);
             $content = array('success' => true);
             $cms_message = $cms_language->getMessage(MESSAGE_ACTION_UPDATE_FILE, array($node));
         } else {
             $cms_message = $cms_language->getMessage(MESSAGE_ERROR_UPDATE_FILE) . ' ' . $node;
         }
     }
     break;
 case 'create':
     if (is_dir($file) && $filelabel) {
         if (!is_file($file . '/' . $filelabel)) {
             $extension = io::strtolower(pathinfo($file . '/' . $filelabel, PATHINFO_EXTENSION));
             if (isset($allowedFiles[$extension])) {
                 $file = new CMS_file($file . '/' . $filelabel);
                 if ($file->setContent($definition) && $file->writeToPersistence()) {
                     $log = new CMS_log();
                     $log->logMiscAction(CMS_log::LOG_ACTION_TEMPLATE_EDIT_FILE, $cms_user, "File : " . $node . '/' . $filelabel);
                     $content = array('success' => true);
                     $cms_message = $cms_language->getMessage(MESSAGE_ACTION_CREATE_FILE, array($filelabel));
                 } else {
                     $cms_message = $cms_language->getMessage(MESSAGE_ERROR_UPDATE_FILE) . ' ' . $filelabel;
                 }
             } else {
                 $cms_message = $cms_language->getMessage(MESSAGE_ERROR_CREATE_FILE_EXTENSION, array($filelabel));
             }
         } else {
             $cms_message = $cms_language->getMessage(MESSAGE_ERROR_CREATE_FILE_EXISTS, array($filelabel));
         }
     }
     break;
Exemple #9
0
 /**
  * Do patch installation
  *
  * @param array of install command to do, view documentation for format
  *  This array MUST be checked before by checkInstall method to ensure it format is as correct as possible
  * @param array of excluded commands
  * @return void
  * @access public
  */
 function doInstall(&$array, $excludeCommand = array(), $stopOnErrors = true)
 {
     if (is_array($array)) {
         foreach ($array as $line => $aInstallCheck) {
             $line++;
             //to have the correct line number
             $installParams = array_map("trim", explode("\t", $aInstallCheck));
             if ($installParams[0] != 'ex') {
                 $originalFile = isset($installParams[1]) ? PATH_REALROOT_FS . $installParams[1] : PATH_REALROOT_FS;
                 $patchFile = isset($installParams[1]) ? PATH_TMP_FS . $installParams[1] : PATH_TMP_FS;
             }
             if (!in_array($installParams[0], $excludeCommand)) {
                 //launch installation request
                 switch ($installParams[0]) {
                     case ">":
                         //add or update a file or folder
                         //copy file or folder
                         if (CMS_FILE::copyTo($patchFile, $originalFile)) {
                             $this->_verbose(' -> File ' . $patchFile . ' successfully copied to ' . $originalFile);
                         } else {
                             $this->_report('Error during copy of ' . $patchFile . ' to ' . $originalFile, true);
                             if ($stopOnErrors) {
                                 return;
                             }
                         }
                         if (!isset($installParams[2])) {
                             break;
                         }
                     case "ch":
                         //execute chmod
                         $filesNOK = $this->applyChmod($installParams[2], $originalFile);
                         if (!$filesNOK) {
                             switch ($installParams[2]) {
                                 case 'r':
                                     $this->_verbose(' -> File(s) ' . $originalFile . ' are readable.');
                                     break;
                                 case 'w':
                                     $this->_verbose(' -> File(s) ' . $originalFile . ' are writable.');
                                     break;
                                 case 'x':
                                     $this->_verbose(' -> File(s) ' . $originalFile . ' are executable.');
                                     break;
                                 default:
                                     $this->_verbose(' -> File(s) ' . $originalFile . ' successfully chmoded with value ' . $installParams[2]);
                                     break;
                             }
                         } else {
                             $this->_report('Error during chmod operation of ' . $originalFile . '. Can\'t apply chmod value \'' . $installParams[2] . '\' on files :<br />' . $filesNOK . '<br />', true);
                             //do not stop on chmod error : only report them
                             //if ($stopOnErrors) return;
                         }
                         break;
                     case "<":
                         //delete a file or folder (recursively)
                         if (file_exists($originalFile) && CMS_FILE::deleteFile($originalFile)) {
                             $this->_verbose(' -> File ' . $originalFile . ' successfully deleted');
                         } else {
                             $this->_verbose(' -> Cannot delete ' . $originalFile . '. It does not exists.');
                         }
                         break;
                     case "+":
                         //concatenate module xml file
                         //load destination module parameters
                         $module = CMS_modulesCatalog::getByCodename($installParams[2]);
                         $moduleParameters = $module->getParameters(false, true);
                         //load the XML data of the source the files
                         $sourceXML = new CMS_file($patchFile);
                         $domdocument = new CMS_DOMDocument();
                         try {
                             $domdocument->loadXML($sourceXML->readContent("string"));
                         } catch (DOMException $e) {
                         }
                         $paramsTags = $domdocument->getElementsByTagName('param');
                         $sourceParameters = array();
                         foreach ($paramsTags as $aTag) {
                             $name = $aTag->hasAttribute('name') ? $aTag->getAttribute('name') : '';
                             $type = $aTag->hasAttribute('type') ? $aTag->getAttribute('type') : '';
                             $sourceParameters[$name] = array(CMS_DOMDocument::DOMElementToString($aTag, true), $type);
                         }
                         //merge the two tables of parameters
                         $resultParameters = array_merge($sourceParameters, $moduleParameters);
                         //set new parameters to the module
                         if ($module->setAndWriteParameters($resultParameters)) {
                             $this->_verbose(' -> File ' . $patchFile . ' successfully merged with module ' . $installParams[2] . ' parameters');
                         } else {
                             $this->_report('Error during merging of ' . $patchFile . ' with module ' . $installParams[2] . ' parameters', true);
                             if ($stopOnErrors) {
                                 return;
                             }
                         }
                         break;
                     case "x":
                         //execute SQL or PHP file
                         //exec sql script with help of some phpMyAdmin classes
                         if (io::substr($patchFile, -4, 4) == '.sql') {
                             if ($this->executeSqlScript($patchFile)) {
                                 $this->_verbose(' -> File ' . $patchFile . ' successfully executed');
                             } else {
                                 $this->_report('Error during execution of ' . $patchFile, true);
                                 if ($stopOnErrors) {
                                     return;
                                 }
                             }
                         } elseif (io::substr($patchFile, -4, 4) == '.php') {
                             //exec php script
                             $executionReturn = $this->executePhpScript($patchFile);
                             if ($executionReturn === false) {
                                 $this->_report('Error during execution of ' . $patchFile, true);
                                 if ($stopOnErrors) {
                                     return;
                                 }
                             } else {
                                 $executionReturn = $executionReturn ? ' -> Return :<br /><div style="border:1px;background-color:#000080;color:#C0C0C0;padding:5px;">' . $executionReturn . '</div><br />' : '';
                                 $this->_report(' -> File ' . $patchFile . ' executed<br />' . $executionReturn);
                             }
                         }
                         break;
                     case "co":
                         //execute change owner
                         $filesNOK = $this->changeOwner($installParams[2], $originalFile);
                         if (!$filesNOK) {
                             $this->_verbose(' -> Owner of file(s) ' . $originalFile . ' successfully changed to ' . $installParams[2]);
                         } else {
                             $this->_report('Error during operation on ' . $originalFile . '. Can\'t change owner to \'' . $installParams[2] . '\' on files :<br />' . $filesNOK . '<br />', true);
                             if ($stopOnErrors) {
                                 return;
                             }
                         }
                         break;
                     case "cg":
                         //execute change group
                         $filesNOK = $this->changeGroup($installParams[2], $originalFile);
                         if (!$filesNOK) {
                             $this->_verbose(' -> Group of file(s) ' . $originalFile . ' successfully changed to ' . $installParams[2]);
                         } else {
                             $this->_report('Error during operation on ' . $originalFile . '. Can\'t change group to \'' . $installParams[2] . '\' on files :<br />' . $filesNOK . '<br />', true);
                             if ($stopOnErrors) {
                                 return;
                             }
                         }
                         break;
                     case "rc":
                         $this->automneGeneralScript();
                         break;
                     case "htaccess":
                         $installParams[1] = io::substr($installParams[1], -1) == '/' ? io::substr($installParams[1], 0, -1) : $installParams[1];
                         $pathes = glob(PATH_REALROOT_FS . $installParams[1]);
                         if ($pathes) {
                             foreach ($pathes as $path) {
                                 if ($installParams[2] == 'root' && file_exists($path . '/.htaccess')) {
                                     //for root file, if already exists, only replace ErrorDocument instructions to set correct path
                                     $htaccessFile = new CMS_file($path . '/.htaccess');
                                     $lines = $htaccessFile->readContent('array', '');
                                     foreach ($lines as $key => $line) {
                                         if (substr($line, 0, 13) == 'ErrorDocument') {
                                             list($errorDoc, $code, $file) = preg_split("/[\\s]+/", $line);
                                             if ($code == '404') {
                                                 $lines[$key] = 'ErrorDocument 404 ' . PATH_REALROOT_WR . '/404.php' . "\n";
                                             } elseif ($code == '403') {
                                                 $lines[$key] = 'ErrorDocument 403 ' . PATH_REALROOT_WR . '/403.php' . "\n";
                                             }
                                         }
                                     }
                                     $htaccessFile->setContent(implode('', $lines), false);
                                     if ($htaccessFile->writeToPersistence()) {
                                         $this->_report('File ' . $path . '/.htaccess (' . $installParams[2] . ') successfully updated');
                                     } else {
                                         $this->_report('Error during operation on ' . $path . '/.htaccess. Can\'t write file.<br />', true);
                                     }
                                 } else {
                                     if (is_dir($path) && CMS_file::makeWritable($path)) {
                                         if (CMS_file::copyTo(PATH_HTACCESS_FS . '/htaccess_' . $installParams[2], $path . '/.htaccess')) {
                                             CMS_file::chmodFile(FILES_CHMOD, $path . '/.htaccess');
                                             $this->_report('File ' . $path . '/.htaccess (' . $installParams[2] . ') successfully writen');
                                         } else {
                                             $this->_report('Error during operation on ' . $path . '/.htaccess. Can\'t write file.<br />', true);
                                             if ($stopOnErrors) {
                                                 return;
                                             }
                                         }
                                     } else {
                                         $this->_report('Error during operation. ' . $path . ' must be a writable directory.<br />', true);
                                         if ($stopOnErrors) {
                                             return;
                                         }
                                     }
                                 }
                             }
                         }
                         break;
                     default:
                         if (io::substr($installParams[0], 0, 1) != '#') {
                             $this->raiseError("Unknown parameter : " . $installParams[0]);
                             return false;
                         }
                         break;
                 }
             } else {
                 $this->_report('Error during operation of "' . $aInstallCheck . '". Command execution is not allowed.<br />', true);
                 if ($stopOnErrors) {
                     return;
                 }
             }
         }
     } else {
         $this->raiseError("Param must be an array");
         return false;
     }
     //at end of any patch process, update Automne subversion to force reload of JS and CSS cache from client
     if (@file_put_contents(PATH_MAIN_FS . "/SUBVERSION", time()) !== false) {
         CMS_file::chmodFile(FILES_CHMOD, PATH_MAIN_FS . "/SUBVERSION");
     }
 }
Exemple #10
0
                         $content .= '<li class="atm-pic-cancel">' . $line['text'] . '</li>';
                         break;
                 }
                 break;
         }
     }
     $content .= '</ul>';
     break;
 case 'browser-cache-reset':
     //update SUBVERSION file
     $file = new CMS_file(PATH_MAIN_FS . "/SUBVERSION");
     if ($file->exists()) {
         $date = (int) $file->getContent();
         $date++;
         $file->setContent((string) $date);
         if ($file->writeToPersistence()) {
             $cms_message = $cms_language->getMessage(MESSAGE_OPERATION_DONE);
         } else {
             $cms_message = $cms_language->getMessage(MESSAGE_UPDATE_ERROR);
         }
     } else {
         if (@file_put_contents(PATH_MAIN_FS . "/SUBVERSION", time()) !== false) {
             CMS_file::chmodFile(FILES_CHMOD, PATH_MAIN_FS . "/SUBVERSION");
             $cms_message = $cms_language->getMessage(MESSAGE_OPERATION_DONE);
         } else {
             $cms_message = $cms_language->getMessage(MESSAGE_CREATION_ERROR);
         }
     }
     //remove JS and CSS cache
     if (!CMS_cache::clearTypeCache('text/javascript') || !CMS_cache::clearTypeCache('text/css')) {
         $cms_message = $cms_language->getMessage(MESSAGE_CREATION_ERROR);
Exemple #11
0
 /**
  * Create the redirection file (index.php) of an alias
  *
  * @return boolean true on success, false on failure
  * @access public
  */
 function createRedirectionFile()
 {
     if (!$this->_createFolder()) {
         return false;
     }
     //get alias position
     $pos = substr_count('/' . $this->getAliasLineAge() . $this->getAlias(), '/');
     $fileContent = '<?php' . "\n" . '//Alias file generated on ' . date('r') . ' by ' . CMS_grandFather::SYSTEM_LABEL . ' ' . AUTOMNE_VERSION . "\n" . 'require_once(dirname(__FILE__).\'/' . str_repeat('../', $pos) . 'cms_rc_frontend.php\');' . "\n" . '$pPath = CMS_module_cms_aliases::redirect();' . "\n" . '$cms_page_included = true;' . "\n" . 'require($pPath);' . "\n" . '?>';
     //then create index.php file in folder
     $file = new CMS_file($this->getPath(true, PATH_RELATIVETO_FILESYSTEM) . 'index.php');
     $file->setContent($fileContent);
     return $file->writeToPersistence();
 }