[ 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$ 20 21 $CMS_ADMIN_PAGE=1; 22 23 require_once ("../include.php"); 24 25 if (isset($_POST['cancel'])) 26 redirect('listtemplates.php'); 27 28 check_login(); 29 30 $action = ''; 31 if (isset($_POST['multiaction'])) $action = $_POST['multiaction']; 32 33 global $gCms; 34 35 $nodelist = array(); 36 $badlist = array(); 37 38 $templateops =& $gCms->GetTemplateOperations(); 39 40 if (isset($_POST['idlist'])) 41 { 42 foreach (explode(':', $_POST['idlist']) as $id) 43 { 44 $template =& $templateops->LoadTemplateByID($id); 45 $nodelist[] =& $template; 46 } 47 } 48 else 49 { 50 foreach ($_POST as $k=>$v) 51 { 52 if (startswith($k, 'multitemplate-')) 53 { 54 $id = substr($k, strlen('multitemplate-')); 55 $template =& $templateops->LoadTemplateByID($id); 56 if ($action == 'delete' && $template->UsageCount() > 0) 57 $badlist[] =& $template; 58 else 59 $nodelist[] =& $template; 60 } 61 } 62 } 63 64 include_once ("header.php"); 65 66 if (count($nodelist) == 0 && count($badlist) == 0) 67 { 68 redirect("listtemplates.php"); 69 } 70 else 71 { 72 if ($action == 'delete') 73 { 74 ?> 75 <div class="pagecontainer"> 76 <p class="pageheader"><?php echo lang('deletetemplate') ?></p><br /> 77 <?php 78 $userid = get_userid(); 79 $access = check_permission($userid, 'Remove Templates'); 80 if ($access) 81 { 82 echo '<form method="post" action="multitemplate.php">' . "\n"; 83 $idlist = array(); 84 if (count($nodelist) > 0) 85 { 86 echo '<p>'.lang('templatestodelete').'</p><p>' . "\n"; 87 foreach ($nodelist as $node) 88 { 89 echo $node->name . '<br />' . "\n"; 90 $idlist[] = $node->id; 91 } 92 echo '</p>'; 93 } 94 95 if (count($badlist) > 0) 96 { 97 echo '<p>'.lang('wontdeletetemplateinuse').'</p><p>' . "\n"; 98 foreach ($badlist as $node) 99 { 100 echo $node->name . '<br />' . "\n"; 101 } 102 echo '</p>'; 103 } 104 105 echo '<div class="pageoverflow"> 106 <p class="pagetext"> </p> 107 <p class="pageinput">'; 108 109 echo '<input type="hidden" name="multiaction" value="dodelete" /><input type="hidden" name="idlist" value="'.implode(':', $idlist).'" />' . "\n"; 110 ?> 111 <?php if (count($nodelist) > 0) { ?><input type="submit" name="confirm" value="<?php echo lang('submit') ?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" /><?php } ?> 112 <input type="submit" name="cancel" value="<?php echo lang('cancel') ?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" /> 113 </p> 114 </div> 115 </form> 116 </div> 117 </div> 118 <?php 119 } 120 else 121 { 122 redirect('listtemplates.php'); 123 } 124 } 125 else if ($action == 'dodelete') 126 { 127 $userid = get_userid(); 128 $access = check_permission($userid, 'Remove Templates'); 129 if ($access) 130 { 131 foreach ($nodelist as $node) 132 { 133 $id = $node->id; 134 $title = $node->name; 135 $node->Delete(); 136 audit($id, $title, 'Deleted Template'); 137 } 138 } 139 redirect("listtemplates.php"); 140 } 141 else if ($action == 'inactive') 142 { 143 $userid = get_userid(); 144 $permission = check_permission($userid, 'Modify Templates'); 145 146 foreach ($nodelist as $node) 147 { 148 if ($permission) 149 { 150 if ($node->active) 151 { 152 $node->active = false; 153 $node->Save(); 154 } 155 } 156 } 157 redirect("listtemplates.php"); 158 } 159 else if ($action == 'active') 160 { 161 $userid = get_userid(); 162 $permission = check_permission($userid, 'Modify Templates'); 163 164 foreach ($nodelist as $node) 165 { 166 if ($permission) 167 { 168 if (!$node->active) 169 { 170 $node->active = true; 171 $node->Save(); 172 } 173 } 174 } 175 redirect("listtemplates.php"); 176 } 177 else 178 { 179 redirect("listtemplates.php"); 180 } 181 } 182 183 include_once ("footer.php"); 184 185 # vim:ts=4 sw=4 noet 186 ?>
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 |