From c4feca4ce7d3ff879c9e30baaa2e57dd670e5d3a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 26 Jun 2008 10:08:47 -0400 Subject: [PATCH] Clean up $funct->*() to BSFunctions::*() --- admin/global.php | 6 +++--- admin/index.php | 2 +- admin/setting.php | 2 +- attachment.php | 2 +- docs/cache_templates.php | 4 ++-- docs/mailtest.php | 2 +- docs/populate.php | 2 +- favorite.php | 4 ++-- includes/api_user.php | 8 ++++---- includes/class_notification.php | 2 +- index.php | 2 +- login.php | 10 +++++----- register.php | 2 +- search.php | 6 +++--- showhistory.php | 4 ++-- viewattachment.php | 2 +- 16 files changed, 30 insertions(+), 30 deletions(-) diff --git a/admin/global.php b/admin/global.php index 5a0894c..5e6abf3 100755 --- a/admin/global.php +++ b/admin/global.php @@ -76,11 +76,11 @@ if (can_perform('canadminpanel')) if ($session AND $session['userid'] == bugdar::$userinfo['userid'] AND $session['dateline'] >= (TIMENOW - 3600)) { // renew the cookie - $funct->cookie(COOKIE_PREFIX . 'adminsession', $session['sessionid'], false); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', $session['sessionid'], false); } else { - $funct->cookie(COOKIE_PREFIX . 'adminsession', null); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', null); admin_login(); // do we need this message? $admin->error(T('Invalid admin session has been terminated.')); @@ -88,7 +88,7 @@ if (can_perform('canadminpanel')) } else { - $funct->cookie(COOKIE_PREFIX . 'adminsession', null); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', null); admin_login(); } diff --git a/admin/index.php b/admin/index.php index ea3a906..9ef0665 100755 --- a/admin/index.php +++ b/admin/index.php @@ -67,7 +67,7 @@ $admin->row_span(T('Server Options'), 'thead'); $mysql = $db->query_first("SHOW VARIABLES LIKE 'max_allowed_packet'"); $admin->row_text(T('MySQL: Maximum Packet Size'), $mysql['Value']); -$admin->row_text(T('MySQL: Maximum Upload Size'), $funct->fetch_max_attachment_size()); +$admin->row_text(T('MySQL: Maximum Upload Size'), BSFunctions::fetch_max_php_file_size()); $mysql = $db->query_first("SHOW VARIABLES LIKE 'ft_min_word_len'"); $admin->row_text(T('MySQL: Full-Text Search Minimum Word Length'), $mysql['Value']); diff --git a/admin/setting.php b/admin/setting.php index 07982d6..72f7b30 100755 --- a/admin/setting.php +++ b/admin/setting.php @@ -84,7 +84,7 @@ if ($_REQUEST['do'] == 'modify') // authmethod $admin->row_span(T('Authentication Method'), 'thead'); - $methods = $funct->scandir('./includes/auth/'); + $methods = BSFunctions::scan_directory('./includes/auth/'); foreach ($methods[''] AS $path) { if (preg_match('#auth_(.*)\.php#', $path, $matches)) diff --git a/attachment.php b/attachment.php index b51ce83..61848d8 100755 --- a/attachment.php +++ b/attachment.php @@ -172,7 +172,7 @@ if ($_REQUEST['do'] == 'add') $message->errorPermission(); } - $MAXFILESIZE = $funct->fetch_max_attachment_size(); + $MAXFILESIZE = BSFunctions::fetch_max_php_file_size(); $show['addcomment'] = ((can_perform('canpostcomments', $bug['product'])) ? true : false); $show['obsoletes'] = false; diff --git a/docs/cache_templates.php b/docs/cache_templates.php index 3310f60..cf47230 100644 --- a/docs/cache_templates.php +++ b/docs/cache_templates.php @@ -6,7 +6,7 @@ chdir('..'); require_once('./global.php'); -$files = $funct->scandir('templates'); +$files = BSFunctions::scan_directory('templates'); $db->query("TRUNCATE TABLE " . TABLE_PREFIX . "template"); @@ -14,7 +14,7 @@ foreach ($files AS $path => $bits) { foreach ($bits AS $file) { - if ($funct->fetch_extension($file) == 'tpl') + if (BSFunctions::fetch_extension($file) == 'tpl') { $db->query("INSERT INTO " . TABLE_PREFIX . "template (filename, template, timestamp) VALUES ('$path" . substr($file, 0, strlen($file) - 4) . "', '" . $db->escape_string($template->_parse(file_get_contents("templates/$path$file"))) . "', " . time() . ")"); } diff --git a/docs/mailtest.php b/docs/mailtest.php index a80b5d5..8b28eb0 100644 --- a/docs/mailtest.php +++ b/docs/mailtest.php @@ -73,7 +73,7 @@ Sendmail (Path): \"" . ini_get('sendmail_path') . "\""; $mail->setFromName('Bugdar Mailing Test'); $mail->setSubject('Email Tests'); - if (empty($bugsys->in['receive']) OR empty($bugsys->in['sender']) OR !$funct->is_valid_email($bugsys->in['receive']) OR !$funct->is_valid_email($bugsys->in['sender'])) + if (empty($bugsys->in['receive']) OR empty($bugsys->in['sender']) OR !BSFunctions::is_valid_email($bugsys->in['receive']) OR !BSFunctions::is_valid_email($bugsys->in['sender'])) { echo '

You did not fill in all the fields or the email addresses are not valid. Please go back.

'; } diff --git a/docs/populate.php b/docs/populate.php index 8aede92..50042a2 100644 --- a/docs/populate.php +++ b/docs/populate.php @@ -15,7 +15,7 @@ for ($i = 11; $i < 111; $i++) $bug->set('severity', 1); $comment->set('userid', bugdar::$userinfo['userid']); - $comment->set('comment', $funct->rand(100)); + $comment->set('comment', BSFunctions::random(100)); $bug->set('priority', bugdar::$options['defaultpriority']); $bug->set('status', bugdar::$options['defaultstatus']); diff --git a/favorite.php b/favorite.php index c3fcf62..afa6bff 100644 --- a/favorite.php +++ b/favorite.php @@ -93,8 +93,8 @@ if ($_REQUEST['do'] == 'manage') foreach ($favorites as $bug) { - $funct->exec_swap_bg('altcolor', ''); - $bug = ProcessBugDataForDisplay($bug, $funct->bgcolour); + BSFunctions::swap_css_classes('altcolor', ''); + $bug = ProcessBugDataForDisplay($bug, BSFunctions::$cssClass); $bugs .= $sort->constructRow($bug); } diff --git a/includes/api_user.php b/includes/api_user.php index 9067bdf..e9c5670 100644 --- a/includes/api_user.php +++ b/includes/api_user.php @@ -82,7 +82,7 @@ class UserAPI extends BSApi */ function set_salt() { - $this->set('salt', $this->registry->funct->rand(array(1, 15))); + $this->set('salt', BSFunctions::random(array(1, 15))); } // ################################################################### @@ -93,7 +93,7 @@ class UserAPI extends BSApi */ function set_authkey() { - $this->set('authkey', $this->registry->funct->rand()); + $this->set('authkey', BSFunctions::random()); } // ################################################################### @@ -143,7 +143,7 @@ class UserAPI extends BSApi return $ne; } - if (!$this->registry->funct->is_valid_email($this->values['email'])) + if (!BSFunctions::is_valid_email($this->values['email'])) { return T('The specified email is invalid.'); } @@ -202,7 +202,7 @@ class UserAPI extends BSApi { $groups = explode(',', $this->values['groupids']); } - $groups = $this->registry->funct->array_strip_empty($groups); + $groups = BSFunctions::array_strip_empty($groups); foreach ($groups AS $group) { diff --git a/includes/class_notification.php b/includes/class_notification.php index 8035803..0118906 100644 --- a/includes/class_notification.php +++ b/includes/class_notification.php @@ -175,7 +175,7 @@ class NotificationCenter } $masterids = array_merge($this->roles['-notapplicable-'], $this->roles['reporter'], $this->roles['assignee'], $this->roles['favorite'], $this->roles['voter'], $this->roles['commenter']); - $masterids = $this->registry->funct->array_strip_empty(array_unique($masterids)); + $masterids = BSFunctions::array_strip_empty(array_unique($masterids)); if (is_array($masterids) AND sizeof($masterids) > 0) { diff --git a/index.php b/index.php index 29034ff..f83d602 100644 --- a/index.php +++ b/index.php @@ -68,7 +68,7 @@ $bugs_fetch = $db->query($sort->fetch_sql_query(null, $pagination->fetchLimit($p foreach ($bugs_fetch as $bug) { BSFunctions::swap_css_classes('altcolor', ''); - $bug = ProcessBugDataForDisplay($bug, $funct->bgcolour); + $bug = ProcessBugDataForDisplay($bug, BSFunctions::$cssClass); $bugs .= $sort->constructRow($bug); } diff --git a/login.php b/login.php index c63ab96..ef16205 100755 --- a/login.php +++ b/login.php @@ -72,10 +72,10 @@ if ($_POST['do'] == 'login' OR $_POST['do'] == 'cplogin') { if ($_POST['do'] == 'cplogin') { - $hash = $funct->rand(90); + $hash = BSFunctions::random(90); $db->query("DELETE FROM " . TABLE_PREFIX . "adminsession WHERE dateline < " . (TIMENOW - 3600)); $db->query("INSERT INTO " . TABLE_PREFIX . "adminsession (sessionid, userid, dateline) VALUES ('$hash', " . $auth->bugdarUser['userid'] . ", " . TIMENOW . ")"); - $funct->cookie(COOKIE_PREFIX . 'adminsession', $hash, false); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession', $hash, false); } $message->redirect(T('Welcome back! You are now logged in.'), $url); } @@ -93,7 +93,7 @@ if ($_REQUEST['do'] == 'logout') { $db->query("DELETE FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $bugsys->input_escape(COOKIE_PREFIX . 'adminsession') . "'"); $auth->clearCookies(); - $funct->cookie(COOKIE_PREFIX . 'adminsession'); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession'); $message->redirect(T('You have been logged out.'), ($_SERVER['HTTP_REFERER'] ? $_SERVER['HTTP_REFERER'] : 'index.php')); } else @@ -118,7 +118,7 @@ if ($_POST['do'] == 'sendpw') } else { - $activator = $funct->rand(25); + $activator = BSFunctions::random(25); $db->query("INSERT INTO " . TABLE_PREFIX . "passwordreset (activatorid, dateline, userid) VALUES ('" . $activator . "', " . TIMENOW . ", " . $user->objdata['userid'] . ")"); eval('$email = "' . $template->fetch(FetchEmailPath('passwordreset.xml', bugdar::$datastore['language'][$user->objdata['languageid']]['langcode'])) . '";'); @@ -208,7 +208,7 @@ if ($_REQUEST['do'] == 'cplogout') if ($_COOKIE[COOKIE_PREFIX . 'adminsession']) { $db->query("DELETE FROM " . TABLE_PREFIX . "adminsession WHERE sessionid = '" . $bugsys->input_escape(COOKIE_PREFIX . 'adminsession') . "'"); - $funct->cookie(COOKIE_PREFIX . 'adminsession'); + BSFunctions::cookie(COOKIE_PREFIX . 'adminsession'); $message->redirect(T('You have been logged out.'), 'admin/'); } else diff --git a/register.php b/register.php index 6c6db55..720f8bf 100755 --- a/register.php +++ b/register.php @@ -92,7 +92,7 @@ if ($_POST['do'] == 'insert') // Verify email address if ($usergroupid == 3) { - $activationid = $funct->rand(25); + $activationid = BSFunctions::random(25); $db->query("INSERT INTO " . TABLE_PREFIX . "useractivation (userid, activator, dateline, usergroupid) VALUES ($userid, '$activationid', " . TIMENOW . ", 2)"); diff --git a/search.php b/search.php index 2cd5865..1ad8f0e 100644 --- a/search.php +++ b/search.php @@ -628,7 +628,7 @@ if ($_REQUEST['do'] == 'export') $xml .= "\n"; - $funct->download_file($xml, T('bugdar-search-' . $search['searchid'] . '.xml'), true); + BSFunctions::download_file($xml, T('bugdar-search-' . $search['searchid'] . '.xml'), true); } // ################################################################### @@ -698,8 +698,8 @@ if ($_POST['do'] == 'results') $search = $db->query("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid IN ($search[ids]) $search[orderby] LIMIT " . $pagination->fetchLimit($pagination->getPage() - 1) . ", " . $pagination->getPerPage()); foreach ($search as $bug) { - $funct->exec_swap_bg('altcolor', ''); - $bug = ProcessBugDataForDisplay($bug, $funct->bgcolour); + BSFunctions::swap_css_classes('altcolor', ''); + $bug = ProcessBugDataForDisplay($bug, BSFunctions::$cssClass); $bugs .= $sort->constructRow($bug, "&hilight=$hilight"); } diff --git a/showhistory.php b/showhistory.php index f1802a7..a6e490a 100644 --- a/showhistory.php +++ b/showhistory.php @@ -158,8 +158,8 @@ foreach ($logs AS $dateline => $logitems) } } - $funct->exec_swap_bg('', 'altcolor'); - $bgcolor = $funct->bgcolour; + BSFunctions::swap_css_classes('', 'altcolor'); + $bgcolor = BSFunctions::$cssClass; eval('$history .= "' . $template->fetch('history_bit') . '";'); $show['group'] = false; diff --git a/viewattachment.php b/viewattachment.php index 8548999..4a1bb8d 100755 --- a/viewattachment.php +++ b/viewattachment.php @@ -48,7 +48,7 @@ ob_clean(); ob_end_clean(); // only allow certain images to be displayed inline because all other types are a potential XSS issue waiting to happen -if (in_array(strtolower($funct->fetch_extension($attachment['filename'])), array('jpg', 'jpeg', 'png', 'gif'))) +if (in_array(strtolower(BSFunctions::fetch_extension($attachment['filename'])), array('jpg', 'jpeg', 'png', 'gif'))) { header("Content-Disposition: inline; filename=$attachment[filename]"); header("Content-transfer-encoding: binary"); -- 2.43.5