]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/common.php
Merge branch 'admin-sections/4' into 0.9.x
[quix0rs-gnu-social.git] / lib / common.php
index ce33c871bfb15b83d1c0e4b207952c8a7b61cb54..732c22bfdf6d641fa13f8daf1978d4f7760f52f4 100644 (file)
@@ -19,6 +19,9 @@
 
 if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
 
+//exit with 200 response, if this is checking fancy from the installer
+if (isset($_REQUEST['p']) && $_REQUEST['p'] == 'check-fancy') {  exit; } 
+
 define('STATUSNET_VERSION', '0.9.0dev');
 define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility
 
@@ -38,22 +41,24 @@ define('FOREIGN_NOTICE_SEND_REPLY', 4);
 define('FOREIGN_FRIEND_SEND', 1);
 define('FOREIGN_FRIEND_RECV', 2);
 
-define_syslog_variables();
-
 # append our extlib dir as the last-resort place to find libs
 
 set_include_path(get_include_path() . PATH_SEPARATOR . INSTALLDIR . '/extlib/');
 
+# To protect against upstream libraries which haven't updated
+# for PHP 5.3 where dl() function may not be present...
+if (!function_exists('dl')) {
+    function dl($library) {
+        return false;
+    }
+}
+
 # global configuration object
 
 require_once('PEAR.php');
 require_once('DB/DataObject.php');
 require_once('DB/DataObject/Cast.php'); # for dates
 
-if (!function_exists('gettext')) {
-    require_once("php-gettext/gettext.inc");
-}
-
 require_once(INSTALLDIR.'/lib/language.php');
 
 // This gets included before the config file, so that admin code and plugins
@@ -74,6 +79,9 @@ function _sn_to_path($sn)
     return $p;
 }
 
+// Save our sanity when code gets loaded through subroutines such as PHPUnit tests
+global $default, $config, $_server, $_path;
+
 // try to figure out where we are. $server and $path
 // can be set by including module, else we guess based
 // on HTTP info.
@@ -169,6 +177,7 @@ if (isset($conffile)) {
     $_config_files[] = INSTALLDIR.'/config.php';
 }
 
+global $_have_a_config;
 $_have_a_config = false;
 
 foreach ($_config_files as $_config_file) {
@@ -185,7 +194,14 @@ function _have_config()
 }
 
 // XXX: Throw a conniption if database not installed
-
+// XXX: Find a way to use htmlwriter for this instead of handcoded markup
+if (!_have_config()) {
+  echo '<p>'. _('No configuration file found. ') .'</p>';
+  echo '<p>'. _('I looked for configuration files in the following places: ') .'<br/> '. implode($_config_files, '<br/>');
+  echo '<p>'. _('You may wish to run the installer to fix this.') .'</p>';
+  echo '<a href="install.php">'. _('Go to the installer.') .'</a>';
+  exit;
+}
 // Fixup for statusnet.ini
 
 $_db_name = substr($config['db']['database'], strrpos($config['db']['database'], '/') + 1);
@@ -219,11 +235,8 @@ require_once 'markdown.php';
 
 require_once INSTALLDIR.'/lib/util.php';
 require_once INSTALLDIR.'/lib/action.php';
-require_once INSTALLDIR.'/lib/theme.php';
 require_once INSTALLDIR.'/lib/mail.php';
 require_once INSTALLDIR.'/lib/subs.php';
-require_once INSTALLDIR.'/lib/Shorturl_api.php';
-require_once INSTALLDIR.'/lib/twitter.php';
 
 require_once INSTALLDIR.'/lib/clientexception.php';
 require_once INSTALLDIR.'/lib/serverexception.php';