[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 #CMS - CMS Made Simple 3 #(c)2004 by Ted Kulp (wishy@users.sf.net) 4 #This project's homepage is: http://cmsmadesimple.sf.net 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 #You should have received a copy of the GNU General Public License 16 #along with this program; if not, write to the Free Software 17 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 # 19 #$Id: deletecss.php 3601 2006-12-20 21:04:54Z calguy1000 $ 20 21 /** 22 * This page is used to delete CSS. It doesn't show any HTML and only does 23 * treatments. 24 * 25 * Only one parameter is required and must be passed by GET : 26 * - $css_id : the id of the CSS to delete 27 * 28 * At the end of treatment, user is redirected to the CSS list 29 * 30 * @since 0.6 31 * @author calexico 32 */ 33 34 35 $CMS_ADMIN_PAGE=1; 36 37 require_once ("../include.php"); 38 39 check_login(); 40 41 global $gCms; 42 $styleops =& $gCms->GetStylesheetOperations(); 43 $db =& $gCms->GetDb(); 44 45 #****************************************************************************** 46 # Definition of global vars 47 #****************************************************************************** 48 49 # this var is used to check if we'll delete or not the css 50 # it is turned to false if any error is encountered 51 $dodelete = true; 52 53 #****************************************************************************** 54 # start of the treatment 55 #****************************************************************************** 56 if (isset($_GET["css_id"])) 57 { 58 59 # we get the params 60 $css_id = $_GET["css_id"]; 61 62 # css name will be used for logging 63 $css_name = ""; 64 65 $userid = get_userid(); 66 $access = check_permission($userid, 'Remove Stylesheets'); 67 68 # checking of users permissions 69 if ($access) 70 { 71 72 # first we get the name of the css for logging 73 $query = "SELECT css_name FROM ".cms_db_prefix()."css WHERE css_id = ?"; 74 $result = $db->Execute($query, array($css_id)); 75 76 if ($result && $result->RecordCount()) 77 { 78 $row = $result->FetchRow(); 79 $css_name = $row['css_name']; 80 } 81 else 82 { 83 $dodelete = false; 84 $error = lang('errorgettingcssname'); 85 } 86 87 # we test on dodelete only to avoid too many queries 88 if ($dodelete) 89 { 90 # then we check if this CSS has associations 91 $query = "SELECT * FROM ".cms_db_prefix()."css_assoc WHERE assoc_css_id = ?"; 92 $result = $db->Execute($query, array($css_id)); 93 94 if ($result && $result->RecordCount()) 95 { 96 $dodelete = false; 97 $error = lang('errorcssinuse'); 98 } 99 } 100 101 # everything should be ok 102 if ($dodelete) 103 { 104 global $gCms; 105 $styleops =& $gCms->GetStylesheetOperations(); 106 $onestylesheet = $styleops->LoadStylesheetByID($css_id); 107 108 Events::SendEvent('Core', 'DeleteStylesheetPre', array('stylesheet' => &$onestylesheet)); 109 110 $result = $styleops->DeleteStylesheetById($css_id); 111 112 if ($result) 113 { 114 Events::SendEvent('Core', 'DeleteStylesheetPost', array('stylesheet' => &$onestylesheet)); 115 audit($css_id, $css_name, 'Deleted CSS'); 116 } 117 else 118 { 119 $dodelete = false; 120 $error = lang('errordeletingcss'); 121 } 122 } # end of deletion 123 } # end of if access 124 125 # there the user does not have access 126 else 127 { 128 $dodelete = false; 129 $error = lang('noaccessto',array(lang('deletecss'))); 130 } 131 } # end of isset params 132 133 else 134 { 135 $dodelete = false; 136 $error = lang('idnotvalid'); 137 } 138 139 #****************************************************************************** 140 # end of treatment, we now redirect 141 #****************************************************************************** 142 if ($dodelete) 143 { 144 redirect("listcss.php"); 145 } 146 else 147 { 148 redirect("listcss.php?message=$error"); 149 } 150 151 # vim:ts=4 sw=4 noet 152 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |