diff options
author | Evan Prodromou <evan@controlyourself.ca> | 2009-08-21 16:17:06 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlyourself.ca> | 2009-08-21 16:17:06 -0400 |
commit | 8236037bf0bff51d4bc623646454f39eec4bc6ec (patch) | |
tree | ea895bd201a379e7cda2a7587ec862c46aeb3408 /lib | |
parent | b2664e1ae2e2cf66585cdd8696d88efdd053eb3b (diff) | |
parent | 538dcf2eefd2742f698cb812ae90c10971ef5e75 (diff) |
Merge branch 'dbconfig' into 0.9.x
Conflicts:
lib/common.php
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common.php | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/lib/common.php b/lib/common.php index 84ee5be15..067a5a2a6 100644 --- a/lib/common.php +++ b/lib/common.php @@ -21,6 +21,8 @@ if (!defined('LACONICA')) { exit(1); } define('LACONICA_VERSION', '0.9.0dev'); +// XXX: move these to class variables + define('AVATAR_PROFILE_SIZE', 96); define('AVATAR_STREAM_SIZE', 48); define('AVATAR_MINI_SIZE', 24); @@ -387,7 +389,25 @@ if (!$config['openid']['enabled']) { $config['site']['openidonly'] = false; } +function __autoload($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)); + } +} + // 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'; @@ -403,26 +423,14 @@ require_once INSTALLDIR.'/lib/twitter.php'; require_once INSTALLDIR.'/lib/clientexception.php'; require_once INSTALLDIR.'/lib/serverexception.php'; +// Load settings from database; note we need autoload for this + +Config::loadSettings(); + // XXX: other formats here define('NICKNAME_FMT', VALIDATE_NUM.VALIDATE_ALPHA_LOWER); -function __autoload($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)); - } -} - // Give plugins a chance to initialize in a fully-prepared environment Event::handle('InitializePlugin'); |