if (dbm::is_result($r))
return $r[0]['id'];
- $r = q("INSERT INTO `fcontact` ( `url`, `name`, `photo` ) VALUES ( '%s', '%s', '%s' ) ",
- dbesc($nurl),
- dbesc($name),
- dbesc($photo)
- );
+ $r = dba::insert('fcontact', array('url' => $nurl, 'name' => $name, 'photo' => $photo));
if (dbm::is_result($r)) {
$r = q("SELECT `id` FROM `fcontact` WHERE `url` = '%s' LIMIT 1",
}
function ffinder_store($uid,$cid,$fid) {
- $r = q("INSERT INTO `ffinder` ( `uid`, `cid`, `fid` ) VALUES ( %d, %d, %d ) ",
- intval($uid),
- intval($cid),
- intval($fid)
- );
+ $r = dba::insert('ffinder', array('uid' => $uid, 'cid' => $cid, 'fid' => $fid));
return $r;
}
}
return true;
}
- $r = q("INSERT INTO `group` ( `uid`, `name` )
- VALUES( %d, '%s' ) ",
- intval($uid),
- dbesc($name)
- );
+ $r = dba::insert('group', array('uid' => $uid, 'name' => $name));
$ret = $r;
}
return $ret;
// we indicate success because the group member was in fact created
// -- It was just created at another time
if (! dbm::is_result($r)) {
- $r = q("INSERT INTO `group_member` (`uid`, `gid`, `contact-id`)
- VALUES( %d, %d, %d ) ",
- intval($uid),
- intval($gid),
- intval($member)
- );
+ $r = dba::insert('group_member', array('uid' => $uid, 'gid' => $gid, 'contact-id' => $member));
}
return $r;
}
$j = json_decode($txt);
if ($j->type != "error") {
dba::insert('oembed', array('url' => normalise_link($embedurl),
- 'content' => $txt, 'created' => datetime_convert()));
+ 'content' => $txt, 'created' => datetime_convert()), true);
}
Cache::set($a->videowidth.$embedurl, $txt, CACHE_DAY);
$func = $plugin . '_install';
$func();
- $plugin_admin = (function_exists($plugin."_plugin_admin")?1:0);
+ $plugin_admin = (function_exists($plugin."_plugin_admin") ? 1 : 0);
- $r = q("INSERT INTO `addon` (`name`, `installed`, `timestamp`, `plugin_admin`) VALUES ( '%s', 1, %d , %d ) ",
- dbesc($plugin),
- intval($t),
- $plugin_admin
- );
+ dba::insert('addon', array('name' => $plugin, 'installed' => true,
+ 'timestamp' => $t, 'plugin_admin' => $plugin_admin));
// we can add the following with the previous SQL
// once most site tables have been updated.
if (dbm::is_result($r))
return true;
- $r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' ) ",
- dbesc($hook),
- dbesc($file),
- dbesc($function),
- dbesc($priority)
- );
+ $r = dba::insert('hook', array('hook' => $hook, 'file' => $file, 'function' => $function, 'priority' => $priority));
+
return $r;
}}
$r = q('SELECT `pid` FROM `process` WHERE `pid` = %d', intval(getmypid()));
if (!dbm::is_result($r)) {
- q("INSERT INTO `process` (`pid`,`command`,`created`) VALUES (%d, '%s', '%s')", intval(getmypid()), dbesc($command), dbesc(datetime_convert()));
+ dba::insert('process', array('pid' => getmypid(), 'command' => $command, 'created' => datetime_convert()));
}
dba::commit();
}
$data = self::getSiteinfo($url, $no_guessing, $do_oembed);
- q("INSERT INTO `parsed_url` (`url`, `guessing`, `oembed`, `content`, `created`) VALUES ('%s', %d, %d, '%s', '%s')
- ON DUPLICATE KEY UPDATE `content` = '%s', `created` = '%s'",
- dbesc(normalise_link($url)), intval(!$no_guessing), intval($do_oembed),
- dbesc(serialize($data)), dbesc(datetime_convert()),
- dbesc(serialize($data)), dbesc(datetime_convert()));
+ dba::insert('parsed_url', array('url' => normalise_link($url), 'guessing' => !$no_guessing,
+ 'oembed' => $do_oembed, 'content' => serialize($data),
+ 'created' => datetime_convert()), true);
return $data;
}