diff --git a/CHANGES b/CHANGES
index 6f2719d..5f264ff 100644
--- a/CHANGES
+++ b/CHANGES
@@ -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.
\ No newline at end of file
diff --git a/VERSION b/VERSION
index dca4b2c..cad6253 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.8.13_beta
\ No newline at end of file
+0.8.14_beta
\ No newline at end of file
diff --git a/bookmarks.php b/bookmarks.php
index 2643f3a..79eae1a 100644
--- a/bookmarks.php
+++ b/bookmarks.php
@@ -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" . '
' . "\n";
diff --git a/export.php b/export.php
index fd74989..0c115d3 100644
--- a/export.php
+++ b/export.php
@@ -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;
diff --git a/folders.php b/folders.php
index 236c1f0..2dbeca2 100644
--- a/folders.php
+++ b/folders.php
@@ -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;
}
diff --git a/import.php b/import.php
index ce72db6..573128b 100644
--- a/import.php
+++ b/import.php
@@ -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;
}
diff --git a/shared.php b/shared.php
index b64b964..dfca600 100644
--- a/shared.php
+++ b/shared.php
@@ -62,12 +62,12 @@ if (isset ($_GET['user']) && check_username ($user)) {
- make_tree (0);
- $tree->print_tree ();
- ?>
+ make_tree (0);
+ $tree->print_tree ();
+ ?>
@@ -104,7 +104,8 @@ if (isset ($_GET['user']) && check_username ($user)) {
false,
false,
false,
- true);
+ true,
+ $user);
}
else {
message ($mysql->error);