Ejemplo n.º 1
0
if (!empty($_REQUEST['parser'])) {
    $parser = $_REQUEST['parser'];
    require_once $GLOBALS['studioConfig']['parsers'][$_REQUEST['parser']];
} else {
    require_once 'modules/Studio/parsers/' . $parser . '.php';
}
$sp = new $parser();
require_once 'modules/Studio/SugarBackup.php';
$files = $sp->getFiles($the_module);
if (empty($_SESSION['studio']['selectedFileId'])) {
    $keys = array_keys($files);
    $_SESSION['studio']['selectedFileId'] = $keys[0];
}
$studioDef = $files[$_SESSION['studio']['selectedFileId']];
$file = $studioDef['template_file'];
$file = StudioParser::getWorkingFile($file);
$the_class = $beanList[$the_module];
require_once $beanFiles[$the_class];
$the_focus = new $the_class();
$type = $sp->getFileType($studioDef['type']);
$GLOBALS['layout_edit_mode'] = true;
$sp->loadFile($file);
$sp->parse($sp->curText);
$sp->workingModule = $the_module;
$sp->focus =& $the_focus;
$view = $sp->prepSlots();
$xtpl = $sp->writeToCache($file, $view);
echo $sp->yahooJS();
echo $sp->getFormButtons();
//change mod strings to module
$prev_mod = $mod_strings;
Ejemplo n.º 2
0
/**
 * The contents of this file are subject to the SugarCRM Public License Version
 * 1.1.3 ("License"); You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * All copies of the Covered Code must include on each user interface screen:
 *    (i) the "Powered by SugarCRM" logo and
 *    (ii) the SugarCRM copyright notice
 * in the same form as they appear in the distribution.  See full license for
 * requirements.
 *
 * The Original Code is: SugarCRM Open Source
 * The Initial Developer of the Original Code is SugarCRM, Inc.
 * Portions created by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.;
 * All Rights Reserved.
 * Contributor(s): ______________________________________.
 */
$the_module = $_SESSION['studio']['module'];
ob_clean();
require_once 'modules/Studio/parsers/StudioParser.php';
$fileDef = StudioParser::getFiles($the_module, $_SESSION['studio']['selectedFileId']);
$workingFile = StudioParser::getWorkingFile($fileDef['template_file']);
//BACKUP EXISTING FILE
require_once 'modules/Studio/SugarBackup.php';
SugarBackup::backup($fileDef['template_file']);
copy($workingFile, $fileDef['template_file']);
sugar_cleanup(true);
 /**
  * Restores a backup overwriting the current working copy
  *
  * @param unknown_type $file
  * @param unknown_type $backupid
  */
 function restoreBackup($backupfile)
 {
     $info = $this->getBackupInfo($backupfile);
     $status = copy($backupfile, $info['original_file']);
     if ($status) {
         $wf = StudioParser::getWorkingFile($info['original_file'], true);
     }
     return $status;
 }