示例#1
0
 function export()
 {
     global $settings, $browser;
     # collect the folder data
     require_once ABSOLUTE_PATH . "folders.php";
     $this->tree = new folder();
     $this->tree->folders[0] = array('id' => 0, 'childof' => null, 'name' => $settings['root_folder_name']);
     global $username, $mysql;
     $this->browser = $browser;
     $this->counter = 0;
     # work around PHP < 5 problem
     # http://bugs.php.net/bug.php?id=25670
     if (intval(str_replace('.', '', phpversion())) < 500) {
         $this->charset = 'iso-8859-1';
     } else {
         $this->charset = set_post_charset();
     }
     # collect the bookmark data
     $query = sprintf("SELECT title, url, description, childof, id\n\t\t\tFROM bookmark \n\t\t\tWHERE user='******' \n\t\t\tAND deleted!='1'", $mysql->escape($username));
     if ($mysql->query($query)) {
         while ($row = mysql_fetch_assoc($mysql->result)) {
             if (!isset($this->bookmarks[$row['childof']])) {
                 $this->bookmarks[$row['childof']] = array();
             }
             array_push($this->bookmarks[$row['childof']], $row);
         }
     } else {
         message($mysql->error);
     }
 }
示例#2
0
 function import()
 {
     global $username, $parentfolder, $mysql;
     # open the importfile
     $this->fp = fopen($_FILES['importfile']['tmp_name'], "r");
     if ($this->fp == null) {
         message("Failed to open file");
     }
     $this->charset = set_post_charset();
     $this->public = set_post_bool_var("public", false);
     $this->count_folders = 0;
     $this->count_bookmarks = 0;
     $this->username = $username;
     $this->parent_folder = $parentfolder;
     $this->current_folder = $this->parent_folder;
     $this->folder_depth = array();
     $this->mysql = $mysql;
 }