[ 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: editbookmark.php 3601 2006-12-20 21:04:54Z calguy1000 $ 20 21 $CMS_ADMIN_PAGE=1; 22 23 require_once ("../include.php"); 24 25 check_login(); 26 global $gCms; 27 $db =& $gCms->GetDb(); 28 29 $error = ""; 30 31 $title = ""; 32 if (isset($_POST["title"])) $title = $_POST["title"]; 33 34 $url = ""; 35 if (isset($_POST["url"])) $url = $_POST["url"]; 36 37 $bookmark_id = -1; 38 if (isset($_POST["bookmark_id"])) $bookmark_id = $_POST["bookmark_id"]; 39 else if (isset($_GET["bookmark_id"])) $bookmark_id = $_GET["bookmark_id"]; 40 41 if (isset($_POST["cancel"])) { 42 redirect("listbookmarks.php"); 43 return; 44 } 45 46 $userid = get_userid(); 47 48 if (isset($_POST["editbookmark"])) 49 { 50 $validinfo = true; 51 if ($title == "") 52 { 53 $validinfo = false; 54 $error .= "<li>".lang('nofieldgiven', array(lang('title')))."</li>"; 55 } 56 if ($url == "") 57 { 58 $validinfo = false; 59 $error .= "<li>".lang('nofieldgiven', array(lang('url')))."</li>"; 60 } 61 62 if ($validinfo) 63 { 64 global $gCms; 65 $gCms->GetBookmarkOperations(); 66 $markobj =& new Bookmark(); 67 $markobj->bookmark_id = $bookmark_id; 68 $markobj->title = $title; 69 $markobj->url = $url; 70 $markobj->user_id = $userid; 71 72 $result = $markobj->save(); 73 74 if ($result) 75 { 76 redirect("listbookmarks.php"); 77 return; 78 } 79 else 80 { 81 $error .= "<li>".lang('errorupdatingbookmark')."</li>"; 82 } 83 } 84 85 } 86 else if ($bookmark_id != -1) 87 { 88 $query = "SELECT * from ".cms_db_prefix()."admin_bookmarks WHERE bookmark_id = ?"; 89 $result = $db->Execute($query, array($bookmark_id)); 90 91 $row = $result->FetchRow(); 92 93 $url = $row["url"]; 94 $title = $row["title"]; 95 } 96 97 if (strlen($title) > 0) 98 { 99 $CMS_ADMIN_SUBTITLE = $title; 100 } 101 102 include_once ("header.php"); 103 104 if ($error != "") 105 { 106 echo '<div class="pageerrorcontainer"><p class="pageerror">'.$error.'</p></div>'; 107 } 108 ?> 109 110 <div class="pagecontainer"> 111 <?php echo $themeObject->ShowHeader('editbookmark'); ?> 112 <form method="post" action="editbookmark.php"> 113 <div class="pageoverflow"> 114 <p class="pagetext"><?php echo lang('title')?>:</p> 115 <p class="pageinput"><input type="text" name="title" maxlength="255" value="<?php echo $title?>" /></p> 116 </div> 117 <div class="pageoverflow"> 118 <p class="pagetext"><?php echo lang('url')?>:</p> 119 <p class="pageinput"><input type="text" name="url" maxlength="255" value="<?php echo $url ?>" /></p> 120 </div> 121 <div class="pageoverflow"> 122 <p class="pagetext"> </p> 123 <p class="pageinput"> 124 <input type="hidden" name="bookmark_id" value="<?php echo $bookmark_id?>" /><input type="hidden" name="editbookmark" value="true" /><input type="hidden" name="userid" value="<?php echo $userid?>" /> 125 <input type="submit" value="<?php echo lang('submit')?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" /> 126 <input type="submit" name="cancel" value="<?php echo lang('cancel')?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" /> 127 </p> 128 </div> 129 </form> 130 </div> 131 <?php 132 133 echo '<p class="pageback"><a class="pageback" href="'.$themeObject->BackUrl().'">« '.lang('back').'</a></p>'; 134 include_once ("footer.php"); 135 136 # vim:ts=4 sw=4 noet 137 ?>
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 |