| [ PHPXref.com ] | [ Generated: Sun Jul 20 16:25:17 2008 ] | [ ActionApps 2.8.1b ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * filldisc.php3 - writes a discussion item into the discussion table 4 * expected parameters (usually from a HTML form): 5 * $d_item_id 6 * $d_parent_id 7 * $d_subject 8 * $d_author 9 * $d_e_mail 10 * $d_body 11 * $d_state 12 * $d_flag 13 * $d_free1 14 * $d_free2 15 * $d_url_address 16 * $d_url_description 17 * 18 * date and remote address(IP) of client is set by script. 19 * 20 * @package UserInput 21 * @version $Id: filldisc.php3,v 1.15 2005/04/24 21:48:11 honzam Exp $ 22 * @author 23 * @copyright Copyright (C) 1999, 2000 Association for Progressive Communications 24 */ 25 /* 26 Copyright (C) 1999, 2000 Association for Progressive Communications 27 http://www.apc.org/ 28 29 This program is free software; you can redistribute it and/or modify 30 it under the terms of the GNU General Public License as published by 31 the Free Software Foundation; either version 2 of the License, or 32 (at your option) any later version. 33 34 This program is distributed in the hope that it will be useful, 35 but WITHOUT ANY WARRANTY; without even the implied warranty of 36 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 37 GNU General Public License for more details. 38 39 You should have received a copy of the GNU General Public License 40 along with this program (LICENSE); if not, write to the Free Software 41 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 42 */ 43 44 45 /** 46 * Handle with PHP magic quotes - quote the variables if quoting is set off 47 * @param mixed $val the variable or array to quote (add slashes) 48 * @return mixed the quoted variables (with added slashes) 49 */ 50 function Myaddslashes($val, $n=1) { 51 if (!is_array($val)) { 52 return addslashes($val); 53 } 54 for (reset($val); list($k, $v) = each($val); ) 55 $ret[$k] = Myaddslashes($v, $n+1); 56 return $ret; 57 } 58 59 if (!get_magic_quotes_gpc()) { 60 // Overrides GPC variables 61 if ( isset($HTTP_GET_VARS) AND is_array($HTTP_GET_VARS)) 62 for (reset($HTTP_GET_VARS); list($k, $v) = each($HTTP_GET_VARS); ) 63 $$k = Myaddslashes($v); 64 if ( isset($HTTP_POST_VARS) AND is_array($HTTP_POST_VARS)) 65 for (reset($HTTP_POST_VARS); list($k, $v) = each($HTTP_POST_VARS); ) 66 $$k = Myaddslashes($v); 67 if ( isset($HTTP_COOKIE_VARS) AND is_array($HTTP_COOKIE_VARS)) 68 for (reset($HTTP_COOKIE_VARS); list($k, $v) = each($HTTP_COOKIE_VARS); ) 69 $$k = Myaddslashes($v); 70 } 71 72 /** APC-AA configuration file */ 73 require_once "./include/config.php3"; 74 /** Main include file for using session management function on a page */ 75 require_once $GLOBALS['AA_INC_PATH']."locsess.php3"; 76 /** Set of useful functions used on most pages */ 77 require_once $GLOBALS['AA_INC_PATH']."util.php3"; 78 /** Defines class for inserting and updating database fields */ 79 require_once $GLOBALS['AA_INC_PATH']."varset.php3"; 80 /** discussion utility functions */ 81 require_once $GLOBALS['AA_INC_PATH']."discussion.php3"; 82 /** defines PageCache class used for caching informations into database */ 83 require_once $GLOBALS['AA_INC_PATH']."pagecache.php3"; 84 /** defines class that prints the items (news, discussions, calendar...) */ 85 require_once $GLOBALS['AA_INC_PATH']."itemview.php3"; 86 /** Defines class for item manipulation (shows item in compact or fulltext format, replaces aliases ...) */ 87 require_once $GLOBALS['AA_INC_PATH']."item.php3"; 88 89 $err["Init"] = ""; // error array (Init - just for initializing variable) 90 91 $new_id = new_id(); 92 93 $catVS = new Cvarset(); 94 $catVS->add("id", "unpacked", $new_id); 95 $catVS->add("parent", "unpacked", $d_parent); 96 $catVS->add("item_id", "unpacked", $d_item_id); 97 $catVS->add("subject", "quoted", $d_subject); 98 $catVS->add("author", "quoted", $d_author); 99 $catVS->add("e_mail", "quoted", $d_e_mail); 100 $catVS->add("body", "quoted", $d_body); 101 $catVS->add("state", "quoted", $d_state); 102 $catVS->add("flag", "quoted", $d_flag); 103 $catVS->add("free1", "quoted", $d_free1); 104 $catVS->add("free2", "quoted", $d_free2); 105 $catVS->add("url_address", "quoted", $d_url_address); 106 $catVS->add("url_description", "quoted", $d_url_description); 107 $catVS->add("date", "quoted", time()); 108 $catVS->add("remote_addr", "quoted", $GLOBALS[REMOTE_ADDR]); 109 110 $SQL = "INSERT INTO discussion" . $catVS->makeINSERT(); 111 $db = new DB_AA; 112 if (!$db->query($SQL)) { // not necessary - we have set the halt_on_error 113 $err["DB"] .= MsgErr("Can't add discussion comment"); 114 } 115 send2mailList($d_item_id, $new_id); 116 117 // invalidate cache 118 $slice_id = unpack_id128(GetTable2Array("SELECT slice_id FROM item WHERE id='".q_pack_id($d_item_id)."'", 'aa_first', 'slice_id')); 119 $GLOBALS['pagecache']->invalidateFor("slice_id=$slice_id"); // invalidate old cached values 120 writeLog('PAGECACHE', "slice_id=$slice_id", "filldisc" ); 121 122 updateDiscussionCount($d_item_id); // update a count of the comments belong to the item 123 124 // special discussion setting 125 if ( $_POST['all_ids'] ) 126 $url = str_replace('&sh_itm', "&all_ids=".$_POST['all_ids'].'&sh_itm', $url); 127 go_url( $url); 128 129 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |