[ Index ] |
PHP Cross Reference of phpwcms V1.5.0 _r431 (28.01.12) |
[Summary view] [Print] [Text view]
1 <?php 2 /************************************************************************************* 3 Copyright notice 4 5 (c) 2002-2012 Oliver Georgi <oliver@phpwcms.de> // All rights reserved. 6 7 This script is part of PHPWCMS. The PHPWCMS web content management system is 8 free software; you can redistribute it and/or modify it under the terms of 9 the GNU General Public License as published by the Free Software Foundation; 10 either version 2 of the License, or (at your option) any later version. 11 12 The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 13 A copy is found in the textfile GPL.txt and important notices to the license 14 from the author is found in LICENSE.txt distributed with these scripts. 15 16 This script is distributed in the hope that it will be useful, but WITHOUT ANY 17 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 18 PARTICULAR PURPOSE. See the GNU General Public License for more details. 19 20 This copyright notice MUST APPEAR in all copies of the script! 21 *************************************************************************************/ 22 23 // ---------------------------------------------------------------- 24 // obligate check for phpwcms constants 25 if (!defined('PHPWCMS_ROOT')) { 26 die("You Cannot Access This Script Directly, Have a Nice Day."); 27 } 28 // ---------------------------------------------------------------- 29 30 31 // try 32 33 if(isset($_GET['edit'])) { 34 $glossary['id'] = intval($_GET['edit']); 35 } else { 36 $glossary['id'] = 0; 37 } 38 39 40 // process post form 41 if(isset($_POST['glossary_title'])) { 42 43 $glossary['data'] = array( 44 45 'glossary_id' => intval($_POST['glossary_id']), 46 'glossary_title' => clean_slweg($_POST['glossary_title']), 47 'glossary_created' => date('Y-m-d H:i:s'), 48 'glossary_changed' => date('Y-m-d H:i:s'), 49 'glossary_tag' => clean_slweg($_POST['glossary_tag']), 50 'glossary_keyword' => clean_slweg($_POST['glossary_keyword']), 51 'glossary_text' => slweg($_POST['glossary_text']), 52 'glossary_object' => array(), 53 'glossary_status' => empty($_POST['glossary_status']) ? 0 : 1, 54 'glossary_highlight' => empty($_POST['glossary_highlight']) ? 0 : 1 55 56 ); 57 58 if(empty($glossary['data']['glossary_title'])) { 59 60 $glossary['error']['glossary_title'] = 1; 61 62 } 63 64 if(empty($glossary['data']['glossary_keyword'])) { 65 66 $glossary['error']['glossary_keyword'] = 1; 67 68 } else { 69 70 $sql = 'SELECT COUNT(*) FROM '.DB_PREPEND."phpwcms_glossary "; 71 $sql .= "WHERE glossary_keyword LIKE '".aporeplace($glossary['data']['glossary_keyword']); 72 $sql .= "' AND glossary_id <> ".$glossary['data']['glossary_id']; 73 74 if(_dbQuery($sql, 'COUNT')) { 75 76 $glossary['error']['glossary_keyword'] = 1; 77 78 } 79 80 } 81 82 83 if(!isset($glossary['error'])) { 84 85 if($glossary['data']['glossary_id']) { 86 87 // UPDATE 88 $sql = 'UPDATE '.DB_PREPEND.'phpwcms_glossary SET '; 89 90 $sql .= "glossary_title='".aporeplace($glossary['data']['glossary_title'])."', "; 91 $sql .= "glossary_tag='".aporeplace($glossary['data']['glossary_tag'])."', "; 92 $sql .= "glossary_keyword='".aporeplace($glossary['data']['glossary_keyword'])."', "; 93 $sql .= "glossary_text='".aporeplace($glossary['data']['glossary_text'])."', "; 94 $sql .= "glossary_object='".aporeplace(serialize($glossary['data']['glossary_object']))."', "; 95 $sql .= "glossary_changed='".aporeplace($glossary['data']['glossary_changed'])."', "; 96 $sql .= "glossary_status=".$glossary['data']['glossary_status'].", "; 97 $sql .= "glossary_highlight=".$glossary['data']['glossary_highlight']." "; 98 99 $sql .= "WHERE glossary_id=".$glossary['data']['glossary_id']; 100 101 if(@_dbQuery($sql, 'UPDATE')) { 102 103 if(isset($_POST['save'])) { 104 105 headerRedirect(decode_entities(GLOSSARY_HREF)); 106 107 } 108 109 } else { 110 111 $glossary['error']['update'] = mysql_error(); 112 113 } 114 115 116 } else { 117 118 // INSERT 119 $sql = 'INSERT INTO '.DB_PREPEND.'phpwcms_glossary ('; 120 $sql .= 'glossary_created, glossary_changed, glossary_title, glossary_tag, '; 121 $sql .= 'glossary_keyword, glossary_text, glossary_highlight, glossary_object, glossary_status'; 122 $sql .= ') VALUES ('; 123 $sql .= "'".aporeplace($glossary['data']['glossary_created'])."', "; 124 $sql .= "'".aporeplace($glossary['data']['glossary_changed'])."', "; 125 $sql .= "'".aporeplace($glossary['data']['glossary_title'])."', "; 126 $sql .= "'".aporeplace($glossary['data']['glossary_tag'])."', "; 127 $sql .= "'".aporeplace($glossary['data']['glossary_keyword'])."', "; 128 $sql .= "'".aporeplace($glossary['data']['glossary_text'])."', "; 129 $sql .= aporeplace($glossary['data']['glossary_highlight']).', '; 130 $sql .= "'".aporeplace(serialize($glossary['data']['glossary_object']))."', "; 131 $sql .= aporeplace($glossary['data']['glossary_status']); 132 $sql .= ')'; 133 134 if($result = @_dbQuery($sql, 'INSERT')) { 135 136 if(isset($_POST['save'])) { 137 138 headerRedirect(decode_entities(GLOSSARY_HREF)); 139 140 } 141 142 if(!empty($result['INSERT_ID'])) { 143 $glossary['id'] = $result['INSERT_ID']; 144 } 145 146 } else { 147 148 $glossary['error']['update'] = mysql_error(); 149 150 } 151 152 153 } 154 } 155 156 } 157 158 // try to read entry from database 159 if($glossary['id'] && !isset($glossary['error'])) { 160 161 $sql = 'SELECT * FROM '.DB_PREPEND.'phpwcms_glossary WHERE glossary_id='.$glossary['id']; 162 $glossary['data'] = _dbQuery($sql); 163 $glossary['data'] = $glossary['data'][0]; 164 } 165 166 // default values 167 if(empty($glossary['data'])) { 168 169 $glossary['data'] = array( 170 171 'glossary_id' => 0, 172 'glossary_title' => '', 173 'glossary_created' => '', 174 'glossary_changed' => date('Y-m-d H:i:s'), 175 'glossary_tag' => '', 176 'glossary_keyword' => '', 177 'glossary_text' => '', 178 'glossary_object' => array(), 179 'glossary_status' => 0, 180 'glossary_highlight' => 0 181 182 ); 183 184 } 185 186 187 188 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Jan 29 16:31:14 2012 | Cross-referenced by PHPXref 0.7.1 |