]> jfr.im git - irc/h9k/magirc.git/commitdiff
Include port number in base url for servers with non-standard ports
authorHal9000 <redacted>
Mon, 11 Jun 2012 11:25:22 +0000 (13:25 +0200)
committerHal9000 <redacted>
Mon, 11 Jun 2012 11:25:22 +0000 (13:25 +0200)
admin/index.php
index.php
lib/magirc/Magirc.class.php
lib/magirc/denora/Denora.class.php
rest/denora.php
setup/index.php

index 4d9f6e45a4a9af748cf5c11b99bac394293e574a..d3807ad501cbfacbc3f2f79a35493e59e12000cd 100644 (file)
@@ -7,7 +7,7 @@
  * @copyright   2012 Sebastian Vassiliou
  * @link        http://www.magirc.org/
  * @license     GNU GPL Version 3, see http://www.gnu.org/licenses/gpl-3.0-standalone.html
- * @version     0.8.3
+ * @version     0.8.4
  */
 
 ini_set('display_errors','on');
@@ -27,7 +27,7 @@ require_once('../lib/magirc/Config.class.php');
 include_once('../lib/ckeditor/ckeditor.php');
 require_once('lib/Admin.class.php');
 
-define('BASE_URL', sprintf("%s://%s%s", @$_SERVER['HTTPS'] ? 'https' : 'http', $_SERVER['SERVER_NAME'], str_replace('index.php', '', $_SERVER['SCRIPT_NAME'])));
+define('BASE_URL', sprintf("%s://%s:%s%s", @$_SERVER['HTTPS'] ? 'https' : 'http', $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], str_replace('index.php', '', $_SERVER['SCRIPT_NAME'])));
 $admin = new Admin();
 
 try {
index 1985649b4002bf3b92e3d005c29abe1b9e99b441..eeaa2378567687d4dfe2cdb98e5275afede19150 100644 (file)
--- a/index.php
+++ b/index.php
@@ -7,7 +7,7 @@
  * @copyright   2012 Sebastian Vassiliou
  * @link        http://www.magirc.org/
  * @license     GNU GPL Version 3, see http://www.gnu.org/licenses/gpl-3.0-standalone.html
- * @version     0.8.3
+ * @version     0.8.4
  */
 
 ini_set('display_errors','on');
@@ -30,7 +30,7 @@ $magirc = new Magirc;
 
 try {
        define('DEBUG', $magirc->cfg->debug_mode);
-       define('BASE_URL', sprintf("%s://%s%s", @$_SERVER['HTTPS'] ? 'https' : 'http', $_SERVER['SERVER_NAME'], str_replace('index.php', '', $_SERVER['SCRIPT_NAME'])));
+       define('BASE_URL', sprintf("%s://%s:%s%s", @$_SERVER['HTTPS'] ? 'https' : 'http', $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], str_replace('index.php', '', $_SERVER['SCRIPT_NAME'])));
        $magirc->tpl->template_dir = 'theme/'.$magirc->cfg->theme.'/tpl';
        $magirc->tpl->config_dir = 'theme/'.$magirc->cfg->theme.'/cfg';
        $magirc->tpl->assign('cfg', $magirc->cfg);
index 2c6e9d8f6437567e32086b275a1448f6d7a1c9e7..112911b0eed7e302ca87edcf965eb811e70ebc62 100644 (file)
@@ -8,13 +8,14 @@ class Magirc_DB extends DB {
 
        public static function getInstance() {
                if (is_null(self::$instance) === true) {
+                       $db = null;
                        $error = false;
                        if (file_exists(PATH_ROOT.'conf/magirc.cfg.php')) {
                                include(PATH_ROOT.'conf/magirc.cfg.php');
                        } else {
                                $error = true;
                        }
-                       if (!isset($db)) {
+                       if (!is_array($db)) {
                                $error = true;
                        }
                        if ($error) {
index bb8755d56eb56ce204df3f49830511267d06aa9a..4ddd1c0cf16a5f494bbf8c66d69f0cfdd48d4748 100644 (file)
@@ -7,6 +7,7 @@ class Denora_DB extends DB {
        public static function getInstance() {
                if (is_null(self::$instance) === true) {
                        // Check the database configuration
+                       $db = null;
                        $error = false;
                        $config_file = PATH_ROOT . 'conf/denora.cfg.php';
                        if (file_exists($config_file)) {
@@ -14,7 +15,7 @@ class Denora_DB extends DB {
                        } else {
                                $error = true;
                        }
-                       if ($error || !isset($db)) {
+                       if ($error || !is_array($db)) {
                                die('<strong>MagIRC</strong> is not properly configured<br />Please configure the Denora database in the <a href="admin/">Admin Panel</a>');
                        }
                        $dsn = "mysql:dbname={$db['database']};host={$db['hostname']}";
@@ -231,6 +232,7 @@ class Denora {
                $clients = array();
                foreach ($result as $client) {
                        // Determine client name and version
+                       $matches = array();
                        preg_match('/^(.*?)\s*(\S*\d\S*)/', str_replace(array('(',')','[',']','{','}'), '', $client['client']), $matches);
                        if (count($matches) == 3) {
                                $name = $matches[1];
@@ -259,6 +261,7 @@ class Denora {
                });
                foreach ($clients as $key => $val) {
                        arsort($clients[$key]['versions']);
+                       unset($val);
                }
 
                // Prepare data for output
@@ -412,7 +415,6 @@ class Denora {
         * @return array of Channel
         */
        function getChannelList($datatables = false) {
-               $aaData = array();
                $secret_mode = Protocol::chan_secret_mode;
                $private_mode = Protocol::chan_private_mode;
 
index e6d740929d275b8453687438e517ee9d0d39343f..60cff55de60aadf7d944f0b0b8f7c33b513417f6 100644 (file)
@@ -7,7 +7,7 @@
  * @copyright   2012 Sebastian Vassiliou
  * @link        http://www.magirc.org/
  * @license     GNU GPL Version 3, see http://www.gnu.org/licenses/gpl-3.0-standalone.html
- * @version     0.8.3
+ * @version     0.8.4
  **/
 
 include_once('../lib/magirc/version.inc.php');
index c75ece0550efe116a27709a5c9545a61635321f3..3ee6f12b04c4f244696727e3550c3acdb326fc01 100644 (file)
@@ -7,7 +7,7 @@
  * @copyright   2012 Sebastian Vassiliou
  * @link        http://www.magirc.org/
  * @license     GNU GPL Version 3, see http://www.gnu.org/licenses/gpl-3.0-standalone.html
- * @version     0.8.3
+ * @version     0.8.4
  */
 
 ini_set('display_errors','off');