| [ 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 Copyright (C) 1999, 2000 Association for Progressive Communications 4 http://www.apc.org/ 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program (LICENSE); if not, write to the Free Software 18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 */ 20 21 /* (c) Jakub Adámek, October 2002 22 23 Used by live checkboxes (item alias function f_k). 24 Updates a boolean field in database and sends 25 back an image file 26 27 Params: live_checkbox[short_id][field_id]=action 28 29 where 30 short_id is the item short ID 31 field_id is the field ID (like "highlight......") 32 action is one of on, off and decides whether the checkbox should be switched on or off 33 (it looks like action is ignored, and the field is just toggled - mitra) 34 */ 35 /* 36 function f () { 37 $image_path = "http://localhost/aa_jakub/images/"; 38 header ("Content-Type: image/gif"); 39 readfile ($image_path.'cb_on.gif'); 40 exit; 41 } 42 */ 43 $directory_depth = "base"; 44 require_once "./include/init_page.php3"; 45 require_once $GLOBALS['AA_INC_PATH']."util.php3"; 46 require_once $GLOBALS['AA_INC_PATH']."itemfunc.php3"; 47 48 $image_path = $AA_BASE_PATH."images/"; 49 50 reset($live_checkbox); 51 list($short_id, $ar) = each ($live_checkbox); 52 reset($ar); 53 list($field_id, $action) = each ($ar); 54 55 $db = new DB_AA; 56 $db->query("SELECT id, slice_id FROM item WHERE short_id = $short_id"); 57 if ($db->next_record()) { 58 $item_id = unpack_id128($db->f("id")); 59 $slice_id = unpack_id128($db->f("slice_id")); 60 } 61 else failed(); 62 63 if (!IfSlPerm(PS_EDIT_ALL_ITEMS)) { 64 failed(); 65 } 66 67 if (!$debug) { 68 header ("Content-Type: image/gif"); 69 } 70 $content4ids = GetItemContent($item_id); 71 reset($content4ids); 72 $content4id = current($content4ids); 73 $oldcontent4id = $content4id; 74 $action = ! ($content4id[$field_id][0]['value']); 75 $content4id = array ($field_id => array (0 => array ("value" => $action))); 76 list($fields) = GetSliceFields($slice_id); 77 78 StoreItem($item_id, $slice_id, $content4id, $fields, false, true, false, $oldcontent4id); 79 80 readfile ($image_path.'cb_'.($action ? "on" : "off").'.gif'); 81 page_close(); 82 exit; 83 84 // ------------------------------------------------------------------------------------ 85 86 function failed () { 87 global $image_path; 88 readfile ($image_path.'cb_failed.gif'); 89 page_close(); 90 exit; 91 } 92 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |