q("START TRANSACTION");
$r = q("SELECT `pid` FROM `process` WHERE `pid` = %d", intval(getmypid()));
- if(!dbm::is_result($r)) {
+ if (!dbm::is_result($r)) {
q("INSERT INTO `process` (`pid`,`command`,`created`) VALUES (%d, '%s', '%s')",
intval(getmypid()),
dbesc($command),
q("START TRANSACTION");
$r = q("SELECT `pid` FROM `process`");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach ($r AS $process) {
if (!posix_kill($process["pid"], 0)) {
q("DELETE FROM `process` WHERE `pid` = %d", intval($process["pid"]));
function check_plugins(&$a) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1");
- if(dbm::is_result($r))
+ if (dbm::is_result($r))
$installed = $r;
else
$installed = array();
$r = q("select theme from user where uid = %d limit 1",
intval($a->profile_uid)
);
- if(dbm::is_result($r))
+ if (dbm::is_result($r))
$page_theme = $r[0]['theme'];
}
intval($uid)
);
- if(dbm::is_result($p)) {
+ if (dbm::is_result($p)) {
$tmp_dob = substr($p[0]['dob'],5);
if(intval($tmp_dob)) {
$y = datetime_convert($tz,$tz,'now','Y');
// create 's' keys for everybody that does not have one
$r = q("SELECT * FROM `user` WHERE `spubkey` = '' ");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
$sres=openssl_pkey_new(array('encrypt_key' => false ));
$sprvkey = '';
function update_1011() {
q("ALTER TABLE `contact` ADD `nick` CHAR( 255 ) NOT NULL AFTER `name` ");
$r = q("SELECT * FROM `contact` WHERE 1");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
q("UPDATE `contact` SET `nick` = '%s' WHERE `id` = %d",
dbesc(basename($rr['url'])),
require_once('include/Photo.php');
q("ALTER TABLE `contact` ADD `micro` TEXT NOT NULL AFTER `thumb` ");
$r = q("SELECT * FROM `photo` WHERE `scale` = 4");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
$ph = new Photo($rr['data']);
if($ph->is_valid()) {
}
}
$r = q("SELECT * FROM `contact` WHERE 1");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
if(stristr($rr['thumb'],'avatar'))
q("UPDATE `contact` SET `micro` = '%s' WHERE `id` = %d",
function update_1036() {
$r = dbq("SELECT * FROM `contact` WHERE `network` = 'dfrn' && `photo` LIKE '%include/photo%' ");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d",
dbesc(str_replace('include/photo','photo',$rr['photo'])),
function update_1074() {
q("ALTER TABLE `user` ADD `hidewall` TINYINT( 1) NOT NULL DEFAULT '0' AFTER `blockwall` ");
$r = q("SELECT `uid` FROM `profile` WHERE `is-default` = 1 AND `hidewall` = 1");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr)
q("UPDATE `user` SET `hidewall` = 1 WHERE `uid` = %d",
intval($rr['uid'])
function update_1075() {
q("ALTER TABLE `user` ADD `guid` CHAR( 16 ) NOT NULL AFTER `uid` ");
$r = q("SELECT `uid` FROM `user` WHERE 1");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
$found = true;
do {
ADD INDEX ( `guid` ) ");
// make certain the following code is only executed once
$r = q("select `id` from `photo` where `guid` != '' limit 1");
- if(dbm::is_result($r))
+ if (dbm::is_result($r))
return;
$r = q("SELECT distinct(`resource-id`) FROM `photo` WHERE 1 group by `id`");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
$guid = get_guid();
q("update `photo` set `guid` = '%s' where `resource-id` = '%s'",
q("ALTER TABLE `item` ADD `commented` datetime NOT NULL DEFAULT '0000-00-00 00:00:00' AFTER `edited` ");
$r = q("SELECT `id` FROM `item` WHERE `parent` = `id` ");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
$x = q("SELECT max(`created`) AS `cdate` FROM `item` WHERE `parent` = %d LIMIT 1",
intval($rr['id'])
require_once('include/text.php');
$r = q("select id, url from contact where url != '' and nurl = '' ");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
q("update contact set nurl = '%s' where id = %d",
dbesc(normalise_link($rr['url'])),
// might be missing on new installs. We'll check.
$r = q("describe item");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr)
if($rr['Field'] == 'spam')
return;
// order in reverse so that we save the newest entry
$r = q("select * from config where 1 order by id desc");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
$found = false;
foreach($arr as $x) {
$arr = array();
$r = q("select * from pconfig where 1 order by id desc");
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
$found = false;
foreach($arr as $x) {
$r = suggestion_query(local_user(), 0, 9);
$tpl = get_markup_template('ch_directory_item.tpl');
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
$aside['$comunity_profiles_title'] = t('Community Profiles');
$aside['$comunity_profiles_items'] = array();
WHERE `is-default` = 1 $publish AND `user`.`blocked` = 0 $order LIMIT %d , %d ",
0, 9);
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
$aside['$lastusers_title'] = t('Last users');
$aside['$lastusers_items'] = array();
$tpl = get_markup_template('ch_connectors.tpl');
- if(dbm::is_result($r)) {
+ if (dbm::is_result($r)) {
$con_services = array();
$con_services['title'] = Array("", t('Connect Services'), "", "");