[ Index ] |
|
Code source de XOOPS 2.0.17.1 |
1 <?php 2 // $Id: main.php 669 2006-08-25 22:14:09Z skalpa $ 3 // ------------------------------------------------------------------------ // 4 // XOOPS - PHP Content Management System // 5 // Copyright (c) 2000 XOOPS.org // 6 // <http://www.xoops.org/> // 7 // ------------------------------------------------------------------------ // 8 // This program is free software; you can redistribute it and/or modify // 9 // it under the terms of the GNU General Public License as published by // 10 // the Free Software Foundation; either version 2 of the License, or // 11 // (at your option) any later version. // 12 // // 13 // You may not change or alter any portion of this comment or credits // 14 // of supporting developers from this source code or any supporting // 15 // source code which is considered copyrighted (c) material of the // 16 // original comment or credit authors. // 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; if not, write to the Free Software // 25 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // 26 // ------------------------------------------------------------------------- // 27 28 if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) { 29 exit("Access Denied"); 30 } 31 include_once XOOPS_ROOT_PATH."/modules/system/admin/banners/banners.php"; 32 include_once XOOPS_ROOT_PATH."/class/module.textsanitizer.php"; 33 34 $op = "BannersAdmin"; 35 if (isset($_GET['op'])) { 36 $op = $_GET['op']; 37 } elseif (isset($_POST['op'])) { 38 $op = $_POST['op']; 39 } 40 41 switch ( $op ) { 42 case "BannersAdmin": 43 BannersAdmin(); 44 break; 45 46 case "BannersAdd": 47 if (!$GLOBALS['xoopsSecurity']->check()) { 48 redirect_header("admin.php?fct=banners&op=BannersAdmin#top", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); 49 } 50 $name = isset($_POST['name']) ? trim($_POST['name']) : ''; 51 $cid = isset($_POST['cid']) ? intval($_POST['cid']) : 0; 52 $imageurl = isset($_POST['imageurl']) ? trim($_POST['imageurl']) : ''; 53 $clickurl = isset($_POST['clickurl']) ? trim($_POST['clickurl']) : ''; 54 $imptotal = isset($_POST['imptotal']) ? intval($_POST['imptotal']) : 0; 55 $htmlbanner = isset($_POST['htmlbanner']) ? intval($_POST['htmlbanner']) : 0; 56 $htmlcode = isset($_POST['htmlcode']) ? trim($_POST['htmlcode']) : ''; 57 if ($cid <= 0) { 58 redirect_header("admin.php?fct=banners&op=BannersAdmin#top"); 59 } 60 $db =& Database::getInstance(); 61 $myts =& MyTextSanitizer::getInstance(); 62 $newid = $db->genId($db->prefix("banner")."_bid_seq"); 63 $sql = sprintf("INSERT INTO %s (bid, cid, imptotal, impmade, clicks, imageurl, clickurl, date, htmlbanner, htmlcode) VALUES (%d, %d, %d, 1, 0, %s, %s, %d, %d, %s)", $db->prefix("banner"), intval($newid), $cid, $imptotal, $db->quoteString($myts->stripSlashesGPC($imageurl)), $db->quoteString($myts->stripSlashesGPC($clickurl)), time(), $htmlbanner, $db->quoteString($myts->stripSlashesGPC($htmlcode))); 64 $db->query($sql); 65 redirect_header("admin.php?fct=banners&op=BannersAdmin#top",1,_AM_DBUPDATED); 66 exit(); 67 break; 68 69 case "BannerAddClient": 70 if (!$GLOBALS['xoopsSecurity']->check()) { 71 redirect_header("admin.php?fct=banners&op=BannersAdmin#top", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); 72 } 73 $name = isset($_POST['name']) ? trim($_POST['name']) : ''; 74 $contact = isset($_POST['contact']) ? trim($_POST['contact']) : ''; 75 $email = isset($_POST['email']) ? trim($_POST['email']) : ''; 76 $login = isset($_POST['login']) ? trim($_POST['login']) : ''; 77 $passwd = isset($_POST['passwd']) ? trim($_POST['passwd']) : ''; 78 $extrainfo = isset($_POST['extrainfo']) ? trim($_POST['extrainfo']) : ''; 79 $db =& Database::getInstance(); 80 $myts =& MyTextSanitizer::getInstance(); 81 $newid = $db->genId($xoopsDB->prefix("bannerclient")."_cid_seq"); 82 $sql = sprintf("INSERT INTO %s (cid, name, contact, email, login, passwd, extrainfo) VALUES (%d, %s, %s, %s, %s, %s, %s)", $db->prefix("bannerclient"), intval($newid), $db->quoteString($myts->stripSlashesGPC($name)), $db->quoteString($myts->stripSlashesGPC($contact)), $db->quoteString($myts->stripSlashesGPC($email)), $db->quoteString($myts->stripSlashesGPC($login)), $db->quoteString($myts->stripSlashesGPC($passwd)), $db->quoteString($myts->stripSlashesGPC($extrainfo))); 83 $db->query($sql); 84 redirect_header("admin.php?fct=banners&op=BannersAdmin#top",1,_AM_DBUPDATED); 85 exit(); 86 break; 87 88 case "BannerFinishDelete": 89 xoops_cp_header(); 90 xoops_confirm(array('op' => 'BannerFinishDelete2', 'bid' => intval($_GET['bid']), 'fct' => 'banners'), 'admin.php', _AM_SUREDELE); 91 xoops_cp_footer(); 92 break; 93 94 case "BannerFinishDelete2": 95 $bid = isset($_POST['bid']) ? intval($_POST['bid']) : 0; 96 if ($bid <= 0 | !$GLOBALS['xoopsSecurity']->check()) { 97 redirect_header("admin.php?fct=banners&op=BannersAdmin#top", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); 98 } 99 $db =& Database::getInstance(); 100 $sql = sprintf("DELETE FROM %s WHERE bid = %u", $db->prefix("bannerfinish"), $bid); 101 $db->query($sql); 102 redirect_header("admin.php?fct=banners&op=BannersAdmin#top",1,_AM_DBUPDATED); 103 exit(); 104 break; 105 106 case "BannerDelete": 107 $bid = isset($_GET['bid']) ? intval($_GET['bid']) : 0; 108 if ($bid > 0) { 109 BannerDelete($bid); 110 } 111 break; 112 113 case "BannerDelete2": 114 $bid = isset($_POST['bid']) ? intval($_POST['bid']) : 0; 115 if ($bid <= 0 | !$GLOBALS['xoopsSecurity']->check()) { 116 redirect_header("admin.php?fct=banners&op=BannersAdmin#top", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); 117 } 118 $db =& Database::getInstance(); 119 $sql = sprintf("DELETE FROM %s WHERE bid = %u", $db->prefix("banner"), $bid); 120 $db->query($sql); 121 redirect_header("admin.php?fct=banners&op=BannersAdmin#top",1,_AM_DBUPDATED); 122 break; 123 124 case "BannerEdit": 125 $bid = isset($_GET['bid']) ? intval($_GET['bid']) : 0; 126 if ($bid > 0) { 127 BannerEdit($bid); 128 } 129 break; 130 131 case "BannerChange": 132 $bid = isset($_POST['bid']) ? intval($_POST['bid']) : 0; 133 $cid = isset($_POST['cid']) ? intval($_POST['cid']) : 0; 134 if (($cid <= 0 || $bid <= 0) | !$GLOBALS['xoopsSecurity']->check()) { 135 redirect_header("admin.php?fct=banners&op=BannersAdmin#top", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); 136 } 137 $imageurl = isset($_POST['imageurl']) ? trim($_POST['imageurl']) : ''; 138 $clickurl = isset($_POST['clickurl']) ? trim($_POST['clickurl']) : ''; 139 $imptotal = isset($_POST['imptotal']) ? intval($_POST['imptotal']) : 0; 140 $impadded = isset($_POST['impadded']) ? intval($_POST['impadded']) : 0; 141 $htmlbanner = isset($_POST['htmlbanner']) ? intval($_POST['htmlbanner']) : 0; 142 $htmlcode = isset($_POST['htmlcode']) ? trim($_POST['htmlcode']) : ''; 143 $db =& Database::getInstance(); 144 $myts =& MyTextSanitizer::getInstance(); 145 $sql = sprintf("UPDATE %s SET cid = %d, imptotal = %d, imageurl = %s, clickurl = %s, htmlbanner = %d, htmlcode = %s WHERE bid = %d", $db->prefix("banner"), $cid, $imptotal + $impadded, $db->quoteString($myts->stripSlashesGPC($imageurl)), $db->quoteString($myts->stripSlashesGPC($clickurl)), $htmlbanner, $db->quoteString($myts->stripSlashesGPC($htmlcode)), $bid); 146 $db->query($sql); 147 redirect_header("admin.php?fct=banners&op=BannersAdmin#top",1,_AM_DBUPDATED); 148 break; 149 150 case "BannerClientDelete": 151 $cid = isset($_GET['cid']) ? intval($_GET['cid']) : 0; 152 if ($cid > 0) { 153 BannerClientDelete($cid); 154 } 155 break; 156 157 case "BannerClientDelete2": 158 $cid = isset($_POST['cid']) ? intval($_POST['cid']) : 0; 159 $db =& Database::getInstance(); 160 if ($cid <= 0 | !$GLOBALS['xoopsSecurity']->check()) { 161 redirect_header("admin.php?fct=banners&op=BannersAdmin#top", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); 162 } 163 $sql = sprintf("DELETE FROM %s WHERE cid = %u", $db->prefix("banner"), $cid); 164 $db->query($sql); 165 $sql = sprintf("DELETE FROM %s WHERE cid = %u", $db->prefix("bannerclient"), $cid); 166 $db->query($sql); 167 redirect_header("admin.php?fct=banners&op=BannersAdmin#top",1,_AM_DBUPDATED); 168 break; 169 170 case "BannerClientEdit": 171 $cid = isset($_GET['cid']) ? intval($_GET['cid']) : 0; 172 if ($cid > 0) { 173 BannerClientEdit($cid); 174 } 175 break; 176 177 case "BannerClientChange": 178 $cid = isset($_POST['cid']) ? intval($_POST['cid']) : 0; 179 if ($cid <= 0 | !$GLOBALS['xoopsSecurity']->check()) { 180 redirect_header("admin.php?fct=banners&op=BannersAdmin#top", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); 181 } 182 $name = isset($_POST['name']) ? trim($_POST['name']) : ''; 183 $contact = isset($_POST['contact']) ? trim($_POST['contact']) : ''; 184 $email = isset($_POST['email']) ? trim($_POST['email']) : ''; 185 $login = isset($_POST['login']) ? trim($_POST['login']) : ''; 186 $passwd = isset($_POST['passwd']) ? trim($_POST['passwd']) : ''; 187 $extrainfo = isset($_POST['extrainfo']) ? trim($_POST['extrainfo']) : ''; 188 $db =& Database::getInstance(); 189 $myts =& MyTextSanitizer::getInstance(); 190 $sql = sprintf( 191 "UPDATE %s SET name = %s, contact = %s, email = %s, login = %s, passwd = %s, extrainfo = %s WHERE cid = %d", 192 $db->prefix("bannerclient"), 193 $db->quoteString( $myts->stripSlashesGPC($name) ), 194 $db->quoteString( $myts->stripSlashesGPC($contact) ), 195 $db->quoteString( $myts->stripSlashesGPC($email) ), 196 $db->quoteString( $myts->stripSlashesGPC($login) ), 197 $db->quoteString( $myts->stripSlashesGPC($passwd) ), 198 $db->quoteString( $myts->stripSlashesGPC($extrainfo) ), 199 $cid 200 ); 201 $db->query($sql); 202 redirect_header("admin.php?fct=banners&op=BannersAdmin#top",1,_AM_DBUPDATED); 203 break; 204 205 default: 206 BannersAdmin(); 207 break; 208 } 209 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Nov 25 11:44:32 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |