public function step1() { echo L_UPDATE_USERS_MIGRATION . "<br />"; # On génère le fichier XML $xml = "<?xml version=\"1.0\" encoding=\"" . PLX_CHARSET . "\"?>\n"; $xml .= "<document>\n"; foreach ($this->plxAdmin->aUsers as $user_id => $user) { $salt = plxUtils::charAleatoire(10); $password = sha1($salt . $user['password']); $xml .= "\t" . '<user number="' . $user_id . '" active="' . $user['active'] . '" profil="' . $user['profil'] . '" delete="' . $user['delete'] . '">' . "\n"; $xml .= "\t\t" . '<login><![CDATA[' . plxUtils::cdataCheck($user['login']) . ']]></login>' . "\n"; $xml .= "\t\t" . '<name><![CDATA[' . plxUtils::cdataCheck($user['name']) . ']]></name>' . "\n"; $xml .= "\t\t" . '<infos><![CDATA[' . plxUtils::cdataCheck($user['infos']) . ']]></infos>' . "\n"; $xml .= "\t\t" . '<password><![CDATA[' . $password . ']]></password>' . "\n"; $xml .= "\t\t" . '<salt><![CDATA[' . $salt . ']]></salt>' . "\n"; $xml .= "\t\t" . '<email><![CDATA[' . $user['email'] . ']]></email>' . "\n"; $xml .= "\t\t" . '<lang><![CDATA[' . $user['lang'] . ']]></lang>' . "\n"; $xml .= "\t</user>\n"; } $xml .= "</document>"; if (!plxUtils::write($xml, PLX_ROOT . $this->plxAdmin->aConf['users'])) { echo '<p class="error">' . L_UPDATE_ERR_USERS_MIGRATION . ' (' . $this->plxAdmin->aConf['users'] . ')</p>'; return false; } return true; }
public function OnActivate() { if (version_compare(PHP_VERSION, PP_REQUIRED_PHP_VERSION) < 0) { exit(sprintf($this->getLang('L_PHP_VERSION_TOO_LOW'), PP_REQUIRED_PHP_VERSION)); } if (!is_file(PLX_ROOT . 'data/configuration/plugins/pickypaste.site.css')) { $css = file_get_contents(PLX_PLUGINS . 'pickyPasteInPluxml/css/pickypaste.css'); plxUtils::write($css, PLX_ROOT . 'data/configuration/plugins/pickyPasteInPluxml.site.css'); } }
/** * Méthode qui valide la durée de vide d'un token * * @parm $request (deprecated) * @return stdio/null * @author Stephane F **/ public static function validateFormToken($request = '') { if ($_SERVER['REQUEST_METHOD'] == 'POST' and isset($_SESSION['formtoken'])) { if (empty($_POST['token']) or plxUtils::getValue($_SESSION['formtoken'][$_POST['token']]) < time() - 3600) { # 3600 seconds unset($_SESSION['formtoken']); die('Security error : invalid or expired token'); } unset($_SESSION['formtoken'][$_POST['token']]); } }
public function __construct($default_lang) { # appel du constructeur de la classe plxPlugin (obligatoire) parent::__construct($default_lang); # Récupération d'une instance de plxMotor $plxMotor = plxMotor::getInstance(); #init path $this->imgFullPath = isset($plxMotor->aConf['medias']) ? plxUtils::getRacine() . $plxMotor->aConf['medias'] : plxUtils::getRacine() . $plxMotor->aConf['images']; $this->imgPath = isset($plxMotor->aConf['medias']) ? $plxMotor->aConf['medias'] : $plxMotor->aConf['images']; # PROFIL_ADMIN , PROFIL_MANAGER , PROFIL_MODERATOR , PROFIL_EDITOR , PROFIL_WRITER # Accès au menu admin réservé au profil administrateur $this->setAdminProfil(PROFIL_ADMIN, PROFIL_MANAGER); # droits pour accèder à la page config.php du plugin $this->setConfigProfil(PROFIL_ADMIN); # Déclaration des hooks $this->addHook('AdminMediasTop', 'AdminMediasTop'); }
public function step4() { echo L_UPDATE_FILE . " (" . $this->plxAdmin->aConf['categories'] . ")<br />"; $data = file_get_contents(PLX_ROOT . $this->plxAdmin->aConf['categories']); $tag = 'categorie'; if (preg_match_all('{<' . $tag . '[^>]*>(.*?)</' . $tag . '>}', $data, $matches, PREG_PATTERN_ORDER)) { foreach ($matches[0] as $match) { if (!preg_match('/<title_htmltag>/', $match)) { $str = str_replace('</' . $tag . '>', '<title_htmltag><![CDATA[]]></title_htmltag></' . $tag . '>', $match); $data = str_replace($match, $str, $data); } } if (!plxUtils::write($data, PLX_ROOT . $this->plxAdmin->aConf['categories'])) { echo '<p class="error">' . L_UPDATE_ERR_FILE . '</p>'; return false; } } return true; }
public function step2() { echo L_UPDATE_ARTICLES_CONVERSION . "<br />"; $plxGlob_arts = plxGlob::getInstance(PLX_ROOT . $this->plxAdmin->aConf['racine_articles']); if ($files = $plxGlob_arts->query('/(.*).xml$/', 'art')) { foreach ($files as $filename) { if (is_readable($filename)) { $data = file_get_contents(PLX_ROOT . $this->plxAdmin->aConf['racine_articles'] . $filename); if (!preg_match('/\\]\\]<\\/title_htmltag>/', $data)) { $data = preg_replace("/<\\/document>\$/", "\t<title_htmltag>\n\t\t<![CDATA[]]>\n\t</title_htmltag>\n</document>", $data); } if (!plxUtils::write($data, PLX_ROOT . $this->plxAdmin->aConf['racine_articles'] . $filename)) { echo '<p class="error">' . L_UPDATE_ERR_FILE_PROCESSING . ' : ' . $filename . '</p>'; return false; } } } } return true; }
public function step2() { echo L_UPDATE_UPDATE_PLUGINS_FILE . "<br />"; # récupération de la liste des plugins $aPlugins = $this->loadConfig(); # Migration du format du fichier plugins.xml $xml = "<?xml version='1.0' encoding='" . PLX_CHARSET . "'?>\n"; $xml .= "<document>\n"; foreach ($aPlugins as $k => $v) { if (isset($v['activate']) and $v['activate'] != '0') { $xml .= "\t<plugin name=\"{$k}\"></plugin>\n"; } } $xml .= "</document>"; if (!plxUtils::write($xml, path('XMLFILE_PLUGINS'))) { echo '<p class="error">' . L_UPDATE_ERR_FILE_PROCESSING . '</p>'; return false; } return true; }
<?php echo '<input type="hidden" name="catNum[]" value="' . $new_catid . '" />'; plxUtils::printInput($new_catid . '_template', 'categorie.php', 'hidden'); plxUtils::printInput($new_catid . '_name', '', 'text', '10-50'); echo '</td><td>'; plxUtils::printInput($new_catid . '_url', '', 'text', '10-50'); echo '</td><td>'; plxUtils::printSelect($new_catid . '_active', array('1' => L_YES, '0' => L_NO), '1'); echo '</td><td>'; plxUtils::printSelect($new_catid . '_tri', $aTri, $plxAdmin->aConf['tri']); echo '</td><td>'; plxUtils::printInput($new_catid . '_bypage', $plxAdmin->aConf['bypage'], 'text', '1-3'); echo '</td><td>'; plxUtils::printInput($new_catid . '_ordre', ++$num, 'text', '1-3'); echo '</td><td>'; plxUtils::printSelect($new_catid . '_menu', array('oui' => L_DISPLAY, 'non' => L_HIDE), '1'); echo '</td><td> '; ?> </td> </tr> </tbody> </table> </div> </form> <?php # Hook Plugins eval($plxAdmin->plxPlugins->callHook('AdminCategoriesFoot')); # On inclut le footer include dirname(__FILE__) . '/foot.php';
public function step9() { if (!is_file(PLX_ROOT . '.htaccess')) { echo "Création du fichier .htaccess<br />"; $txt = '<Files "version"> Order allow,deny Deny from all </Files>'; if (!plxUtils::write($txt, PLX_ROOT . '.htaccess')) { echo '<p class="error">Erreur pendant la crétion du fichier .htaccess</p>'; return false; } } return true; }
" title="Revenir au site">Retour</a></p> <?php } else { ?> <form action="index.php" method="post"> <fieldset> <p><strong>Vous allez mettre à jour votre ancienne version de PluXml <?php echo $plxUpdater->oldVersion; ?> </strong></p> <?php if (empty($plxUpdater->oldVersion)) { ?> <p>Veuillez sélectionner dans la liste ci-dessous votre ancienne version de PluXml à mettre à jour.</p> <p><?php plxUtils::printSelect('version', $versions, ''); ?> </p> <p> Si votre ancienne version n'est pas listée ici, c'est qu'il n'existe pas de procédure automatisée de mise à jour car votre version est trop vieille.<br /> Nous vous suggérons de télécharger la dernière version de <a href="http://pluxml.org">PluXml</a> et de faire une nouvelle installation. </p> <?php } ?> <br /> <p class="msg">Attention, avant de démarrer la mise à jour, n'oubliez pas de faire une sauvegarde de vos données en faisant une copie du dossier "data"</p> <p style="text-align:center"><input type="submit" name="submit" value="Démarrer la mise à jour" /></p> </fieldset> </form> <?php
plxUtils::printSelect('feed_chapo', array('1' => L_YES, '0' => L_NO), $plxAdmin->aConf['feed_chapo']); ?> <a class="hint"><span><?php echo L_CONFIG_VIEW_FEEDS_HEADLINE_HELP; ?> </span></a> </div> </div> <div class="grid"> <div class="col sml-12"> <label for="id_content"><?php echo L_CONFIG_VIEW_FEEDS_FOOTER; ?> :</label> <?php plxUtils::printArea('content', plxUtils::strCheck($plxAdmin->aConf['feed_footer']), 140, 5); ?> </div> </div> </fieldset> <?php eval($plxAdmin->plxPlugins->callHook('AdminSettingsDisplay')); ?> <?php echo plxToken::getTokenPostMethod(); ?> </form>
function install($content, $config) { # gestion du timezone date_default_timezone_set($config['timezone']); # Création du fichier de configuration $xml = '<?xml version="1.0" encoding="' . PLX_CHARSET . '"?>' . "\n"; $xml .= '<document>' . "\n"; foreach ($config as $k => $v) { if (is_numeric($v)) { $xml .= "\t<parametre name=\"{$k}\">" . $v . "</parametre>\n"; } else { $xml .= "\t<parametre name=\"{$k}\"><![CDATA[" . plxUtils::cdataCheck($v) . "]]></parametre>\n"; } } $xml .= '</document>'; plxUtils::write($xml, path('XMLFILE_PARAMETERS')); # Création du fichier des utilisateurs $salt = plxUtils::charAleatoire(10); $xml = '<?xml version="1.0" encoding="' . PLX_CHARSET . '"?>' . "\n"; $xml .= "<document>\n"; $xml .= "\t" . '<user number="001" active="1" profil="0" delete="0">' . "\n"; $xml .= "\t\t" . '<login><![CDATA[' . trim($content['login']) . ']]></login>' . "\n"; $xml .= "\t\t" . '<name><![CDATA[' . trim($content['name']) . ']]></name>' . "\n"; $xml .= "\t\t" . '<infos><![CDATA[]]></infos>' . "\n"; $xml .= "\t\t" . '<password><![CDATA[' . sha1($salt . md5(trim($content['pwd']))) . ']]></password>' . "\n"; $xml .= "\t\t" . '<salt><![CDATA[' . $salt . ']]></salt>' . "\n"; $xml .= "\t\t" . '<email><![CDATA[]]></email>' . "\n"; $xml .= "\t\t" . '<lang><![CDATA[' . $config['default_lang'] . ']]></lang>' . "\n"; $xml .= "\t</user>\n"; $xml .= "</document>"; plxUtils::write($xml, path('XMLFILE_USERS')); # Création du fichier des categories $xml = '<?xml version="1.0" encoding="' . PLX_CHARSET . '"?>' . "\n"; $xml .= '<document>' . "\n"; $xml .= "\t" . '<categorie number="001" active="1" homepage="1" tri="' . $config['tri'] . '" bypage="' . $config['bypage'] . '" menu="oui" url="' . L_DEFAULT_CATEGORY_URL . '" template="categorie.php"><name><![CDATA[' . plxUtils::strRevCheck(L_DEFAULT_CATEGORY_TITLE) . ']]></name><description><![CDATA[]]></description><meta_description><![CDATA[]]></meta_description><meta_keywords><![CDATA[]]></meta_keywords><title_htmltag><![CDATA[]]></title_htmltag></categorie>' . "\n"; $xml .= '</document>'; plxUtils::write($xml, path('XMLFILE_CATEGORIES')); # Création du fichier des pages statiques $xml = '<?xml version="1.0" encoding="' . PLX_CHARSET . '"?>' . "\n"; $xml .= '<document>' . "\n"; $xml .= "\t" . '<statique number="001" active="1" menu="oui" url="' . L_DEFAULT_STATIC_URL . '" template="static.php"><group><![CDATA[]]></group><name><![CDATA[' . plxUtils::strRevCheck(L_DEFAULT_STATIC_TITLE) . ']]></name><meta_description><![CDATA[]]></meta_description><meta_keywords><![CDATA[]]></meta_keywords><title_htmltag><![CDATA[]]></title_htmltag></statique>' . "\n"; $xml .= '</document>'; plxUtils::write($xml, path('XMLFILE_STATICS')); plxUtils::write(file_get_contents(PLX_CORE . '/lib/html.static.txt'), PLX_ROOT . $config['racine_statiques'] . '001.' . L_DEFAULT_STATIC_URL . '.php'); # Création du premier article $html = explode('-----', file_get_contents(PLX_CORE . '/lib/html.article.txt')); $xml = '<?xml version="1.0" encoding="' . PLX_CHARSET . '"?>' . "\n"; $xml .= '<document> <title><![CDATA[' . plxUtils::strRevCheck(L_DEFAULT_ARTICLE_TITLE) . ']]></title> <allow_com>1</allow_com> <template><![CDATA[article.php]]></template> <chapo> <![CDATA[' . $html[0] . ']]> </chapo> <content> <![CDATA[' . $html[1] . ']]> </content> <tags> <![CDATA[PluXml]]> </tags> <meta_description> <![CDATA[]]> </meta_description> <meta_keywords> <![CDATA[]]> </meta_keywords> <title_htmltag> <![CDATA[]]> </title_htmltag> </document>'; plxUtils::write($xml, PLX_ROOT . $config['racine_articles'] . '0001.001.001.' . date('YmdHi') . '.' . L_DEFAULT_ARTICLE_URL . '.xml'); # Création du fichier des tags servant de cache $xml = '<?xml version="1.0" encoding="' . PLX_CHARSET . '"?>' . "\n"; $xml .= '<document>' . "\n"; $xml .= "\t" . '<article number="0001" date="' . date('YmdHi') . '" active="1"><![CDATA[PluXml]]></article>' . "\n"; $xml .= '</document>'; plxUtils::write($xml, path('XMLFILE_TAGS')); # Création du fichier des plugins $xml = '<?xml version="1.0" encoding="' . PLX_CHARSET . '"?>' . "\n"; $xml .= '<document>' . "\n"; $xml .= '</document>'; plxUtils::write($xml, path('XMLFILE_PLUGINS')); # Création du premier commentaire $xml = '<?xml version="1.0" encoding="' . PLX_CHARSET . '"?>' . "\n"; $xml .= '<comment> <author><![CDATA[pluxml]]></author> <type>normal</type> <ip>127.0.0.1</ip> <mail><![CDATA[contact@pluxml.org]]></mail> <site><![CDATA[http://www.pluxml.org]]></site> <content><![CDATA[' . plxUtils::strRevCheck(L_DEFAULT_COMMENT_CONTENT) . ']]></content> </comment>'; plxUtils::write($xml, PLX_ROOT . $config['racine_commentaires'] . '0001.' . date('U') . '-1.xml'); }
<p>Par <strong><?php echo $plxAdmin->plxRecord_coms->f('author'); ?> </strong> le <?php echo plxDate::dateIsoToHum($plxAdmin->plxRecord_coms->f('date'), '#day #num_day #month #num_year(4) à #hour:#minute'); ?> - <a href="commentaire.php<?php echo !empty($_GET['a']) ? '?c=' . $comId . '&a=' . $_GET['a'] : '?c=' . $comId; ?> " title="Éditer ce commentaire">éditer</a> - <a href="javascript:answerCom('content','<?php echo $plxAdmin->plxRecord_coms->f('numero'); ?> ','<?php echo plxUtils::strCheck($plxAdmin->plxRecord_coms->f('author')); ?> ');" title="RÉpondre à ce commentaire">répondre</a> </p> </div> <blockquote><p><?php echo nl2br($plxAdmin->plxRecord_coms->f('content')); ?> </p></blockquote> </div> <?php } ?> </div> <?php }
function pluginsList($plugins, $defaultLang, $type) { # plugins array() contient la liste des plugins à afficher # defaultLang string langue utilisée dans l'admin # type true|false true=liste des plugins actifs, false=liste des plugins inactifs $output = ''; if (sizeof($plugins) > 0) { $num = 0; foreach ($plugins as $plugName => $plugInstance) { $ordre = ++$num; # détermination de l'icone à afficher if (is_file(PLX_PLUGINS . $plugName . '/icon.png')) { $icon = PLX_PLUGINS . $plugName . '/icon.png'; } elseif (is_file(PLX_PLUGINS . $plugName . '/icon.jpg')) { $icon = PLX_PLUGINS . $plugName . '/icon.jpg'; } elseif (is_file(PLX_PLUGINS . $plugName . '/icon.gif')) { $icon = PLX_PLUGINS . $plugName . '/icon.gif'; } else { $icon = PLX_CORE . 'admin/theme/images/icon_plugin.png'; } $output .= '<tr class="top">'; # checkbox $output .= '<td>'; $output .= '<input type="hidden" name="plugName[]" value="' . $plugName . '" />'; $output .= '<input type="checkbox" name="chkAction[]" value="' . $plugName . '" />'; $output .= '</td>'; # icon $output .= '<td><img src="' . $icon . '" alt="" /></td>'; # plugin infos $output .= '<td class="wrap">'; # message d'alerte si plugin non configuré if ($type and file_exists(PLX_PLUGINS . $plugName . '/config.php') and !file_exists(PLX_ROOT . PLX_CONFIG_PATH . 'plugins/' . $plugName . '.xml')) { $output .= '<span style="margin-top:5px" class="alert red float-right">' . L_PLUGIN_NO_CONFIG . '</span>'; } # title + version $output .= '<strong>' . plxUtils::strCheck($plugInstance->getInfo('title')) . '</strong> - ' . L_PLUGINS_VERSION . ' <strong>' . plxUtils::strCheck($plugInstance->getInfo('version')) . '</strong>'; # date if ($plugInstance->getInfo('date') != '') { $output .= ' (' . plxUtils::strCheck($plugInstance->getInfo('date')) . ')'; } # description $output .= '<br />' . plxUtils::strCheck($plugInstance->getInfo('description')) . '<br />'; # author $output .= L_PLUGINS_AUTHOR . ' : ' . plxUtils::strCheck($plugInstance->getInfo('author')); # site if ($plugInstance->getInfo('site') != '') { $output .= ' - <a href="' . plxUtils::strCheck($plugInstance->getInfo('site')) . '">' . plxUtils::strCheck($plugInstance->getInfo('site')) . '</a>'; } $output .= '</td>'; # colonne pour trier les plugins if ($type) { $output .= '<td>'; $output .= '<input size="2" maxlength="3" type="text" name="plugOrdre[' . $plugName . ']" value="' . $ordre . '" />'; $output .= '</td>'; } # affichage des liens du plugin $output .= '<td class="right">'; # lien configuration if (is_file(PLX_PLUGINS . $plugName . '/config.php')) { $output .= '<a title="' . L_PLUGINS_CONFIG_TITLE . '" href="parametres_plugin.php?p=' . urlencode($plugName) . '">' . L_PLUGINS_CONFIG . '</a><br />'; } # lien pour code css $output .= '<a title="' . L_PLUGINS_CSS_TITLE . '" href="parametres_plugincss.php?p=' . urlencode($plugName) . '">' . L_PLUGINS_CSS . '</a><br />'; # lien aide if (is_file(PLX_PLUGINS . $plugName . '/lang/' . $defaultLang . '-help.php')) { $output .= '<a title="' . L_HELP_TITLE . '" href="parametres_help.php?help=plugin&page=' . urlencode($plugName) . '">' . L_HELP . '</a>'; } $output .= '</td>'; $output .= '</tr>'; } } else { $colspan = $_SESSION['selPlugins'] == '1' ? 5 : 4; $output .= '<tr><td colspan="' . $colspan . '" class="center">' . L_NO_PLUGIN . '</td></tr>'; } return $output; }
<label><?php echo L_DATE_UPDATE; ?> :</label> <div class="inline-form"> <?php plxUtils::printInput('date_update_day', $date_update['day'], 'text', '2-2', false, 'day'); ?> <?php plxUtils::printInput('date_update_month', $date_update['month'], 'text', '2-2', false, 'month'); ?> <?php plxUtils::printInput('date_update_year', $date_update['year'], 'text', '2-4', false, 'year'); ?> <?php plxUtils::printInput('date_update_time', $date_update['time'], 'text', '2-5', false, 'time'); ?> <a class="ico_cal" href="javascript:void(0)" onclick="dateNow('date_update', <?php echo date('Z'); ?> ); return false;" title="<?php L_NOW; ?> "> <img src="theme/images/date.png" alt="calendar" /> </a> </div> </div> </div> </fieldset> <?php
?> <a class="hint"><span><?php echo L_HELP_SLASH_END; ?> </span></a> </div> </div> <div class="grid"> <div class="col sml-12 med-5 label-centered"> <label for="id_custom_admincss_file"><?php echo L_CONFIG_CUSTOM_CSSADMIN_PATH; ?> :</label> </div> <div class="col sml-12 med-7"> <?php plxUtils::printInput('custom_admincss_file', $plxAdmin->aConf['custom_admincss_file']); ?> </div> </div> </fieldset> <?php eval($plxAdmin->plxPlugins->callHook('AdminSettingsAdvanced')); ?> </form> <?php # Hook Plugins eval($plxAdmin->plxPlugins->callHook('AdminSettingsAdvancedFoot')); # On inclut le footer include dirname(__FILE__) . '/foot.php';
/** * Méthode qui sauvegarde la liste des tags dans fichier XML * selon le contenu de la variable de classe $aTags * * @param null * @return null * @author Stephane F **/ public function editTags() { # Génération du fichier XML $xml = "<?xml version='1.0' encoding='" . PLX_CHARSET . "'?>\n"; $xml .= "<document>\n"; foreach ($this->aTags as $id => $tag) { $xml .= "\t" . '<article number="' . $id . '" date="' . $tag['date'] . '" active="' . $tag['active'] . '"><![CDATA[' . $tag['tags'] . ']]></article>' . "\n"; } $xml .= "</document>"; # On écrit le fichier plxUtils::write($xml, PLX_ROOT . $this->aConf['tags']); }
echo $plxPlugin->getParam("mnuName"); ?> "> </p> <p> <label for="mnuPos">Position de la page</label> <input id="mnuPos" name="mnuPos" maxlength="255" value="<?php echo $plxPlugin->getParam("mnuPos"); ?> "> </p> <p> <label for="template">Template de votre page</label> <?php plxUtils::printSelect('template', $aTemplates, $template); ?> </p> <p class="in-action-bar"> <?php echo plxToken::getTokenPostMethod(); ?> <input type="submit" name="submit" value="<?php $plxPlugin->lang('SUBMIT'); ?> " /> </p> </form>
echo plxUtils::strCheck($profil['login']); ?> </strong></p> <p class="field"><label>Nom d'utilisateur :</label></p> <?php plxUtils::printInput('name', plxUtils::strCheck($profil['name']), 'text', '20-255'); ?> <p class="field"><label>Informations :</label></p> <?php plxUtils::printArea('infos', plxUtils::strCheck($profil['infos']), 140, 5); ?> </fieldset> <p class="center"><input type="submit" name="profil" value="Modifier votre profil" /></p> <fieldset class="withlabel"> <legend>Changement du mot de passe :</legend> <p class="field"><label>Mot de passe :</label></p> <?php plxUtils::printInput('password1', '', 'password', '20-255'); ?> <p class="field"><label>Confirmation du mot de passe :</label></p> <?php plxUtils::printInput('password2', '', 'password', '20-255'); ?> </fieldset> <p class="center"><input type="submit" name="password" value="Changer votre mot de passe" /></p> </form> <?php # On inclut le footer include dirname(__FILE__) . '/foot.php';
public function step9() { if (!is_file(PLX_ROOT . '.htaccess')) { echo L_UPDATE_CREATE_HTACCESS_FILE . "<br />"; $txt = '<Files "version"> Order allow,deny Deny from all </Files>'; if (!plxUtils::write($txt, PLX_ROOT . '.htaccess')) { echo '<p class="error">' . L_UPDATE_ERR_CREATE_HTACCESS_FILE . '</p>'; return false; } } return true; }
$nbreponse = floor(sizeof($plxPlugin->getParams()) / 2); if (!empty($_POST)) { if (!empty($_POST['question-new']) and !empty($_POST['reponse-new'])) { # création d'un nouveau reponse $newreponse = $nbreponse + 1; $plxPlugin->setParam('question' . $newreponse, plxUtils::strCheck($_POST['question-new']), 'cdata'); $plxPlugin->setParam('reponse' . $newreponse, plxUtils::strCheck($_POST['reponse-new']), 'cdata'); $plxPlugin->saveParams(); } else { # Mise à jour des reponses existants for ($i = 1; $i <= $nbreponse; $i++) { if ($_POST['delete' . $i] != "1" and !empty($_POST['question' . $i]) and !empty($_POST['reponse' . $i])) { // si on ne supprime pas et que les reponses ne sont pas vide #mise a jour du question et reponse $plxPlugin->setParam('question' . $i, plxUtils::strCheck($_POST['question' . $i]), 'cdata'); $plxPlugin->setParam('reponse' . $i, plxUtils::strCheck($_POST['reponse' . $i]), 'cdata'); $plxPlugin->saveParams(); } elseif ($_POST['delete' . $i] == "1") { $plxPlugin->setParam('question' . $i, '', ''); $plxPlugin->setParam('reponse' . $i, '', ''); $plxPlugin->saveParams(); } } } } # mise à jour du nombre de reponses existants $nbreponse = floor(sizeof($plxPlugin->getParams()) / 2); ?> <!-- navigation sur la page configuration du plugin --> <nav id="tabby-1" class="tabby-tabs" data-for="example-tab-content">
$ordre = ++$num; echo '<tr class="line-' . $num % 2 . '">'; echo '<td><input type="checkbox" name="idFile[]" value="' . $v['name'] . '" /></td>'; echo '<td class="icon">'; if (is_file($v['path']) and $isImage) { echo '<a onclick="overlay(\'' . $v['path'] . '\');return false;" title="' . plxUtils::strCheck($v['name']) . '" href="' . $v['path'] . '"><img alt="" src="' . $v['.thumb'] . '" class="thumb" /></a>'; } echo '</td>'; echo '<td>'; echo '<a onclick="this.target=\'_blank\';return true;" title="' . plxUtils::strCheck($v['name']) . '" href="' . $v['path'] . '">' . plxUtils::strCheck($v['name']) . '</a><br />'; if ($isImage and is_file(plxUtils::thumbName($v['path']))) { echo '<a onclick="this.target=\'_blank\';return true;" title="' . L_MEDIAS_THUMB . ' : ' . plxUtils::strCheck($v['name']) . '" href="' . plxUtils::thumbName($v['path']) . '">' . L_MEDIAS_THUMB . '</a> : ' . $v['thumb']['infos'][0] . ' x ' . $v['thumb']['infos'][1] . ' (' . plxUtils::formatFilesize($v['thumb']['filesize']) . ')'; } echo '</td>'; echo '<td>' . strtoupper($v['extension']) . '</td>'; echo '<td>' . plxUtils::formatFilesize($v['filesize']) . '</td>'; $dimensions = ' '; if ($isImage and (isset($v['infos']) and isset($v['infos'][0]) and isset($v['infos'][1]))) { $dimensions = $v['infos'][0] . ' x ' . $v['infos'][1]; } echo '<td>' . $dimensions . '</td>'; echo '<td>' . plxDate::formatDate(plxDate::timestamp2Date($v['date'])) . '</td>'; echo '</tr>'; } } else { echo '<tr><td colspan="7" class="center">' . L_MEDIAS_NO_FILE . '</td></tr>'; } ?> </tbody> </table> </div>
/** * Méthode qui retourne l'url du dossier du plugin (avec le http://) * * @return string url vers le dossier du plugin * @author Stephane F **/ public function URL() { return plxUtils::getRacine() . $this->ABS_PATH(); }
?> </h2> <p class="field"><label for="id_affPanier"><?php $plxPlugin->lang('L_CONFIG_BASKET_DISPLAY'); ?> :</label></p> <p><?php plxUtils::printSelect("affPanier", $tabAffPanier, $var["affPanier"]); ?> </p> <p class="field"><label for="id_template"><?php $plxPlugin->lang('L_CONFIG_PAGE_TEMPLATE'); ?> :</label></p> <p><?php plxUtils::printSelect('template', $aTemplates, $var['template']); ?> </p> <p></p> </div> <fieldset align="center"></p> <p></p> <p> <?php echo plxToken::getTokenPostMethod(); ?> <input type="submit" name="submit" value="<?php $plxPlugin->lang('L_CONFIG_SUBMIT'); ?>
# chargement du fichier d'administration du plugin $filename = realpath(PLX_PLUGINS . $plugin . '/config.php'); if (is_file($filename)) { # si le plugin n'est pas actif, aucune instance n'a été créée, on va donc la créer, sinon on prend celle qui existe if (!isset($plxAdmin->plxPlugins->aPlugins[$plugin])) { $plxPlugin = $plxAdmin->plxPlugins->getInstance($plugin); } else { $plxPlugin = $plxAdmin->plxPlugins->aPlugins[$plugin]; } # Control des autorisation d'accès à l'écran config.php du plugin $plxAdmin->checkProfil($plxPlugin->getConfigProfil()); # chargement de l'écran de paramétrage du plugin config.php ob_start(); echo ' <div class="inline-form action-bar"> <h2>' . plxUtils::strCheck($plugin) . '</h2> <p><a class="back" href="parametres_plugins.php">' . L_BACK_TO_PLUGINS . '</a></p> </div>'; include $filename; $output = ob_get_clean(); } else { plxMsg::Error(L_NO_ENTRY); header('Location: parametres_plugins.php'); exit; } # On inclut le header include dirname(__FILE__) . '/top.php'; # Affichage des données echo $output; # On inclut le footer include dirname(__FILE__) . '/foot.php';
/** * Méthode qui crée physiquement le fichier XML du commentaire * * @param comment array avec les données du commentaire à ajouter * @return booléen * @author Anthony GUÉRIN, Florent MONTHEL et Stéphane F **/ public function addCommentaire($content) { # Hook plugins if (eval($this->plxPlugins->callHook('plxMotorAddCommentaire'))) { return; } # On genere le contenu de notre fichier XML $xml = "<?xml version='1.0' encoding='" . PLX_CHARSET . "'?>\n"; $xml .= "<comment>\n"; $xml .= "\t<author><![CDATA[" . plxUtils::cdataCheck($content['author']) . "]]></author>\n"; $xml .= "\t<type>" . $content['type'] . "</type>\n"; $xml .= "\t<ip>" . $content['ip'] . "</ip>\n"; $xml .= "\t<mail><![CDATA[" . plxUtils::cdataCheck($content['mail']) . "]]></mail>\n"; $xml .= "\t<site><![CDATA[" . plxUtils::cdataCheck($content['site']) . "]]></site>\n"; $xml .= "\t<content><![CDATA[" . plxUtils::cdataCheck($content['content']) . "]]></content>\n"; $xml .= "\t<parent><![CDATA[" . plxUtils::cdataCheck($content['parent']) . "]]></parent>\n"; # Hook plugins eval($this->plxPlugins->callHook('plxMotorAddCommentaireXml')); $xml .= "</comment>\n"; # On ecrit ce contenu dans notre fichier XML return plxUtils::write($xml, PLX_ROOT . $this->aConf['racine_commentaires'] . $content['filename']); }
/** * Méthode qui converti les liens relatifs en liens absolus * * @param base url du site qui sera rajoutée devant les liens relatifs * @param html chaine de caractères à convertir * @return string chaine de caractères modifiée **/ public static function rel2abs($base, $html) { // generate server-only replacement for root-relative URLs $server = preg_replace('@^([^\\:]*)://([^/*]*)(/|$).*@', '\\1://\\2/', $base); // on repart les liens ne commençant que part # $get = plxUtils::getGets(); $html = preg_replace('@\\<([^>]*) (href|src)="(#[^"]*)"@i', '<\\1 \\2="' . $get . '\\3"', $html); // replace root-relative URLs $html = preg_replace('@\\<([^>]*) (href|src)="/([^"]*)"@i', '<\\1 \\2="' . $server . '\\3"', $html); // replace base-relative URLs $html = preg_replace('@\\<([^>]*) (href|src)="(([^\\:"])*|([^"]*:[^/"].*))"@i', '<\\1 \\2="' . $base . '\\3"', $html); return $html; }
public function step6() { echo L_UPDATE_CREATE_PLUGINS_FILE . "<br />"; $xml = '<?xml version="1.0" encoding="' . PLX_CHARSET . '"?>' . "\n"; $xml .= '<document>' . "\n"; $xml .= '</document>'; if (!plxUtils::write($xml, PLX_ROOT . $this->plxAdmin->aConf['plugins'])) { echo '<p class="error">' . L_UPDATE_ERR_CREATE_PLUGINS_FILE . '</p>'; return false; } return true; }
echo '<td class="tc1" style="text-align:center"> <a title="Commentaires en attente de validation" href="commentaires_offline.php?a=' . $plxAdmin->plxRecord_arts->f('numero') . '&page=1">' . $nbComsToValidate . '</a> / <a title="Commentaires publiés" href="commentaires_online.php?a=' . $plxAdmin->plxRecord_arts->f('numero') . '&page=1">' . $nbComsValidated . '</a></td>'; echo '<td class="tc4"> ' . plxUtils::strCheck($author) . '</td>'; echo '<td class="tc4" style="text-align:center"> '; if ($publi and $draft == '') { # Si l'article est publié echo '<a href="' . PLX_ROOT . '?article' . intval($plxAdmin->plxRecord_arts->f('numero')) . '/' . $plxAdmin->plxRecord_arts->f('url') . '" title="Visualiser cet article sur le site">Visualiser</a> - '; } echo '<a href="article.php?a=' . $plxAdmin->plxRecord_arts->f('numero') . '" title="Editer cet article">Éditer</a>'; echo "</td>"; echo "</tr>"; } ?> <tr> <td colspan="7"> <?php plxUtils::printSelect('selection', array('' => 'Pour la sélection...', 'delete' => 'Supprimer'), ''); ?> <input class="button" type="submit" name="submit" value="Ok" /> </td> </tr> <?php } else { # Pas d'article echo '<tr><td colspan="7" class="center">Aucun article ne correspond à votre recherche</td></tr>'; } ?> </tbody> </table> </form>
</div> <?php eval($plxAdmin->plxPlugins->callHook('AdminSettingsEdittplTop')); ?> <div class="grid"> <div class="col sml-12"> <label for="id_content"><?php echo L_CONTENT_FIELD; ?> :</label> <?php plxUtils::printInput('tpl', plxUtils::strCheck($tpl), 'hidden'); ?> <?php plxUtils::printArea('content', plxUtils::strCheck($content), 60, 20, false, 'full-width'); ?> <?php eval($plxAdmin->plxPlugins->callHook('AdminSettingsEdittpl')); ?> </div> </div> </form> <?php # Hook Plugins eval($plxAdmin->plxPlugins->callHook('AdminSettingsEdittplFoot')); # On inclut le footer include dirname(__FILE__) . '/foot.php';