Merge branch 'rewrites/dbm_is_result' of github.com:Quix0r/friendica into rewrites/dbm_is_result

Signed-off-by: Roland Häder <roland@mxchange.org>

Conflicts:
	include/Photo.php
	include/api.php
	include/cache.php
	include/dbstructure.php
	include/enotify.php
	include/items.php
	include/onepoll.php
	include/queue_fn.php
	include/session.php
	include/text.php
	mod/contacts.php
	mod/dfrn_request.php
	mod/display.php
	mod/events.php
	mod/item.php
	mod/message.php
	mod/msearch.php
	mod/photos.php
	mod/poco.php
	mod/profile.php
	mod/proxy.php
	mod/videos.php
	update.php
	view/theme/diabook/theme.php
	view/theme/vier/theme.php
This commit is contained in:
Roland Häder 2016-12-13 11:00:44 +01:00
commit 63610c7b73
33 changed files with 320 additions and 260 deletions

View file

@ -3943,7 +3943,6 @@
}
api_register_func('api/friendica/direct_messages_search', 'api_friendica_direct_messages_search', true);
/**
* @brief return data of all the profiles a user has to the client
*

View file

@ -433,7 +433,7 @@ function cron_repair_diaspora(&$a) {
$r = q("SELECT `id`, `url` FROM `contact`
WHERE `network` = '%s' AND (`batch` = '' OR `notify` = '' OR `poll` = '' OR pubkey = '')
ORDER BY RAND() LIMIT 50", dbesc(NETWORK_DIASPORA));
if ($r) {
if (dbm::is_result($r)) {
foreach ($r AS $contact) {
if (poco_reachable($contact["url"])) {
$data = probe_url($contact["url"]);
@ -463,7 +463,7 @@ function cron_repair_database() {
// Update the global contacts for local users
$r = q("SELECT `uid` FROM `user` WHERE `verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired`");
if ($r)
if (dbm::is_result($r))
foreach ($r AS $user)
update_gcontact_for_user($user["uid"]);

View file

@ -17,6 +17,14 @@ function update_fail($update_id, $error_message){
$admin_mail_list
);
// No valid result?
if (!dbm::is_result($adminlist)) {
logger(sprintf('Cannot notify administrators about update_id=%d, error_message=%s', $update_id, $error_message), LOGGER_WARNING);
// Don't continue
return;
}
// every admin could had different language
foreach ($adminlist as $admin) {
@ -73,7 +81,7 @@ function table_structure($table) {
$fielddata = array();
$indexdata = array();
if (is_array($indexes))
if (dbm::is_result($indexes))
foreach ($indexes AS $index) {
if ($index["Index_type"] == "FULLTEXT")
continue;
@ -93,7 +101,7 @@ function table_structure($table) {
$indexdata[$index["Key_name"]][] = $column;
}
if (is_array($structures)) {
if (dbm::is_result($structures)) {
foreach($structures AS $field) {
$fielddata[$field["Field"]]["type"] = $field["Type"];
if ($field["Null"] == "NO")
@ -151,6 +159,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
foreach ($tables AS $table) {
$table = current($table);
logger(sprintf('updating structure for table %s ...', $table), LOGGER_DEBUG);
$database[$table] = table_structure($table);
}
@ -179,7 +188,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
$sql3="";
if (!isset($database[$name])) {
$r = db_create_table($name, $structure["fields"], $charset, $verbose, $action, $structure['indexes']);
if(false === $r) {
if(!dbm::is_result($r)) {
$errors .= t('Errors encountered creating database tables.').$name.EOL;
}
$is_new_table = True;
@ -256,7 +265,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
if ($action) {
$r = @$db->q($sql3);
if(false === $r)
if(dbm::is_result($r))
$errors .= t('Errors encountered performing database changes.').$sql3.EOL;
}
}

View file

@ -1278,7 +1278,7 @@ class diaspora {
$r = q("SELECT `id` FROM `mail` WHERE `uri` = '%s' LIMIT 1",
dbesc($message_uri)
);
if($r) {
if(dbm::is_result($r)) {
logger("duplicate message already delivered.", LOGGER_DEBUG);
return false;
}
@ -2925,7 +2925,7 @@ class diaspora {
$p = q("SELECT `guid`, `uri`, `parent-uri` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($item["thr-parent"]));
if(!$p)
if(!dbm::is_result($p))
return false;
$parent = $p[0];
@ -2956,7 +2956,7 @@ class diaspora {
intval($item["parent"])
);
if (!$p)
if (!dbm::is_result($p))
return false;
$parent = $p[0];
@ -3170,7 +3170,7 @@ class diaspora {
intval($item["uid"])
);
if (!$r) {
if (!dbm::is_result($r)) {
logger("conversation not found.");
return;
}

View file

@ -411,7 +411,7 @@ function notification($params) {
$hash = random_string();
$r = q("SELECT `id` FROM `notify` WHERE `hash` = '%s' LIMIT 1",
dbesc($hash));
if (dbm::is_result($r))
if(dbm::is_result($r))
$dups = true;
} while($dups == true);
@ -739,7 +739,7 @@ function check_item_notification($itemid, $uid, $defaulttype = "") {
$tags = q("SELECT `url` FROM `term` WHERE `otype` = %d AND `oid` = %d AND `type` = %d AND `uid` = %d",
intval(TERM_OBJ_POST), intval($itemid), intval(TERM_MENTION), intval($uid));
if (count($tags)) {
if (dbm::is_result($tags)) {
foreach ($tags AS $tag) {
$r = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `notify_new_posts`",
normalise_link($tag["url"]), intval($uid));

View file

@ -59,6 +59,8 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
if ($attributes->name == "href")
$author["author-link"] = $attributes->textContent;
$author["author-id"] = $xpath->evaluate('/atom:feed/atom:author/atom:uri/text()')->item(0)->nodeValue;
if ($author["author-link"] == "")
$author["author-link"] = $author["author-id"];
@ -142,6 +144,10 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
$author["owner-link"] = $contact["url"];
$author["owner-name"] = $contact["name"];
$author["owner-avatar"] = $contact["thumb"];
// This is no field in the item table. So we have to unset it.
unset($author["author-nick"]);
unset($author["author-id"]);
}
$header = array();

View file

@ -451,7 +451,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
/* check for create date and expire time */
$uid = intval($arr['uid']);
$r = q("SELECT expire FROM user WHERE uid = %d", intval($uid));
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$expire_interval = $r[0]['expire'];
if ($expire_interval>0) {
$expire_date = new DateTime( '- '.$expire_interval.' days', new DateTimeZone('UTC'));
@ -580,7 +580,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
intval($arr['uid'])
);
if (dbm::is_result($r))
if(dbm::is_result($r))
$arr['network'] = $r[0]["network"];
// Fallback to friendica (why is it empty in some cases?)
@ -634,7 +634,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
$r = q("SELECT `guid` FROM `item` WHERE `guid` = '%s' AND `network` = '%s' AND `uid` = '%d' LIMIT 1",
dbesc($arr['guid']), dbesc($arr['network']), intval($arr['uid']));
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
logger('found item with guid '.$arr['guid'].' for user '.$arr['uid'].' on network '.$arr['network'], LOGGER_DEBUG);
return 0;
}
@ -662,7 +662,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
intval($arr['uid'])
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
// is the new message multi-level threaded?
// even though we don't support it now, preserve the info
@ -1531,7 +1531,7 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
intval($importer['uid']),
dbesc($url)
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$contact_record = $r[0];
update_contact_avatar($photo, $importer["uid"], $contact_record["id"], true);
}
@ -1541,7 +1541,8 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
intval($importer['uid'])
);
$a = get_app();
if (dbm::is_result($r) AND !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
if(dbm::is_result($r) AND !in_array($r[0]['page-flags'], array(PAGE_SOAPBOX, PAGE_FREELOVE))) {
// create notification
$hash = random_string();
@ -2111,7 +2112,7 @@ function drop_item($id,$interactive = true) {
dbesc($item['parent-uri']),
intval($item['uid'])
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
q("UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
intval($r[0]['id'])
);
@ -2147,7 +2148,7 @@ function first_post_date($uid,$wall = false) {
intval($uid),
intval($wall ? 1 : 0)
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
// logger('first_post_date: ' . $r[0]['id'] . ' ' . $r[0]['created'], LOGGER_DATA);
return substr(datetime_convert('',date_default_timezone_get(),$r[0]['created']),0,10);
}

View file

@ -338,7 +338,6 @@ function xml_status($st, $message = '') {
killme();
}
/**
* @brief Send HTTP status header and exit.
*
@ -348,6 +347,14 @@ function xml_status($st, $message = '') {
* 'description' => optional message
*/
/**
* @brief Send HTTP status header and exit.
*
* @param integer $val HTTP status result value
* @param array $description optional message
* 'title' => header title
* 'description' => optional message
*/
function http_status_exit($val, $description = array()) {
$err = '';
if($val >= 400) {
@ -381,19 +388,32 @@ function http_status_exit($val, $description = array()) {
* @return boolean True if it's a valid URL, fals if something wrong with it
*/
function validate_url(&$url) {
logger(sprintf('[%s:%d]: url=%s - CALLED!', __FUNCTION__, __LINE__, $url), LOGGER_TRACE);
if(get_config('system','disable_url_validation'))
logger(sprintf('[%s:%d]: URL validation disabled, returning TRUE - EXIT!', __FUNCTION__, __LINE__), LOGGER_TRACE);
return true;
// no naked subdomains (allow localhost for tests)
if(strpos($url,'.') === false && strpos($url,'/localhost/') === false)
logger(sprintf('[%s:%d]: URL is not complete, returning FALSE - EXIT!', __FUNCTION__, __LINE__), LOGGER_TRACE);
return false;
if(substr($url,0,4) != 'http')
if(substr($url,0,4) != 'http' && substr($url,0,5) != 'https')
$url = 'http://' . $url;
logger(sprintf('[%s:%d]: url=%s - before parse_url() ...', __FUNCTION__, __LINE__, $url), LOGGER_DEBUG);
$h = @parse_url($url);
if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) {
logger(sprintf('[%s:%d]: h[]=%s', __FUNCTION__, __LINE__, gettype($h)), LOGGER_DEBUG);
if((is_array($h)) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR) || filter_var($h['host'], FILTER_VALIDATE_IP) )) {
logger(sprintf('[%s:%d]: URL %s validated. - EXIT!', __FUNCTION__, __LINE__, $url), LOGGER_TRACE);
return true;
}
logger(sprintf('[%s:%d]: URL %s maybe not valid - EXIT!', __FUNCTION__, __LINE__, $url), LOGGER_TRACE);
return false;
}

View file

@ -424,6 +424,20 @@ function notifier_run(&$argv, &$argc){
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}
// Send a salmon to the parent author
$probed_contact = probe_url($thr_parent[0]['author-link']);
if ($probed_contact["notify"] != "") {
logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]);
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}
// Send a salmon to the parent owner
$probed_contact = probe_url($thr_parent[0]['owner-link']);
if ($probed_contact["notify"] != "") {
logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
$url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
}
// Send a salmon notification to every person we mentioned in the post
$arr = explode(',',$target_item['tag']);
foreach($arr as $x) {

View file

@ -24,7 +24,12 @@ function remove_queue_item($id) {
*/
function was_recently_delayed($cid) {
$was_delayed = false;
$r = q("SELECT `id` FROM `queue` WHERE `cid` = %d
and last > UTC_TIMESTAMP() - interval 15 minute limit 1",
intval($cid)
);
if(dbm::is_result($r))
return true;
// Are there queue entries that were recently added?
$r = q("SELECT `id` FROM `queue` WHERE `cid` = %d
@ -32,18 +37,7 @@ function was_recently_delayed($cid) {
intval($cid)
);
$was_delayed = dbm::is_result($r);
// We set "term-date" to a current date if the communication has problems.
// If the communication works again we reset this value.
if ($was_delayed) {
$r = q("SELECT `term-date` FROM `contact` WHERE `id` = %d AND `term-date` <= '1000-01-01' LIMIT 1",
intval($cid)
);
$was_delayed = !dbm::is_result($r);
}
return $was_delayed;
return (dbm::is_result($r));
}

View file

@ -30,7 +30,7 @@ function ref_session_read($id) {
$r = q("SELECT `data` FROM `session` WHERE `sid`= '%s'", dbesc($id));
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$session_exists = true;
return $r[0]['data'];
} else {

View file

@ -901,13 +901,14 @@ function contact_block() {
dbesc(NETWORK_DIASPORA),
intval($shown)
);
if ($r) {
if(dbm::is_result($r)) {
$contacts = "";
foreach ($r AS $contact)
$contacts[] = $contact["id"];
$r = q("SELECT `id`, `uid`, `addr`, `url`, `name`, `thumb`, `network` FROM `contact` WHERE `id` IN (%s)",
dbesc(implode(",", $contacts)));
if(dbm::is_result($r)) {
$contacts = sprintf( tt('%d Contact','%d Contacts', $total),$total);
$micropro = Array();

View file

@ -174,7 +174,7 @@ function add_shadow_entry($itemid) {
function update_thread_uri($itemuri, $uid) {
$messages = q("SELECT `id` FROM `item` WHERE uri ='%s' AND uid=%d", dbesc($itemuri), intval($uid));
if(count($messages))
if(dbm::is_result($messages))
foreach ($messages as $message)
update_thread($message["id"]);
}
@ -183,7 +183,7 @@ function update_thread($itemid, $setmention = false) {
$items = q("SELECT `uid`, `guid`, `title`, `body`, `created`, `edited`, `commented`, `received`, `changed`, `wall`, `private`, `pubmail`, `moderated`, `visible`, `spam`, `starred`, `bookmark`, `contact-id`, `gcontact-id`,
`deleted`, `origin`, `forum_mode`, `network`, `rendered-html`, `rendered-hash` FROM `item` WHERE `id` = %d AND (`parent` = %d OR `parent` = 0) LIMIT 1", intval($itemid), intval($itemid));
if (!$items)
if (!dbm::is_result($items))
return;
$item = $items[0];

View file

@ -47,4 +47,4 @@ function contactgroup_content(&$a) {
}
killme();
}
}

View file

@ -772,6 +772,8 @@ function contacts_content(&$a) {
$sql_extra3 = unavailable_networks();
$contacts = array();
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `pending` = 0 $sql_extra $sql_extra2 $sql_extra3 ORDER BY `name` ASC LIMIT %d , %d ",
intval($_SESSION['uid']),
intval($a->pager['start']),

View file

@ -273,7 +273,7 @@ function dfrn_request_post(&$a) {
dbesc(datetime_convert('UTC','UTC','now - 24 hours')),
intval($uid)
);
if(dbm::is_result($r) > $maxreq) {
if(dbm::is_result($r) && count($r) > $maxreq) {
notice( sprintf( t('%s has received too many connection requests today.'), $a->profile['name']) . EOL);
notice( t('Spam protection measures have been invoked.') . EOL);
notice( t('Friends are advised to please try again in 24 hours.') . EOL);
@ -370,8 +370,8 @@ function dfrn_request_post(&$a) {
$r = q("SELECT * FROM `mailacct` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
if(! dbm::is_result($r)) {
if(! dbm::is_result($r)) {
notice( t('This account has not been configured for email. Request failed.') . EOL);
return;
}
@ -431,8 +431,8 @@ function dfrn_request_post(&$a) {
$hash = random_string();
$r = q("insert into intro ( uid, `contact-id`, knowyou, note, hash, datetime, blocked )
values( %d , %d, %d, '%s', '%s', '%s', %d ) ",
$r = q("INSERT INTO intro ( uid, `contact-id`, knowyou, note, hash, datetime, blocked )
VALUES( %d , %d, %d, '%s', '%s', '%s', %d ) ",
intval($uid),
intval($contact_id),
((x($_POST,'knowyou') && ($_POST['knowyou'] == 1)) ? 1 : 0),
@ -449,9 +449,13 @@ function dfrn_request_post(&$a) {
$data = probe_url($url);
$network = $data["network"];
logger('dfrn_request: url=' . $url . ',network=' . $network . ',hcard=' . $hcard . ' - BEFORE!', LOGGER_DEBUG);
// Canonicalise email-style profile locator
$url = Probe::webfinger_dfrn($url,$hcard);
logger('dfrn_request: url=' . $url . ',network=' . $network . ',hcard=' . $hcard . ' - AFTER!', LOGGER_DEBUG);
if (substr($url,0,5) === 'stat:') {
// Every time we detect the remote subscription we define this as OStatus.
@ -473,7 +477,7 @@ function dfrn_request_post(&$a) {
dbesc($url)
);
if(count($ret)) {
if(dbm::is_result($ret)) {
if(strlen($ret[0]['issued-id'])) {
notice( t('You have already introduced yourself here.') . EOL );
return;
@ -720,7 +724,9 @@ function dfrn_request_content(&$a) {
dbesc($_GET['confirm_key'])
);
if(count($intro)) {
if(dbm::is_result($intro)) {
$auto_confirm = false;
$r = q("SELECT `contact`.*, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid`
WHERE `contact`.`id` = %d LIMIT 1",

View file

@ -303,7 +303,7 @@ function display_content(&$a, $update = 0) {
intval($contact_id),
intval($a->profile['uid'])
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$contact = $r[0];
$remote_contact = true;
}
@ -319,7 +319,7 @@ function display_content(&$a, $update = 0) {
$r = qu("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1",
intval($a->profile['uid'])
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$a->page_contact = $r[0];
}
$is_owner = ((local_user()) && (local_user() == $a->profile['profile_uid']) ? true : false);

View file

@ -344,9 +344,10 @@ function events_content(&$a) {
$events=array();
// transform the event in a usable array
if(dbm::is_result($r))
if(dbm::is_result($r)) {
$r = sort_by_date($r);
$events = process_events($r);
}
if ($a->argv[1] === 'json'){
echo json_encode($events); killme();

View file

@ -130,7 +130,7 @@ function item_post(&$a) {
intval($parent_item['contact-id']),
intval($uid)
);
if (dbm::is_result($r))
if(dbm::is_result($r))
$parent_contact = $r[0];
// If the contact id doesn't fit with the contact, then set the contact to null
@ -234,7 +234,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($profile_uid)
);
if (dbm::is_result($r))
if(dbm::is_result($r))
$user = $r[0];
if($orig_post) {
@ -399,7 +399,7 @@ function item_post(&$a) {
}
}
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$author = $r[0];
$contact_id = $author['id'];
}
@ -413,7 +413,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` = 1 LIMIT 1",
intval($profile_uid)
);
if (dbm::is_result($r))
if(dbm::is_result($r))
$contact_record = $r[0];
}
@ -496,7 +496,7 @@ function item_post(&$a) {
intval($profile_uid),
intval($attach)
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$r = q("UPDATE `attach` SET `allow_cid` = '%s', `allow_gid` = '%s', `deny_cid` = '%s', `deny_gid` = '%s'
WHERE `uid` = %d AND `id` = %d",
dbesc($str_contact_allow),
@ -637,7 +637,7 @@ function item_post(&$a) {
intval($profile_uid),
intval($mtch)
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
if(strlen($attachments))
$attachments .= ',';
$attachments .= '[attach]href="' . $a->get_baseurl() . '/attach/' . $r[0]['id'] . '" length="' . $r[0]['filesize'] . '" type="' . $r[0]['filetype'] . '" title="' . (($r[0]['filename']) ? $r[0]['filename'] : '') . '"[/attach]';

View file

@ -309,18 +309,20 @@ function message_content(&$a) {
intval(local_user()),
intval($a->argv[2])
);
if(!$r) {
if(!dbm::is_result($r)) {
$r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s' LIMIT 1",
intval(local_user()),
dbesc(normalise_link(base64_decode($a->argv[2])))
);
}
if(!$r) {
if(!dbm::is_result($r)) {
$r = q("SELECT `name`, `url`, `id` FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1",
intval(local_user()),
dbesc(base64_decode($a->argv[2]))
);
}
if(dbm::is_result($r)) {
$prename = $r[0]['name'];
$preurl = $r[0]['url'];

View file

@ -13,9 +13,12 @@ function msearch_post(&$a) {
$r = q("SELECT COUNT(*) AS `total` FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') ",
dbesc($search)
);
if(dbm::is_result($r))
$total = $r[0]['total'];
$results = array();
$r = q("SELECT `pub_keywords`, `username`, `nickname`, `user`.`uid` FROM `user` LEFT JOIN `profile` ON `user`.`uid` = `profile`.`uid` WHERE `is-default` = 1 AND `user`.`hidewall` = 0 AND MATCH `pub_keywords` AGAINST ('%s') LIMIT %d , %d ",
dbesc($search),
intval($startrec),
@ -23,6 +26,7 @@ function msearch_post(&$a) {
);
$results = array();
if(dbm::is_result($r)) {
foreach($r as $rr)
$results[] = array(
@ -39,4 +43,4 @@ function msearch_post(&$a) {
killme();
}
}

View file

@ -729,7 +729,9 @@ function network_content(&$a, $update = 0) {
intval($parents),
intval($max_comments + 1)
);
$items = array_merge($items, $thread_items);
if (dbm::is_result($thread_items))
$items = array_merge($items, $thread_items);
}
$items = conv_sort($items,$ordering);
} else {

View file

@ -305,7 +305,6 @@ function notifications_content(&$a) {
$notif_nocontent = sprintf( t('No more %s notifications.'), $notifs['ident']);
}
$o .= replace_macros($notif_tpl, array(
'$notif_header' => $notif_header,
'$tabs' => $tabs,

View file

@ -48,7 +48,7 @@ function p_init($a){
$r = q("SELECT `user`.`prvkey`, `contact`.`addr`, `user`.`nickname`, `contact`.`nick` FROM `user`
INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid`
WHERE `user`.`uid` = %d", intval($item[0]["uid"]));
if (!$r) {
if (!dbm::is_result($r)) {
header($_SERVER["SERVER_PROTOCOL"].' 404 '.t('Not Found'));
killme();
}

View file

@ -117,7 +117,7 @@ function photo_init(&$a) {
intval($resolution)
);
$public = ($r[0]['allow_cid'] == '') AND ($r[0]['allow_gid'] == '') AND ($r[0]['deny_cid'] == '') AND ($r[0]['deny_gid'] == '');
$public = (dbm::is_result($r)) && ($r[0]['allow_cid'] == '') AND ($r[0]['allow_gid'] == '') AND ($r[0]['deny_cid'] == '') AND ($r[0]['deny_gid'] == '');
if(dbm::is_result($r)) {
$resolution = $r[0]['scale'];

View file

@ -254,8 +254,8 @@ function photos_post(&$a) {
dbesc($album)
);
}
if (dbm::is_result($r)) {
foreach ($r as $rr) {
if(dbm::is_result($r)) {
foreach($r as $rr) {
$res[] = "'" . dbesc($rr['rid']) . "'" ;
}
} else {
@ -276,8 +276,8 @@ function photos_post(&$a) {
$r = q("SELECT `parent-uri` FROM `item` WHERE `resource-id` IN ( $str_res ) AND `uid` = %d",
intval($page_owner_uid)
);
if (dbm::is_result($r)) {
foreach ($r as $rr) {
if(dbm::is_result($r)) {
foreach($r as $rr) {
q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(datetime_convert()),
dbesc($rr['parent-uri']),
@ -337,7 +337,7 @@ function photos_post(&$a) {
dbesc($a->argv[2])
);
}
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
q("DELETE FROM `photo` WHERE `uid` = %d AND `resource-id` = '%s'",
intval($page_owner_uid),
dbesc($r[0]['resource-id'])
@ -393,7 +393,7 @@ function photos_post(&$a) {
dbesc($resource_id),
intval($page_owner_uid)
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$ph = new Photo($r[0]['data'], $r[0]['type']);
if ($ph->is_valid()) {
$rotate_deg = ( (intval($_POST['rotate']) == 1) ? 270 : 90 );
@ -510,7 +510,7 @@ function photos_post(&$a) {
intval($page_owner_uid)
);
}
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$old_tag = $r[0]['tag'];
$old_inform = $r[0]['inform'];
}
@ -594,7 +594,7 @@ function photos_post(&$a) {
intval($page_owner_uid)
);
}*/
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$newname = $r[0]['name'];
$profile = $r[0]['url'];
$notify = 'cid:' . $r[0]['id'];
@ -1008,7 +1008,7 @@ function photos_content(&$a) {
intval($contact_id),
intval($owner_uid)
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$can_post = true;
$contact = $r[0];
$remote_contact = true;
@ -1036,7 +1036,7 @@ function photos_content(&$a) {
intval($contact_id),
intval($owner_uid)
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$contact = $r[0];
$remote_contact = true;
}
@ -1188,7 +1188,7 @@ function photos_content(&$a) {
intval($owner_uid),
dbesc($album)
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(20);
}
@ -1243,7 +1243,7 @@ function photos_content(&$a) {
$photos = array();
if (dbm::is_result($r))
if(dbm::is_result($r))
$twist = 'rotright';
foreach ($r as $rr) {
if ($twist == 'rotright')
@ -1435,7 +1435,7 @@ function photos_content(&$a) {
);
if (dbm::is_result($r))
if(dbm::is_result($r))
$a->set_pager_total($r[0]['total']);
@ -1611,7 +1611,7 @@ function photos_content(&$a) {
// display comments
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
foreach ($r as $item) {
builtin_activity_puller($item, $conv_responses);
@ -1794,7 +1794,7 @@ function photos_content(&$a) {
dbesc('Contact Photos'),
dbesc( t('Contact Photos'))
);
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$a->set_pager_total(count($r));
$a->set_pager_itemspage(20);
}
@ -1812,7 +1812,7 @@ function photos_content(&$a) {
$photos = array();
if (dbm::is_result($r)) {
if(dbm::is_result($r)) {
$twist = 'rotright';
foreach ($r as $rr) {
//hide profile photos to others

View file

@ -173,7 +173,7 @@ function poco_init(&$a) {
}
if(is_array($r)) {
if(count($r) > 0) {
if(dbm::is_result($r)) {
foreach($r as $rr) {
if (!isset($rr['generation'])) {
if ($global)

View file

@ -256,21 +256,21 @@ function profile_content(&$a, $update = 0) {
AND `thread`.`wall` = 1
$sql_extra $sql_extra2 ",
intval($a->profile['profile_uid'])
);
);
if(dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']);
if(dbm::is_result($r)) {
$a->set_pager_total($r[0]['total']);
}
}
// check if we serve a mobile device and get the user settings
// accordingly
if ($a->is_mobile) {
$itemspage_network = get_pconfig(local_user(),'system','itemspage_mobile_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 10);
$itemspage_network = get_pconfig(local_user(),'system','itemspage_mobile_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 10);
} else {
$itemspage_network = get_pconfig(local_user(),'system','itemspage_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20);
$itemspage_network = get_pconfig(local_user(),'system','itemspage_network');
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20);
}
// now that we have the user settings, see if the theme forces
// a maximum item number which is lower then the user choice

View file

@ -209,7 +209,6 @@ function search_content(&$a) {
$sql_extra = sprintf(" AND `item`.`body` REGEXP '%s' ", dbesc(protect_sprintf(preg_quote($search))));
}
$r = q("SELECT %s
FROM `item` %s
WHERE %s AND (`item`.`uid` = 0 OR (`item`.`uid` = %s AND NOT `item`.`global`))

View file

@ -55,13 +55,13 @@ function q($sql) {
return $result;
}
//second call in handle_body, name
if($result[0]['name']===$args[1]) {
return $result;
if($result[0]['name']===$args[1]) {
return $result;
}
}
//third call in handle_body, nick or attag
if($result[0]['nick']===$args[2] || $result[0]['attag']===$args[1]) {
return $result;
if($result[0]['nick']===$args[2] || $result[0]['attag']===$args[1]) {
return $result;
}
}
@ -88,23 +88,23 @@ function dbesc($str) {
*/
class GetTagsTest extends PHPUnit_Framework_TestCase {
/** the mock to use as app */
private $a;
private $a;
/**
* initialize the test. That's a phpUnit function,
* don't change its name.
*/
public function setUp() {
*/
public function setUp() {
$this->a=new MockApp();
}
/**
* test with one Person tag
*/
public function testGetTagsShortPerson() {
$text="hi @Mike";
$tags=get_tags($text);
/**
* test with one Person tag
*/
public function testGetTagsShortPerson() {
$text="hi @Mike";
$tags=get_tags($text);
$inform='';
$str_tags='';
@ -113,32 +113,32 @@ class GetTagsTest extends PHPUnit_Framework_TestCase {
}
//correct tags found?
$this->assertEquals(1, count($tags));
$this->assertEquals(1, count($tags));
$this->assertTrue(in_array("@Mike", $tags));
//correct output from handle_tag?
$this->assertEquals("cid:15", $inform);
$this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags);
$this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url]", $text);
$this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url]", $text);
}
/**
/**
* test with one Person tag.
* There's a minor spelling mistake...
*/
public function testGetTagsShortPersonSpelling() {
$text="hi @Mike.because";
$tags=get_tags($text);
* There's a minor spelling mistake...
*/
public function testGetTagsShortPersonSpelling() {
$text="hi @Mike.because";
//correct tags found?
$this->assertEquals(1, count($tags));
$tags=get_tags($text);
//correct tags found?
$this->assertEquals(1, count($tags));
$this->assertTrue(in_array("@Mike.because", $tags));
$inform='';
$str_tags='';
handle_tag($this->a, $text, $inform, $str_tags, 11, $tags[0]);
$inform='';
$str_tags='';
handle_tag($this->a, $text, $inform, $str_tags, 11, $tags[0]);
// (mike) - This is a tricky case.
// we support mentions as in @mike@example.com - which contains a period.
// This shouldn't match anything unless you have a contact named "Mike.because".
@ -147,91 +147,91 @@ class GetTagsTest extends PHPUnit_Framework_TestCase {
// $this->assertEquals("cid:15", $inform);
// $this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags);
// $this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url].because", $text);
// $this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url].because", $text);
$this->assertEquals("", $inform);
$this->assertEquals("", $str_tags);
}
/**
/**
* test with two Person tags.
* There's a minor spelling mistake...
*/
* There's a minor spelling mistake...
*/
public function testGetTagsPerson2Spelling() {
$text="hi @Mike@campino@friendica.eu";
$tags=get_tags($text);
public function testGetTagsPerson2Spelling() {
$text="hi @Mike@campino@friendica.eu";
$tags=get_tags($text);
// This construct is not supported. Results are indeterminate
// $this->assertEquals(2, count($tags));
// $this->assertEquals(2, count($tags));
// $this->assertTrue(in_array("@Mike", $tags));
// $this->assertTrue(in_array("@campino@friendica.eu", $tags));
}
// $this->assertTrue(in_array("@campino@friendica.eu", $tags));
}
/**
* Test with one hash tag.
*/
public function testGetTagsShortTag() {
$text="This is a #test_case";
$tags=get_tags($text);
*/
public function testGetTagsShortTag() {
$text="This is a #test_case";
$this->assertEquals(1, count($tags));
$this->assertTrue(in_array("#test_case", $tags));
}
$tags=get_tags($text);
$this->assertEquals(1, count($tags));
$this->assertTrue(in_array("#test_case", $tags));
}
/**
* test with a person and a hash tag
*/
public function testGetTagsShortTagAndPerson() {
$text="hi @Mike This is a #test_case";
$tags=get_tags($text);
*/
public function testGetTagsShortTagAndPerson() {
$text="hi @Mike This is a #test_case";
$tags=get_tags($text);
$this->assertEquals(3, count($tags));
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("@Mike This", $tags));
$this->assertTrue(in_array("#test_case", $tags));
$this->assertTrue(in_array("@Mike This", $tags));
$this->assertTrue(in_array("#test_case", $tags));
$inform='';
$str_tags='';
foreach($tags as $tag) {
handle_tag($this->a, $text, $inform, $str_tags, 11, $tag);
}
$this->assertEquals("cid:15", $inform);
$this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url],#[url=baseurl/search?tag=test%20case]test case[/url]", $str_tags);
$this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url] This is a #[url=baseurl/search?tag=test%20case]test case[/url]", $text);
}
}
/**
* test with a person, a hash tag and some special chars.
*/
public function testGetTagsShortTagAndPersonSpecialChars() {
$text="hi @Mike, This is a #test_case.";
$tags=get_tags($text);
*/
public function testGetTagsShortTagAndPersonSpecialChars() {
$text="hi @Mike, This is a #test_case.";
$tags=get_tags($text);
$this->assertEquals(2, count($tags));
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("#test_case", $tags));
}
$this->assertTrue(in_array("#test_case", $tags));
}
/**
* Test with a person tag and text behind it.
*/
public function testGetTagsPersonOnly() {
$text="@Test I saw the Theme Dev group was created.";
$tags=get_tags($text);
*/
public function testGetTagsPersonOnly() {
$text="@Test I saw the Theme Dev group was created.";
$this->assertEquals(2, count($tags));
$tags=get_tags($text);
$this->assertEquals(2, count($tags));
$this->assertTrue(in_array("@Test I", $tags));
$this->assertTrue(in_array("@Test", $tags));
}
$this->assertTrue(in_array("@Test", $tags));
}
/**
* this test demonstrates strange behaviour by intval.
@ -255,72 +255,72 @@ class GetTagsTest extends PHPUnit_Framework_TestCase {
//happens right now, but it shouldn't be necessary
$this->assertTrue(in_array("@mike+15 id", $tags));
$inform='';
$inform='';
$str_tags='';
foreach($tags as $tag) {
handle_tag($this->a, $text, $inform, $str_tags, 11, $tag);
}
$this->assertEquals("Test with @[url=http://justatest.de]Mike Lastname[/url] id tag", $text);
$this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags);
$this->assertEquals("Test with @[url=http://justatest.de]Mike Lastname[/url] id tag", $text);
$this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags);
// this test may produce two cid:15 entries - which is OK because duplicates are pruned before delivery
$this->assertContains("cid:15",$inform);
}
/**
* test with two persons and one special tag.
*/
public function testGetTags2Persons1TagSpecialChars() {
$text="hi @Mike, I'm just writing #test_cases, so"
." so @somebody@friendica.com may change #things.";
$tags=get_tags($text);
*/
public function testGetTags2Persons1TagSpecialChars() {
$text="hi @Mike, I'm just writing #test_cases, so"
." so @somebody@friendica.com may change #things.";
$this->assertEquals(5, count($tags));
$this->assertTrue(in_array("@Mike", $tags));
$tags=get_tags($text);
$this->assertEquals(5, count($tags));
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("#test_cases", $tags));
$this->assertTrue(in_array("@somebody@friendica.com", $tags));
$this->assertTrue(in_array("@somebody@friendica.com may", $tags));
$this->assertTrue(in_array("#things", $tags));
}
$this->assertTrue(in_array("@somebody@friendica.com", $tags));
$this->assertTrue(in_array("@somebody@friendica.com may", $tags));
$this->assertTrue(in_array("#things", $tags));
}
/**
* test with a long text.
*/
public function testGetTags() {
$text="hi @Mike, I'm just writing #test_cases, "
." so @somebody@friendica.com may change #things. Of course I "
."look for a lot of #pitfalls, like #tags at the end of a sentence "
."@comment. I hope noone forgets about @fullstops.because that might"
." break #things. @Mike@campino@friendica.eu is also #nice, isn't it? "
."Now, add a @first_last tag. ";
$tags=get_tags($text);
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("#test_cases", $tags));
$this->assertTrue(in_array("@somebody@friendica.com", $tags));
$this->assertTrue(in_array("#things", $tags));
$this->assertTrue(in_array("#pitfalls", $tags));
$this->assertTrue(in_array("#tags", $tags));
$this->assertTrue(in_array("@comment", $tags));
$this->assertTrue(in_array("@fullstops.because", $tags));
$this->assertTrue(in_array("#things", $tags));
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("#nice", $tags));
*/
public function testGetTags() {
$text="hi @Mike, I'm just writing #test_cases, "
." so @somebody@friendica.com may change #things. Of course I "
."look for a lot of #pitfalls, like #tags at the end of a sentence "
."@comment. I hope noone forgets about @fullstops.because that might"
." break #things. @Mike@campino@friendica.eu is also #nice, isn't it? "
."Now, add a @first_last tag. ";
$tags=get_tags($text);
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("#test_cases", $tags));
$this->assertTrue(in_array("@somebody@friendica.com", $tags));
$this->assertTrue(in_array("#things", $tags));
$this->assertTrue(in_array("#pitfalls", $tags));
$this->assertTrue(in_array("#tags", $tags));
$this->assertTrue(in_array("@comment", $tags));
$this->assertTrue(in_array("@fullstops.because", $tags));
$this->assertTrue(in_array("#things", $tags));
$this->assertTrue(in_array("@Mike", $tags));
$this->assertTrue(in_array("#nice", $tags));
$this->assertTrue(in_array("@first_last", $tags));
//right now, none of the is matched (unsupported)
// $this->assertFalse(in_array("@Mike@campino@friendica.eu", $tags));
// $this->assertFalse(in_array("@Mike@campino@friendica.eu", $tags));
// $this->assertTrue(in_array("@campino@friendica.eu", $tags));
// $this->assertTrue(in_array("@campino@friendica.eu is", $tags));
}
// $this->assertTrue(in_array("@campino@friendica.eu is", $tags));
}
/**
* test with an empty string
*/
public function testGetTagsEmpty() {
$tags=get_tags("");
$this->assertEquals(0, count($tags));
*/
public function testGetTagsEmpty() {
$tags=get_tags("");
$this->assertEquals(0, count($tags));
}
}
}

View file

@ -32,21 +32,21 @@
<!--[if IE]>
<script type="text/javascript" src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="js/modernizr.js" ></script>
<script type="text/javascript" src="js/jquery.js" ></script>
<!-- <script type="text/javascript" src="js/jquery-migrate.js" ></script>-->
<script type="text/javascript" src="js/jquery-migrate.js" ></script>
<script type="text/javascript" src="js/jquery.textinputs.js" ></script>
<script type="text/javascript" src="library/jquery-textcomplete/jquery.textcomplete.min.js" ></script>
<script type="text/javascript" src="js/autocomplete.js" ></script>
<script type="text/javascript" src="library/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="library/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="library/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
<script type="text/javascript" src="js/acl.js" ></script>
<script type="text/javascript" src="js/webtoolkit.base64.js" ></script>
<script type="text/javascript" src="js/main.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/modernizr.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/jquery.js" ></script>
<!-- <script type="text/javascript" src="{{$baseurl}}/js/jquery-migrate.js" ></script>-->
<script type="text/javascript" src="{{$baseurl}}/js/jquery-migrate.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/jquery.textinputs.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/library/jquery-textcomplete/jquery.textcomplete.min.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/autocomplete.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/library/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/library/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/acl.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/webtoolkit.base64.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/main.js" ></script>
<script>
var updateInterval = {{$update_interval}};

View file

@ -24,69 +24,69 @@ img {
}
#pending-update {
float:right;
color: #ffffff;
font-weight: bold;
background-color: #FF0000;
padding: 0em 0.3em;
float:right;
color: #ffffff;
font-weight: bold;
background-color: #FF0000;
padding: 0em 0.3em;
}
.admin.linklist {
border: 0px;
padding: 0px;
list-style: none;
margin-top: 0px;
border: 0px;
padding: 0px;
list-style: none;
margin-top: 0px;
}
.admin.link {
list-style-position: inside;
font-size: 1em;
/* padding-left: 5px;
margin: 5px; */
list-style-position: inside;
font-size: 1em;
/* padding-left: 5px;
margin: 5px; */
}
#adminpage dl {
clear: left;
margin-bottom: 2px;
padding-bottom: 2px;
border-bottom: 1px solid black;
clear: left;
margin-bottom: 2px;
padding-bottom: 2px;
border-bottom: 1px solid black;
}
#adminpage dt {
width: 200px;
float: left;
font-weight: bold;
width: 200px;
float: left;
font-weight: bold;
}
#adminpage dd {
margin-left: 200px;
margin-left: 200px;
}
#adminpage h3 {
border-bottom: 1px solid #898989;
margin-bottom: 5px;
margin-top: 10px;
border-bottom: 1px solid #898989;
margin-bottom: 5px;
margin-top: 10px;
}
#adminpage .submit {
clear:left;
clear:left;
}
#adminpage #pluginslist {
margin: 0px; padding: 0px;
margin: 0px; padding: 0px;
}
#adminpage .plugin {
list-style: none;
display: block;
/* border: 1px solid #888888; */
padding: 1em;
margin-bottom: 5px;
clear: left;
list-style: none;
display: block;
/* border: 1px solid #888888; */
padding: 1em;
margin-bottom: 5px;
clear: left;
}
#adminpage .toggleplugin {
float:left;
margin-right: 1em;
float:left;
margin-right: 1em;
}
#adminpage table {width:100%; border-bottom: 1px solid #000000; margin: 5px 0px;}

View file

@ -170,12 +170,13 @@ function vier_community_info() {
$publish = (get_config('system','publish_all') ? '' : " AND `publish` = 1 ");
$order = " ORDER BY `register_date` DESC ";
$tpl = get_markup_template('ch_directory_item.tpl');
$r = q("SELECT `profile`.*, `profile`.`uid` AS `profile_uid`, `user`.`nickname`
FROM `profile` LEFT JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $order LIMIT %d , %d ",
0, 9);
$tpl = get_markup_template('ch_directory_item.tpl');
if(dbm::is_result($r)) {
$aside['$lastusers_title'] = t('Last users');
@ -367,7 +368,7 @@ function vier_community_info() {
$tpl = get_markup_template('ch_connectors.tpl');
if(count($r)) {
if(dbm::is_result($r)) {
$con_services = array();
$con_services['title'] = Array("", t('Connect Services'), "", "");