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

title

Body

[close]

/ -> jsview.php3 (source)

   1  <?php
   2  //$Id: jsview.php3,v 1.9 2005/04/24 21:48:11 honzam Exp $
   3  /* 
   4  Copyright (C) 1999, 2000 Association for Progressive Communications 
   5  http://www.apc.org/
   6  
   7      This program is free software; you can redistribute it and/or modify
   8      it under the terms of the GNU General Public License as published by
   9      the Free Software Foundation; either version 2 of the License, or
  10      (at your option) any later version.
  11  
  12      This program is distributed in the hope that it will be useful,
  13      but WITHOUT ANY WARRANTY; without even the implied warranty of
  14      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15      GNU General Public License for more details.
  16  
  17      You should have received a copy of the GNU General Public License
  18      along with this program (LICENSE); if not, write to the Free Software
  19      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  20  */
  21  
  22  // jsview.php3 is exactly the same as view.php3, but the calling of this script 
  23  // is not through SSI (server side includes), but through javascript:
  24  //
  25  // Exapmle of calling view.php3:
  26  //    <!--#include virtual="/apps/aa/view.php3?&vid=2&cmd[2]=c-1-Database" -->
  27  //
  28  // Exapmle of calling jsview.php3:
  29  //    <script src="http://www.apc.org/apps/aa/jsview.php3?&vid=2&cmd[2]=c-1-Database"></script>
  30  
  31  //expected  vid      // id of view
  32  //optionaly cmd[]    // command to modify the view
  33                      // cmd[23]=v-25 means: show view id 25 in place of id 23 
  34                      // cmd[23]=i-24-7464674747 means view 
  35                      //   number 23 has to display item 74.. in format defined
  36                      //   in view 24
  37                      // cmd[23]=c-1-Environment means display view no 23 in place 
  38                      //   of view no 23 (that's normal), but change value for 
  39                      //   condition 1 to "Environment".
  40                      // cmd[23]=c-1-Environment-2-Jane means the same as above, 
  41                      //   but there are redefined two conditions
  42                      // cmd[23]=d-headline........-LIKE-Profit-publish_date....-m:>-86400
  43                      //   generalized version of cmd[]-c
  44                      //      - fields and operators specifed
  45                      //      - unlimited number of conditions
  46                      //      - all default conditions from view definition are 
  47                      //        completely redefined by the specified ones
  48  //optionaly set[]    // setings to modify view behavior (can be combined with cmd)
  49                      // set[23]=listlen-20 
  50                      //   - sets maximal number of viewed items in view 23 to 20
  51                      //   - there can be more settings (future) - comma separated 
  52  //optionaly als[]    // user alias - see slice.php3 for more details
  53  //
  54  // please look into /view.php3 for more details
  55  
  56  // handle with PHP magic quotes - quote the variables if quoting is set off
  57  function Myaddslashes($val, $n=1) {
  58    if (!is_array($val)) {
  59      return addslashes($val);
  60    }  
  61    for (reset($val); list($k, $v) = each($val); )
  62      $ret[$k] = Myaddslashes($v, $n+1);
  63    return $ret;
  64  }    
  65  
  66  if (!get_magic_quotes_gpc()) { 
  67    // Overrides GPC variables 
  68    if ( isset($HTTP_GET_VARS) AND is_array($HTTP_GET_VARS))
  69      for (reset($HTTP_GET_VARS); list($k, $v) = each($HTTP_GET_VARS); ) 
  70        $$k = Myaddslashes($v); 
  71    if ( isset($HTTP_POST_VARS) AND is_array($HTTP_POST_VARS))
  72      for (reset($HTTP_POST_VARS); list($k, $v) = each($HTTP_POST_VARS); ) 
  73        $$k = Myaddslashes($v); 
  74    if ( isset($HTTP_COOKIE_VARS) AND is_array($HTTP_COOKIE_VARS))
  75      for (reset($HTTP_COOKIE_VARS); list($k, $v) = each($HTTP_COOKIE_VARS); ) 
  76        $$k = Myaddslashes($v); 
  77  }
  78  
  79  require_once  "./include/config.php3";
  80  require_once $GLOBALS['AA_INC_PATH']."easy_scroller.php3";
  81  require_once $GLOBALS['AA_INC_PATH']."util.php3";
  82  require_once $GLOBALS['AA_INC_PATH']."item.php3";
  83  require_once $GLOBALS['AA_INC_PATH']."view.php3";
  84  require_once $GLOBALS['AA_INC_PATH']."pagecache.php3";
  85  require_once $GLOBALS['AA_INC_PATH']."searchlib.php3";
  86  require_once $GLOBALS['AA_INC_PATH']."locsessi.php3";    // DB_AA object definition
  87  
  88  $p_slice_id= q_pack_id($slice_id);
  89  $db = new DB_AA;             // open BD    
  90  $db2 = new DB_AA;          // open BD    
  91  
  92  $html_code = GetView(ParseViewParameters());          // get view content
  93  $html_code = str_replace( '"', '\"', $html_code );    // backslash quotes
  94  $html_code = str_replace( "\r\n", '\n', $html_code ); // remove newlines
  95  $html_code = str_replace( "\n", '\n', $html_code );   // remove newlines
  96  $html_code = str_replace( "\r", '\n', $html_code );   // remove newlines
  97  echo 'document.write("'. $html_code .'");';           // print it as javascript
  98  exit;
  99  
 100  ?>


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