1
0

Getting rid of dangeros in export.php, import.php and folders.php.

This commit is contained in:
Stefan Frech
2008-08-12 19:40:21 +00:00
committed by Jonas Kattendick
parent 132a3c4c0d
commit 754adfab01
7 changed files with 35 additions and 30 deletions

View File

@@ -28,3 +28,6 @@
01.08.2008, Version 0.8.13_beta
- Adjusted order function so that arrow changes direction when changing order.
12.08.2008, Version 0.8.14_beta
- Getting rid of dangeros $GLOBALS in export.php, import.php and folders.php.

View File

@@ -1 +1 @@
0.8.13_beta
0.8.14_beta

View File

@@ -3,7 +3,7 @@ if (basename ($_SERVER['SCRIPT_NAME']) == basename (__FILE__)) {
die ("no direct access allowed");
}
function list_bookmarks ($bookmarks, $show_checkbox, $show_folder, $show_icon, $show_link, $show_desc, $show_date, $show_edit, $show_move, $show_delete, $show_share, $show_header) {
function list_bookmarks ($bookmarks, $show_checkbox, $show_folder, $show_icon, $show_link, $show_desc, $show_date, $show_edit, $show_move, $show_delete, $show_share, $show_header, $user = false) {
global $folderid,
$expand,
$settings,
@@ -61,8 +61,8 @@ function list_bookmarks ($bookmarks, $show_checkbox, $show_folder, $show_icon, $
'expand' => implode (",", $expand),
'order' => $sort_d,
);
if (isset ($GLOBALS['user']) && $GLOBALS['user'] != '') {
$query_data['user'] = $GLOBALS['user'];
if ($user) {
$query_data['user'] = $user;
}
$query_string = assemble_query_string ($query_data);
echo "\t\t" . '<div class="bmright">' . "\n";

View File

@@ -182,13 +182,14 @@ else{
class export {
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' => $GLOBALS['settings']['root_folder_name']);
$this->tree->folders[0] = array ('id' => 0, 'childof' => null, 'name' => $settings['root_folder_name']);
global $username, $mysql;
$this->browser = $GLOBALS['browser'];
$this->browser = $browser;
$this->counter = 0;

View File

@@ -6,16 +6,16 @@ if (basename ($_SERVER['SCRIPT_NAME']) == basename (__FILE__)) {
class folder {
function folder ($user = false) {
global $settings;
global $settings, $username, $folderid, $expand;
$this->username = $GLOBALS['username'];
$this->folderid = $GLOBALS['folderid'];
$this->username = $username;
$this->folderid = $folderid;
$this->expand = $expand;
$this->folders = array ();
$this->tree = array ();
$this->get_children = array ();
$this->level = 0;
$this->foreign_username = false;
$this->expand = $GLOBALS['expand'];
if ($user) {
$this->get_shared_data ($user);
@@ -59,15 +59,15 @@ class folder {
}
}
function get_shared_data ($username) {
global $mysql;
function get_shared_data ($user) {
global $mysql, $username;
# does the user exist in the database?
if (check_username ($username)) {
$this->foreign_username = $username;
if (check_username ($user)) {
$this->foreign_username = $user;
}
else {
$this->foreign_username = $GLOBALS['username'];
$this->foreign_username = $username;
}
# get all shared folders for the given user
@@ -285,16 +285,14 @@ class folder {
### prints a path
###
function print_path ($id) {
global $settings;
global $settings, $delimiter;
$parents = $this->get_path_to_root ($id);
$parents = array_reverse ($parents);
# the following if condition has been disabled. could be enabled to
# allow the "show_root_folder" function.
#if ($GLOBALS['show_root_folder']){
$path = $GLOBALS['delimiter'] . $settings['root_folder_name'];
#}
$path = $delimiter . $settings['root_folder_name'];
foreach ($parents as $value) {
$path .= $GLOBALS['delimiter'] . $this->folders[$value]['name'];
$path .= $delimiter . $this->folders[$value]['name'];
}
return $path;
}

View File

@@ -158,6 +158,8 @@ else{
class import {
function import () {
global $username, $parentfolder, $mysql;
# open the importfile
$this->fp = fopen ($_FILES['importfile']['tmp_name'], "r");
if ($this->fp == null){
@@ -170,13 +172,13 @@ class import {
$this->count_folders = 0;
$this->count_bookmarks = 0;
$this->username = $GLOBALS['username'];
$this->parent_folder = $GLOBALS['parentfolder'];
$this->username = $username;
$this->parent_folder = $parentfolder;
$this->current_folder = $this->parent_folder;
$this->folder_depth = array ();
$this->mysql = $GLOBALS['mysql'];
$this->mysql = $mysql;
}

View File

@@ -62,12 +62,12 @@ if (isset ($_GET['user']) && check_username ($user)) {
<!-- Folders starts here. -->
<div class="folders" style="width: <?php echo $column_width_folder; ?>; height: <?php echo $table_height; ?>;">
<?php
require_once (ABSOLUTE_PATH . "folders.php");
$tree = & new folder ($user);
$tree->make_tree (0);
$tree->print_tree ();
?>
<?php
require_once (ABSOLUTE_PATH . "folders.php");
$tree = & new folder ($user);
$tree->make_tree (0);
$tree->print_tree ();
?>
<!-- Folders ends here. -->
</div>
@@ -104,7 +104,8 @@ if (isset ($_GET['user']) && check_username ($user)) {
false,
false,
false,
true);
true,
$user);
}
else {
message ($mysql->error);