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
|
||||
- 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");
|
||||
}
|
||||
|
||||
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";
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
26
folders.php
26
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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
15
shared.php
15
shared.php
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user