Change the notice type defines all into class constants and adapt all files.
This commit is contained in:
parent
0d06055f40
commit
418a5a95ab
|
@ -190,7 +190,7 @@ class ShownoticeAction extends OwnerDesignAction
|
||||||
{
|
{
|
||||||
parent::handle($args);
|
parent::handle($args);
|
||||||
|
|
||||||
if ($this->notice->is_local == 0) {
|
if ($this->notice->is_local == Notice::REMOTE_OMB) {
|
||||||
if (!empty($this->notice->url)) {
|
if (!empty($this->notice->url)) {
|
||||||
common_redirect($this->notice->url, 301);
|
common_redirect($this->notice->url, 301);
|
||||||
} else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) {
|
} else if (!empty($this->notice->uri) && preg_match('/^https?:/', $this->notice->uri)) {
|
||||||
|
|
|
@ -29,10 +29,6 @@ require_once INSTALLDIR.'/classes/Memcached_DataObject.php';
|
||||||
|
|
||||||
define('NOTICE_CACHE_WINDOW', 61);
|
define('NOTICE_CACHE_WINDOW', 61);
|
||||||
|
|
||||||
define('NOTICE_LOCAL_PUBLIC', 1);
|
|
||||||
define('NOTICE_REMOTE_OMB', 0);
|
|
||||||
define('NOTICE_LOCAL_NONPUBLIC', -1);
|
|
||||||
|
|
||||||
define('MAX_BOXCARS', 128);
|
define('MAX_BOXCARS', 128);
|
||||||
|
|
||||||
class Notice extends Memcached_DataObject
|
class Notice extends Memcached_DataObject
|
||||||
|
@ -62,6 +58,10 @@ class Notice extends Memcached_DataObject
|
||||||
/* the code above is auto generated do not remove the tag below */
|
/* the code above is auto generated do not remove the tag below */
|
||||||
###END_AUTOCODE
|
###END_AUTOCODE
|
||||||
|
|
||||||
|
/* Notice types */
|
||||||
|
const LOCAL_PUBLIC = 1;
|
||||||
|
const REMOTE_OMB = 0;
|
||||||
|
const LOCAL_NONPUBLIC = -1;
|
||||||
const GATEWAY = -2;
|
const GATEWAY = -2;
|
||||||
|
|
||||||
function getProfile()
|
function getProfile()
|
||||||
|
@ -134,7 +134,7 @@ class Notice extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
static function saveNew($profile_id, $content, $source=null,
|
static function saveNew($profile_id, $content, $source=null,
|
||||||
$is_local=1, $reply_to=null, $uri=null, $created=null) {
|
$is_local=Notice::LOCAL_PUBLIC, $reply_to=null, $uri=null, $created=null) {
|
||||||
|
|
||||||
$profile = Profile::staticGet($profile_id);
|
$profile = Profile::staticGet($profile_id);
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
if (($blacklist && in_array($profile_id, $blacklist)) ||
|
if (($blacklist && in_array($profile_id, $blacklist)) ||
|
||||||
($source && $autosource && in_array($source, $autosource))) {
|
($source && $autosource && in_array($source, $autosource))) {
|
||||||
$notice->is_local = -1;
|
$notice->is_local = Notice::LOCAL_NONPUBLIC;
|
||||||
} else {
|
} else {
|
||||||
$notice->is_local = $is_local;
|
$notice->is_local = $is_local;
|
||||||
}
|
}
|
||||||
|
@ -509,7 +509,7 @@ class Notice extends Memcached_DataObject
|
||||||
|
|
||||||
function blowPublicCache($blowLast=false)
|
function blowPublicCache($blowLast=false)
|
||||||
{
|
{
|
||||||
if ($this->is_local == 1) {
|
if ($this->is_local == Notice::LOCAL_PUBLIC) {
|
||||||
$cache = common_memcache();
|
$cache = common_memcache();
|
||||||
if ($cache) {
|
if ($cache) {
|
||||||
$cache->delete(common_cache_key('public'));
|
$cache->delete(common_cache_key('public'));
|
||||||
|
@ -775,10 +775,11 @@ class Notice extends Memcached_DataObject
|
||||||
}
|
}
|
||||||
|
|
||||||
if (common_config('public', 'localonly')) {
|
if (common_config('public', 'localonly')) {
|
||||||
$notice->whereAdd('is_local = 1');
|
$notice->whereAdd('is_local = ' . Notice::LOCAL_PUBLIC);
|
||||||
} else {
|
} else {
|
||||||
# -1 == blacklisted
|
# -1 == blacklisted, -2 == gateway (i.e. Twitter)
|
||||||
$notice->whereAdd('is_local != -1');
|
$notice->whereAdd('is_local !='. Notice::LOCAL_NONPUBLIC);
|
||||||
|
$notice->whereAdd('is_local !='. Notice::GATEWAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($since_id != 0) {
|
if ($since_id != 0) {
|
||||||
|
|
|
@ -120,7 +120,7 @@ class MySQLSearch extends SearchEngine
|
||||||
} else if ('identica_notices' === $this->table) {
|
} else if ('identica_notices' === $this->table) {
|
||||||
|
|
||||||
// Don't show imported notices
|
// Don't show imported notices
|
||||||
$this->target->whereAdd('notice.is_local != ' . NOTICE_GATEWAY);
|
$this->target->whereAdd('notice.is_local != ' . Notice::GATEWAY);
|
||||||
|
|
||||||
if (strtolower($q) != $q) {
|
if (strtolower($q) != $q) {
|
||||||
$this->target->whereAdd("( MATCH(content) AGAINST ('" . addslashes($q) .
|
$this->target->whereAdd("( MATCH(content) AGAINST ('" . addslashes($q) .
|
||||||
|
|
|
@ -79,7 +79,7 @@ class UnQueueManager
|
||||||
|
|
||||||
function _isLocal($notice)
|
function _isLocal($notice)
|
||||||
{
|
{
|
||||||
return ($notice->is_local == NOTICE_LOCAL_PUBLIC ||
|
return ($notice->is_local == Notice::LOCAL_PUBLIC ||
|
||||||
$notice->is_local == NOTICE_LOCAL_NONPUBLIC);
|
$notice->is_local == Notice::LOCAL_NONPUBLIC);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -854,8 +854,8 @@ function common_enqueue_notice($notice)
|
||||||
$transports[] = 'jabber';
|
$transports[] = 'jabber';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($notice->is_local == NOTICE_LOCAL_PUBLIC ||
|
if ($notice->is_local == Notice::LOCAL_PUBLIC ||
|
||||||
$notice->is_local == NOTICE_LOCAL_NONPUBLIC) {
|
$notice->is_local == Notice::LOCAL_NONPUBLIC) {
|
||||||
$transports = array_merge($transports, $localTransports);
|
$transports = array_merge($transports, $localTransports);
|
||||||
if ($xmpp) {
|
if ($xmpp) {
|
||||||
$transports[] = 'public';
|
$transports[] = 'public';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user