[ PHPXref.com ] [ Generated: Sun Jul 20 16:25:17 2008 ] [ ActionApps 2.8.1b ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/ -> discussion.php3 (source)

   1  <?php
   2  /**
   3   * View discussions, parse search conditions (conds[discussion] array)
   4   * @package UserOutput
   5   * @version $Id: discussion.php3,v 1.8 2005/04/24 21:48:11 honzam Exp $
   6   * @author
   7   * @copyright Copyright (C) 1999, 2000 Association for Progressive Communications
   8  */
   9  /*
  10  Copyright (C) 1999, 2000 Association for Progressive Communications
  11  http://www.apc.org/
  12  
  13      This program is free software; you can redistribute it and/or modify
  14      it under the terms of the GNU General Public License as published by
  15      the Free Software Foundation; either version 2 of the License, or
  16      (at your option) any later version.
  17  
  18      This program is distributed in the hope that it will be useful,
  19      but WITHOUT ANY WARRANTY; without even the implied warranty of
  20      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21      GNU General Public License for more details.
  22  
  23      You should have received a copy of the GNU General Public License
  24      along with this program (LICENSE); if not, write to the Free Software
  25      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  26  */
  27  
  28  /**
  29   * Handle with PHP magic quotes - quote the variables if quoting is set off
  30   * @param mixed $val the variable or array to quote (add slashes)
  31   * @return mixed the quoted variables (with added slashes)
  32   */
  33  function Myaddslashes($val, $n=1) {
  34    if (!is_array($val)) {
  35      return addslashes($val);
  36    }
  37    for (reset($val); list($k, $v) = each($val); )
  38      $ret[$k] = Myaddslashes($v, $n+1);
  39    return $ret;
  40  }
  41  
  42  if (!get_magic_quotes_gpc()) {
  43    // Overrides GPC variables
  44    if ( isset($HTTP_GET_VARS) AND is_array($HTTP_GET_VARS))
  45      for (reset($HTTP_GET_VARS); list($k, $v) = each($HTTP_GET_VARS); )
  46        $$k = Myaddslashes($v);
  47    if ( isset($HTTP_POST_VARS) AND is_array($HTTP_POST_VARS))
  48      for (reset($HTTP_POST_VARS); list($k, $v) = each($HTTP_POST_VARS); )
  49        $$k = Myaddslashes($v);
  50    if ( isset($HTTP_COOKIE_VARS) AND is_array($HTTP_COOKIE_VARS))
  51      for (reset($HTTP_COOKIE_VARS); list($k, $v) = each($HTTP_COOKIE_VARS); )
  52        $$k = Myaddslashes($v);
  53  }
  54  
  55  /**
  56   * PutSearchLog
  57   */
  58  function PutSearchLog ()
  59  {
  60      global $QUERY_STRING_UNESCAPED, $REDIRECT_QUERY_STRING_UNESCAPED, $HTTP_REMOTE_USER,
  61          $searchlog;
  62  
  63      $httpquery = $QUERY_STRING_UNESCAPED.$REDIRECT_QUERY_STRING_UNESCAPED;
  64      $httpquery = DeBackslash ($httpquery);
  65      $httpquery = str_replace ("'", "\\'", $httpquery);
  66      $db = new DB_AA;
  67      global $view_param;
  68      $found_count = count ($view_param["disc_ids"]);
  69      list($usec, $sec) = explode(" ",microtime());
  70      $slice_time = 1000 * ((float)$usec + (float)$sec - $GLOBALS[disc_starttime]);
  71      $user = $GLOBALS[HTTP_SERVER_VARS]['REMOTE_USER'];
  72      $db->query(
  73      "INSERT INTO searchlog (date,query,user,found_count,search_time,additional1)
  74      VALUES (".time().",'$httpquery','$user',$found_count,$slice_time,'discuss $searchlog')");
  75  }
  76  
  77  /** APC-AA configuration file */
  78  require_once  "./include/config.php3";
  79  /** Defines simplified class for page scroller */
  80  require_once $GLOBALS['AA_INC_PATH']."easy_scroller.php3";
  81  /** Set of usefull functions used on most pages */
  82  require_once $GLOBALS['AA_INC_PATH']."util.php3";
  83  /** Mail sending functions */
  84  require_once $GLOBALS['AA_INC_PATH']."mail.php3";
  85  /**  Defines class for item manipulation (shows item in compact or fulltext format, replaces aliases ...) */
  86  require_once $GLOBALS['AA_INC_PATH']."item.php3";
  87  /** parses view settings, gets view data and other functions */
  88  require_once $GLOBALS['AA_INC_PATH']."view.php3";
  89  /** discussion utility functions */
  90  require_once $GLOBALS['AA_INC_PATH']."discussion.php3";
  91  /** defines PageCache class used for caching informations into database */
  92  require_once $GLOBALS['AA_INC_PATH']."pagecache.php3";
  93  /** functions for searching and filtering items */
  94  require_once $GLOBALS['AA_INC_PATH']."searchlib.php3";
  95  /** Main include file for using session management function on page */
  96  require_once $GLOBALS['AA_INC_PATH']."locsessi.php3";    // DB_AA object definition
  97  
  98  add_vars();
  99  
 100  $p_slice_id= q_pack_id($slice_id);
 101  $db = new DB_AA;             // open BD
 102  
 103  list($usec, $sec) = explode(" ",microtime());
 104  $disc_starttime = ((float)$usec + (float)$sec);
 105  
 106  $view_param = ParseViewParameters();
 107  $view_param["disc_ids"] = QueryDiscIDs($slice_id, $conds, $sort, $slices );
 108  $view_param["disc_type"] = "list";
 109  // special url parameter disc_url - tell us, where we have to show
 110  // discussion fulltext (good for discussion search)
 111  if ( $disc_url )
 112      $view_param["disc_url"] = $disc_url;
 113  
 114  if ($debug) {
 115      echo "Discussion item IDs:<br>";
 116      print_r ($view_param["disc_ids"]);
 117  }
 118  
 119  echo GetView($view_param);
 120  
 121  if ($searchlog) PutSearchLog();
 122  exit;
 123  
 124  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]