[ 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: editgroup.php 3601 2006-12-20 21:04:54Z calguy1000 $ 20 21 $CMS_ADMIN_PAGE=1; 22 23 require_once ("../include.php"); 24 require_once ("../lib/classes/class.group.inc.php"); 25 26 check_login(); 27 global $gCms; 28 $db =& $gCms->GetDb(); 29 30 $error = ""; 31 32 $dropdown = ""; 33 34 $group = ""; 35 if (isset($_POST["group"])) $group = $_POST["group"]; 36 37 $active = 1; 38 if (!isset($_POST["active"]) && isset($_POST["editgroup"])) $active = 0; 39 40 $group_id = -1; 41 if (isset($_POST["group_id"])) $group_id = $_POST["group_id"]; 42 else if (isset($_GET["group_id"])) $group_id = $_GET["group_id"]; 43 44 if (isset($_POST["cancel"])) { 45 redirect("listgroups.php"); 46 return; 47 } 48 49 $userid = get_userid(); 50 $access = check_permission($userid, 'Modify Groups'); 51 52 if ($access) { 53 54 if (isset($_POST["editgroup"])) 55 { 56 $validinfo = true; 57 if ($group == "") 58 { 59 $validinfo = false; 60 $error .= "<li>".lang('nofieldgiven', array(lang('name')))."</li>"; 61 } 62 63 if ($validinfo) 64 { 65 $groupobj = new Group(); 66 $groupobj->id = $group_id; 67 $groupobj->name = $group; 68 $groupobj->active = $active; 69 70 #Perform the editgroup_pre callback 71 foreach($gCms->modules as $key=>$value) 72 { 73 if ($gCms->modules[$key]['installed'] == true && 74 $gCms->modules[$key]['active'] == true) 75 { 76 $gCms->modules[$key]['object']->EditGroupPre($groupobj); 77 } 78 } 79 80 Events::SendEvent('Core', 'EditGroupPre', array('group' => &$groupobj)); 81 82 $result = $groupobj->save(); 83 84 if ($result) 85 { 86 #Perform the editgroup_post callback 87 foreach($gCms->modules as $key=>$value) 88 { 89 if ($gCms->modules[$key]['installed'] == true && 90 $gCms->modules[$key]['active'] == true) 91 { 92 $gCms->modules[$key]['object']->EditGroupPost($groupobj); 93 } 94 } 95 96 Events::SendEvent('Core', 'EditGroupPost', array('group' => &$groupobj)); 97 98 audit($groupobj->id, $groupobj->name, 'Edited Group'); 99 redirect("listgroups.php"); 100 return; 101 } 102 else { 103 $error .= "<li>".lang('errorupdatinggroup')."</li>"; 104 } 105 } 106 107 } 108 else if ($group_id != -1) { 109 110 $query = "SELECT * from ".cms_db_prefix()."groups WHERE group_id = ?"; 111 $result = $db->Execute($query, array($group_id)); 112 113 $row = $result->FetchRow(); 114 115 $group = $row["group_name"]; 116 $active = $row["active"]; 117 } 118 } 119 if (strlen($group) > 0) 120 { 121 $CMS_ADMIN_SUBTITLE = $group; 122 } 123 include_once ("header.php"); 124 125 if (!$access) { 126 echo "<div class=\"pageerrorcontainer\"><p class=\"pageerror\">".lang('noaccessto', array(lang('editgroup')))."</p></div>"; 127 } 128 else { 129 if ($error != "") { 130 echo "<div class=\"pageerrorcontainer\"><ul class=\"pageerror\">".$error."</ul></div>"; 131 } 132 ?> 133 134 <div class="pagecontainer"> 135 <?php echo $themeObject->ShowHeader('editgroup'); ?> 136 <form method="post" action="editgroup.php"> 137 <div class="pageoverflow"> 138 <p class="pagetext"><?php echo lang('name')?>:</p> 139 <p class="pageinput"><input type="text" name="group" maxlength="25" value="<?php echo $group?>" /></p> 140 </div> 141 <div class="pageoverflow"> 142 <p class="pagetext"><?php echo lang('active')?>:</p> 143 <p class="pageinput"><input type="checkbox" name="active" <?php echo ($active == 1?"checked=\"checked\"":"")?> /></p> 144 </div> 145 <div class="pageoverflow"> 146 <p class="pagetext"> </p> 147 <p class="pageinput"> 148 <input type="hidden" name="group_id" value="<?php echo $group_id?>" /><input type="hidden" name="editgroup" value="true" /> 149 <input type="submit" value="<?php echo lang('submit')?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" /> 150 <input type="submit" name="cancel" value="<?php echo lang('cancel')?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" /> 151 </p> 152 </div> 153 </form> 154 </div> 155 <?php 156 157 } 158 echo '<p class="pageback"><a class="pageback" href="'.$themeObject->BackUrl().'">« '.lang('back').'</a></p>'; 159 160 include_once ("footer.php"); 161 162 # vim:ts=4 sw=4 noet 163 ?>
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 |