Pages vues depuis 25/05/2001 : 104 272 776
Index du forum »» Bugs, Probs ... »» Balise [pageX]
|
Message édité par : Pascal / 19-05-2015 12:59
global $numpage;
$numpage=$page;
sert à faire fonctionner le programme de construction des listes de pages (voir http://www.npds.org/viewtopic.php?topic=26307&forum=9).
function viewarticle($artid, $page) {
global $NPDS_Prefix;
global $prev, $user;
global $numpage;
$numpage=$page;
if (file_exists("sections.config.php"))
!include! ("sections.config.php");
if ($page=="")
sql_query("update ".$NPDS_Prefix."seccont set counter=counter+1 where artid='$artid'");
$result_S = sql_query("select artid, secid, title, content, counter, userlevel from ".$NPDS_Prefix."seccont where artid='$artid'");
list($artid, $secid, $title, $Xcontent, $counter, $userlevel) = sql_fetch_row($result_S);
list($secid, $secname, $rubid) = sql_fetch_row(sql_query("select secid, secname, rubid from ".$NPDS_Prefix."sections where secid='$secid'"));
list($rubname) = sql_fetch_row(sql_query("select rubname from ".$NPDS_Prefix."rubriques where rubid='$rubid'"));
$tmp_auto=explode(",",$userlevel);
while (list(,$userlevel)=each($tmp_auto)) {
$okprint=autorisation_section($userlevel);
if ($okprint) break;
}
if ($okprint) {
$old_title=$title;
$pindex=substr(substr($page,5),0,-1);
if ($pindex!="") {$pindex=" - ".translate("Next Page")." ".$pindex;}
if ($sections_chemin) {
$title=aff_langue($rubname)." - ".aff_langue($secname)." - ".aff_langue($title)." ".$pindex;
} else {
$title=aff_langue($title)." ".$pindex;
}
!include!("header.php");
$title=aff_langue($old_title);
global $SuperCache;
if ($SuperCache) {
$cache_obj = new cacheManager();
$cache_obj->startCachingPage();
} else {
$cache_obj = new SuperCacheEmpty();
}
if (($cache_obj->genereting_output==1) or ($cache_obj->genereting_output==-1) or (!$SuperCache)) {
$words = sizeof(explode(" ", $Xcontent));
if ($prev==1) {echo "<input class=\"bouton_standard\" type=\"button\" value=\"".translate("Back to console")."\" !onclick!=\"!javascript!:history.back()\" /><br /><br />";}
if (function_exists("themesection_title")) {
themesection_title($title);
} else {
opentable();
echo $title;
closetable();
}
opentable();
// echo "<p align=\"right\">($words ".translate("total words in this text)")." -
// ".translate("read:")." $counter ".translate("times")."
// <a href=\"sections.php?op=printpage&artid=$artid\"><img src=\"";
// if ($ibid=theme_image("box/print.gif")) {$imgtmp=$ibid;} else {$imgtmp="images/print.gif";}
// echo "$imgtmp\" border=\"0\" alt=\"" . translate("Printer Friendly Page")."\" align=\"center\" /></a></p>";
echo "<div class=\"separ\"></div>";
if ($page!="") {
// $Xcontent=substr($Xcontent,strpos($Xcontent,$page)+7);
$Xcontent=substr($Xcontent,strpos($Xcontent,$page)+strlen($page));
$multipage=true;
} else {
$multipage=false;}
$pos_page=strpos($Xcontent,"[page");
$longueur=mb_strpos($Xcontent,"]",$pos_page)-$pos_page+1;
if ($pos_page) {
$pageS=substr($Xcontent,$pos_page,$longueur);
$Xcontent=substr($Xcontent,0,$pos_page)."<p align=\"center\"><a href=\"sections.php?op=viewarticle&artid=$artid&page=$pageS\" class=\"noir\">".translate("Next Page")."</a></p>";
} else if($multipage) {
// $Xcontent.="<p align=\"center\"><a href=\"sections.php?op=viewarticle&artid=$artid\" class=\"noir\">".translate("Top of the article")."</a></p>";
$Xcontent.="<p align=\"center\"><a href=\"sections.php?op=viewarticle&artid=$artid&page=[page0]\" class=\"noir\">".translate("Top of the article")."</a></p>";
}
$Xcontent=aff_code(aff_langue($Xcontent));
echo meta_lang($Xcontent);
// echo "<br /><br />";
echo "<div class=\"separ\"></div>";
// echo "<br />";
if ($togglesection)
!include!_once ("lib/togglediv.class.php");
$artidtempo=$artid;
if ($rubname!="Divers") {
$rowcolor=tablos();
$rowcolor=tablos();
echo "<span class=\"noir\"><b>".translate("Back to chapter:")."</b></span>";
echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" $rowcolor>
<tr><td><ul><li><a href=\"sections.php?op=listarticles&secid=$secid\" class=\"noir\">".aff_langue($secname)."</a></li></ul></td></tr></table>";
$result3 = sql_query("select artid, secid, title, userlevel from ".$NPDS_Prefix."seccont where (artid<>'$artid' and secid='$secid') order by ordre");
$nb_article = sql_num_rows($result3);
if ($togglesection)
$toggle = new ToggleDiv(2);
if ($nb_article > 0) {
// echo "<br />";
if ($togglesection)
echo $toggle->Img();
echo "<span class=\"noir\"><b>".translate("Other courses in chapter:")."</b></span>";
if ($togglesection)
echo $toggle->Begin();
echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" $rowcolor><tr><td><ul>";
while (list($artid, $secid, $title, $userlevel) = sql_fetch_row($result3)) {
$okprint2=autorisation_section($userlevel);
if ($okprint2) {
echo "<li><a href=\"sections.php?op=viewarticle&artid=$artid\" class=\"noir\">".aff_langue($title)."</a></li>";
}
}
echo "</ul></td></tr></table>";
if ($togglesection)
echo $toggle->End();
}
}
$artid=$artidtempo;
$resultconnexe = sql_query("select id2 from ".$NPDS_Prefix."compatsujet where id1='$artid'");
if (sql_num_rows($resultconnexe) > 0) {
echo "<br />";
if ($togglesection)
echo "<br />".$toggle->Img();
echo "<span class=\"noir\"><b>".translate("You may be interested in:")."</b></span>";
if ($togglesection)
echo $toggle->Begin();
echo "<table width=\"100%\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\" $rowcolor><tr><td><ul>";
while(list($connexe) = sql_fetch_row($resultconnexe)) {
$resultpdtcompat = sql_query("select artid, title, userlevel from ".$NPDS_Prefix."seccont where artid='$connexe'");
list($artid2, $title, $userlevel) = sql_fetch_row($resultpdtcompat);
$okprint2=autorisation_section($userlevel);
if ($okprint2) {
echo "<li><a href=\"sections.php?op=viewarticle&artid=$artid2\" class=\"noir\">".aff_langue($title)."</a></li>";
}
}
echo "</ul></td></tr></table>";
if ($togglesection)
echo $toggle->End();
}
closetable();
}
sql_free_result($result_S);
if ($SuperCache) {
$cache_obj->endCachingPage();
}
!include! ('footer.php');
} else {
header("Location: sections.php");
}
}
Message édité par : B-Mag / 27-05-2015 09:40