// // This file is part of IlohaMail. // IlohaMail is free software released under the GPL // license. See enclosed file COPYING for details, // or see http://www.fsf.org/copyleft/gpl.html // ///////////////////////////////////////////////////////// /******************************************************** AUTHOR: Ryo Chijiiwa FILE: source/bookmarks.php PURPOSE: Create/edit/delete bookmarks PRE-CONDITIONS: $user - Session ID ********************************************************/ include("../include/stopwatch.inc"); $timer = new stopwatch(true); $timer->register("start"); include("../include/super2global.inc"); include("../include/header_main.inc"); include("../include/langs.inc"); include("../include/icl.inc"); include("../lang/".$my_prefs["lang"]."bookmarks.inc"); include("../include/data_manager.inc"); $timer->register("included"); //authenticate /* $conn=iil_Connect($host, $loginID, $password, $AUTH_MODE); if ($conn){ iil_Close($conn); }else{ echo "Authentication failed."; echo "\n"; exit; } */ //make sure feature is not disabled if ($DISABLE_BOOKMARKS){ echo $bmError[2]; echo "\n"; exit; } //open DM connection $dm = new DataManager_obj; if ($dm->initialize($loginID, $host, $DB_BOOKMARKS_TABLE, $DB_TYPE)){ }else{ echo "Data Manager initialization failed:
\n"; $dm->showError(); } //do import if (isset($import)){ if(is_uploaded_file($userfile)) { $bookmark_folder=array(); $bookmark_folder[]="@Bookmark"; echo "Uploaded
"; $fp=fopen($_FILES['userfile']['tmp_name'],"r"); while(!feof($fp)) { $buffer=fgets($fp,2048); $new_url=""; $new_name=""; switch(true) { case (preg_match("/\\

(.*?)\<\/H3\>/",$buffer,$match)): $bookmark_folder[]=$match[2]; break; case (preg_match("/\<\/DL\>\/",$buffer)): unset($bookmark_folder[count($bookmark_folder)-1]); $tmp=array(); foreach($bookmark_folder as $item) $tmp[]=$item; $bookmark_folder=$tmp; break; case (preg_match("/\\(.*?)\<\/A\>/",$buffer,$match)): $new_url=$match[1]; $new_name=$match[3]; break; } $new_grp=""; for($i=0;$i0) $currentFolder.=" - "; $new_grp.=$bookmark_folder[$i]; } if($new_grp && $new_url && $new_name) { if (!ereg("[fht]+tp[s]*://", $new_url)) $new_url = "http://".$new_url; $new_entry = array(); $new_entry["name"] = $new_name; $new_entry["url"] = $new_url; $new_entry["rss"] = $new_rss; $new_entry["grp"] = (empty($new_grp)?$new_grp_other:$new_grp); $new_entry["comments"] = $new_comments; $new_entry["is_private"] = $new_private; if ($dm->insert($new_entry)) echo ""; else echo ""; $new_name = $new_url = $new_rss = $new_grp = $new_comments = $new_private = $new_grp_other = ""; } } fclose($fp); } } //do add if (isset($add)){ if ((empty($new_name)) || (empty($new_url))) $error .= $bmError[1]; else{ if (!ereg("[fht]+tp[s]*://", $new_url)) $new_url = "http://".$new_url; $new_entry = array(); $new_entry["name"] = $new_name; $new_entry["url"] = $new_url; $new_entry["rss"] = $new_rss; $new_entry["grp"] = (empty($new_grp)?$new_grp_other:$new_grp); $new_entry["comments"] = $new_comments; $new_entry["is_private"] = $new_private; if ($dm->insert($new_entry)) echo ""; else echo ""; $new_name = $new_url = $new_rss = $new_grp = $new_comments = $new_private = $new_grp_other = ""; } } //do edit if (isset($edit) && ($edit_id > 0)){ if (!ereg("[fht]+tp[s]*://", $edit_url)) $edit_url = "http://".$edit_url; $new_entry["name"] = $edit_name; $new_entry["url"] = $edit_url; $new_entry["rss"] = $edit_rss; $new_entry["grp"] = (empty($edit_grp)?$edit_grp_other:$edit_grp); $new_entry["comments"] = $edit_comments; $new_entry["is_private"] = $edit_private; if ($dm->update($edit_id, $new_entry)) echo ""; else echo ""; $edit_id = 0; } //do delete if (isset($delete) && ($edit_id > 0)){ if ($dm->delete($edit_id)) $edit_id = 0; else $error .= "Deletion failed
\n"; } //get sorted list of bookmarks $urls_a = $dm->sort("grp,name", "ASC"); //get groups and form

'; if ($edit_id>0){ reset($urls_a); while ( list($k,$foo) = each($urls_a) ){ if ($urls_a[$k]["id"]==$edit_id){ $v = $urls_a[$k]; echo "Found $edit_id
\n"; } } } ?>

0): ?>
0?$bmStrings["edit_url"]:$bmStrings["new"]); ?>
: " size="25"> :
: " size="60">
: " size="60">
: " size="60">
0): ?> "> "> ">

:
">