Getting rid of dangeros in export.php, import.php and folders.php.
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -28,3 +28,6 @@
|
|||||||
|
|
||||||
01.08.2008, Version 0.8.13_beta
|
01.08.2008, Version 0.8.13_beta
|
||||||
- Adjusted order function so that arrow changes direction when changing order.
|
- 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.
|
||||||
@@ -3,7 +3,7 @@ if (basename ($_SERVER['SCRIPT_NAME']) == basename (__FILE__)) {
|
|||||||
die ("no direct access allowed");
|
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,
|
global $folderid,
|
||||||
$expand,
|
$expand,
|
||||||
$settings,
|
$settings,
|
||||||
@@ -61,8 +61,8 @@ function list_bookmarks ($bookmarks, $show_checkbox, $show_folder, $show_icon, $
|
|||||||
'expand' => implode (",", $expand),
|
'expand' => implode (",", $expand),
|
||||||
'order' => $sort_d,
|
'order' => $sort_d,
|
||||||
);
|
);
|
||||||
if (isset ($GLOBALS['user']) && $GLOBALS['user'] != '') {
|
if ($user) {
|
||||||
$query_data['user'] = $GLOBALS['user'];
|
$query_data['user'] = $user;
|
||||||
}
|
}
|
||||||
$query_string = assemble_query_string ($query_data);
|
$query_string = assemble_query_string ($query_data);
|
||||||
echo "\t\t" . '<div class="bmright">' . "\n";
|
echo "\t\t" . '<div class="bmright">' . "\n";
|
||||||
|
|||||||
@@ -182,13 +182,14 @@ else{
|
|||||||
|
|
||||||
class export {
|
class export {
|
||||||
function export () {
|
function export () {
|
||||||
|
global $settings, $browser;
|
||||||
# collect the folder data
|
# collect the folder data
|
||||||
require_once (ABSOLUTE_PATH . "folders.php");
|
require_once (ABSOLUTE_PATH . "folders.php");
|
||||||
$this->tree = & new folder;
|
$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;
|
global $username, $mysql;
|
||||||
$this->browser = $GLOBALS['browser'];
|
$this->browser = $browser;
|
||||||
|
|
||||||
$this->counter = 0;
|
$this->counter = 0;
|
||||||
|
|
||||||
|
|||||||
26
folders.php
26
folders.php
@@ -6,16 +6,16 @@ if (basename ($_SERVER['SCRIPT_NAME']) == basename (__FILE__)) {
|
|||||||
class folder {
|
class folder {
|
||||||
|
|
||||||
function folder ($user = false) {
|
function folder ($user = false) {
|
||||||
global $settings;
|
global $settings, $username, $folderid, $expand;
|
||||||
|
|
||||||
$this->username = $GLOBALS['username'];
|
$this->username = $username;
|
||||||
$this->folderid = $GLOBALS['folderid'];
|
$this->folderid = $folderid;
|
||||||
|
$this->expand = $expand;
|
||||||
$this->folders = array ();
|
$this->folders = array ();
|
||||||
$this->tree = array ();
|
$this->tree = array ();
|
||||||
$this->get_children = array ();
|
$this->get_children = array ();
|
||||||
$this->level = 0;
|
$this->level = 0;
|
||||||
$this->foreign_username = false;
|
$this->foreign_username = false;
|
||||||
$this->expand = $GLOBALS['expand'];
|
|
||||||
|
|
||||||
if ($user) {
|
if ($user) {
|
||||||
$this->get_shared_data ($user);
|
$this->get_shared_data ($user);
|
||||||
@@ -59,15 +59,15 @@ class folder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_shared_data ($username) {
|
function get_shared_data ($user) {
|
||||||
global $mysql;
|
global $mysql, $username;
|
||||||
|
|
||||||
# does the user exist in the database?
|
# does the user exist in the database?
|
||||||
if (check_username ($username)) {
|
if (check_username ($user)) {
|
||||||
$this->foreign_username = $username;
|
$this->foreign_username = $user;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$this->foreign_username = $GLOBALS['username'];
|
$this->foreign_username = $username;
|
||||||
}
|
}
|
||||||
|
|
||||||
# get all shared folders for the given user
|
# get all shared folders for the given user
|
||||||
@@ -285,16 +285,14 @@ class folder {
|
|||||||
### prints a path
|
### prints a path
|
||||||
###
|
###
|
||||||
function print_path ($id) {
|
function print_path ($id) {
|
||||||
global $settings;
|
global $settings, $delimiter;
|
||||||
$parents = $this->get_path_to_root ($id);
|
$parents = $this->get_path_to_root ($id);
|
||||||
$parents = array_reverse ($parents);
|
$parents = array_reverse ($parents);
|
||||||
# the following if condition has been disabled. could be enabled to
|
# the following if condition has been disabled. could be enabled to
|
||||||
# allow the "show_root_folder" function.
|
# allow the "show_root_folder" function.
|
||||||
#if ($GLOBALS['show_root_folder']){
|
$path = $delimiter . $settings['root_folder_name'];
|
||||||
$path = $GLOBALS['delimiter'] . $settings['root_folder_name'];
|
|
||||||
#}
|
|
||||||
foreach ($parents as $value) {
|
foreach ($parents as $value) {
|
||||||
$path .= $GLOBALS['delimiter'] . $this->folders[$value]['name'];
|
$path .= $delimiter . $this->folders[$value]['name'];
|
||||||
}
|
}
|
||||||
return $path;
|
return $path;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,6 +158,8 @@ else{
|
|||||||
|
|
||||||
class import {
|
class import {
|
||||||
function import () {
|
function import () {
|
||||||
|
global $username, $parentfolder, $mysql;
|
||||||
|
|
||||||
# open the importfile
|
# open the importfile
|
||||||
$this->fp = fopen ($_FILES['importfile']['tmp_name'], "r");
|
$this->fp = fopen ($_FILES['importfile']['tmp_name'], "r");
|
||||||
if ($this->fp == null){
|
if ($this->fp == null){
|
||||||
@@ -170,13 +172,13 @@ class import {
|
|||||||
$this->count_folders = 0;
|
$this->count_folders = 0;
|
||||||
$this->count_bookmarks = 0;
|
$this->count_bookmarks = 0;
|
||||||
|
|
||||||
$this->username = $GLOBALS['username'];
|
$this->username = $username;
|
||||||
$this->parent_folder = $GLOBALS['parentfolder'];
|
$this->parent_folder = $parentfolder;
|
||||||
$this->current_folder = $this->parent_folder;
|
$this->current_folder = $this->parent_folder;
|
||||||
|
|
||||||
$this->folder_depth = array ();
|
$this->folder_depth = array ();
|
||||||
|
|
||||||
$this->mysql = $GLOBALS['mysql'];
|
$this->mysql = $mysql;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,8 @@ if (isset ($_GET['user']) && check_username ($user)) {
|
|||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
true);
|
true,
|
||||||
|
$user);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
message ($mysql->error);
|
message ($mysql->error);
|
||||||
|
|||||||
Reference in New Issue
Block a user