Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/HuasoFoundries/phpPgAdmin6.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/classes/Misc.php')
-rw-r--r--src/classes/Misc.php75
1 files changed, 15 insertions, 60 deletions
diff --git a/src/classes/Misc.php b/src/classes/Misc.php
index c364f895..a5c5e554 100644
--- a/src/classes/Misc.php
+++ b/src/classes/Misc.php
@@ -1,7 +1,7 @@
<?php
/**
- * PHPPgAdmin v6.0.0-RC2
+ * PHPPgAdmin v6.0.0-RC1.
*/
namespace PHPPgAdmin;
@@ -11,16 +11,12 @@ namespace PHPPgAdmin;
* Class to hold various commonly used functions
*
* Id: Misc.php,v 1.171 2008/03/17 21:35:48 ioguix Exp $
- *
- * @package PHPPgAdmin
*/
/**
* Class to hold various commonly used functions.
*
* Release: Misc.php,v 1.171 2008/03/17 21:35:48 ioguix Exp $
- *
- * @package PHPPgAdmin
*/
class Misc
{
@@ -112,7 +108,7 @@ class Misc
if (count($this->conf['servers']) === 1) {
$info = $this->conf['servers'][0];
- $this->_server_id = sha1($info['host'].':'.$info['port'].':'.$info['sslmode']);
+ $this->_server_id = sha1($info['host'] . ':' . $info['port'] . ':' . $info['sslmode']);
} elseif ($request_server !== null) {
$this->_server_id = $request_server;
} elseif (isset($_SESSION['webdbLogin']) && count($_SESSION['webdbLogin']) > 0) {
@@ -182,8 +178,8 @@ class Misc
{
if ($help !== null) {
$helplink = $this->getHelpLink($help);
- $str .= '<a class="help" href="'.$helplink.'" title="'.$this->lang['strhelp'].'" target="phppgadminhelp">';
- $str .= $this->lang['strhelpicon'].'</a>';
+ $str .= '<a class="help" href="' . $helplink . '" title="' . $this->lang['strhelp'] . '" target="phppgadminhelp">';
+ $str .= $this->lang['strhelpicon'] . '</a>';
}
if ($do_print) {
echo $str;
@@ -201,7 +197,7 @@ class Misc
*/
public function getHelpLink($help)
{
- return htmlspecialchars(SUBFOLDER.'/help?help='.urlencode($help).'&server='.urlencode($this->getServerId()));
+ return htmlspecialchars(SUBFOLDER . '/help?help=' . urlencode($help) . '&server=' . urlencode($this->getServerId()));
}
/**
@@ -332,7 +328,7 @@ class Misc
return null;
}
- $_type = '\PHPPgAdmin\Database\\'.$_type;
+ $_type = '\PHPPgAdmin\Database\\' . $_type;
$this->prtrace('driver:', $_type);
@@ -454,7 +450,7 @@ class Misc
// Otherwise, look for it in the conf file
foreach ($this->conf['servers'] as $idx => $info) {
- $server_string = $info['host'].':'.$info['port'].':'.$info['sslmode'];
+ $server_string = $info['host'] . ':' . $info['port'] . ':' . $info['sslmode'];
$server_sha = sha1($server_string);
if ($this->_server_id === $server_string ||
@@ -609,13 +605,13 @@ class Misc
$schema = $this->container->schema || isset($_REQUEST['schema']) ? $_REQUEST['schema'] : null;
if ($server && $exclude_from !== 'server') {
- $href[] = 'server='.urlencode($server);
+ $href[] = 'server=' . urlencode($server);
}
if ($database && $exclude_from !== 'database') {
- $href[] = 'database='.urlencode($database);
+ $href[] = 'database=' . urlencode($database);
}
if ($schema && $exclude_from !== 'schema') {
- $href[] = 'schema='.urlencode($schema);
+ $href[] = 'schema=' . urlencode($schema);
}
$this->href = htmlentities(implode('&', $href));
@@ -630,14 +626,14 @@ class Misc
{
$form = [];
if ($this->container->server) {
- $form[] = '<input type="hidden" name="server" value="'.htmlspecialchars($this->container->server).'" />';
+ $form[] = '<input type="hidden" name="server" value="' . htmlspecialchars($this->container->server) . '" />';
}
if ($this->container->database) {
- $form[] = '<input type="hidden" name="database" value="'.htmlspecialchars($this->container->database).'" />';
+ $form[] = '<input type="hidden" name="database" value="' . htmlspecialchars($this->container->database) . '" />';
}
if ($this->container->schema) {
- $form[] = '<input type="hidden" name="schema" value="'.htmlspecialchars($this->container->schema).'" />';
+ $form[] = '<input type="hidden" name="schema" value="' . htmlspecialchars($this->container->schema) . '" />';
}
$this->form = implode("\n", $form);
@@ -729,49 +725,8 @@ class Misc
public function icon($icon)
{
- if (is_string($icon)) {
- $path = "/assets/images/themes/{$this->conf['theme']}/{$icon}";
- if (file_exists(\BASE_PATH.$path.'.png')) {
- return SUBFOLDER.$path.'.png';
- }
-
- if (file_exists(\BASE_PATH.$path.'.gif')) {
- return SUBFOLDER.$path.'.gif';
- }
-
- if (file_exists(\BASE_PATH.$path.'.ico')) {
- return SUBFOLDER.$path.'.ico';
- }
-
- $path = "/assets/images/themes/default/{$icon}";
- if (file_exists(\BASE_PATH.$path.'.png')) {
- return SUBFOLDER.$path.'.png';
- }
-
- if (file_exists(\BASE_PATH.$path.'.gif')) {
- return SUBFOLDER.$path.'.gif';
- }
-
- if (file_exists(\BASE_PATH.$path.'.ico')) {
- return SUBFOLDER.$path.'.ico';
- }
- } else {
- // Icon from plugins
- $path = "/plugins/{$icon[0]}/images/{$icon[1]}";
- if (file_exists(\BASE_PATH.$path.'.png')) {
- return SUBFOLDER.$path.'.png';
- }
-
- if (file_exists(\BASE_PATH.$path.'.gif')) {
- return SUBFOLDER.$path.'.gif';
- }
-
- if (file_exists(\BASE_PATH.$path.'.ico')) {
- return SUBFOLDER.$path.'.ico';
- }
- }
+ return $this->container->utils->icon($icon);
- return '';
}
/**
@@ -814,7 +769,7 @@ class Misc
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$data->fieldClean($str);
- return '"'.$str.'"';
+ return '"' . $str . '"';
}
return escapeshellcmd($str);