Example #1
0
/*                                                                      */
/* NPDS Copyright (c) 2002-2015 by Philippe Brunier                     */
/* Great mods by snipe                                                  */
/*                                                                      */
/* 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.       */
/************************************************************************/
if (!function_exists("Mysql_Connexion")) {
    include "mainfile.php";
}
include 'functions.php';
if ($SuperCache) {
    $cache_obj = new cacheManager();
} else {
    $cache_obj = new SuperCacheEmpty();
}
include 'auth.php';
global $NPDS_Prefix, $admin, $adminforum;
if ($allow_upload_forum) {
    include "modules/upload/upload_forum.php";
}
//==> droits des admin sur les forums (superadmin et admin avec droit gestion forum)
$adminforum = false;
if ($admin) {
    $adminforum = 0;
    $adminX = base64_decode($admin);
    $adminR = explode(':', $adminX);
    $Q = sql_fetch_assoc(sql_query("SELECT * FROM " . $NPDS_Prefix . "authors WHERE aid='{$adminR['0']}' LIMIT 1"));
    if ($Q['radminsuper'] == 1) {
        $adminforum = 1;
Example #2
0
}
if (!function_exists("Mysql_Connexion")) {
    include "mainfile.php";
}
include "modules/{$ModPath}/archive-stories.conf.php";
include "modules/{$ModPath}/cache.timings.php";
if (!isset($start)) {
    $start = 0;
}
include "header.php";
// Include cache manager
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) {
    if ($arch_titre) {
        echo $arch_titre;
    }
    echo '
   <hr />
   <table id ="lst_art_arch" data-toggle="table" data-striped="true" data-search="true" data-show-toggle="true" data-mobile-responsive="true" data-icons-prefix="fa" data-icons="icons">
      <thead>
         <tr>
            <th data-sortable="true" data-halign="center">' . translate("Articles") . '</th>
            <th data-sortable="true" data-halign="center" data-align="right">' . translate("reads") . '</th>
            <th data-halign="center" data-align="right">' . translate("Posted on") . '</th>
            <th data-sortable="true" data-halign="center" data-align="right">' . translate("Author") . '</th>
            <th data-halign="center" data-align="right">' . translate("Functions") . '</th>
Example #3
0
/* Based on PhpNuke 4.x source code                                     */
/* Based on Parts of phpBB                                              */
/*                                                                      */
/* NPDS Copyright (c) 2002-2013 by Philippe Brunier                     */
/*                                                                      */
/* 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.       */
/************************************************************************/
if (!function_exists("Mysql_Connexion")) {
    include "mainfile.php";
}
if ($SuperCache) {
    $cache_obj = new cacheManager();
} else {
    $cache_obj = new SuperCacheEmpty();
}
settype($op, 'string');
settype($Subforumid, 'array');
if ($op == "maj_subscribe") {
    if ($user) {
        settype($cookie[0], "integer");
        $result = sql_query("DELETE FROM " . $NPDS_Prefix . "subscribe WHERE uid='{$cookie['0']}' AND forumid!='NULL'");
        $result = sql_query("SELECT forum_id FROM " . $NPDS_Prefix . "forums ORDER BY forum_index,forum_id");
        while (list($forumid) = sql_fetch_row($result)) {
            if (is_array($Subforumid)) {
                if (array_key_exists($forumid, $Subforumid)) {
                    $resultX = sql_query("INSERT INTO " . $NPDS_Prefix . "subscribe (forumid, uid) VALUES ('{$forumid}','{$cookie['0']}')");
                }
            }
        }
Example #4
0
function fab_block($title, $member, $content, $Xcache)
{
    global $SuperCache, $CACHE_TIMINGS;
    // Multi-Langue
    $title = aff_langue($title);
    // Bloc caché
    $hidden = false;
    if (substr($content, 0, 7) == "hidden#") {
        $content = str_replace("hidden#", '', $content);
        $hidden = true;
    }
    // Si on cherche à charger un JS qui a déjà été chargé par pages.php alors on ne le charge pas ...
    global $pages_js;
    if ($pages_js != '') {
        preg_match('#src="([^"]*)#', $content, $jssrc);
        if (is_array($pages_js)) {
            foreach ($pages_js as $jsvalue) {
                if (array_key_exists('1', $jssrc)) {
                    if ($jsvalue == $jssrc[1]) {
                        $content = '';
                        break;
                    }
                }
            }
        } else {
            if (array_key_exists('1', $jssrc)) {
                if ($pages_js == $jssrc[1]) {
                    $content = "";
                }
            }
        }
    }
    $content = aff_langue($content);
    if ($SuperCache and $Xcache != 0) {
        $cache_clef = md5($content);
        $CACHE_TIMINGS[$cache_clef] = $Xcache;
        $cache_obj = new cacheManager();
        $cache_obj->startCachingBlock($cache_clef);
    } else {
        $cache_obj = new SuperCacheEmpty();
    }
    if ($cache_obj->genereting_output == 1 or $cache_obj->genereting_output == -1 or !$SuperCache or $Xcache == 0) {
        global $user, $admin;
        // For including CLASS AND URI in Block
        global $B_class_title, $B_class_content;
        $B_class_title = "";
        $B_class_content = "";
        $R_uri = "";
        if (stristr($content, "class-") or stristr($content, "uri")) {
            $tmp = explode("\n", $content);
            $content = "";
            while (list($id, $class) = each($tmp)) {
                $temp = explode("#", $class);
                if ($temp[0] == "class-title") {
                    $B_class_title = str_replace("\r", "", $temp[1]);
                } else {
                    if ($temp[0] == "class-content") {
                        $B_class_content = str_replace("\r", "", $temp[1]);
                    } else {
                        if ($temp[0] == "uri") {
                            $R_uri = str_replace("\r", "", $temp[1]);
                        } else {
                            if ($content != "") {
                                $content .= "\n ";
                            }
                            $content .= str_replace("\r", "", $class);
                        }
                    }
                }
            }
        }
        // For BLOC URIs
        if ($R_uri) {
            global $REQUEST_URI;
            $page_ref = basename($REQUEST_URI);
            $tab_uri = explode(" ", $R_uri);
            $R_content = false;
            $tab_pref = parse_url($page_ref);
            $racine_page = $tab_pref['path'];
            $tab_pref = explode("&", $tab_pref['query']);
            while (list(, $RR_uri) = each($tab_uri)) {
                $tab_puri = parse_url($RR_uri);
                $racine_uri = $tab_puri['path'];
                if ($racine_page == $racine_uri) {
                    $tab_puri = explode("&", $tab_puri['query']);
                    while (list($idx, $RRR_uri) = each($tab_puri)) {
                        if (substr($RRR_uri, -1) == "*") {
                            // si le token contient *
                            if (substr($RRR_uri, 0, strpos($RRR_uri, "=")) == substr($tab_pref[$idx], 0, strpos($tab_pref[$idx], "="))) {
                                $R_content = true;
                            }
                        } else {
                            // sinon
                            if ($RRR_uri != $tab_pref[$idx]) {
                                $R_content = false;
                            } else {
                                $R_content = true;
                            }
                        }
                    }
                }
            }
            if (!$R_content) {
                $content = '';
            }
        }
        // For Javascript in Block
        if (!stristr($content, "javascript")) {
            $content = nl2br($content);
        }
        // For including externale file in block / the return MUST BE in $content
        if (stristr($content, "include#")) {
            $Xcontent = false;
            // You can now, include AND cast a fonction with params in the same bloc !
            if (stristr($content, "function#")) {
                $content = str_replace("<br />", "", $content);
                $content = str_replace("<BR />", "", $content);
                $content = str_replace("<BR>", "", $content);
                $pos = strpos($content, "function#");
                $Xcontent = substr(trim($content), $pos);
                $content = substr(trim($content), 8, $pos - 10);
            } else {
                $content = substr(trim($content), 8);
            }
            include_once $content;
            if ($Xcontent) {
                $content = $Xcontent;
            }
        }
        if (!empty($content)) {
            if ($member == 1 and isset($user)) {
                if (!block_fonction($title, $content)) {
                    if (!$hidden) {
                        themesidebox($title, $content);
                    } else {
                        echo $content;
                    }
                }
            } elseif ($member == 0) {
                if (!block_fonction($title, $content)) {
                    if (!$hidden) {
                        themesidebox($title, $content);
                    } else {
                        echo $content;
                    }
                }
            } elseif ($member > 1 and isset($user)) {
                $tab_groupe = valid_group($user);
                if (groupe_autorisation($member, $tab_groupe)) {
                    if (!block_fonction($title, $content)) {
                        if (!$hidden) {
                            themesidebox($title, $content);
                        } else {
                            echo $content;
                        }
                    }
                }
            } elseif ($member == -1 and !isset($user)) {
                if (!block_fonction($title, $content)) {
                    if (!$hidden) {
                        themesidebox($title, $content);
                    } else {
                        echo $content;
                    }
                }
            } elseif ($member == -127 and isset($admin) and $admin) {
                if (!block_fonction($title, $content)) {
                    if (!$hidden) {
                        themesidebox($title, $content);
                    } else {
                        echo $content;
                    }
                }
            }
        }
        if ($SuperCache and $Xcache != 0) {
            $cache_obj->endCachingBlock($cache_clef);
        }
    }
}
Example #5
0
 if ($days != "" && $days != 0) {
     $q .= "AND TO_DAYS(NOW()) - TO_DAYS(time) <= '{$days}' ";
 }
 $q .= " ORDER BY s.time DESC" . $limit;
 $t = $topic;
 $x = 0;
 if ($SuperCache) {
     $cache_clef = "[objet]==> {$q}";
     $CACHE_TIMINGS[$cache_clef] = 3600;
     $cache_obj = new cacheManager();
     $tab_sid = $cache_obj->startCachingObjet($cache_clef);
     if ($tab_sid != "") {
         $x = count($tab_sid);
     }
 } else {
     $cache_obj = new SuperCacheEmpty();
 }
 if ($cache_obj->genereting_output == 1 or $cache_obj->genereting_output == -1 or !$SuperCache) {
     $result = sql_query($q);
     if ($result) {
         while (list($sid, $aid, $title, $time, $url, $topic, $informant, $ihome) = sql_fetch_row($result)) {
             if (ctrl_aff($ihome, 0)) {
                 $tab_sid[$x]['sid'] = $sid;
                 $tab_sid[$x]['aid'] = $aid;
                 $tab_sid[$x]['title'] = $title;
                 $tab_sid[$x]['time'] = $time;
                 $tab_sid[$x]['url'] = $url;
                 $tab_sid[$x]['topic'] = $topic;
                 $tab_sid[$x]['informant'] = $informant;
                 $x++;
             }
Example #6
0
function fiche_detail($Xlid)
{
    global $ModPath, $ModStart;
    include "header.php";
    // Include cache manager
    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) {
        settype($xlid, 'integer');
        $browse_key = $Xlid;
        $link_fiche_detail = "fiche_detail";
        $inter = 'cid';
        include "modules/sform/links/link_detail.php";
    }
    if ($SuperCache) {
        $cache_obj->endCachingPage();
    }
    include "footer.php";
}
Example #7
0
function viewarticle($artid, $page)
{
    global $NPDS_Prefix, $prev, $user, $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 type="button" value="' . translate("Back to console") . '" onclick="javascript:history.back()" /><br /><br />';
            }
            if (function_exists("themesection_title")) {
                themesection_title($title);
            } else {
                echo '<h3>' . $title . '</h3>';
            }
            echo '<p class="text-muted">(' . $words . ' ' . translate("total words in this text)") . '&nbsp;-&nbsp;
         ' . translate("read:") . ' ' . $counter . ' ' . translate("times") . '&nbsp;&nbsp;&nbsp;<a href="sections.php?op=printpage&amp;artid=' . $artid . '" title="' . translate("Printer Friendly Page") . '" data-toggle="tooltip" ><i class="fa fa-print fa-lg"></i></a></p>';
            preg_match_all('#\\[page.*\\]#', $Xcontent, $rs);
            $ndepages = count($rs[0]);
            if ($page != '') {
                $Xcontent = substr($Xcontent, strpos($Xcontent, $page) + strlen($page));
                $multipage = true;
            } else {
                $multipage = false;
            }
            $pos_page = strpos($Xcontent, '[page');
            $longueur = mb_strpos($Xcontent, ']', $pos_page, 'iso-8859-1') - $pos_page + 1;
            if ($pos_page) {
                $pageS = substr($Xcontent, $pos_page, $longueur);
                $Xcontent = substr($Xcontent, 0, $pos_page);
                $Xcontent .= '
            <div class="center-block">
               <ul class="pagination pagination-sm">
               <li class="page-item disabled"><a class="page-link" href="#">' . $ndepages . ' pages</a></li>';
                if ($pageS !== '[page0]') {
                    $Xcontent .= '
                  <li class="page-item"><a class="page-link" href="sections.php?op=viewarticle&amp;artid=' . $artid . '">' . translate("Top of the article") . '</a></li>';
                }
                $Xcontent .= '
                  <li class="page-item active"><a class="page-link" href="#">' . preg_replace('#\\[(page)(.*)(\\])#', '\\1 \\2', $pageS) . '</a></li>
                  <li class="page-item"><a class="page-link" href="sections.php?op=viewarticle&amp;artid=' . $artid . '&amp;page=' . $pageS . '" >' . translate("Next Page") . '</a></li>
               </ul>
            </div>';
            } else {
                if ($multipage) {
                    $Xcontent .= '<br /><br /><p class=""><a href="sections.php?op=viewarticle&amp;artid=' . $artid . '&amp;page=[page0]">' . translate("Top of the article") . '</a></p>';
                }
            }
            $Xcontent = aff_code(aff_langue($Xcontent));
            echo meta_lang($Xcontent);
            $artidtempo = $artid;
            if ($rubname != "Divers") {
                echo '<p><a class="btn btn-secondary" href="sections.php">' . translate("Return to Sections Index") . '</a></p>';
                /*         echo '<h4>***<strong>'.translate("Back to chapter:").'</strong></h4>';
                            echo '<ul class="list-group"><li class="list-group-item"><a href="sections.php?op=listarticles&amp;secid='.$secid.'">'.aff_langue($secname).'</a></li></ul>';
                
                            $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 ($nb_article > 0) {
                               echo '<h4>*<strong>'.translate("Other courses in chapter:").'</strong></h4>';
                               echo '<ul class="list-group">';
                               while (list($artid, $secid, $title, $userlevel) = sql_fetch_row($result3)) {
                                  $okprint2=autorisation_section($userlevel);
                                  if ($okprint2) {
                                     echo '<li class="list-group-item"><a href="sections.php?op=viewarticle&amp;artid='.$artid.'">'.aff_langue($title).'</a></li>';
                                  }
                              }
                              echo '</ul>';
                            }*/
            }
            $artid = $artidtempo;
            $resultconnexe = sql_query("SELECT id2 FROM " . $NPDS_Prefix . "compatsujet WHERE id1='{$artid}'");
            if (sql_num_rows($resultconnexe) > 0) {
                echo '<br />';
                echo "<strong>" . translate("You may be interested in:") . "</strong>";
                echo '<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&amp;artid=' . $artid2 . '">' . aff_langue($title) . '</a></li>';
                    }
                }
                echo '</ul>';
            }
        }
        sql_free_result($result_S);
        if ($SuperCache) {
            $cache_obj->endCachingPage();
        }
        include 'footer.php';
    } else {
        header("Location: sections.php");
    }
}
Example #8
0
function theindex($op, $catid, $marqeur)
{
    include "header.php";
    // Include cache manager
    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) {
        // Appel de la publication de News et la purge automatique
        automatednews();
        global $theme;
        if ($op == "newcategory" or $op == "newtopic" or $op == "newindex" or $op == "edito-newindex") {
            aff_news($op, $catid, $marqeur);
        } else {
            if (file_exists("themes/{$theme}/central.php")) {
                include "themes/{$theme}/central.php";
            } else {
                if ($op == "edito" or $op == "edito-nonews") {
                    aff_edito();
                }
                if ($op != "edito-nonews") {
                    aff_news($op, $catid, $marqeur);
                }
            }
        }
    }
    if ($SuperCache) {
        $cache_obj->endCachingPage();
    }
    include "footer.php";
}
Example #9
0
function charg_metalang()
{
    global $SuperCache, $CACHE_TIMINGS, $REQUEST_URI;
    global $NPDS_Prefix;
    if ($SuperCache) {
        $racine = parse_url(basename($REQUEST_URI));
        $cache_clef = "[metalang]==>" . $racine['path'] . ".common";
        $CACHE_TIMINGS[$cache_clef] = 86400;
        $cache_obj = new cacheManager();
        $glossaire = $cache_obj->startCachingObjet($cache_clef);
    } else {
        $cache_obj = new SuperCacheEmpty();
    }
    if ($cache_obj->genereting_output == 1 or $cache_obj->genereting_output == -1 or !$SuperCache) {
        $result = sql_query("SELECT def, content, type_meta, type_uri, uri FROM " . $NPDS_Prefix . "metalang WHERE type_meta='mot' OR type_meta='meta' OR type_meta='smil'");
        while (list($def, $content, $type_meta, $type_uri, $uri) = sql_fetch_row($result)) {
            // la syntaxe est presque la même que pour les blocs (on n'utilise que la racine de l'URI)
            // si type_uri="-" / uri site les URIs où les meta-mot NE seront PAS actifs (tous sauf ...)
            // si type_uri="+" / uri site les URI où les meta-mot seront actifs (seulement ...)
            // Le séparateur entre les URI est l'ESPACE
            // => Exemples : index.php user.php forum.php static.php
            if ($uri != "") {
                $match = match_uri($racine['path'], $uri);
                if ($match and $type_uri == "+" or !$match and $type_uri == "-") {
                    $glossaire[$def]['content'] = $content;
                    $glossaire[$def]['type'] = $type_meta;
                }
            } else {
                $glossaire[$def]['content'] = $content;
                $glossaire[$def]['type'] = $type_meta;
            }
        }
    }
    if ($SuperCache) {
        $cache_obj->endCachingObjet($cache_clef, $glossaire);
    }
    return $glossaire;
}