[ 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: addgroup.php 2922 2006-06-15 03:32:59Z wishy $ 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 28 $error = ""; 29 30 $group= ""; 31 if (isset($_POST["group"])) $group = $_POST["group"]; 32 33 $active = 1; 34 if (!isset($_POST["active"]) && isset($_POST["addgroup"])) $active = 0; 35 36 if (isset($_POST["cancel"])) { 37 redirect("listgroups.php"); 38 return; 39 } 40 41 $userid = get_userid(); 42 $access = check_permission($userid, 'Add Groups'); 43 44 if ($access) 45 { 46 if (isset($_POST["addgroup"])) 47 { 48 $validinfo = true; 49 50 if ($group == "") 51 { 52 $error .= "<li>".lang('nofieldgiven', array('addgroup'))."</li>"; 53 $validinfo = false; 54 } 55 56 if ($validinfo) 57 { 58 $groupobj = new Group(); 59 $groupobj->name = $group; 60 $groupobj->active = $active; 61 62 #Perform the addgroup_pre callback 63 foreach($gCms->modules as $key=>$value) 64 { 65 if ($gCms->modules[$key]['installed'] == true && 66 $gCms->modules[$key]['active'] == true) 67 { 68 $gCms->modules[$key]['object']->AddGroupPre($groupobj); 69 } 70 } 71 72 Events::SendEvent('Core', 'AddGroupPre', array('group' => &$groupobj)); 73 74 $result = $groupobj->save(); 75 76 if ($result) 77 { 78 #Perform the addgroup_post callback 79 foreach($gCms->modules as $key=>$value) 80 { 81 if ($gCms->modules[$key]['installed'] == true && 82 $gCms->modules[$key]['active'] == true) 83 { 84 $gCms->modules[$key]['object']->AddGroupPost($groupobj); 85 } 86 } 87 Events::SendEvent('Core', 'AddGroupPost', array('group' => &$groupobj)); 88 audit($groupobj->id, $groupobj->name, 'Added Group'); 89 redirect("listgroups.php"); 90 return; 91 } 92 else 93 { 94 $error .= "<li>".lang('errorinsertinggroup')."</li>"; 95 } 96 } 97 } 98 } 99 100 include_once ("header.php"); 101 102 if (!$access) 103 { 104 echo "<div class=\"pageerrorcontainer\"><p class=\"pageerror\">".lang('noaccessto', array(lang('addgroup')))."</p></div>"; 105 } 106 else 107 { 108 if ($error != "") 109 { 110 echo "<div class=\"pageerrorcontainer\"><ul class=\"pageerror\">".$error."</ul></div>"; 111 } 112 ?> 113 114 <div class="pagecontainer"> 115 <?php echo $themeObject->ShowHeader('addgroup'); ?> 116 <form method="post" action="addgroup.php"> 117 <div class="pageoverflow"> 118 <p class="pagetext">*<?php echo lang('name')?>:</p> 119 <p class="pageinput"><input type="text" name="group" maxlength="255" value="<?php echo $group?>" /></p> 120 </div> 121 <div class="pageoverflow"> 122 <p class="pagetext"><?php echo lang('active')?>:</p> 123 <p class="pageinput"><input class="pagecheckbox" type="checkbox" name="active" <?php echo ($active == 1?"checked=\"checked\"":"")?> /></p> 124 </div> 125 <div class="pageoverflow"> 126 <p class="pagetext"> </p> 127 <p class="pageinput"> 128 <input type="hidden" name="addgroup" value="true" /> 129 <input type="submit" value="<?php echo lang('submit')?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" /> 130 <input type="submit" name="cancel" value="<?php echo lang('cancel')?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" /> 131 </p> 132 </div> 133 </form> 134 </div> 135 136 <?php 137 } 138 echo '<p class="pageback"><a class="pageback" href="'.$themeObject->BackUrl().'">« '.lang('back').'</a></p>'; 139 140 include_once ("footer.php"); 141 142 # vim:ts=4 sw=4 noet 143 ?>
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 |