linea21-modules
[ class tree: linea21-modules ] [ index: linea21-modules ] [ all elements ]

Source for file mysql.inc.php

Documentation is available at mysql.inc.php

  1. <?php
  2. /**
  3.  * @package linea21.modules
  4.  * @subpackage page
  5.  * @author Simon Georget <simon@linea21.com>
  6.  * @version $id SVN
  7.  * @access public
  8.  * @license http://opensource.org/licenses/gpl-3.0.html
  9.  */
  10.  
  11. //////////// Check Inclusion de pages ////////////
  12. if (!class_exists('auth')){
  13.   include_once("../lib/lib_common.php");
  14.   ReloadIndex('admin');
  15. }
  16. ////////////
  17.  
  18.  
  19. $req_count_page "SELECT COUNT(page_id) as num_rows FROM " T_PAGE " WHERE page_status <> 'E';";
  20.  
  21.  
  22. $req_quickbox_add "SELECT page_id, LEFT(page_title, 50) as page_title, DATE_FORMAT(page_date_crea, '".toStringSqlDate('long')."') AS page_date_crea_display FROM " T_PAGE " WHERE page_status  = 'P' OR page_status = 'D'  ORDER BY page_date_crea DESC LIMIT 0 , 10;";
  23. $req_quickbox_sup "SELECT page_id,  LEFT(page_title, 50) as page_title, DATE_FORMAT(page_last_modify, '".toStringSqlDate('long')."') AS page_last_modify_display, DATE_FORMAT(page_date_crea, '".toStringSqlDate()."') AS page_date_crea_display FROM " T_PAGE " WHERE page_status = 'E' ORDER BY page_last_modify DESC LIMIT 0 , 10;";
  24. $req_quickbox_mod "SELECT page_id, LEFT(page_title, 50) as page_title, DATE_FORMAT(page_last_modify, '".toStringSqlDate('long')."') AS page_last_modify_display, DATE_FORMAT(page_date_crea, '".toStringSqlDate()."') AS page_date_crea_display FROM " T_PAGE " WHERE page_status  <> 'E' ORDER BY page_last_modify DESC LIMIT 0 , 10;";
  25. $req_quickbox_list "SELECT page_id,  LEFT(page_title, 50) as page_title, DATE_FORMAT(page_published_date, '".toStringSqlDate('long')."') AS page_published_date_display, DATE_FORMAT(page_date_crea, '".toStringSqlDate()."') AS page_date_crea_display FROM " T_PAGE " WHERE page_status <> 'E' AND  page_published_date <> '0001-01-01' ORDER BY page_published_date DESC LIMIT 0 , 10;";
  26.  
  27.  
  28. function SQL_getoneCompletePage($page_id$force_status false{
  29.     
  30.     if($force_status$force_status " AND "sql_status_filter('page_status'$force_status);
  31.     else $force_status "";
  32.     
  33.   $q =    "SELECT P.page_title, P.page_header, P.page_homepage, P.page_body, P.page_status, P.page_posted_by, U.user_login, ".
  34.                 "DATE_FORMAT(P.page_date_crea, '".toStringSqlDate()."') AS page_date_crea_display, ".
  35.                 "DATE_FORMAT(P.page_last_modify, '".toStringSqlDate('long')."') AS page_last_modify_display, ".
  36.                 "DATE_FORMAT(P.page_published_date, '".toStringSqlDate()."') AS page_published_date_display ".
  37.                 "FROM " T_PAGE " AS  P ".
  38.                 "LEFT OUTER JOIN ".T_USER." AS U on P.page_posted_by=U.user_id ".
  39.                 "WHERE page_id='".$page_id."'"$force_status.";";
  40.  
  41.   return $q;
  42. }
  43.  
  44.  
  45. function SQL_getPagesList($debut$limite$status{
  46.   switch ($status{
  47.     case 'public':
  48.       $mask=" WHERE page_status = 'P'";
  49.       $orderby="page_published_date DESC";
  50.       break;
  51.     case 'draft':
  52.       $mask=" WHERE page_status = 'D'";
  53.       $orderby="page_date_crea DESC";
  54.       break;
  55.     default:
  56.       $mask=" WHERE page_status <> 'E'";
  57.       $orderby="page_date_crea DESC";
  58.       break;
  59.   }
  60.  
  61.   $q"SELECT page_id, LEFT(page_title, 60) AS page_title, page_title AS complete_page_title, ".
  62.               "page_homepage, page_header, page_status, page_posted_by, user_login, ".
  63.               "DATE_FORMAT(page_date_crea, '".toStringSqlDate()."') AS page_date_crea_display, ".
  64.               "DATE_FORMAT(page_published_date, '".toStringSqlDate()."') AS page_published_date_display, ".
  65.               "DATE_FORMAT(page_last_modify, '".toStringSqlDate()."') AS page_last_modify_display ".
  66.               "FROM " T_PAGE ." ".
  67.               "LEFT OUTER JOIN ".T_USER." AS U on page_posted_by=U.user_id ".
  68.       
  69.   $mask." ORDER BY ".$orderby." LIMIT ".$debut." , ".$limite.";";
  70.  
  71.   return $q;
  72. }
  73.  
  74. function SQL_getCountPagesList($status{
  75.   switch ($status{
  76.     case 'public':
  77.       $mask="WHERE page_status = 'P'";
  78.       break;
  79.     case 'draft':
  80.       $mask="WHERE page_status = 'D'";
  81.       break;
  82.     default:
  83.       $mask="WHERE page_status <> 'E'";
  84.       break;
  85.   }
  86.  
  87.   $q  "SELECT COUNT(page_id) AS num_rows FROM " T_PAGE ." ";
  88.   $q .= $mask.";";
  89.   return $q;
  90. }
  91.  
  92.  
  93. function SQL_getPageTitle($page_id$force_status false{
  94.     
  95.     if($force_status$force_status " AND "sql_status_filter('page_status'$force_status);
  96.     else $force_status "";
  97.     
  98.   $q =    "SELECT P.page_title, P.page_posted_by FROM " T_PAGE " AS  P WHERE page_id='".$page_id."'"$force_status.";";
  99.   
  100.   return $q;
  101. }
  102.  
  103.  
  104. ?>

Documentation generated on Thu, 20 Mar 2014 16:49:14 +0100 by phpDocumentor 1.4.1