Example #1
0
<?php

if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) {
    print "This script must be run from the command line\n";
    exit;
}
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
define('GNUSOCIAL', true);
define('STATUSNET', true);
// compatibility
require_once INSTALLDIR . '/lib/common.php';
// Make sure this is loaded
// XXX: how to test other plugins...?
addPlugin('Geonames');
class LocationTest extends PHPUnit_Framework_TestCase
{
    /**
     * @dataProvider locationNames
     */
    public function testLocationFromName($name, $language, $location)
    {
        $result = Location::fromName($name, $language);
        $this->assertEquals($result, $location);
    }
    public static function locationNames()
    {
        return array(array('Montreal', 'en', null), array('San Francisco, CA', 'en', null), array('Paris, France', 'en', null), array('Paris, Texas', 'en', null));
    }
    /**
     * @dataProvider locationIds
     */
Example #2
0
$config['db']['type'] = 'mysql';
$config['site']['profile'] = 'public';
$config['attachments']['uploads'] = true;
$config['attachments']['supported'] = true;
//allow all file types to be uploaded
$config['attachments']['file_quota'] = 5000000;
$config['attachments']['user_quota'] = 50000000;
$config['attachments']['monthly_quota'] = 15000000;
$config['attachments']['path'] = $config['site']['path'] . "/file/";
//ignored if site is private
$config['attachments']['dir'] = INSTALLDIR . '/file/';
addPlugin('ApiAccount');
addPlugin('ApiMessageBox');
addPlugin('InProcessCache');
addPlugin('Memcache', array('servers' => '127.0.0.1:11211'));
addPlugin('ApiComments');
addPlugin('ApiSuggestions');
addPlugin('ApiDataMigration');
unset($config['plugins']['default']['Mapstraction']);
unset($config['plugins']['default']['OpenID']);
unset($config['plugins']['default']['RSSCloud']);
unset($config['plugins']['default']['WikiHashtags']);
unset($config['plugins']['default']['TightUrl']);
unset($config['plugins']['default']['SimpleUrl']);
unset($config['plugins']['default']['PtitUrl']);
unset($config['plugins']['default']['Geonames']);
unset($config['plugins']['default']['Bookmark']);
unset($config['plugins']['default']['Poll']);
unset($config['plugins']['default']['QnA']);
unset($config['plugins']['default']['Event']);
$config['db']['schemacheck'] = 'script';
Example #3
0
 /**
  * Load the default or specified configuration file.
  * Modifies global $config and may establish plugins.
  *
  * @throws NoConfigException
  */
 protected function loadConfigFile($conffile = null)
 {
     global $_server, $_path, $config;
     // From most general to most specific:
     // server-wide, then vhost-wide, then for a path,
     // finally for a dir (usually only need one of the last two).
     if (isset($conffile)) {
         $config_files = array($conffile);
     } else {
         $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';
         }
         $config_files[] = INSTALLDIR . '/config.php';
     }
     self::$have_config = false;
     foreach ($config_files as $_config_file) {
         if (@file_exists($_config_file)) {
             // Ignore 0-byte config files
             if (filesize($_config_file) > 0) {
                 include $_config_file;
                 self::$have_config = true;
             }
         }
     }
     if (!self::$have_config) {
         throw new NoConfigException("No configuration file found.", $config_files);
     }
     // Fixup for statusnet.ini
     $_db_name = substr($config['db']['database'], strrpos($config['db']['database'], '/') + 1);
     if ($_db_name != 'statusnet' && !array_key_exists('ini_' . $_db_name, $config['db'])) {
         $config['db']['ini_' . $_db_name] = INSTALLDIR . '/classes/statusnet.ini';
     }
     // Backwards compatibility
     if (array_key_exists('memcached', $config)) {
         if ($config['memcached']['enabled']) {
             addPlugin('Memcache', array('servers' => $config['memcached']['server']));
         }
         if (!empty($config['memcached']['base'])) {
             $config['cache']['base'] = $config['memcached']['base'];
         }
     }
 }
Example #4
0
    -x --extensions=     Comma-separated list of plugins to load before checking


END_OF_CHECKSCHEMA_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
function tableDefs()
{
    $schema = array();
    require INSTALLDIR . '/db/core.php';
    return $schema;
}
$schema = Schema::get();
$schemaUpdater = new SchemaUpdater($schema);
foreach (tableDefs() as $table => $def) {
    $schemaUpdater->register($table, $def);
}
$schemaUpdater->checkSchema();
if (have_option('x', 'extensions')) {
    $ext = trim(get_option_value('x', 'extensions'));
    $exts = explode(',', $ext);
    foreach ($exts as $plugin) {
        try {
            addPlugin($plugin);
        } catch (Exception $e) {
            print $e->getMessage() . "\n";
            exit(1);
        }
    }
}
Event::handle('CheckSchema');
Example #5
0
 /**
  * Load the default or specified configuration file.
  * Modifies global $config and may establish plugins.
  *
  * @throws NoConfigException
  */
 protected function loadConfigFile($conffile = null)
 {
     global $_server, $_path, $config;
     // From most general to most specific:
     // server-wide, then vhost-wide, then for a path,
     // finally for a dir (usually only need one of the last two).
     if (isset($conffile)) {
         $config_files = array($conffile);
     } else {
         $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';
         }
         $config_files[] = INSTALLDIR . '/config.php';
     }
     self::$have_config = false;
     foreach ($config_files as $_config_file) {
         if (@file_exists($_config_file)) {
             // Ignore 0-byte config files
             if (filesize($_config_file) > 0) {
                 common_log(LOG_INFO, "Including config file: " . $_config_file);
                 include $_config_file;
                 self::$have_config = true;
             }
         }
     }
     if (!self::$have_config) {
         throw new NoConfigException("No configuration file found.", $config_files);
     }
     // Backwards compatibility
     if (array_key_exists('memcached', $config)) {
         if ($config['memcached']['enabled']) {
             addPlugin('Memcache', array('servers' => $config['memcached']['server']));
         }
         if (!empty($config['memcached']['base'])) {
             $config['cache']['base'] = $config['memcached']['base'];
         }
     }
     if (array_key_exists('xmpp', $config)) {
         if ($config['xmpp']['enabled']) {
             addPlugin('xmpp', array('server' => $config['xmpp']['server'], 'port' => $config['xmpp']['port'], 'user' => $config['xmpp']['user'], 'resource' => $config['xmpp']['resource'], 'encryption' => $config['xmpp']['encryption'], 'password' => $config['xmpp']['password'], 'host' => $config['xmpp']['host'], 'debug' => $config['xmpp']['debug'], 'public' => $config['xmpp']['public']));
         }
     }
     // Check for database server; must exist!
     if (empty($config['db']['database'])) {
         throw new ServerException("No database server for this site.");
     }
 }
 */
if (!defined('GNUSOCIAL')) {
    exit(1);
}
/**
 * Diaspora federation protocol plugin for GNU Social
 *
 * Depends on:
 *  - OStatus plugin
 *  - WebFinger plugin
 *
 * @package ProtocolDiasporaPlugin
 * @maintainer Mikael Nordfeldth <*****@*****.**>
 */
// Depends on OStatus of course.
addPlugin('OStatus');
//Since Magicsig hasn't loaded yet
require_once 'Crypt/AES.php';
class DiasporaPlugin extends Plugin
{
    const REL_SEED_LOCATION = 'http://joindiaspora.com/seed_location';
    const REL_GUID = 'http://joindiaspora.com/guid';
    const REL_PUBLIC_KEY = 'diaspora-public-key';
    public function onEndAttachPubkeyToUserXRD(Magicsig $magicsig, XML_XRD $xrd, Profile $target)
    {
        // So far we've only handled RSA keys, but it can change in the future,
        // so be prepared. And remember to change the statically assigned type attribute below!
        assert($magicsig->publicKey instanceof Crypt_RSA);
        $xrd->links[] = new XML_XRD_Element_Link(self::REL_PUBLIC_KEY, base64_encode($magicsig->exportPublicKey()), 'RSA');
        // Instead of choosing a random string, we calculate our GUID from the public key
        // by fingerprint through a sha256 hash.
Example #7
0
<?php

if (!defined('GNUSOCIAL')) {
    exit(1);
}
$config['site']['name'] = 'Realm of Espionage';
$config['site']['server'] = 'www.realmofespionage.com';
$config['site']['path'] = 'social';
$config['site']['fancy'] = true;
$config['site']['ssl'] = 'always';
$config['db']['database'] = 'mysqli://*****:*****@192.168.1.154/gnusocial';
$config['db']['type'] = 'mysql';
// Uncomment below for better performance. Just remember you must run
// php scripts/checkschema.php whenever your enabled plugins change!
$config['db']['schemacheck'] = 'script';
$config['site']['profile'] = 'community';
$config['mail']['domain'] = 'realmofespionage.com';
$config['mail']['notifyfrom'] = '*****@*****.**';
$config['mail']['backend'] = 'smtp';
$config['mail']['params'] = array('host' => 'smtp.sendgrid.net', 'port' => 587, 'auth' => true, 'username' => 'Espionage724', 'password' => 'x');
addPlugin('EmailRegistration');
addPlugin("GeoURL");
addPlugin("ModPlus");
addPlugin("ChooseTheme");