예제 #1
0
파일: common.php 프로젝트: himmelex/NTW
                    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';
// XXX: other formats here
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';
try {
    StatusNet::init(@$server, @$path, @$conffile);
} catch (NoConfigException $e) {
    // XXX: Throw a conniption if database not installed
    // XXX: Find a way to use htmlwriter for this instead of handcoded markup
    echo '<p>' . _('No configuration file found. ') . '</p>';
    echo '<p>' . _('I looked for configuration files in the following places: ') . '<br/> ';
    echo implode($e->configFiles, '<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;
}
예제 #2
0
        break;
    case 'invite':
        $reminders[] = $types['invite'];
        break;
    case 'all':
        $reminders = $types;
        break;
}
if (have_option('u', 'universe')) {
    $sn = new Status_network();
    try {
        if ($sn->find()) {
            while ($sn->fetch()) {
                try {
                    $server = $sn->getServerName();
                    StatusNet::init($server);
                    // Different queue manager, maybe!
                    $qm = QueueManager::get();
                    foreach ($reminders as $reminder) {
                        extract($reminder);
                        $qm->enqueue(array($type, $opts), 'siterem');
                        if (!$quiet) {
                            print "Sent pending {$type} reminders for {$server}.\n";
                        }
                    }
                } catch (Exception $e) {
                    // keep going
                    common_log(LOG_ERR, "Couldn't init {$server}.\n", __FILE__);
                    if (!$quiet) {
                        print "Couldn't init {$server}.\n";
                    }
예제 #3
0
 /**
  * Change site configuration to site specified by nickname,
  * if set up via Status_network. If not, sites other than
  * the current will fail horribly.
  *
  * May throw exception or trigger a fatal error if the given
  * site is missing or configured incorrectly.
  *
  * @param string $nickname
  */
 public static function switchSite($nickname)
 {
     if ($nickname == StatusNet::currentSite()) {
         return true;
     }
     $sn = Status_network::staticGet('nickname', $nickname);
     if (empty($sn)) {
         return false;
         throw new Exception("No such site nickname '{$nickname}'");
     }
     $server = $sn->getServerName();
     StatusNet::init($server);
 }