X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fcommon.php;h=194eb568f7d1a0ff2b7525599fd196443ee0bd78;hb=9235c1437e542d2b565d2d2d36fe2b7561e4d5f7;hp=be30519f47409bb7e7eefa6ae92e60379e9b7910;hpb=91cba7a76f97a1669cbe9a2c2fa1b3e653786f26;p=quix0rs-gnu-social.git diff --git a/lib/common.php b/lib/common.php index be30519f47..194eb568f7 100644 --- a/lib/common.php +++ b/lib/common.php @@ -1,7 +1,7 @@ . */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } -define('LACONICA_VERSION', '0.8.1dev'); +define('STATUSNET_VERSION', '0.9.0dev'); +define('LACONICA_VERSION', STATUSNET_VERSION); // compatibility + +define('STATUSNET_CODENAME', 'Stand'); define('AVATAR_PROFILE_SIZE', 96); define('AVATAR_STREAM_SIZE', 48); @@ -47,6 +50,9 @@ 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 @@ -82,7 +88,7 @@ if (isset($server)) { if (isset($path)) { $_path = $path; } else { - $_path = array_key_exists('SCRIPT_NAME', $_SERVER) ? + $_path = (array_key_exists('SERVER_NAME', $_SERVER) && array_key_exists('SCRIPT_NAME', $_SERVER)) ? _sn_to_path($_SERVER['SCRIPT_NAME']) : null; } @@ -91,7 +97,7 @@ if (isset($path)) { $config = array('site' => - array('name' => 'Just another Laconica microblog', + array('name' => 'Just another StatusNet microblog', 'server' => $_server, 'theme' => 'default', 'path' => $_path, @@ -113,16 +119,18 @@ $config = 'ssl' => 'never', 'sslserver' => null, 'shorturllength' => 30, - 'dupelimit' => 60), # default for same person saying the same thing + 'dupelimit' => 60, # default for same person saying the same thing + 'textlimit' => 140, + ), 'syslog' => - array('appname' => 'laconica', # for syslog + array('appname' => 'statusnet', # for syslog 'priority' => 'debug', # XXX: currently ignored 'facility' => LOG_USER), 'queue' => array('enabled' => false, 'subsystem' => 'db', # default to database, or 'stomp' 'stomp_server' => null, - 'queue_basename' => 'laconica', + 'queue_basename' => 'statusnet', 'stomp_username' => null, 'stomp_password' => null, ), @@ -137,7 +145,8 @@ $config = array('blacklist' => array(), 'featured' => array()), 'profile' => - array('banned' => array()), + array('banned' => array(), + 'biolimit' => null), 'avatar' => array('server' => null, 'dir' => INSTALLDIR . '/avatar/', @@ -192,8 +201,11 @@ $config = 'twitterbridge' => array('enabled' => false), 'integration' => - array('source' => 'Laconica', # source attribute for Twitter + array('source' => 'StatusNet', # source attribute for Twitter 'taguri' => $_server.',2009'), # base for tag URIs + 'twitter' => + array('consumer_key' => null, + 'consumer_secret' => null), 'memcached' => array('enabled' => false, 'server' => 'localhost', @@ -209,7 +221,7 @@ $config = 'snapshot' => array('run' => 'web', 'frequency' => 10000, - 'reporturl' => 'http://laconi.ca/stats/report'), + 'reporturl' => 'http://status.net/stats/report'), 'attachments' => array('server' => null, 'dir' => INSTALLDIR . '/file/', @@ -252,7 +264,8 @@ $config = 'filecommand' => '/usr/bin/file', ), 'group' => - array('maxaliases' => 3), + array('maxaliases' => 3, + 'desclimit' => null), 'oohembed' => array('endpoint' => 'http://oohembed.com/oohembed/'), 'search' => array('type' => 'fulltext'), @@ -267,6 +280,12 @@ $config = 'linkcolor' => null, 'backgroundimage' => null, 'disposition' => null), + 'notice' => + array('contentlimit' => null), + 'message' => + array('contentlimit' => null), + 'http' => + array('client' => 'curl'), // XXX: should this be the default? ); $config['db'] = &PEAR::getStaticProperty('DB_DataObject','options'); @@ -332,10 +351,14 @@ function addPlugin($name, $attrs = null) if (isset($conffile)) { $_config_files = array($conffile); } else { - $_config_files = array('/etc/laconica/laconica.php', + $_config_files = array('/etc/statusnet/statusnet.php', + '/etc/statusnet/laconica.php', + '/etc/laconica/laconica.php', + '/etc/statusnet/'.$_server.'.php', '/etc/laconica/'.$_server.'.php'); if (strlen($_path) > 0) { + $_config_files[] = '/etc/statusnet/'.$_server.'_'.$_path.'.php'; $_config_files[] = '/etc/laconica/'.$_server.'_'.$_path.'.php'; } @@ -359,15 +382,33 @@ function _have_config() // XXX: Throw a conniption if database not installed -// Fixup for laconica.ini +// Fixup for statusnet.ini $_db_name = substr($config['db']['database'], strrpos($config['db']['database'], '/') + 1); -if ($_db_name != 'laconica' && !array_key_exists('ini_'.$_db_name, $config['db'])) { - $config['db']['ini_'.$_db_name] = INSTALLDIR.'/classes/laconica.ini'; +if ($_db_name != 'statusnet' && !array_key_exists('ini_'.$_db_name, $config['db'])) { + $config['db']['ini_'.$_db_name] = INSTALLDIR.'/classes/statusnet.ini'; +} + +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'; @@ -383,24 +424,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($class) -{ - if ($class == 'OAuthRequest') { - require_once('OAuth.php'); - } else if (file_exists(INSTALLDIR.'/classes/' . $class . '.php')) { - require_once(INSTALLDIR.'/classes/' . $class . '.php'); - } else if (file_exists(INSTALLDIR.'/lib/' . strtolower($class) . '.php')) { - require_once(INSTALLDIR.'/lib/' . strtolower($class) . '.php'); - } else if (mb_substr($class, -6) == 'Action' && - file_exists(INSTALLDIR.'/actions/' . strtolower(mb_substr($class, 0, -6)) . '.php')) { - require_once(INSTALLDIR.'/actions/' . strtolower(mb_substr($class, 0, -6)) . '.php'); - } -} - // Give plugins a chance to initialize in a fully-prepared environment Event::handle('InitializePlugin');