Exemplo n.º 1
0
 /**
  * Constructor of the class PFile.
  * This object manage the file on the disk.
  *
  * @param string $strPath : the path of the file
  * @return PFile : the object PFile
  */
 function PFile($strPath)
 {
     parent::POFile($strPath);
     if (!is_file($this->path) && is_file($strNewPath = utf8_decode($this->path))) {
         $this->path = $strNewPath;
     }
 }
Exemplo n.º 2
0
 function PDir($path)
 {
     parent::POFile($path);
     if (substr($path, -1) == SLASH) {
         $path = substr($path, 0, strlen($path) - 1);
     }
     $this->path = $path;
     if (is_dir($newpath = utf8_decode($this->path))) {
         $this->path = $newpath;
     }
 }
Exemplo n.º 3
0
 function getPathUrl($strPath)
 {
     $strUrl = POFile::getPathRelativePath($strPath);
     if (SLASH != '/') {
         $strUrl = str_replace(SLASH, '/', $strUrl);
     }
     if (is_dir($strPath) && !preg_match('/\\/$/', $strUrl)) {
         $strUrl .= '/';
     }
     //be shure that a directory url end with /
     return SITE_URL . $strUrl;
 }
Exemplo n.º 4
0
     $current_User->check_perm('options', 'edit', true);
     // Get PO file for that edit_locale:
     $AdminUI->append_to_titlearea(sprintf(T_('Extracting language file for %s...'), '<b>' . $edit_locale . '</b>'));
     $po_file = $locales_path . $locales[$edit_locale]['messages'] . '/LC_MESSAGES/messages.po';
     if (!is_file($po_file)) {
         $Messages->add(sprintf(T_('File <code>%s</code> not found.'), '/' . $locales_subdir . $locales[$edit_locale]['messages'] . '/LC_MESSAGES/messages.po'), 'error');
         break;
     }
     $outfile = $locales_path . $locales[$edit_locale]['messages'] . '/_global.php';
     if (file_exists($outfile) && !is_writable($outfile)) {
         // The '_global.php' file exists but it is not writable
         $Messages->add(sprintf(T_('The file %s is not writable.'), '<b>' . $outfile . '</b>'));
         break;
     }
     load_class('locales/_pofile.class.php', 'POFile');
     $POFile = new POFile($po_file);
     $POFile->read(true);
     // adds info about sources to $Messages
     $POFile->write_evo_trans($outfile, $locales[$edit_locale]['messages']);
     // Redirect so that a reload doesn't write to the DB twice:
     header_redirect('?ctrl=locales' . ($loc_transinfo ? '&loc_transinfo=1' : ''), 303);
     // Will EXIT
     // We have EXITed already at this point!!
     break;
 case 'resetlocale':
     // Reset a specific Locale:
     // Check that this action request is not a CSRF hacked request:
     $Session->assert_received_crumb('locales');
     // Check permission:
     $current_User->check_perm('options', 'edit', true);
     $edit_locale_messages = empty($locales[$edit_locale]['messages']) ? $edit_locale : str_replace('-', '_', $locales[$edit_locale]['messages']);
Exemplo n.º 5
0
 /**
  * Write POFile::$msgids into $file_path.
  *
  * @return true|string True on success, string with error on failure
  */
 function write_evo_trans($file_path, $locale)
 {
     $fp = fopen($file_path, 'w+');
     if (!$fp) {
         return "Could not open {$file_path} for writing!";
     }
     fwrite($fp, "<?php\n");
     fwrite($fp, "/*\n");
     fwrite($fp, " * Global lang file\n");
     fwrite($fp, " * This file was generated automatically from messages.po\n");
     fwrite($fp, " */\n");
     fwrite($fp, "if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );");
     fwrite($fp, "\n\n");
     fwrite($fp, '$trans[\'' . $locale . "'] = array(\n");
     // Write meta/format info:
     $charset = 'utf-8';
     // default
     if (isset($this->msgids[''])) {
         if (preg_match('~\\\\nContent-Type: text/plain; charset=(.*?);?\\\\n~', $this->msgids['']['trans'], $match)) {
             $charset = strtolower($match[1]);
         }
     }
     fwrite($fp, "'__meta__' => array('format_version'=>1, 'charset'=>'{$charset}'),\n");
     foreach ($this->msgids as $msgid => $msginfo) {
         $msgstr = $msginfo['trans'];
         fwrite($fp, POFile::quote($msgid) . ' => ' . POFile::quote($msgstr) . ",\n");
     }
     fwrite($fp, "\n);\n?>");
     fclose($fp);
     return true;
 }
Exemplo n.º 6
0
        function DisplayEditor()
        {
            $strReturn = '';
            $strFCKConfigDir = SITE . SLASH . 'config' . SLASH . 'fckeditor' . SLASH;
            $strFCKConfigUrl = SITE_URL . (SLASH == '/' ? $strFCKConfigDir : str_replace(SLASH, '/', $strFCKConfigDir));
            $strFCKConfigDir = CONFIG_DIR . 'fckeditor' . SLASH;
            $oFCKeditor = new FCKeditor('text');
            $oFCKeditor->BasePath = SITE_URL . 'vendors/jscripts/fckeditor/';
            $oFCKeditor->Value = $this->getEditorFileContent();
            $oFCKeditor->Height = '400';
            //the styles to apply to the editor, the page style and the fckeditor.css style
            $fileStyleUrls = '';
            if ($pageStyle = $this->getConfig("PAGE_STYLE")) {
                $fileStyleUrls .= THEME_URL . 'css/' . $pageStyle . ',';
            }
            if (is_file($strFCKConfigDir . 'fckeditor.css')) {
                $fileStyleUrls .= $strFCKConfigUrl . 'fckeditor.css';
            }
            $oFCKeditor->Config["EditorAreaCSS"] = $fileStyleUrls;
            $oFCKeditor->Config["ImageBrowserURL"] = SITE_URL . "core/admin/admin_file_selector.php?rootpath=" . urlencode(POFile::getPathRelativePath(MEDIAS_PATH));
            $oFCKeditor->Config["FlashBrowserURL"] = SITE_URL . "core/admin/admin_file_selector.php?rootpath=" . urlencode(POFile::getPathRelativePath(MEDIAS_PATH));
            //go to the parent path
            $oFCKeditor->Config["LinkBrowserURL"] = SITE_URL . "core/admin/admin_file_selector.php?current_dir=" . urlencode(POFile::getPathRelativePath($this->getParentPath(), PAGES_PATH)) . "&rootpath=" . urlencode(POFile::getPathRelativePath(PAGES_PATH));
            $oFCKeditor->Config["CustomConfigurationsPath"] = SITE_URL . 'index.php?page=fckconfig.js';
            if (is_file($strFCKConfigDir . 'fcktemplates.xml')) {
                $oFCKeditor->Config["TemplatesXmlPath"] = SITE_URL . 'index.php?page=fcktemplates.xml';
            }
            if (is_file($strFCKConfigDir . 'fckstyles.xml')) {
                $oFCKeditor->Config["StylesXmlPath"] = SITE_URL . 'index.php?page=fckstyles.xml';
            }
            $strBarName = getUserEditorBar();
            if ($strBarName) {
                $oFCKeditor->ToolbarSet = $strBarName;
            }
            $strTabsTpl = '
		<div id="tabPageEditor">
			<ul>
				<li class="ui-tabs-nav-item"><a href="#fragEditor"><span>Edition</span></a></li>
				<li class="ui-tabs-nav-item"><a href="#fragOptions"><span>Options</span></a></li>
			</ul>
			
			<div id="fragEditor">{TAB_EDITOR}</div>
			<div id="fragOptions">{TAB_OPTIONS}</div>
		</div>';
            $strFragEditorContent = '
			<form action="' . $_SERVER["REQUEST_URI"] . '" method="POST" id="form_editor" onSubmit="return actionClickOnSaveHtml(this,\'' . $this->getUrl() . '\',\'' . urljsencode($_GET['file']) . '\');" style="text-align:right">
				<div class="fckEditor">
					' . $oFCKeditor->CreateHtml() . '
				<div class="panelHistory">
					<h4>' . _('History') . '</h4>
					{HISTORY_CONTENT}
				</div><!-- end history -->
				</div><!-- end fckblock -->
				<!-- buttons -->
				<div style="text-align:right;clear:both;">
					<button class="ui-state-default ui-corner-all" type="button" onClick="MyCancel();">' . _('cancel') . '</button>
					<button class="ui-state-default ui-corner-all" type="button" onClick="$(\'.openTabs:first\').trigger(\'click\');">' . _('history') . '</button>
					<button class="ui-state-default ui-corner-all" type="submit">' . _('save') . '</button>
				</div>
				<input type="hidden" value="false" name="view" />
				<input type="hidden" name="todo" value="save" />
			</form>
		';
            // GESTION DE L'HISTORIQUE
            $strHistoryContent = '<ul class="historylist">{LIST_HISTORY}</ul>';
            $strHtmlListHistory = '';
            $tabHistory =& $this->getHistoryList();
            if (sizeof($tabHistory) == 0) {
                $strHistoryContent = _('History empty !');
            } else {
                $i = 0;
                foreach ($tabHistory as $elemHistory) {
                    $strHtmlListHistory .= '<li><a class="itemHistory ' . ($i == 0 ? 'selected' : '') . '" href="#" onclick="loadHistoryPage(\'' . $elemHistory['PATH'] . '\',this);return false;">' . $elemHistory['PRINTNAME'] . '</a></li>';
                    $i++;
                }
                $strHistoryContent = str_replace('{LIST_HISTORY}', $strHtmlListHistory, $strHistoryContent);
            }
            $strFragEditorContent = str_replace('{HISTORY_CONTENT}', $strHistoryContent, $strFragEditorContent);
            $strFragOptionsContent = $this->oPConfigFile->DisplayEditor();
            $strReturn = str_replace(array('{TAB_EDITOR}', '{TAB_OPTIONS}'), array($strFragEditorContent, $strFragOptionsContent), $strTabsTpl);
            return $strReturn;
        }
Exemplo n.º 7
0
/**
 * images_tools_change_image_src_to_autoresize
 * Change the source of the displayed page.
 * Search for img, if param width and height is set, change the image src to imagestoolsresize.php script.
 * 
 * @param unknown_type $source
 * @param unknown_type $smarty
 * @return unknown
 */
function images_tools_change_image_src_to_autoresize($source, &$smarty)
{
    $oPlugin = new PPluginDir(dirname(__FILE__));
    $oConfigFile =& $oPlugin->oConfig;
    if ($oConfigFile->getDirectParam("SERVER_RESIZE") !== "true") {
        return $source;
    }
    $strUploadUrl = preg_quote(POFile::getPathUrl(MEDIAS_PATH), '/');
    $source = preg_replace(array('/(<img([^>]*)width="([^"]*)"([^>]*)height="([^"]*)"([^>]*)src="(' . $strUploadUrl . '[^"]*)"([^>]*)>)/', '/(<img([^>]*)src="(' . $strUploadUrl . '[^"]*)"([^>]*)style="width:[^0-9]*([0-9]*)px;\\sheight:[^0-9]*([0-9]*)px;[^"]*"([^>]*)>)/'), array('<img\\2\\4\\6src="' . SITE_URL . 'imagestoolsresize.php?img=\\7&width=\\3&height=\\5"\\8>', '<img\\2src="' . SITE_URL . 'imagestoolsresize.php?img=\\3&width=\\5&height=\\6"\\4\\7>'), $source);
    /*
    $source = preg_replace(
    	'/(<img([^>]*)width="([^"]*)"([^>]*)height="([^"]*)"([^>]*)src="('.$strUploadUrl.'[^"]*)"([^>]*)>)/',
    	'<img\2\4\6src="'.SITE_URL.'imagestoolsresize.php?src=\7&width=\3&height=\5"\8>',
    $source);
    //if modified with mouse fck set style and not width and height properties
    $source = preg_replace(
    	'/(<img([^>]*)src="('.$strUploadUrl.'[^"]*)"([^>]*)style="width:[^0-9]*([0-9]*)px;\sheight:[^0-9]*([0-9]*)px;[^"]*"([^>]*)>)/',
    	'<img\2src="'.SITE_URL.'imagestoolsresize.php?src=\3&width=\5&height=\6"\4\7>',
    $source);
    */
    return $source;
}
Exemplo n.º 8
0
<?php

include 'admin_top.php';
$tabMainTabs = array();
$oTextConfigFile = new PTextFile($configFile->path);
$tabMainTabs[] = array('FRAG_NAME' => 'frag_config', 'TAB_NAME' => _('Site Configuration'), 'TAB_CONTENT' => array_to_tabs(array(array('FRAG_NAME' => 'site_config', 'TAB_NAME' => _('Site Parameters'), 'TAB_CONTENT' => $configFile->DisplayEditor('actionClickOnSaveSiteConfig')), array('FRAG_NAME' => 'hotkeys_management', 'TAB_NAME' => _('Manage Hot Keys'), 'TAB_CONTENT' => $configFile->DisplayEditor('actionClickOnSaveConfig', 'HOTKEYS')), array('FRAG_NAME' => 'site_cache', 'TAB_NAME' => _('Cache Management'), 'TAB_CONTENT' => '
					<div style="padding-top:60px">
						<button onClick="clickOnClearCache(this,\'' . _('Clearing cache ....') . '\',\'site\');" class="ui-state-default ui-corner-all" type="button">' . _('clear site cache') . '</button>
						<button onClick="clickOnClearCache(this,\'' . _('Clearing cache ....') . '\',\'thumbs\');" class="ui-state-default ui-corner-all" type="button">' . _('clear thumbs cache') . '</button>
						<button onClick="clickOnClearCache(this,\'' . _('Clearing cache ....') . '\',\'history\');" class="ui-state-default ui-corner-all" type="button">' . _('clear history cache') . '</button>
					</div>
				'), array('FRAG_NAME' => 'site_file_config', 'TAB_NAME' => _('Config File'), 'TAB_CONTENT' => $oTextConfigFile->DisplayEditor())), 'tabConfiguratorLevel2'));
/**Models **/
$strModelContent = '';
$strUrltabModels = 'admin_file_management.php?current_dir=' . urlencode(POFile::getPathRelativePath(PAGES_MODELS_PATH));
if (!is_dir(PAGES_MODELS_PATH)) {
    $oDirModels = new PDir(PAGES_MODELS_PATH);
    if (!$oDirModels->mkdir()) {
        $strModelContent .= getError();
    }
}
if (is_dir(PAGES_MODELS_PATH)) {
    $oDirModels =& getFileObject(PAGES_MODELS_PATH);
    $tabListModels = $oDirModels->listDir($oDirModels->ONLY_FILES);
    foreach ($tabListModels as $filePath) {
        if (is_file($filePath)) {
            $oTemp =& getFileObject($filePath);
            //$strModelContent.=get_class($oTemp);
            $strModelContent .= $oTemp->Display(70, $url = false, $oDirModels);
        }
    }
Exemplo n.º 9
0
 /**
  * Function: display
  * If page has not been cached, calculate it.
  * Then call the smarty display fonction
  *
  *
  * param: &$oPage, a reference to the object page to display
  */
 function displayPage(&$oPage)
 {
     $strTemplateName = $oPage->getTemplateName();
     $strCompiledId = $this->getCompiledId();
     $this->oPageCurrent =& $oPage;
     $this->register_object('oPageCurrent', $oPage);
     //if page must not be cached, set the site cache to 0
     $this->caching = $this->caching && $oPage->isCached() ? 1 : 0;
     //on regénére le menu si le menu n'existe pas en cache ou si la page courante a été modifiée après le menu
     $bGenerateMenu = !is_file(SMARTY_CACHE_DIR . 'menu.cache');
     //|| (is_file(SMARTY_CACHE_DIR.'menu.cache') && $oPage->getModifiedTime()>filemtime(SMARTY_CACHE_DIR.'menu.cache'));
     //rebuild menu not exist (a page has been updated) or the page if cache not exists or page not use cache
     if ($bGenerateMenu || $this->caching == 0 || $this->force_compile || !$this->is_cached($strTemplateName, $strCompiledId)) {
         //check that the template file exists
         if (!is_file($this->template_dir . SLASH . $strTemplateName)) {
             setError(sprintf(_("The template file %s doesn't exist."), $strTemplateName));
             printFatalHtmlError();
         }
         //si on doit regénérer le menu, on le supprime avant
         if ($bGenerateMenu) {
             if (!deleteMenuCache()) {
                 printFatalError();
             }
         }
         //assign the menu
         $this->assign_by_ref("menu", $this->getMenu(isConnected()));
         $this->assign("PAGE_PATH", $oPage->path);
         $this->assign("PAGE_CONTENU", $oPage->path);
         $this->assign("PAGE_PATH_TITLE", $oPage->getPagePathForTitle());
         $this->assign('MEDIAS_URL', POFile::getPathUrl(MEDIAS_PATH));
         $oPageConfigFile = $oPage->getConfigFileObject();
         if (is_file($oPageConfigFile->path)) {
             $this->assign("CONFIG_FILE_PAGE", $oPageConfigFile->path);
         }
         $oCatConfigFile = $oPage->getConfigFileObjectCategory();
         if (is_file($oCatConfigFile->path)) {
             $this->assign("CONFIG_FILE_CATAGORY", $oCatConfigFile->path);
         }
         //we load filter only in case of cache
         $this->loadAdminFilters();
     }
     //end calcul
     if (true || checkKey()) {
         //display the page !!
         $strContent = parent::fetch($strTemplateName, $strCompiledId);
         doEventAction('beforedisplay', array(&$strContent, &$this));
         echo $strContent;
     } else {
         printError();
     }
 }
Exemplo n.º 10
0
function admin_btn_news()
{
    return '
	<a href="admin_file_management.php?current_dir=' . urlencode(POFile::getPathRelativePath(PAGES_PATH . '/actualites/')) . '"  class="panel-link infobulles" id="actualites">
		<img src="' . SITE_URL . 'plugins/news/img/news.jpg" />
			<span>
				<h3> Gestion des actualités </h3>
				<p>Dans cette espace vous pouvez gérer vos actualités.</p>
			</span>
	</a>
		
	';
}
Exemplo n.º 11
0
"  class="panel-link infobulles" id="pages">
			<div class="block-icon"><div class="img-icon"><img src="<?php 
    echo SITE_URL;
    ?>
core/admin/theme/images/admin/icon-pages.gif" /></div><div class="title-icon"><?php 
    echo _('Models');
    ?>
</div><div class="reset"></div></div>
			<span>
				<h3> Gestion des modèles </h3>
				<p>Dans cette espace vous pouvez gérer les modèles de pages de votre site.</p>
			</span>
		</a>
	</td><td>
		<a href="admin_file_management.php?current_dir=<?php 
    echo urlencode(POFile::getPathRelativePath(MEDIAS_PATH));
    ?>
" class="panel-link infobulles" id="images">
			<div class="block-icon"><div class="img-icon"><img style="padding-top:5px;" src="<?php 
    echo SITE_URL;
    ?>
core/admin/theme/images/admin/icon-images.gif" /></div><div class="title-icon"><?php 
    echo _('Medias');
    ?>
</div><div class="reset"></div></div>
			<span>
				<h3>Gestion de vos médias</h3>
				<p>Vous pouvez gérer ici les images du site ainsi que les fichiers joins (pdf ....)</p>
			</span>
		</a>
	</td>
Exemplo n.º 12
0
function do_merge($locale, $fuzzy)
{
    global $dyn_locales_dir;
    if (chdir("{$dyn_locales_dir}/{$locale}/LC_MESSAGES/") == FALSE) {
        die("Unable to change to messages directory.");
    }
    // Try to back up the existing translation
    assert(file_exists("messages.po"));
    $save = "messages_" . strftime("%Y%m%d%H%M%S", filemtime("messages.po")) . ".po";
    if (!@copy("messages.po", $save)) {
        echo "<p>" . _("Could not save a copy of the previous file.") . " " . _("File was not updated.") . "</p>";
        return;
    }
    $po_filename = "{$dyn_locales_dir}/{$locale}/LC_MESSAGES/messages.po";
    $pot_filename = "{$dyn_locales_dir}/messages.pot";
    $po_file = new POFile($po_filename);
    try {
        $po_file->merge_from_template($pot_filename, $fuzzy == 'on');
        echo "<p>" . _("File successfully updated. You may now download it.") . "</p>";
    } catch (Exception $exception) {
        echo "<p>" . _("<code>msgmerge</code> reports the following errors:") . "</p>\n";
        echo "<pre>";
        foreach (explode("\n", $exception->getMessage()) as $v) {
            echo html_safe($v) . "\n";
        }
        echo "</pre><br>";
        return;
    }
}
Exemplo n.º 13
0
echo SITE_URL;
?>
vendors/jscripts/jqueryplugins/jquery.jeditable.js" ></script>
<script language="JavaScript" src="../jscripts/admin_file_management.js"></script>

<script language="JavaScript">
function myRelodPage(){
	window.location = '<?php 
echo $_SERVER['REQUEST_URI'];
?>
';
}
function setUrl(url){
	<?php 
$rootpathdirurl = $rootpathdir;
$uploadpathurl = POFile::getPathRelativePath(MEDIAS_PATH);
if (SLASH != '/') {
    $rootpathdirurl = str_replace(SLASH, '/', $rootpathdirurl);
    $uploadpathurl = str_replace(SLASH, '/', $uploadpathurl);
}
echo '
			var rootpathdirurl = "' . $rootpathdirurl . '";
			var uploadpathurl = "' . $uploadpathurl . '";
		';
?>
	//file selector
	if(oSelec = window.opener.document.getElementById("cmbLinkProtocol")){
		oSelec.selectedIndex=4;//set protocol on other

		if( uploadpathurl == rootpathdirurl )
			window.opener.SetUrl("{#SITE_URL#}"+rootpathdirurl+"/"+encodeURI(url));