X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fcommon.php;h=4592fd15a59c266f704927b43402b90b7c217a05;hb=fb4b004435403dd0d4126a0c11c9fa5c557e9dba;hp=08779fb6fd82cd0141f8c5f10d93fe14078ef42a;hpb=6fa0bea76db45454071a08b12664d9f25fea5ca5;p=quix0rs-gnu-social.git diff --git a/lib/common.php b/lib/common.php index 08779fb6fd..4592fd15a5 100644 --- a/lib/common.php +++ b/lib/common.php @@ -1,7 +1,7 @@ isDisabled(); // don't need to check this now - } catch (ReflectionException $e) { - // Ok, it *really* doesn't exist! - 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 - -require_once(INSTALLDIR.'/lib/language.php'); - -// This gets included before the config file, so that admin code and plugins -// can use it - -require_once(INSTALLDIR.'/lib/event.php'); -require_once(INSTALLDIR.'/lib/plugin.php'); - -function addPlugin($name, $attrs = null) -{ - return StatusNet::addPlugin($name, $attrs); -} - -function _have_config() -{ - return StatusNet::haveConfig(); -} - -/** - * Wrapper for class autoloaders. - * This used to be the special function name __autoload(), but that causes bugs with PHPUnit 3.5+ - */ -function autoload_sn($cls) -{ - if (file_exists(INSTALLDIR.'/classes/' . $cls . '.php')) { - require_once(INSTALLDIR.'/classes/' . $cls . '.php'); - } else if (file_exists(INSTALLDIR.'/lib/' . strtolower($cls) . '.php')) { - require_once(INSTALLDIR.'/lib/' . strtolower($cls) . '.php'); - } else if (mb_substr($cls, -6) == 'Action' && - file_exists(INSTALLDIR.'/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php')) { - require_once(INSTALLDIR.'/actions/' . strtolower(mb_substr($cls, 0, -6)) . '.php'); - } else if ($cls == 'OAuthRequest') { - require_once('OAuth.php'); - } else { - Event::handle('Autoload', array(&$cls)); - } -} - -spl_autoload_register('autoload_sn'); - -// XXX: how many of these could be auto-loaded on use? -// XXX: note that these files should not use config options -// at compile time since DB config options are not yet loaded. - -require_once 'Validate.php'; -require_once 'markdown.php'; - -// XXX: other formats here - -/** - * Avoid the NICKNAME_FMT constant; use the Nickname class instead. - * - * Nickname::DISPLAY_FMT is more suitable for inserting into regexes; - * note that it includes the [] and repeating bits, so should be wrapped - * directly in a capture paren usually. - * - * For validation, use Nickname::normalize(), Nickname::isValid() etc. - * - * @deprecated - */ -define('NICKNAME_FMT', VALIDATE_NUM.VALIDATE_ALPHA_LOWER); - -require_once INSTALLDIR.'/lib/util.php'; -require_once INSTALLDIR.'/lib/action.php'; -require_once INSTALLDIR.'/lib/mail.php'; -require_once INSTALLDIR.'/lib/subs.php'; - -require_once INSTALLDIR.'/lib/clientexception.php'; -require_once INSTALLDIR.'/lib/serverexception.php'; +// All the fun stuff to actually initialize StatusNet's framework code, +// without loading up a site configuration. +require_once INSTALLDIR . '/lib/framework.php'; try { StatusNet::init(@$server, @$path, @$conffile);