Skip to content

Commit

Permalink
Improved naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
s22-tech committed May 23, 2024
1 parent ce936cb commit 62d4208
Show file tree
Hide file tree
Showing 29 changed files with 85 additions and 88 deletions.
2 changes: 1 addition & 1 deletion admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,5 @@ function list_users() {

<?php
print_footer();
require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
?>
2 changes: 1 addition & 1 deletion bookmarks/add_bookmark.php
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?php
include(APPLICATION_PATH . '/bookmarks/new_bookmark.php');
include(BASE_DIR . '/bookmarks/new_bookmark.php');
4 changes: 2 additions & 2 deletions bookmarks/async_bookmarks.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?php

require_once(APPLICATION_PATH .'/async_header.php');
require_once(BASE_DIR .'/async_header.php');
logged_in_only();

$order = set_get_order();

require_once(APPLICATION_PATH .'/bookmarks/bookmarks.php');
require_once(BASE_DIR .'/bookmarks/bookmarks.php');

$query = sprintf("
SELECT `title`, `url`, `description`, UNIX_TIMESTAMP(`date`) AS timestamp, `id`, `favicon`, `public`
Expand Down
2 changes: 1 addition & 1 deletion bookmarks/bookmarks.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function list_bookmarks($bookmarks, $show_checkbox, $show_folder, $show_icon, $s


if ($show_folder) {
require_once(APPLICATION_PATH . '/folders/folder.php');
require_once(BASE_DIR . '/folders/folder.php');
$tree = new Folder();
}

Expand Down
6 changes: 3 additions & 3 deletions bookmarks/delete_bookmark.inc.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require_once(realpath(dirname(__FILE__, 2)) . '/header.php');
require_once(realpath(dirname(__FILE__, 2)) . '/header.min.php');
logged_in_only();

if (!empty($username) && $username !== 'demo') {
Expand Down Expand Up @@ -36,9 +36,9 @@

foreach ($icons_to_delete as $favicon) {
if (! str_contains($favicon, 'bookmark.gif')) {
if (is_file(APPLICATION_PATH .'/icons/'. $favicon)) {
if (is_file(BASE_DIR .'/icons/'. $favicon)) {
if (!str_contains($favicon, 'bookmark')) {
unlink(APPLICATION_PATH .'/icons/'. $favicon);
unlink(BASE_DIR .'/icons/'. $favicon);
}
}
else {
Expand Down
4 changes: 2 additions & 2 deletions bookmarks/delete_bookmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
$mysql->escape($username)
);
if ($mysql->query($query)) {
require_once(APPLICATION_PATH . '/bookmarks/bookmarks.php');
require_once(BASE_DIR . '/bookmarks/bookmarks.php');
$query_string = 'bmlist=' . implode(',', $bmlist);
?>

Expand Down Expand Up @@ -101,5 +101,5 @@
}
}

require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
?>
10 changes: 5 additions & 5 deletions bookmarks/edit_bookmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
$mysql->escape($username)
);
if ($mysql->query($query)) {
require_once(APPLICATION_PATH . '/bookmarks/bookmarks.php');
require_once(BASE_DIR . '/bookmarks/bookmarks.php');
$query_string = '?bmlist=' . implode('_"', $bmlist);
?>

Expand Down Expand Up @@ -113,7 +113,7 @@
else {
$row = mysqli_fetch_object($mysql->result);

require_once(APPLICATION_PATH . '/folders/folder.php');
require_once(BASE_DIR . '/folders/folder.php');
$tree = new Folder();
$query_string = '?expand=' . implode(',', $tree->get_path_to_root($row->childof)) . '&amp;folderid=' . $row->childof;
$path = $tree->print_path($row->childof);
Expand All @@ -133,7 +133,7 @@
else {
$used_url = $row->url;
}
require_once(APPLICATION_PATH . '/favicon.php');
require_once(BASE_DIR . '/favicon.php');
$favicon = new Favicon($used_url);
$new_fav = $favicon->favicon;
debug_logger(name:'favicon->favicon >>', variable:$new_fav, file:__FILE__, function:__FUNCTION__);
Expand All @@ -151,7 +151,7 @@
message($mysql->error);
}
if (!empty($row->favicon)) { /* && is_file($row->favicon) */
@unlink(APPLICATION_PATH .'/icons/'. $row->favicon);
@unlink(BASE_DIR .'/icons/'. $row->favicon);
}
$icon = '<img src="/icons/'. $new_fav .'" width="'.$cfg['icon_w'].'" height="'.$cfg['icon_h'].'" alt="">';
}
Expand Down Expand Up @@ -233,5 +233,5 @@
}
}

require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
?>
4 changes: 2 additions & 2 deletions bookmarks/move_bookmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div style="width:100%; height:330px; overflow:auto;">

<?php
require_once(APPLICATION_PATH . '/folders/folder.php');
require_once(BASE_DIR . '/folders/folder.php');
$tree = new Folder();
$tree->make_tree(0);
$tree->print_tree();
Expand Down Expand Up @@ -56,5 +56,5 @@
}
}

require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
?>
6 changes: 3 additions & 3 deletions bookmarks/new_bookmark.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
$post_childof = set_post_childof();
$post_public = set_post_bool_var('public', false);

require_once(APPLICATION_PATH . '/folders/folder.php');
require_once(BASE_DIR . '/folders/folder.php');
$tree = new Folder();
$query_string = '?expand=' . implode(',', $tree->get_path_to_root($post_childof)) . '&amp;folderid=' . $post_childof;

Expand Down Expand Up @@ -108,7 +108,7 @@
// since the favicon is not as important.
///////////////////////////
if ($settings['show_bookmark_icon']) {
require_once(APPLICATION_PATH . '/favicon.php');
require_once(BASE_DIR . '/favicon.php');
$favicon = new Favicon($post_url);
debug_logger(variable:print_r($favicon, true), name:'favicon-object', file:__FILE__, function:__FUNCTION__);

Expand Down Expand Up @@ -148,5 +148,5 @@
echo '<script> self.close(); </script>';
}
}
require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
?>
4 changes: 2 additions & 2 deletions change_password.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
require_once(APPLICATION_PATH . '/header.php');
require_once(BASE_DIR . '/header.php');
logged_in_only();

$pw_message = null;
Expand Down Expand Up @@ -69,5 +69,5 @@
</form>

<?php
require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
?>
8 changes: 4 additions & 4 deletions config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
die ('No direct access allowed.');
}

define('APPLICATION_PATH', realpath(dirname(__FILE__, 2))); // Includes the sub-directory.
define('BASE_DIR', realpath(dirname(__FILE__, 2))); // Includes the sub-directory.

////////////////////////
// Load Config File ////
Expand All @@ -24,8 +24,8 @@
$cfg['domain'] = 's22.us';
$cfg['debug'] = true; // Turns debug logging on or off.

$cfg['error_log'] = APPLICATION_PATH . '/logs/php_error_log_obm';
$cfg['debug_log'] = APPLICATION_PATH . '/logs/obm_d-bug.log';
$cfg['error_log'] = BASE_DIR . '/logs/php_error_log_obm';
$cfg['debug_log'] = BASE_DIR . '/logs/obm_d-bug.log';

$cfg['locale'] = 'en-US';
$cfg['user_agent'] = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/124.0.2478.109';
Expand Down Expand Up @@ -81,7 +81,7 @@

$cfg['sub_dir'] = '';
if (sub_dir_bool_check()) {
$cfg['sub_dir'] = '/'. basename(APPLICATION_PATH);
$cfg['sub_dir'] = '/'. basename(BASE_DIR);
}

if ($cfg['debug']) {
Expand Down
18 changes: 9 additions & 9 deletions export.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
<div style="width:<?php echo (($settings['column_width_folder'] == 0) ? "auto" : $settings['column_width_folder']); ?>; height:350px; overflow:auto;">

<?php
require_once(APPLICATION_PATH . '/folders/folder.php');
require_once(BASE_DIR . '/folders/folder.php');
$tree = new Folder();
$tree->make_tree(0);
$tree->print_tree();
Expand Down Expand Up @@ -127,20 +127,20 @@

<?php
print_footer();
require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
}
else {
// These files are being included, because we do not want to include
// header.php since there is no reason for the http header to display.
//require_once(APPLICATION_PATH . '/lib/webstart.php');
require_once(APPLICATION_PATH . '/config/config.php');
require_once(APPLICATION_PATH . '/lib/mysql.php');
//require_once(BASE_DIR . '/lib/webstart.php');
require_once(BASE_DIR . '/config/config.php');
require_once(BASE_DIR . '/lib/mysql.php');
$mysql = new Mysql();
require_once(APPLICATION_PATH . '/lib/auth.php');
require_once(BASE_DIR . '/lib/auth.php');
$auth = new Auth();
require_once(APPLICATION_PATH . '/lib/lib.php');
require_once(BASE_DIR . '/lib/lib.php');
logged_in_only();
require_once(APPLICATION_PATH . '/lib/login.php');
require_once(BASE_DIR . '/lib/login.php');

$browser = set_post_browser();
if ($browser == 'opera') {
Expand Down Expand Up @@ -185,7 +185,7 @@ class Export
function export() {
global $settings, $browser;
// Collect the folder data.
require_once(APPLICATION_PATH . '/folders/folder.php');
require_once(BASE_DIR . '/folders/folder.php');
$this->tree = new Folder();
$this->tree->folders[0] = ['id' => 0, 'childof' => null, 'name' => $settings['root_folder_name']];

Expand Down
10 changes: 5 additions & 5 deletions favicon.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

require_once(realpath(dirname(__FILE__, 1)) . '/config/config.php');
include_once(APPLICATION_PATH . '/vendor/simplehtmldom/HtmlWeb.php');
include_once(BASE_DIR . '/vendor/simplehtmldom/HtmlWeb.php');
use simplehtmldom\HtmlWeb;

class Favicon
Expand All @@ -33,14 +33,14 @@ function __construct($url) {
if ($this->favicon_url = $this->get_favicon_url()) {
$this->download_favicon_image();
$this->icon_name = $this->rename_favicon($url . '/'. $this->temp_icon_name);
$favicon_url_path = APPLICATION_PATH . '/icons/'. $this->icon_name;
$favicon_url_path = BASE_DIR . '/icons/'. $this->icon_name;

debug_logger(name:'this->temp_icon_name', variable:$this->temp_icon_name, newline:false, file:__FILE__, function:__FUNCTION__);
debug_logger(name:'this->favicon_url', variable:$this->favicon_url, newline:false, file:__FILE__, function:__FUNCTION__);
debug_logger(name:'this->icon_name', variable:$this->icon_name, newline:false, file:__FILE__, function:__FUNCTION__);
debug_logger(name:'favicon_url_path', variable:$favicon_url_path, file:__FILE__, function:__FUNCTION__);

$tmp_file = APPLICATION_PATH . '/tmp/'. $this->temp_icon_name;
$tmp_file = BASE_DIR . '/tmp/'. $this->temp_icon_name;
[$fav_ext, $ident] = $this->identify_fav($tmp_file);
debug_logger(name:'tmp_file', variable:$tmp_file, newline:false, file:__FILE__, function:__FUNCTION__);
debug_logger(name:'fav_ext', variable:$fav_ext, newline:false, file:__FILE__, function:__FUNCTION__);
Expand Down Expand Up @@ -86,7 +86,7 @@ function convert_favicon($tmp_file, $fav_ext, $ident) : string {
$new_name = $this->rename_favicon($this->url);
debug_logger(name:'new_name', variable:$new_name, newline:false, file:__FILE__, function:__FUNCTION__);

$save_path_name = APPLICATION_PATH . '/icons/'. $new_name;
$save_path_name = BASE_DIR . '/icons/'. $new_name;
debug_logger(name:'save_path_name', variable:$save_path_name, newline:false, file:__FILE__, function:__FUNCTION__);

// if (strtolower($fav_ext) === 'svg') {
Expand Down Expand Up @@ -137,7 +137,7 @@ function download_favicon_image() {
curl_close($ch);

if (admin_only()) {
$bytes = file_put_contents(APPLICATION_PATH . '/tmp/'. $this->temp_icon_name, $response);
$bytes = file_put_contents(BASE_DIR . '/tmp/'. $this->temp_icon_name, $response);
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion folders/async_folders.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_once(realpath(dirname(__FILE__, 2)) . '/async_header.php');
logged_in_only();

require_once(APPLICATION_PATH .'/folders/folder.php');
require_once(BASE_DIR .'/folders/folder.php');
$tree = new Folder();
$tree->make_tree(0);
$tree->print_tree('index.php');
7 changes: 2 additions & 5 deletions folders/delete_folder.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?php

ini_set('display_errors', 1);
ini_set('error_prepend_string', '<pre style="white-space: pre-wrap;">');
ini_set('error_append_string', '</pre>');
require_once(realpath(dirname(__FILE__, 2)) . '/header.php');
logged_in_only();

Expand All @@ -15,7 +12,7 @@
}
elseif (!$settings['confirm_delete'] || $noconfirm) {
// Lets do the deletion if the confirm variable is set to FALSE or after confirmation.
require_once(APPLICATION_PATH . '/folders/folder.php');
require_once(BASE_DIR . '/folders/folder.php');
$tree = new Folder();
$tree->get_children($folderid);

Expand Down Expand Up @@ -130,5 +127,5 @@ function reloadparentwindow() {
echo '<input type="button" value=" Cancel " onclick="self.close()">';
}

require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
?>
4 changes: 2 additions & 2 deletions folders/edit_folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

if ($mysql->query($query)) {
if ($inherit) {
require_once(APPLICATION_PATH . '/folders/folder.php');
require_once(BASE_DIR . '/folders/folder.php');
$tree = new Folder();
$tree->get_children($folderid);
if (count($tree->get_children) > 0) {
Expand Down Expand Up @@ -119,5 +119,5 @@
}
}

require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
?>
4 changes: 2 additions & 2 deletions folders/move_folder.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
require_once(realpath(dirname(__FILE__, 2)) . '/header.php');
logged_in_only();
require_once(APPLICATION_PATH . '/folders/folder.php');
require_once(BASE_DIR . '/folders/folder.php');

$sourcefolder = set_post_sourcefolder();
$tree = new Folder();
Expand Down Expand Up @@ -61,5 +61,5 @@
message ($mysql->error);
}
}
require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
?>
2 changes: 1 addition & 1 deletion folders/new_folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@
}
}

require_once(APPLICATION_PATH.'/footer.php');
require_once(BASE_DIR.'/footer.php');
4 changes: 2 additions & 2 deletions folders/select_folder.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<div style="width:100%; height:330px; overflow:auto;">

<?php
require_once(APPLICATION_PATH . '/folders/folder.php');
require_once(BASE_DIR . '/folders/folder.php');
$tree = new Folder();
$tree->make_tree(0);
$tree->print_tree();
Expand All @@ -22,5 +22,5 @@
<input type="button" value=" New Folder " onclick="self.location.href='javascript:foldernew(<?php echo $folderid; ?>)'">

<?php
require_once(APPLICATION_PATH . '/footer.php');
require_once(BASE_DIR . '/footer.php');
?>
Loading

0 comments on commit 62d4208

Please sign in to comment.