aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHabeas Codice <habeascodice@federated.social>2014-11-17 15:15:02 -0800
committerHabeas Codice <habeascodice@federated.social>2014-11-17 15:15:02 -0800
commit96427a23a3523daf2c1966fe1b8a6e119e797e50 (patch)
treea7aaea69271817bbc8f78396f0d98052ca52d3f3 /include
parentbcaa32a83a965f111bfc2ba085a59857a4fa0c2d (diff)
parente59f7cc198fb038cd8344c2d403b423d57300a96 (diff)
downloadvolse-hubzilla-96427a23a3523daf2c1966fe1b8a6e119e797e50.tar.gz
volse-hubzilla-96427a23a3523daf2c1966fe1b8a6e119e797e50.tar.bz2
volse-hubzilla-96427a23a3523daf2c1966fe1b8a6e119e797e50.zip
Merge branch 'master' of https://github.com/habeascodice/red
Diffstat (limited to 'include')
-rw-r--r--include/ItemObject.php42
-rw-r--r--include/conversation.php30
-rw-r--r--include/datetime.php45
-rwxr-xr-xinclude/dba/dba_driver.php8
-rwxr-xr-xinclude/dba/dba_mysqli.php2
-rw-r--r--include/externals.php2
-rw-r--r--include/poller.php55
-rw-r--r--include/zot.php13
8 files changed, 100 insertions, 97 deletions
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 90c036def..4aa6857c1 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -28,6 +28,7 @@ class Item extends BaseObject {
private $threaded = false;
private $visiting = false;
private $channel = null;
+ private $display_mode = 'normal';
public function __construct($data) {
@@ -64,8 +65,6 @@ class Item extends BaseObject {
public function get_template_data($alike, $dlike, $thread_level=1) {
- $t1 = dba_timer();
-
$result = array();
$a = $this->get_app();
@@ -228,15 +227,13 @@ class Item extends BaseObject {
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
$indent .= ' shiny';
- $t2 = dba_timer();
localize_item($item);
-
- $t3 = dba_timer();
-
$body = prepare_body($item,true);
+
- $t4 = dba_timer();
+ $comment_count_txt = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
+ $children = $this->get_children();
$tmp_item = array(
'template' => $this->get_template(),
@@ -248,6 +245,7 @@ class Item extends BaseObject {
'id' => $this->get_id(),
'linktitle' => sprintf( t('View %s\'s profile - %s'), $profile_name, $item['author']['xchan_addr']),
'olinktitle' => sprintf( t('View %s\'s profile - %s'), $this->get_owner_name(), $item['owner']['xchan_addr']),
+ 'llink' => $item['llink'],
'to' => t('to'),
'via' => t('via'),
'wall' => t('Wall-to-Wall'),
@@ -292,6 +290,8 @@ class Item extends BaseObject {
'drop' => $drop,
'multidrop' => ((feature_enabled($conv->get_profile_owner(),'multi_delete')) ? $multidrop : ''),
// end toolbar buttons
+ 'comment_count' => $total_children,
+ 'comment_count_txt' => $comment_count_txt,
'like_count' => $like_count,
'like_list' => $like_list,
'like_list_part' => $like_list_part,
@@ -311,24 +311,22 @@ class Item extends BaseObject {
'thread_level' => $thread_level
);
- $t5 = dba_timer();
-
$arr = array('item' => $item, 'output' => $tmp_item);
call_hooks('display_item', $arr);
$result = $arr['output'];
$result['children'] = array();
- $children = $this->get_children();
$nb_children = count($children);
- if($nb_children > 0) {
+
+ if(($this->get_display_mode() === 'normal') && ($nb_children > 0)) {
foreach($children as $child) {
$result['children'][] = $child->get_template_data($alike, $dlike, $thread_level + 1);
}
// Collapse
if(($nb_children > 2) || ($thread_level > 1)) {
$result['children'][0]['comment_firstcollapsed'] = true;
- $result['children'][0]['num_comments'] = sprintf( tt('%d comment','%d comments',$total_children),$total_children );
+ $result['children'][0]['num_comments'] = $comment_count_txt;
$result['children'][0]['hide_text'] = t('[+] show all');
if($thread_level > 1) {
$result['children'][$nb_children - 1]['comment_lastcollapsed'] = true;
@@ -350,14 +348,6 @@ class Item extends BaseObject {
$result['flatten'] = true;
$result['threaded'] = false;
}
- $t6 = dba_timer();
-
-// profiler($t1,$t2,'t2');
-// profiler($t2,$t3,'t3');
-// profiler($t3,$t4,'t4');
-// profiler($t4,$t5,'t5');
-// profiler($t5,$t6,'t6');
-// profiler($t1,$t6,'item total');
return $result;
}
@@ -366,6 +356,14 @@ class Item extends BaseObject {
return $this->get_data_value('id');
}
+ public function get_display_mode() {
+ return $this->display_mode;
+ }
+
+ public function set_display_mode($mode) {
+ $this->display_mode = $mode;
+ }
+
public function is_threaded() {
return $this->threaded;
}
@@ -517,12 +515,12 @@ class Item extends BaseObject {
/**
* Get template
*/
- private function get_template() {
+ public function get_template() {
return $this->template;
}
- private function set_template($t) {
+ public function set_template($t) {
$this->template = $t;
}
diff --git a/include/conversation.php b/include/conversation.php
index c2258c20a..96864c29a 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -419,8 +419,6 @@ function visible_activity($item) {
function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $prepared_item = '') {
- $tstart = dba_timer();
- $t0 = $t1 = $t2 = $t3 = $t4 = $t5 = $t6 = null;
$content_html = '';
$o = '';
@@ -452,8 +450,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
if($mode === 'network') {
- $t1 = dba_timer();
-
$profile_owner = local_user();
$page_writeable = true;
@@ -790,29 +786,21 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
$item['pagedrop'] = $page_dropping;
if($item['id'] == $item['parent']) {
-// $tx1 = dba_timer();
+
$item_object = new Item($item);
$conv->add_thread($item_object);
- if($page_mode === 'list')
+ if($page_mode === 'list') {
$item_object->set_template('conv_list.tpl');
-
-// $tx2 = dba_timer();
-// if($mode === 'network')
-// profiler($tx1,$tx2,'add thread ' . $item['id']);
+ $item_object->set_display_mode('list');
+ }
}
}
- $t2 = dba_timer();
+
$threads = $conv->get_template_data($alike, $dlike);
if(!$threads) {
logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
$threads = array();
}
- $t3 = dba_timer();
- if($mode === 'network') {
- profiler($t1,$t2,'Conversation prepare');
- profiler($t2,$t3,'Conversation get_template');
- }
-
}
}
@@ -848,14 +836,6 @@ function conversation(&$a, $items, $mode, $update, $page_mode = 'traditional', $
'$dropping' => ($page_dropping?t('Delete Selected Items'):False),
));
- if($mode === 'network') {
- $t4 = dba_timer();
- profiler($t3,$t4,'conversation template');
- }
-
- if($page_mode === 'preview')
- logger('preview: ' . $o);
-
return $o;
}
diff --git a/include/datetime.php b/include/datetime.php
index 270be5e3d..59dad2045 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -163,12 +163,12 @@ function dob($dob) {
* @param $id
* id and name of datetimepicker (defaults to "datetimepicker")
*/
-function datesel($format, $min, $max, $default,$id = 'datepicker') {
- return datetimesel($format,$min,$max,$default,$id,true,false);
+function datesel($format, $min, $max, $default, $id = 'datepicker') {
+ return datetimesel($format,$min,$max,$default,$id,true,false, '','');
}
/**
- * returns a date selector
+ * returns a time selector
* @param $format
* format string, e.g. 'ymd' or 'mdy'. Not currently supported
* @param $h
@@ -178,8 +178,8 @@ function datesel($format, $min, $max, $default,$id = 'datepicker') {
* @param $id
* id and name of datetimepicker (defaults to "timepicker")
*/
-function timesel($format,$h,$m,$id='timepicker') {
- return datetimesel($format,mktime(),mktime(),mktime($h,$m),$id,false,true);
+function timesel($format, $h, $m, $id='timepicker') {
+ return datetimesel($format,new DateTime(),new DateTime(),new DateTime("$h:$m"),$id,false,true);
}
/**
@@ -204,31 +204,42 @@ function timesel($format,$h,$m,$id='timepicker') {
* set maximum date from picker with id $maxfrom (none by default)
*/
function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '') {
+ // Once browser support is better this could probably be replaced with native HTML5 date picker
$o = '';
$dateformat = '';
- if($pickdate) $dateformat .= 'YYYY-MM-DD';
+
+ if($pickdate) $dateformat .= 'Y-m-d';
if($pickdate && $picktime) $dateformat .= ' ';
- if($picktime) $dateformat .= 'HH:mm';
+ if($picktime) $dateformat .= 'H:i';
- $mindate = $min ? "new Date($min*1000)" : '';
- $maxdate = $max ? "new Date($max*1000)" : '';
+ $minjs = $min ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : '';
+ $maxjs = $max ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : '';
- $defaultDate = $default ? ", defaultDate: new Date($default*1000)" : '';
+ $input_text = $default ? 'value="' . date($dateformat, $default->getTimestamp()) . '"' : '';
+ $defaultdatejs = $default ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : '';
$pickers = '';
- if(!$pickdate) $pickers .= 'pickDate: false,';
- if(!$picktime) $pickers .= 'pickTime: false,';
+ if(!$pickdate) $pickers .= ',datepicker: false';
+ if(!$picktime) $pickers .= ',timepicker: false';
$extra_js = '';
if($minfrom != '')
- $extra_js .= "\$('#$minfrom').on('dp.change',function (e) { \$('#$id').data('DateTimePicker').setMinDate(e.date); });";
+ $extra_js .= "\$('#$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})";
if($maxfrom != '')
- $extra_js .= "\$('#$maxfrom').on('dp.change',function (e) { \$('#$id').data('DateTimePicker').setMaxDate(e.date); });";
-
- $o .= "<div class='date' id='$id'><input type='text' placeholder='$dateformat' name='$id'/></div>";
- $o .= "<script type='text/javascript'>\$(function () {\$('#$id').datetimepicker({sideBySide: true, $pickers minDate: $mindate, maxDate: $maxdate, format: '$dateformat', useCurrent: false $defaultDate}); $extra_js});</script>";
+ $extra_js .= "\$('#$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})";
+
+ $readable_format = $dateformat;
+ $readable_format = str_replace('Y','yyyy',$readable_format);
+ $readable_format = str_replace('m','mm',$readable_format);
+ $readable_format = str_replace('d','dd',$readable_format);
+ $readable_format = str_replace('H','HH',$readable_format);
+ $readable_format = str_replace('i','MM',$readable_format);
+
+ $o .= "<div class='date'><input type='text' placeholder='$readable_format' name='$id' id='$id' $input_text />";
+ $o .= '</div>';
+ $o .= "<script type='text/javascript'>\$(function () {var picker = \$('#$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs}); $extra_js})</script>";
return $o;
}
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php
index 103dc8fcc..1bb45b06d 100755
--- a/include/dba/dba_driver.php
+++ b/include/dba/dba_driver.php
@@ -24,7 +24,10 @@
function dba_factory($server, $port,$user,$pass,$db,$dbtype,$install = false) {
$dba = null;
- if($dbtype == 1) {
+
+ $dbtype = intval($dbtype);
+
+ if($dbtype == DBTYPE_POSTGRES) {
require_once('include/dba/dba_postgres.php');
if(is_null($port)) $port = 5432;
$dba = new dba_postgres($server, $port, $user, $pass, $db, $install);
@@ -39,6 +42,7 @@ function dba_factory($server, $port,$user,$pass,$db,$dbtype,$install = false) {
$dba = new dba_mysql($server, $port,$user,$pass,$db,$install);
}
}
+
define('NULL_DATE', $dba->get_null_date());
define('ACTIVE_DBTYPE', $dbtype);
return $dba;
@@ -371,7 +375,7 @@ function db_getfunc($f) {
if(isset($lookup[$f]) && isset($lookup[$f][ACTIVE_DBTYPE]))
return $lookup[$f][ACTIVE_DBTYPE];
- logger('Unable to abstract DB function "'. $f . '"', LOG_DEBUG);
+ logger('Unable to abstract DB function "'. $f . '" for dbtype ' . ACTIVE_DBTYPE, LOGGER_DEBUG);
return $f;
}
diff --git a/include/dba/dba_mysqli.php b/include/dba/dba_mysqli.php
index 19907705b..c71f493b0 100755
--- a/include/dba/dba_mysqli.php
+++ b/include/dba/dba_mysqli.php
@@ -40,7 +40,7 @@ class dba_mysqli extends dba_driver {
if(($result === true) || ($result === false)) {
if($this->debug) {
- logger('dba_mysqli: DEBUG: returns ' . (($result) ? 'true' : 'false'));
+ logger('dba_mysqli: DEBUG: ' . printable($sql) . ' returns ' . (($result) ? 'true' : 'false'));
}
return $result;
}
diff --git a/include/externals.php b/include/externals.php
index 0be5d0fde..b0f853dc6 100644
--- a/include/externals.php
+++ b/include/externals.php
@@ -14,6 +14,8 @@ function externals_run($argv, $argc){
$total = 0;
$attempts = 0;
+ logger('externals: startup', LOGGER_DEBUG);
+
// pull in some public posts
diff --git a/include/poller.php b/include/poller.php
index 952431926..e13c6829d 100644
--- a/include/poller.php
+++ b/include/poller.php
@@ -27,10 +27,11 @@ function poller_run($argv, $argc){
// Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it.
$lockfile = 'store/[data]/poller';
- if ((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 3600))) {
- logger("poller: Already running");
+ if((file_exists($lockfile)) && (filemtime($lockfile) > (time() - 3600))
+ && (! get_config('system','override_poll_lockfile'))) {
+ logger("poller: Already running");
return;
- }
+ }
// Create a lockfile. Needs two vars, but $x doesn't need to contain anything.
file_put_contents($lockfile, $x);
@@ -52,7 +53,7 @@ function poller_run($argv, $argc){
// expire any expired items
$r = q("select id from item where expires != '%s' and expires < %s
- and not ( item_restrict & %d )>0 ",
+ and ( item_restrict & %d ) = 0 ",
dbesc(NULL_DATE),
db_utcnow(),
intval(ITEM_DELETED)
@@ -69,7 +70,8 @@ function poller_run($argv, $argc){
// or dead entries.
$r = q("select channel_id from channel where channel_dirdate < %s - INTERVAL %s",
- db_utcnow(), db_quoteinterval('30 DAY')
+ db_utcnow(),
+ db_quoteinterval('30 DAY')
);
if($r) {
foreach($r as $rr) {
@@ -82,7 +84,7 @@ function poller_run($argv, $argc){
// publish any applicable items that were set to be published in the future
// (time travel posts)
- $r = q("select id from item where ( item_restrict & %d )>0 and created <= %s ",
+ $r = q("select id from item where ( item_restrict & %d ) > 0 and created <= %s ",
intval(ITEM_DELAYED_PUBLISH),
db_utcnow()
);
@@ -207,7 +209,8 @@ function poller_run($argv, $argc){
$r = q("select xchan_photo_l, xchan_hash from xchan where xchan_photo_l != '' and xchan_photo_m = ''
and xchan_photo_date < %s - INTERVAL %s",
- db_utcnow(), db_quoteinterval('1 DAY')
+ db_utcnow(),
+ db_quoteinterval('1 DAY')
);
if($r) {
require_once('include/photo/photo_driver.php');
@@ -253,13 +256,13 @@ function poller_run($argv, $argc){
}
- $sql_extra = (($manual_id) ? " AND abook_id = $manual_id " : "");
+ $sql_extra = (($manual_id) ? " AND abook_id = " . intval($manual_id) . " " : "");
reload_plugins();
$d = datetime_convert();
- //TODO check to see if there are any cronhooks before wasting a process
+ // TODO check to see if there are any cronhooks before wasting a process
if(! $restart)
proc_run('php','include/cronhooks.php');
@@ -271,12 +274,12 @@ function poller_run($argv, $argc){
: ''
);
- $randfunc = (ACTIVE_DBTYPE == DBTYPE_POSTGRES) ? 'RANDOM()' : 'RAND()';
+ $randfunc = db_getfunc('RAND');
- $contacts = q("SELECT abook_id, abook_flags, abook_updated, abook_connected, abook_closeness, abook_xchan, abook_channel
- FROM abook LEFT JOIN account on abook_account = account_id
+ $contacts = q("SELECT abook_id, abook_flags, abook_updated, abook_connected, abook_closeness, abook_xchan, abook_channel, xchan_network
+ FROM abook LEFT JOIN xchan on abook_xchan = xchan_hash LEFT JOIN account on abook_account = account_id
$sql_extra
- AND (( abook_flags & %d )>0 OR ( abook_flags = %d ))
+ AND (( abook_flags & %d ) > 0 OR ( abook_flags = %d ))
AND (( account_flags = %d ) OR ( account_flags = %d )) $abandon_sql ORDER BY $randfunc",
intval(ABOOK_FLAG_HIDDEN|ABOOK_FLAG_PENDING|ABOOK_FLAG_UNCONNECTED|ABOOK_FLAG_FEED),
intval(0),
@@ -289,6 +292,9 @@ function poller_run($argv, $argc){
foreach($contacts as $contact) {
+ if($contact['abook_flags'] & ABOOK_FLAG_SELF)
+ continue;
+
$update = false;
$t = $contact['abook_updated'];
@@ -310,6 +316,9 @@ function poller_run($argv, $argc){
}
+ if($contact['xchan_network'] !== 'zot')
+ continue;
+
if($c == $t) {
if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day"))
$update = true;
@@ -330,17 +339,12 @@ function poller_run($argv, $argc){
// He's dead, Jim
if(strcmp(datetime_convert('UTC','UTC', 'now'),datetime_convert('UTC','UTC', $c . " + 30 day")) > 0) {
- $n = q("select xchan_network from xchan where xchan_hash = '%s' limit 1",
- dbesc($contact['abook_xchan'])
+ $r = q("update abook set abook_flags = (abook_flags | %d) where abook_id = %d",
+ intval(ABOOK_FLAG_ARCHIVED),
+ intval($contact['abook_id'])
);
- if($n && $n[0]['xchan_network'] == 'zot') {
- $r = q("update abook set abook_flags = (abook_flags | %d) where abook_id = %d",
- intval(ABOOK_FLAG_ARCHIVED),
- intval($contact['abook_id'])
- );
- $update = false;
- continue;
- }
+ $update = false;
+ continue;
}
if($contact['abook_flags'] & ABOOK_FLAG_ARCHIVED) {
@@ -364,6 +368,9 @@ function poller_run($argv, $argc){
}
+ if($contact['abook_flags'] & (ABOOK_FLAG_PENDING|ABOOK_FLAG_ARCHIVED|ABOOK_FLAG_IGNORED))
+ continue;
+
if((! $update) && (! $force))
continue;
@@ -375,7 +382,7 @@ function poller_run($argv, $argc){
}
if($dirmode == DIRECTORY_MODE_SECONDARY || $dirmode == DIRECTORY_MODE_PRIMARY) {
- $r = q("select distinct ud_addr, updates.* from updates where not ( ud_flags & %d )>0 and ud_addr != '' and ( ud_last = '%s' OR ud_last > %s - INTERVAL %s ) group by ud_addr ",
+ $r = q("select distinct ud_addr, updates.* from updates where ( ud_flags & %d ) = 0 and ud_addr != '' and ( ud_last = '%s' OR ud_last > %s - INTERVAL %s ) group by ud_addr ",
intval(UPDATE_FLAGS_UPDATED),
dbesc(NULL_DATE),
db_utcnow(), db_quoteinterval('7 DAY')
diff --git a/include/zot.php b/include/zot.php
index 2fd950acc..3ffc9b43f 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -202,7 +202,7 @@ function zot_finger($webbie,$channel,$autofallback = true) {
$r = q("select xchan.*, hubloc.* from xchan
left join hubloc on xchan_hash = hubloc_hash
- where xchan_addr = '%s' and (hubloc_flags & %d)>0 limit 1",
+ where xchan_addr = '%s' and (hubloc_flags & %d) > 0 limit 1",
dbesc($xchan_addr),
intval(HUBLOC_FLAGS_PRIMARY)
);
@@ -301,7 +301,7 @@ function zot_refresh($them,$channel = null, $force = false) {
if($them['hubloc_url'])
$url = $them['hubloc_url'];
else {
- $r = q("select hubloc_url from hubloc where hubloc_hash = '%s' and ( hubloc_flags & %d )>0 limit 1",
+ $r = q("select hubloc_url from hubloc where hubloc_hash = '%s' and ( hubloc_flags & %d ) > 0 limit 1",
dbesc($them['xchan_hash']),
intval(HUBLOC_FLAGS_PRIMARY)
);
@@ -383,7 +383,7 @@ function zot_refresh($them,$channel = null, $force = false) {
}
}
- $r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d and not (abook_flags & %d)>0 limit 1",
+ $r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d and not (abook_flags & %d) > 0 limit 1",
dbesc($x['hash']),
intval($channel['channel_id']),
intval(ABOOK_FLAG_SELF)
@@ -409,7 +409,7 @@ function zot_refresh($them,$channel = null, $force = false) {
$y = q("update abook set abook_their_perms = %d, abook_dob = '%s'
where abook_xchan = '%s' and abook_channel = %d
- and not (abook_flags & %d)>0 ",
+ and not (abook_flags & %d) > 0 ",
intval($their_perms),
dbesc($next_birthday),
dbesc($x['hash']),
@@ -421,7 +421,8 @@ function zot_refresh($them,$channel = null, $force = false) {
// if they are in your address book but you aren't in theirs, and/or this does not
// match your current connected state setting, toggle it.
-
+ // FIXME: uncoverted to postgres
+ // FIXME: when this was enabled, all contacts became unconnected. Currently disabled intentionally
// $y1 = q("update abook set abook_flags = (abook_flags ^ %d)
// where abook_xchan = '%s' and abook_channel = %d
// and not (abook_flags & %d) limit 1",
@@ -471,7 +472,7 @@ function zot_refresh($them,$channel = null, $force = false) {
$new_perms = get_all_perms($channel['channel_id'],$x['hash']);
if($new_perms != $previous_perms) {
// Send back a permissions update if permissions have changed
- $z = q("select * from abook where abook_xchan = '%s' and abook_channel = %d and not (abook_flags & %d)>0 limit 1",
+ $z = q("select * from abook where abook_xchan = '%s' and abook_channel = %d and not (abook_flags & %d) > 0 limit 1",
dbesc($x['hash']),
intval($channel['channel_id']),
intval(ABOOK_FLAG_SELF)