[résolu] Impossible de créer une page admin.php ?
Bonjour, je souhaite continuer le développement de mon plugin, et donc j'essaye de créer une page d'administration mais j'obtiens le message "accès interdit". J'ai installé un pluxml brut de dézippage (v5.2) dans un autre répertoire... toujours la même chose.
Peut-être parce que le nom du dossier contenant le plugin est écrit en minuscules et majuscules ?
Si quelqu'un à une info, merci.
Peut-être parce que le nom du dossier contenant le plugin est écrit en minuscules et majuscules ?
Si quelqu'un à une info, merci.
0
Connectez-vous ou Inscrivez-vous pour répondre.
Réponses
<?php // Plugin plxSocialButtons by Websyys // http://websyys.olympe.in class plxSocialButtons extends plxPlugin { public function __construct($default_lang) { # appel du constructeur de la classe plxPlugin parent::__construct($default_lang); # hook $this->addHook('SocialButtons', 'SocialButtons'); # Pour accéder à une page d'administration $this->setAdminProfil(PROFIL_ADMIN,PROFIL_MANAGER); # Pour accéder à une page de configuration $this->setConfigProfil(PROFIL_ADMIN,PROFIL_MANAGER); } # affichage des boutons de partage public function SocialButtons() { $plxMotor = plxMotor::getInstance(); $id = intval($plxMotor->plxRecord_arts->f('numero')); $url = $plxMotor->plxRecord_arts->f('url'); $url_article = $plxMotor->urlRewrite('?article'.$id.'/'.$url); $titre_article = $plxMotor->plxRecord_arts->f('title'); ?> <div class="share-buttons"> <p>Partagez cet article sur les réseaux sociaux :</p> <a target="_blank" title="Twitter" href="https://twitter.com/share?url=<?php echo $url_article ?>&text=<?php echo $titre_article ?>" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=700');return false;"><img src="plugins/plxSocialButtons/img/twitter_icon.png" alt="Twitter" /></a> <a target="_blank" title="Facebook" href="https://www.facebook.com/sharer.php?u=<?php echo $url_article ?>&t=<?php echo $titre_article ?>" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=500,width=700');return false;"><img src="plugins/plxSocialButtons/img/facebook_icon.png" alt="Facebook" /></a> <a target="_blank" title="Google +" href="https://plus.google.com/share?url=<?php echo $url_article ?>&hl=fr" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=650');return false;"><img src="plugins/plxSocialButtons/img/gplus_icon.png" alt="Google Plus" /></a> <a target="_blank" title="Linkedin" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo $url_article ?>&title=<?php echo $titre_article ?>" rel="nofollow" onclick="javascript:window.open(this.href, '','menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=450,width=650');return false;"><img src="plugins/plxSocialButtons/img/linkedin_icon.png" alt="Linkedin" /></a> </div> <?php } } ?>Fichier admin.php<?php if(!defined('PLX_ROOT')) exit; ?> // Le reste de ton codeFichier config.php<?php if(!defined('PLX_ROOT')) exit; ?> // Le reste de ton codeVous arrivez à créer une page admin depuis la version 5.2 ?
Consultant PluXml
Ancien responsable et développeur de PluXml (2010 à 2018)
<?php if(!defined('PLX_ROOT')) exit; ?> <?php if(!empty($_POST)) { $plxPlugin->setParam('param1', $_POST['param1'], 'numeric'); $plxPlugin->setParam('param2', $_POST['param2'], 'string'); $plxPlugin->setParam('param3', $_POST['param3'], 'cdata'); $plxPlugin->saveParams(); header('Location: parametres_plugin.php?p=newplugin '); exit; } ?> <h2><?php $plxPlugin->lang('L_TITLE') ?></h2> <p><?php $plxPlugin->lang('L_DESCRIPTION') ?></p> <form action=" parametres_plugin.php?p=newplugin" method="post"> Parametre 1 : <input type="text" name="param1" value="<?php echo plxUtils::strCheck($plxPlugin->getParam('param1')) ?>" /><br /> Parametre 2 : <input type="text" name="param2" value="<?php echo plxUtils::strCheck($plxPlugin->getParam('param2')) ?>" /><br /> Parametre 3 : <input type="text" name="param3" value="<?php echo plxUtils::strCheck($plxPlugin->getParam('param3')) ?>" /><br /> <br /> <input type="submit" name="submit" value="Enregistrer" /> </form>newplugin/newplugin.php :
<?php class newplugin extends plxPlugin { public function __construct($default_lang) { # appel du constructeur de la classe plxPlugin parent::__construct($default_lang); # hook $this->addHook('SocialButtons', 'SocialButtons'); } # affichage des boutons de partage public function SocialButtons() { $plxShow = plxShow::getInstance(); ?> <div class="share-buttons"> <p>Test :</p> </div> <?php } } ?>Je clique... accès interdit.
Pourquoi ?