[ 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: addhtmlblob.php 3763 2007-01-19 10:58:34Z wishy $ 20 21 $CMS_ADMIN_PAGE=1; 22 23 require_once ("../include.php"); 24 //require_once("../lib/classes/class.htmlblob.inc.php"); 25 require_once ("../lib/classes/class.template.inc.php"); 26 27 check_login(); 28 29 $error = ""; 30 31 $htmlblob = ""; 32 if (isset($_POST['htmlblob'])) $htmlblob = $_POST['htmlblob']; 33 34 $content = ""; 35 if (isset($_POST['content'])) $content = $_POST['content']; 36 37 if (isset($_POST["cancel"])) { 38 redirect("listhtmlblobs.php"); 39 return; 40 } 41 42 $userid = get_userid(); 43 $access = check_permission($userid, 'Add Global Content Blocks'); 44 45 /* 46 $use_javasyntax = false; 47 if (get_preference($userid, 'use_wysiwyg') == "1") { 48 $htmlarea_flag = true; 49 $use_javasyntax = false; 50 }else if (get_preference($userid, 'use_javasyntax') == "1"){ 51 $use_javasyntax = true; 52 } 53 */ 54 $gcb_wysiwyg = get_preference($userid, 'gcb_wysiwyg', 1); 55 56 57 if ($access) { 58 if (isset($_POST["addhtmlblob"])) { 59 60 global $gCms; 61 $gcbops =& $gCms->GetGlobalContentOperations(); 62 $templateops =& $gCms->GetTemplateOperations(); 63 64 $validinfo = true; 65 if ($htmlblob == ""){ 66 $error .= "<li>".lang('nofieldgiven', array('addhtmlblob'))."</li>"; 67 $validinfo = false; 68 } 69 else if ($gcbops->CheckExistingHtmlBlobName($htmlblob)){ 70 $error .= "<li>".lang('blobexists')."</li>"; 71 $validinfo = false; 72 } 73 74 if ($validinfo) { 75 global $gCms; 76 $gcbops =& $gCms->GetGlobalContentOperations(); 77 78 $blobobj =& new GlobalContent(); 79 $blobobj->name = $htmlblob; 80 $blobobj->content = $content; 81 $blobobj->owner = $userid; 82 83 #Perform the addhtmlblob_pre callback 84 foreach($gCms->modules as $key=>$value) 85 { 86 if ($gCms->modules[$key]['installed'] == true && 87 $gCms->modules[$key]['active'] == true) 88 { 89 $gCms->modules[$key]['object']->AddHtmlBlobPre($blobobj); 90 } 91 } 92 93 Events::SendEvent('Core', 'AddGlobalContentPre', array('global_content' => &$blobobj)); 94 95 $result = $blobobj->save(); 96 97 if ($result) { 98 if (isset($_POST["additional_editors"])) { 99 foreach ($_POST["additional_editors"] as $addt_user_id) { 100 $blobobj->AddAuthor($addt_user_id); 101 } 102 } 103 audit($blobobj->id, $blobobj->name, 'Added Html Blob'); 104 105 #Perform the addhtmlblob_post callback 106 foreach($gCms->modules as $key=>$value) 107 { 108 if ($gCms->modules[$key]['installed'] == true && 109 $gCms->modules[$key]['active'] == true) 110 { 111 $gCms->modules[$key]['object']->AddHtmlBlobPost($blobobj); 112 } 113 } 114 115 Events::SendEvent('Core', 'AddGlobalContentPost', array('global_content' => &$blobobj)); 116 117 redirect("listhtmlblobs.php"); 118 return; 119 } 120 else { 121 $error .= "<li>".lang('errorinsertingblob')."</li>"; 122 } 123 } 124 } 125 } 126 127 include_once ("header.php"); 128 129 global $gCms; $db =& $gCms->GetDb(); 130 131 $addt_users = ""; 132 133 $query = "SELECT user_id, username FROM ".cms_db_prefix()."users WHERE user_id <> ? ORDER BY username"; 134 $result = $db->Execute($query, array($userid)); 135 136 if ($result && $result->RecordCount() > 0) { 137 while($row = $result->FetchRow()) { 138 $addt_users .= "<option value=\"".$row["user_id"]."\">".$row["username"]."</option>"; 139 } 140 }else{ 141 $addt_users = "<option> </option>"; 142 } 143 144 if (!$access) 145 { 146 echo "<div class=\"pageerrorcontainer\"><p class=\"pageerror\">".lang('noaccessto', array(lang('addhtmlblob')))."</p></div>"; 147 } 148 else 149 { 150 if ($error != "") { 151 echo "<div class=\"pageerrorcontainer\"><ul class=\"pageerror\">".$error."</ul></div>"; 152 } 153 ?> 154 155 <div class="pagecontainer"> 156 <?php echo $themeObject->ShowHeader('addhtmlblob'); ?> 157 <form method="post" action="addhtmlblob.php"> 158 <div class="pageoverflow"> 159 <p class="pagetext">*<?php echo lang('name')?>:</p> 160 <p class="pageinput"><input type="text" name="htmlblob" maxlength="255" value="<?php echo $htmlblob?>" class="standard" /></p> 161 </div> 162 <div class="pageoverflow"> 163 <p class="pagetext">*<?php echo lang('content')?>:</p> 164 <p class="pageinput"><?php echo create_textarea($gcb_wysiwyg, $content, 'content', 'wysiwyg', 'content'); ?> 165 </div> 166 <div class="pageoverflow"> 167 <p class="pagetext"><?php echo lang('additionaleditors')?>:</p> 168 <p class="pageinput"><select name="additional_editors[]" multiple="multiple" size="3"><?php echo $addt_users?></select></p> 169 </div> 170 <div class="pageoverflow"> 171 <p class="pagetext"> </p> 172 <p class="pageinput"> 173 <input type="hidden" name="addhtmlblob" value="true" /> 174 <input type="submit" value="<?php echo lang('submit')?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" /> 175 <input type="submit" name="cancel" value="<?php echo lang('cancel')?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" /> 176 </p> 177 </div> 178 </form> 179 </div> 180 181 <?php 182 } 183 184 echo '<p class="pageback"><a class="pageback" href="'.$themeObject->BackUrl().'">« '.lang('back').'</a></p>'; 185 186 include_once ("footer.php"); 187 188 # vim:ts=4 sw=4 noet 189 ?>
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 |