if(strlen($plugins)) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1");
- if(count($r))
+ if (dbm::is_result($r))
$installed = $r;
else
$installed = array();
*/
function plugin_enabled($plugin) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = '%s'", $plugin);
- return((bool)(count($r) > 0));
+ return ((dbm::is_result($r)) && (count($r) > 0));
}
dbesc($file),
dbesc($function)
);
- if(count($r))
+ if (dbm::is_result($r))
return true;
$r = q("INSERT INTO `hook` (`hook`, `file`, `function`, `priority`) VALUES ( '%s', '%s', '%s', '%s' ) ",
$a = get_app();
$a->hooks = array();
$r = q("SELECT * FROM `hook` WHERE 1 ORDER BY `priority` DESC, `file`");
- if(count($r)) {
+ if (dbm::is_result($r)) {
foreach($r as $rr) {
if(! array_key_exists($rr['hook'],$a->hooks))
$a->hooks[$rr['hook']] = array();
* @return string
*/
function get_theme_screenshot($theme) {
- $a = get_app();
$exts = array('.png','.jpg');
foreach($exts as $ext) {
- if(file_exists('view/theme/' . $theme . '/screenshot' . $ext))
- return($a->get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext);
+ if(file_exists('view/theme/' . $theme . '/screenshot' . $ext)) {
+ return(App::get_baseurl() . '/view/theme/' . $theme . '/screenshot' . $ext);
+ }
}
- return($a->get_baseurl() . '/images/blank.png');
+ return(App::get_baseurl() . '/images/blank.png');
}
// install and uninstall theme
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
- if($r !== false and count($r)) {
+ if (dbm::is_result($r)) {
$service_class = $r[0]['service_class'];
}
}
$r = q("SELECT `service_class` FROM `user` WHERE `uid` = %d LIMIT 1",
intval($uid)
);
- if($r !== false and count($r)) {
+ if (dbm::is_result($r)) {
$service_class = $r[0]['service_class'];
}
}