/** * Méthode qui affiche l'image du capcha * * @return stdio * @author Stéphane F. **/ public function plxShowCapchaQ() { //'.PLX_PLUGINS.' $plxMotor = plxMotor::getInstance(); $root = $plxMotor->urlRewrite(str_replace('./', '', PLX_PLUGINS) . 'plxMyCapchaImage/capcha.php'); $_SESSION['capcha'] = $this->getCode(5); echo '<img src="' . $root . '" alt="Capcha" id="capcha" />'; echo '<a id="capcha-reload" href="javascript:void(0)" onclick="document.getElementById(\'capcha\').src=\'' . $root . '?\' + Math.random(); return false;"><img src="' . PLX_PLUGINS . 'plxMyCapchaImage/reload.png" title="" /></a><br />'; $this->lang('L_MESSAGE'); echo '<?php return true; ?>'; # pour interrompre la fonction CapchaQ de plxShow }
/** * Constructeur qui initialise l'objet plxMotor par référence * * @param plxMotor objet plxMotor passé par référence * @return null * @author Florent MONTHEL **/ protected function __construct() { $this->plxMotor = plxMotor::getInstance(); # Chargement du fichier de lang du theme $langfile = PLX_ROOT . $this->plxMotor->aConf['racine_themes'] . $this->plxMotor->style . '/lang/' . $this->plxMotor->aConf['default_lang'] . '.php'; if (is_file($langfile)) { include $langfile; $this->lang = $LANG; } # Hook Plugins eval($this->plxMotor->plxPlugins->callHook('plxShowConstruct')); }
public function mkhtaccess() { $plxMotor = plxMotor::getInstance(); $ht = '<IfModule mod_rewrite.c>' . "\n"; $ht .= 'RewriteEngine on' . "\n"; $ht .= 'RewriteCond %{REQUEST_URI} !/plugins/maintenance/workinprogress.php$' . "\n"; $ht .= 'RewriteCond %{REMOTE_ADDR} !' . $this->getParam('ip') . "\n"; $ht .= 'RewriteRule ^(.*)$ ' . $plxMotor->racine . 'plugins/maintenance/workinprogress.php [L]' . "\n"; $ht .= '</IfModule>'; if (is_file(PLX_ROOT . '.htaccess')) { rename(PLX_ROOT . '.htaccess', PLX_ROOT . 'htaccess.txt'); } plxUtils::write($ht, PLX_ROOT . '.htaccess'); }
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'); }
<?php if (!defined('PLX_ROOT')) { exit; } if (!isset($plxMotor)) { $plxMotor = plxMotor::getInstance(); } $plxPlugin = $plxMotor->plxPlugins->getInstance('pickyPasteInPluxml'); ?> <div id="PickyWrapper"> <h1 id="title"> <script type="text/javascript"> var texts = { 'fr': 'Attention, vous allez fermer la page actuelle avec un message entamé\n\nÊtes-vous sûr ?', 'en': 'Caution, you\'re going to shut the current page with a started message.\n\nAre you sure?' } function warn(lang) { if(document.getElementById('message').value != '') { var msg = texts[lang]; if(lang != 'en') msg += '\n\n--------------\n\n' + texts["en"]; return confirm(msg); } return true;
public function modele($modele) { if (!isset($this->donneesModeles["pileModeles"])) { $this->donneesModeles["pileModeles"] = array(); } $this->donneesModeles["pileModeles"][] = $modele; // fichier du modèle dans le thème $plxMotor = plxMotor::getInstance(); $racineTheme = PLX_ROOT . $plxMotor->aConf["racine_themes"] . $plxMotor->style; $fichier = "{$racineTheme}/modeles/plxMyShop/{$modele}.php"; // si le fichier du modèle n'existe pas dans le thème if (!is_file($fichier)) { // on choisi le fichier par défaut dans le répertoire de l'extension $fichier = "modeles/{$modele}.php"; } $d = $this->donneesModeles; require $fichier; // rétablissement des noms des modèles array_pop($this->donneesModeles["pileModeles"]); }
/** * Méthode statique qui affiche le formulaire de recherche * * @return stdio * @author Stephane F **/ public static function form($title = false) { $placeholder = ''; # récupération d'une instance de plxMotor $plxMotor = plxMotor::getInstance(); $plxPlugin = $plxMotor->plxPlugins->getInstance('plxMySearch'); $searchword = ''; if (!empty($_POST['searchfield'])) { $searchword = plxUtils::strCheck(plxUtils::unSlash($_POST['searchfield'])); } if ($plxPlugin->getParam('placeholder_' . $plxPlugin->default_lang) != '') { $placeholder = ' placeholder="' . $plxPlugin->getParam('placeholder_' . $plxPlugin->default_lang) . '"'; } ?> <div class="searchform"> <form action="<?php echo $plxMotor->urlRewrite('?' . $plxPlugin->getParam('url')); ?> " method="post"> <?php if ($title) { ?> <p class="searchtitle"> <?php if ($plxPlugin->getParam('checkboxes_' . $plxPlugin->default_lang) == '') { $plxPlugin->lang('L_FORM_SEARCHFIELD'); } else { $plxPlugin->lang('L_FORM_SEARCHFIELD_2'); } ?> : </p> <?php } ?> <div class="searchfields"> <?php if ($plxPlugin->getParam('checkboxes_' . $plxPlugin->default_lang) != '') { if ($chk = explode(';', $plxPlugin->getParam('checkboxes_' . $plxPlugin->default_lang))) { echo '<ul>'; foreach ($chk as $k => $v) { $c = plxUtils::title2url(trim($v)); $sel = ""; if (isset($_POST['searchcheckboxes'])) { foreach ($_POST['searchcheckboxes'] as $s) { if ($s == $c) { $sel = ' checked="checked"'; } } } echo '<li><input' . $sel . ' class="searchcheckboxes" type="checkbox" name="searchcheckboxes[]" id="id_searchcheckboxes[]" value="' . $c . '" /> ' . plxUtils::strCheck($v) . '</li>'; } echo '</ul>'; } } ?> <input type="text"<?php echo $placeholder; ?> class="searchfield" name="searchfield" value="<?php echo $searchword; ?> " /> <input type="submit" class="searchbutton" name="searchbutton" value="<?php echo $plxPlugin->getParam('frmLibButton_' . $plxPlugin->default_lang); ?> " /> </p> </div> </form> </div> <?php }
/** * Transform svg file into vml file for internet explorer * * @param $svg string svg to transform * @param $vml string path to vml file * @param $root string path of root of app * @param $url string url of site * @return vml string * * @author Cyril MAGUIRE */ public function svg2vml($svg, $vml, $root, $xsl = 'vendors/svg2vml/svg2vml.xsl', $xslpath = '/svg2vml/') { include_once 'svg2vml/xslt.php'; if (is_string($svg)) { $xsl = str_replace('include href="XSL2', 'include href="' . $xslpath . 'XSL2', file_get_contents($xsl)); # for $xsl, see http://vectorconverter.sourceforge.net/index.html $xml_contents = $svg; $from = "/(<meta[^>]*[^\\/]?)>/i"; $xml_contents = preg_replace($from, "\$1/>", $xml_contents); $from = "/\\/(\\/>)/i"; $xml_contents = preg_replace($from, "\$1", $xml_contents); $xml_contents = preg_replace("/<\\!DOCTYPE[^>]+\\>/i", "", $xml_contents); $xml_contents = preg_replace("/<\\?xml-stylesheet[^>]+\\>/i", "", $xml_contents); $xml_contents = preg_replace("/(\r\n|\n|\r)/s", '', $xml_contents); $xml_contents = str_replace(array("\r\n", "\n", "\r", CHR(10), CHR(13)), '', trim($xml_contents)); $xml_contents = preg_replace("/\\<defs\\>(\\s*)\\<style(.*)\\<\\/style\\>(\\s*)\\<\\/defs\\>/", "", $xml_contents); $xh = xslt_create(); $arguments = array('/_xml' => $xml_contents, '/_xsl' => $xsl); $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments); xslt_free($xh); if ($result) { $result = str_replace('<?xml version="1.0"?>' . "\n", '', $result); $result = str_replace('><', ">\n<", $result); file_put_contents($root . $vml, $result); $output = "<div class=\"object\"><object type=\"text/html\" data=\"" . $root . $vml . "\" >"; $output .= "</object></div>\n"; $output = $this->wmodeTransparent($output); return $output; } else { $f = str_replace(array('.html', PLX_PHPGRAPH), array('.png', PLX_PHPGRAPH_IMG), $root . $vml); if (is_file($f)) { $plxMotor = plxMotor::getInstance(); return '<img src="' . $plxMotor->urlRewrite($f) . '" alt="graph" />'; } } } else { return L_ERROR_FILE_NOT_FOUND; } }
public function PP_msg($msg, $exit = false, $status = 'error') { if (!empty($msg)) { if (!isset($plxMotor)) { $plxMotor = plxMotor::getInstance(); } if (!isset($plxShow)) { $plxShow = plxShow::getInstance(); } # Traitements du thème if ($plxMotor->style == '' or !is_dir(PLX_ROOT . $plxMotor->aConf['racine_themes'] . $plxMotor->style)) { header('Content-Type: text/plain'); echo $status == 'error' ? '<span class="error">' . $this->getLang($msg) . '</span>' : $this->getLang($msg); } elseif (file_exists(PLX_ROOT . $plxMotor->aConf['racine_themes'] . $plxMotor->style . '/' . $plxMotor->template)) { # On impose le charset header('Content-Type: text/html; charset=' . PLX_CHARSET); # Insertion du template include PLX_ROOT . $plxMotor->aConf['racine_themes'] . $plxMotor->style . '/' . $plxMotor->template . 'header.php'; ?> <section> <div id="container"> <div class="width-sidebar"> <article role="article" id="static-page-<?php echo $plxShow->staticId(); ?> "> <header> <h1> <?php echo 'PickyPaste ' . ($status == 'error' ? '- ' . $this->getLang('L_ERROR') : ''); ?> </h1> </header> <section> <?php echo $status == 'error' ? '<span class="error">' . $this->getLang($msg) . '</span>' : $this->getLang($msg); ?> </section> </article> </div> <?php if ($this->getParam('sidebar') == 1) { include PLX_ROOT . $plxMotor->aConf['racine_themes'] . $plxMotor->style . '/' . $plxMotor->template . 'sidebar.php'; } ?> </div> </section> <?php include PLX_ROOT . $plxMotor->aConf['racine_themes'] . $plxMotor->style . '/' . $plxMotor->template . 'footer.php'; } else { header('Content-Type: text/plain'); echo $status == 'error' ? '<span class="error">' . $this->getLang($msg) . '</span>' : $this->getLang($msg); } } if ($exit) { exit; } }