Index alphabétique - LIBRE SAVOIR
// This file is part of C-Arbre(r) // (c) 2005 REALINK ORGANIZATION // http://realink.org // ---------------------------------------------------------------------- // Section: lib // File : main_indexed.php // its purpose is to handle browsing of contents registered in a category // by alphabetical order // it is required by indexAZ.php and may be included into another // page with a 'titlestr' URL parameter set to the first letter(s) of title. // // 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. // // 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. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // //Avoid hacking if (isset($_GET['root_path']) || isset($_POST['root_path'])) { echo '
------------
W A R N I N G
-------------
USE OF THIS URL IS CONSIDERED AS UNAUTHORIZED USE OF THIS SYSTEM, SOFTWARE AND SERVICES.

'.$_SERVER["REMOTE_ADDR"].', please read the following statement:

THIS IS A PRIVATE COMPUTER SYSTEM.
This computer system including all related equipment, devices and software (specifically
regarding Internet access), are provided only for authorized use. All computer systems
may be monitored for all lawful purposes, including to ensure that their use is
authorized, for management of the system, to facilitate protection against unauthorized
access, and to verify security procedures, survivability and operational security.
Monitoring includes active attacks by authorized personnel and their entities to test or
verify the security of the system. During monitoring, information may be examined,
recorded, copied and used for authorized purposes. All information including personal
information, placed on or sent over this system may be monitored. Uses of this system,
authorized or unauthorized, constitutes consent to monitoring of this system.
Unauthorized use may subject you to criminal prosecution. Evidence of any such
unauthorized use collected during monitoring may be used for administrative, criminal or
other adverse action. Use of this system constitutes consent to monitoring for these
purposes.

';
  exit;
}
require_once("$root_path/include/Richtxt_functions.inc.php");

//Clean the $catstr var
(isset($catstr) && $catstr=='/') ? $catstr='%' : NULL;
$catstr = cleanSlashes($catstr);

//Clean the $titlestr var
(!isset($titlestr) || $titlestr=='/' || $titlestr=='%' || $titlestr=='none') ? $titlestr='A' : NULL;
$titlestr = cleanSlashes($titlestr);

//this file displays the alphabetical index browser
$CA['default_browser'] = 'indexAZ.php';
require_once("$root_path/lib/alphanum_browser.php");

//get total number of contents registered on website (heavy; a session var is used after first call)
$aGrand_total = get_grand_total();

// -----------------------------------------------------------------------
// Now, get contents of each type available that have their title starting with $titlestr:
//------------------------------------------------------------------------

//These variables are set for display only once before setting the prev-next links
$prevStatus = "$prevLink $totalrecordLimit";
$nextStatus = "$nextLink $totalrecordLimit";
$prevLink         = "< $prevLink |";
$nextLink         = "| $nextLink >";
if ($titlestr!='' && $titlestr!='none' && $titlestr!='%') {
    //Setup query to get contents that are registered in a category and that have title starting with $title str
    // in the abstracts table

    //Special case: * returns all contents that do not begin with A-Z,a-Z, or 0-9
    if ($titlestr=='*') {
        $query="SELECT ob_title,ob_keywords,ob_date,type,ref1,ref2,ref3,ob_category2,ob_category3,ob_creator,ob_publisher,ob_format,ob_type,ob_identifier,ob_description,ob_rights,ob_language FROM ".$CA['tables']['abstracts']." WHERE (ob_category1 LIKE \"$catstr%\" or ob_category2 LIKE \"$catstr%\" or ob_category3 LIKE \"$catstr%\") AND ob_category1!=\"\" ";
	$query.= "AND Left(ob_title, 1) REGEXP '^[^a-z0-9]+$'";

    //Special case: 0-9 returns all contents that begin with 0-9
    } else if ($titlestr=='0-9') {
        $query="SELECT ob_title,ob_keywords,ob_date,type,ref1,ref2,ref3,ob_category2,ob_category3,ob_creator,ob_publisher,ob_format,ob_type,ob_identifier,ob_description,ob_rights,ob_language FROM ".$CA['tables']['abstracts']." WHERE (ob_category1 LIKE \"$catstr%\" or ob_category2 LIKE \"$catstr%\" or ob_category3 LIKE \"$catstr%\") AND ob_category1!=\"\" AND (";
    for ($i=0;$i<10;$i++) {	
      $query.= " Left(ob_title, 1)='$i'";
      if ($i<9) { $query.=' OR '; }
    }
    $query.=')';

    //Alphabetical titles that begin with $titlestr
    } else {
        $query="SELECT ob_title,ob_keywords,ob_date,type,ref1,ref2,ref3,ob_category2,ob_category3,ob_creator,ob_publisher,ob_format,ob_type,ob_identifier,ob_description,ob_rights,ob_language FROM ".$CA['tables']['abstracts']." WHERE (ob_category1 LIKE \"$catstr%\" or ob_category2 LIKE \"$catstr%\" or ob_category3 LIKE \"$catstr%\") AND Left(ob_title, 1)='$titlestr' AND ob_category1!=\"\""; //ob_title is used as key to filter results, ob_category1 should not be empty!
    }

    //build ORDER BY clause and add it to query (see in lib/categories_browser.php)
    if ($obTitle=='DESC' || $obTitle=='ASC') {
        $orderBySetup = " ORDER BY ob_title ".$obTitle;
    } else if ($obDate=='DESC' || $obDate=='ASC') {
        $orderBySetup = " ORDER BY ob_date ".$obDate;
    } else { // default is alphabetical order 
        $orderBySetup = " ORDER BY ob_title ASC";
    }
    $query .= $orderBySetup;
    //echo $query;
    //include file required to build the list of available contents
    include("$root_path/include/build_contents_index.inc.php"); //limit is appended to query in this file
    //end of getting contents when $catstr isset; contents are never displayed in root category 

} else {

    //Only print total number of available contents
    $t = new rFastTemplate (getTemplateDir('contents-none.html'));
    $t->define (array('content' => "contents-none.html"));
    $t->assign (array('carbre_user' =>  $carbre_user,
                   tbbbg1 => $tbbbg1,
                   root_url => $root_url,
                   grand_total => $aGrand_total,
                   strarticlestotal => $strarticlestotal,
    ));
    $t->parse ('CONTENT', 'content');
    $t->FastPrint (); /* Output is done here */
}
?>
  
Rafraîchir la page mise-à-jour le mercredi 10 mars 2010 à 06h25. libresavoir.org est animé par le système de gestion de documents et de publication C-Arbre.