}
if (array_key_exists(session_name(), $_GET)) {
$id = $_GET[session_name()];
- common_log(LOG_INFO, 'Setting session from GET parameter: '.$id);
} else if (array_key_exists(session_name(), $_COOKIE)) {
$id = $_COOKIE[session_name()];
- common_log(LOG_INFO, 'Setting session from COOKIE: '.$id);
}
if (isset($id)) {
session_id($id);
- setcookie(session_name(), $id);
}
@session_start();
if (!isset($_SESSION['started'])) {
}
}
}
- common_debug("Session ID = " . session_id());
}
// Three kinds of arguments:
if (!$user) {
$user = common_current_user();
if (!$user) {
- common_debug('No current user to remember', __FILE__);
return false;
}
}
if (!$result) {
common_log_db_error($rm, 'INSERT', __FILE__);
- common_debug('Error adding rememberme record for ' . $user->nickname, __FILE__);
return false;
}
$rm->query('COMMIT');
- common_debug('Inserted rememberme record (' . $rm->code . ', ' . $rm->user_id . '); result = ' . $result . '.', __FILE__);
-
$cookieval = $rm->user_id . ':' . $rm->code;
common_log(LOG_INFO, 'adding rememberme cookie "' . $cookieval . '" for ' . $user->nickname);
$_cur = common_remembered_user();
if ($_cur) {
- common_debug("Got User " . $_cur->nickname);
- common_debug("Faking session on remembered user");
// XXX: Is this necessary?
$_SESSION['userid'] = $_cur->id;
}
function common_at_link($sender_id, $nickname)
{
$sender = Profile::staticGet($sender_id);
+ if (!$sender) {
+ return $nickname;
+ }
$recipient = common_relative_profile($sender, common_canonical_nickname($nickname));
if ($recipient) {
$user = User::staticGet('id', $recipient->id);
function common_broadcast_notice($notice, $remote=false)
{
- return common_enqueue_notice($notice);
+ // DO NOTHING!
}
// Stick the notice on the queue
static $localTransports = array('omb',
'ping');
- static $allTransports = array('sms', 'plugin');
-
- $transports = $allTransports;
+ $transports = array();
+ if (common_config('sms', 'enabled')) {
+ $transports[] = 'sms';
+ }
+ if (Event::hasHandler('HandleQueuedNotice')) {
+ $transports[] = 'plugin';
+ }
+
$xmpp = common_config('xmpp', 'enabled');
$transports[] = 'jabber';
}
+ // @fixme move these checks into QueueManager and/or individual handlers
if ($notice->is_local == Notice::LOCAL_PUBLIC ||
$notice->is_local == Notice::LOCAL_NONPUBLIC) {
$transports = array_merge($transports, $localTransports);
function common_request_id()
{
$pid = getmypid();
+ $server = common_config('site', 'server');
if (php_sapi_name() == 'cli') {
- return $pid;
+ $script = basename($_SERVER['PHP_SELF']);
+ return "$server:$script:$pid";
} else {
static $req_id = null;
if (!isset($req_id)) {
$url = $_SERVER['REQUEST_URI'];
}
$method = $_SERVER['REQUEST_METHOD'];
- return "$pid.$req_id $method $url";
+ return "$server:$pid.$req_id $method $url";
}
}