Fork me on GitHub


 Bas   Précédent   Suivant

« 1 2 (3) 4 5 6 ... 20 »


Re: simplified url avec le titre dans l'url
Régulier
Inscrit: 07/03/2004 18:48
De Alger
Messages: 201
bonjour
j'ai essayer cet partie du code pour recuperer le titre et ca marche nickel.

<?php
include "mainfile.php";
$title null;
$storyid='1954';
global 
$xoopsDB;
$sql "SELECT title FROM ".$xoopsDB->prefix("stories")." WHERE storyid = ".intval($storyid);
if (
$res $xoopsDB->query($sql)) {
 if (
$oRS mysql_fetch_object($res)) {
  
$title $oRS->title;
 }
}

if (
$title) {
 
$titleurlencode($title);
 echo 
$title;

 }
?>


donc ca doit bugger ailleur faut chercher du coté de la récupération de storyid ou bien de l'injection du titre dans l'url;
en tous cas moi je ne c vraiment pas ce qui cloche dans ce script

Posté le : 20/04/2007 11:09
Transférer la contribution vers d'autres applications Transférer


Re: simplified url avec le titre dans l'url
Régulier
Inscrit: 07/03/2004 18:48
De Alger
Messages: 201
d'aprés mes modestes connaisances en php je croix que c'est bon à ce niveau. je comrend pas rien ne se produit avec le script pas d'erreur et pas de resultat comme si qu'il ne s'execute pas??

Posté le : 19/04/2007 18:39
Transférer la contribution vers d'autres applications Transférer


Re: news 1.53 et xmspotlight
Régulier
Inscrit: 07/03/2004 18:48
De Alger
Messages: 201
hello
aprés avoir désinstaller le module xmspotlight, j'ai laisser tomber je viens de le reinstaller et a ma grande surprise tous marche corectemment, donc je me suis rapeler de ce post pour lui coller une étiquette.
merci

Posté le : 19/04/2007 14:38
Transférer la contribution vers d'autres applications Transférer


Re: code marqueur de Xiti sur theme.html
Régulier
Inscrit: 07/03/2004 18:48
De Alger
Messages: 201
la meilleur solution est d'utiliser phpmv2 ou bien analytics de gogo.
sinon si tu y tiens à xiti je pense que ton truc de la variabla marcherais bien; n'oublie pas que theme.html n'est pas utiliser tous seul.

Posté le : 19/04/2007 14:23
Transférer la contribution vers d'autres applications Transférer


Re: simplified url avec le titre dans l'url
Régulier
Inscrit: 07/03/2004 18:48
De Alger
Messages: 201
voici tous le code du fichier

<?php
// $Id: simplified_url.php,v 1.5 2005/07/02 17:15:00 suin Exp $
//  ------------------------------------------------------------------------ //
//              SIMPLIFIED URLs FOR XOOPS based on ShortURLs                 //
//              Copyright (c) 2004 suin and Reynaldo Alvarez                 //
//                         <http://www.suin.jp>  &nb ... nbsp;   //
//  ------------------------------------------------------------------------ //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  You may not change or alter any portion of this comment or credits       //
//  of supporting developers from this source code or any supporting         //
//  source code which is considered copyrighted (c) material of the          //
//  original comment or credit authors.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  ------------------------------------------------------------------------ //
// 
if (!defined("XOOPS_ROOT_PATH") || !defined("XOOPS_URL") ) {
    exit();
}
// ´Ê°×²½¤ò̵¸ú¤Ë¤¹¤ë¥â¥¸¥å¡¼¥ë
// "|"¤Ç¥â¥¸¥å¡¼¥ë¤Î¥Ç¥£¥ì¥¯¥È¥ê¤ò¶èÀڤ롣 If you do not want to simplify any module, divide the module's dir with "|".

$cancel_module "";
//$cancel_module = "xoopspoll|newbb|news";

if( !empty( $cancel_module ) && isset( $sd_res ) ){
    if( ( 
preg_match("//modules/(".$cancel_module.")//"$_SERVER['SCRIPT_NAME']) )){
        
header('Location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
        exit();
    }
}
if(  ( !
preg_match("//modules/([^/]*)/admin//"$_SERVER['SCRIPT_NAME']) ) 
  && ( !
preg_match("//modules/system//"$_SERVER['SCRIPT_NAME']) )
  && ( !
preg_match("/admin.php/"$_SERVER['SCRIPT_NAME']) )  ) {
    
//ob_start('ob_gzhandler');
    //ob_start('absolutize');
    
ob_start('simplify_urls');
}else{
    if( isset( 
$sd_res ) ){
        
header('Location: http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
        exit();
    }
}

function 
simplify_urls($s
{
    
$XPS_URL str_replace('/','/'quotemeta(XOOPS_URL) );
    
$s absolutize($s); 
    
// Fix URLs and HTML.    //if (strpos($s, "storyid")) {




//include_once XOOPS_ROOT_PATH."/modules/news/class/class.newsstory.php";
//include_once XOOPS_ROOT_PATH.'/modules/news/class/class.sfiles.php';
//include_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php';
//include_once XOOPS_ROOT_PATH."/modules/news/class/class.newstopic.php";
//include_once XOOPS_ROOT_PATH."/modules/news/class/keyhighlighter.class.php";
//$newsStory = new NewsStory($storyid);
//$title=urlencode($newsStory->title);
//$s .= "&title=".urlencode($newsStory->title);

//}
preg_match('/(storyid=)(.*)(.*)/iUs',$s$recherche);
    
$storyid $recherche[2];    
$title null;
global 
$xoopsDB;
$sql "SELECT title FROM ".$xoopsDB->prefix("stories")." WHERE storyid = ".intval($storyid);
if (
$res $xoopsDB->query($sql)) {
   if (
$oRS mysql_fetch_object($res)) {
      
$title $oRS->title;
   }
}

if (
$title) {
$s str_replace("news-article.storyid-([a-zA-Z0-9_-]+).htm""article-$1-$title.htm"$s);
   
$s .= "&title=".urlencode($title);
}
    
$in = array(
        
// Search URLs of Xoops's root directry.
          
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/([a-zA-Z0-9_-]+).php(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '/<(a|meta)([^>]*)(href|url)=(['"
]{0,1})'.$XPS_URL.'/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        // Search URLs of modules' directry.
                                                                  
        
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
           , '/<(a|meta)([^>]*)(href|url)=(['"
]{0,1})'.$XPS_URL.'/modules/news/article.php?storyid=([a-zA-Z0-9_-]*)&title=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'    

        
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
            , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '/<(a|meta)([^>]*)(href|url)=(['"
]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        
'/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '
/<(a|meta)([^>]*)(href|url)=(['"]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
        , '/<(a|meta)([^>]*)(href|url)=(['"
]{0,1})'.$XPS_URL.'/modules/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+).php?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)&?(?:amp;)?([a-zA-Z0-9_-]+)=([a-zA-Z0-9_-]*)(#?[a-zA-Z0-9]*)(['"]{1})([^>]*)>/i'
    
);
    
    
$out = array(
        
// Replace URLs of Xoops's root directry.
          
'<$1$2$3=$4'.XOOPS_URL.'/$5.html$6$7$8>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5.$6-$7.html$8$9$10>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5.$6-$7-$8-$9.html$10$11$12>'
        
// Replace URLs of modules' directry.
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-index.htm$6$7$8>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.htm$7$8$9>'
         
'<$1$2$3=$4'.XOOPS_URL.'/article-$5-$6.htm$7$8$9>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8.htm$9$10$11>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8-$9-$10.htm$11$12$13>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8-$9-$10-$11-$12.htm$13$14$15>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8-$9-$10-$11-$12-$13-$14.htm$15$16$17>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8-$9-$10-$11-$12-$13-$14-$15-$16.htm$17$18$19>'
        
'<$1$2$3=$4'.XOOPS_URL.'/$5-$6.$7-$8-$9-$10-$11-$12-$13-$14-$15-$16-$17-$18.htm$19$20$21>'
    
);


    



    
$s preg_replace($in$out$s); 
//    $s = preg_replace('/<([^>]*)>/i','{\1}', $s);
//    $s = $s.'<!-- Simplified URLs Version 1.1 http://www.suin.jp/ -->';
    
return $s;    
}

function 
absolutize($s){
    if(
preg_match('//$/',$_SERVER['REQUEST_URI'])){
        
$req_dir=preg_replace('//$/','',$_SERVER['REQUEST_URI']);
        
$req_php="";
    }else{
        
$req_dir=dirname($_SERVER['REQUEST_URI']);
        
$req_php=preg_replace('/.*(/[a-zA-Z0-9_-]+).php.*/','\1.php',$_SERVER['REQUEST_URI']);
    }
    
$req_dir = ($req_dir == "\" || $req_dir == "/" ) ? "" $req_dir ;
    
$dir_arr=explode('/'$req_dir);
    
$m count($dir_arr)-1;
    
$d1 = @str_replace('/'.$dir_arr[$m],   ''$req_dir);
    
$d2 = @str_replace('/'.$dir_arr[$m-1], ''$d1);
    
$d3 = @str_replace('/'.$dir_arr[$m-2], ''$d2);
    
$d4 = @str_replace('/'.$dir_arr[$m-3], ''$d3);
    
$d5 = @str_replace('/'.$dir_arr[$m-4], ''$d4);
    
$host 'http://'.$_SERVER['HTTP_HOST'];
    
$in = array(
         
'/<([^>?&]*)(href|src|action|background|window.location)=([^"' >]+)([^>]*)>/i'
//off1        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})../../../../../([^"']*)(["']{1})([^>]*)>/i'
//off2        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})../../../../([^"']*)(["']{1})([^>]*)>/i'
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})../../../([^"']*)(["']{1})([^>]*)>/i'
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})../../([^"']*)(["']{1})([^>]*)>/i'
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})../([^"']*)(["']{1})([^>]*)>/i'
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})/([^"']*)(["']{1})([^>]*)>/i'
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})?([^"']*)(["']{1})([^>]*)>/i'
        //This dir
        ,'
/<([^>?&]*)(href|src|action|background|window.location)=(["']{1})(?:./)?([^"'/:]*/*)?([^"'/:]*/*)?([^"'/:]*/*)?([a-zA-Z0-9_-]+).([^"'>]*)(["']{1})([^>]*)>/i'
        
,'/[^"'a-zA-Z_0-9](window.open|url)((["']{0,1})(?:./)?([^"'/]*).([^"'/]+)(["']*)([^)]*)/i'
        ,'/<meta([^>]*)url=([a-zA-Z0-9_-]+).([^"'>]*)(["'
]{1})([^>]*)>/i'
    );
    $out = array(
         '
<\1\2="\3"\4>'
//off1        ,'
<\1\2=\3'.$host.$d5.'/\4\5\6>'
//off2        ,'
<\1\2=\3'.$host.$d4.'/\4\5\6>'
        ,'
<\1\2=\3'.$host.$d3.'/\4\5\6>'
        ,'
<\1\2=\3'.$host.$d2.'/\4\5\6>'
        ,'
<\1\2=\3'.$host.$d1.'/\4\5\6>'
        ,'
<\1\2=\3'.$host.'/\4\5\6>'
        ,'
<\1\2=\3'.$host.$_SERVER['PHP_SELF'].'?\4\5\6>'
        //This dir.
        ,'
<\1\2=\3'.$host.$req_dir.'/\4\5\6\7.\8\9\10>'
        ,'
$1($2'.$host.$req_dir.'/$3.$4$5$6'
        ,'
<meta$1url='.$host.$req_dir.'/$2.$3$4$5>'
    );


    $s = preg_replace($in, $out, $s); 
//off3    z$s = preg_replace('
/<([^>]*)>/i','{\1}', $s);
    
    return $s;
}
?>

Posté le : 19/04/2007 13:27
Transférer la contribution vers d'autres applications Transférer


Re: simplified url avec le titre dans l'url
Régulier
Inscrit: 07/03/2004 18:48
De Alger
Messages: 201
je te rassure j'ai essayer avec le chemin absolue c'est exactement la meme chose.

je viens d'essayer avec une requete sql; et bien plus de page blanche mais les url reste comme avant. comme si que j'ai rien toucher?

Posté le : 19/04/2007 12:06
Transférer la contribution vers d'autres applications Transférer


Re: Note í  l'attention des débutants...
Régulier
Inscrit: 07/03/2004 18:48
De Alger
Messages: 201
oui j'ai vu ca mais ca reste une faq trés général et ne va pas dans les petits soucis que peut avoir un xoopsien.

quoi qu'il en soit quand en a des Kris, christian,blueteen,hervé, solo.... dans unn forum en se lasse pas de poser des questions...

Posté le : 19/04/2007 11:44
Transférer la contribution vers d'autres applications Transférer


Re: simplified url avec le titre dans l'url
Régulier
Inscrit: 07/03/2004 18:48
De Alger
Messages: 201
include "modules/news/class/class.newsstory.php";

la requete sql ca me branche pas trop ... je vais essayer pour voir.

Posté le : 19/04/2007 11:29
Transférer la contribution vers d'autres applications Transférer


Re: simplified url avec le titre dans l'url
Régulier
Inscrit: 07/03/2004 18:48
De Alger
Messages: 201
pas si grave que du momment que je l'avais mis "heuresementq qu'en est deux"

ca ne marche toujours pas j'ai reesayer avec qq modif, notament en fixant la valeur de l'id de la news juste pour identifier le pb et ca ne marche pas. donc je pense que le probleme viens qq part de la condition! mais comment etre sur??

Posté le : 19/04/2007 10:09
Transférer la contribution vers d'autres applications Transférer


Re: simplified url avec le titre dans l'url
Régulier
Inscrit: 07/03/2004 18:48
De Alger
Messages: 201
charlie charlie, j'ai bien mis ca, j'ai revirifeir aucas ou meme si j'etais sur que j'ai bien mis dans l'ordre.

moi je suspecte la procedure de récuperation de l'id de la news j'ai fait ca normalement ca dvrait marchais mais je préfere en parler::
preg_match('/(storyid=)(.*)(*)/iUs',$s$recherche);
    
$storyid $recherche[2];

qu'en pense tu?

Posté le : 18/04/2007 23:29
Transférer la contribution vers d'autres applications Transférer



 Haut
« 1 2 (3) 4 5 6 ... 20 »




Propulsé avec XOOPS | Graphisme adapté par Tatane, Grosdunord, Montuy337513

36 Personne(s) en ligne (24 Personne(s) connectée(s) sur Forum) | Utilisateur(s): 0 | Invité(s): 36 | Plus ...