Main Page | Directories | File List | File Members

my/bookmarks.php

Go to the documentation of this file.
00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: bookmarks.php 5441 2006-02-19 13:53:40Z toddy $
00006 #
00007 #  Copyright 1999-2000 (c) The SourceForge Crew
00008 #  Copyright 2000-2003 (c) Free Software Foundation
00009 #
00010 #  Copyright 2004-2005 (c) Mathieu Roy <yeupou--gnu.org>
00011 # 
00012 # The Savane project is free software; you can redistribute it and/or
00013 # modify it under the terms of the GNU General Public License
00014 # as published by the Free Software Foundation; either version 2
00015 # of the License, or (at your option) any later version.
00016 #
00017 # The Savane project is distributed in the hope that it will be useful,
00018 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 # GNU General Public License for more details.
00021 #
00022 # You should have received a copy of the GNU General Public License
00023 # along with the Savane project; if not, write to the Free Software
00024 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00025 
00026 
00027 require "../include/pre.php";
00028 
00029 site_user_header(array('context'=>'bookmark'));
00030 
00031 
00032 if ($add && $url)
00033 {
00034   # New bookmark
00035   bookmark_add($url, $title);
00036 }
00037 if ($delete)
00038 {
00039   # Delete bookmark
00040   bookmark_delete($delete);
00041 }
00042 if ($edit)
00043 {
00044   if ($url && $title)
00045     {
00046       # The url and title were in the request, we update the database
00047       bookmark_edit($edit, $url, $title); 
00048     }
00049   else
00050     {
00051       # No url and title? Print the form
00052       $result = db_query("SELECT * from user_bookmarks where "
00053                          . "bookmark_id='".addslashes($edit)."' and user_id='".user_getid()."'");
00054       if ($result) 
00055         {
00056           # Result found? Really print (only) the form 
00057           $title = stripslashes(db_result($result,0,'bookmark_title'));
00058           $url = stripslashes(db_result($result,0,'bookmark_url'));
00059           
00060           print '<form action="'.$_SERVER['PHP_SELF'].'" method="post">';
00061           print '<span class="preinput">'._("Title:").'</span>';
00062           print '<br />&nbsp;&nbsp;&nbsp;<input type="text" name="title" value="'.$title.'" size="50" />';
00063           print '<br />';
00064           print '<span class="preinput">'._("Address:").'</span>';
00065           print '<br />&nbsp;&nbsp;&nbsp;<input type="text" name="url" value="'.$url.'" size="50" />';
00066 
00067           print '<input type="hidden" name="edit" value="'.addslashes($edit).'" /></p>';
00068           print '<p><input type="submit" name="update" value="'._("Update").'" /></p>';
00069 print '</form>';
00070 
00071         }
00072       else 
00073         {
00074           # No result? Gives feedback and print the usual page
00075           fb(_("Item not found"),1);
00076         }
00077     }
00078 }
00079 
00080 $result = db_query("SELECT bookmark_url, bookmark_title, bookmark_id from user_bookmarks where ".
00081                    "user_id='". user_getid() ."' ORDER BY bookmark_title");
00082 $rows=db_numrows($result);
00083 if (!$result || $rows < 1)
00084 {
00085   print _("There is no bookmark saved");
00086 }
00087 else
00088 {
00089   
00090   print $HTML->box_top(_("Saved Bookmarks"),'',1);
00091   for ($i=0; $i<$rows; $i++)
00092         {
00093           print '<li class="'.utils_get_alt_row_color($i).'">';
00094           print '<span class="trash"><a href="?edit='.db_result($result,$i,'bookmark_id').'">'.
00095             '<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/edit.png" alt="'._("Edit this bookmark").'" /></a>'.
00096             '<a href="?delete='.db_result($result,$i,'bookmark_id').'">'.
00097             '<img src="'.$GLOBALS['sys_home'].'images/'.SV_THEME.'.theme/trash.png" alt="'._("Delete this bookmark").'" /></a></span>';
00098           print '<a href="'.db_result($result,$i,'bookmark_url').'">'.
00099             stripslashes(db_result($result,$i,'bookmark_title')).'</a> ';
00100           print '<br /><span class="smaller">'.stripslashes(db_result($result,$i,'bookmark_url'));
00101           print '</span></li>';
00102         }
00103   print $HTML->box_bottom(1);
00104 }
00105 
00106 
00107 site_user_footer(array());
00108 
00109 ?>
00110 

Generated on Sun Feb 26 13:23:03 2006 for Savane PHP Frontend Developer Reference by  doxygen 1.4.4