}
- function get_basepath() {
+ public static function get_basepath() {
$basepath = get_config("system", "basepath");
} else {
$r = q("SELECT `contact`.`avatar-date` AS picdate FROM `contact` WHERE `contact`.`thumb` like '%%/%s'",
$common_filename);
- if(! dbm::is_result($r)){
+ if (! dbm::is_result($r)) {
$this->cached_profile_image[$avatar_image] = $avatar_image;
} else {
$this->cached_profile_picdate[$common_filename] = "?rev=".urlencode($r[0]['picdate']);
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 max_processes_reached() {
- // Is the function called statically?
- if (!is_object($this))
- return(self::$a->max_processes_reached());
-
if ($this->is_backend()) {
$process = "backend";
$max_processes = get_config('system', 'max_processes_backend');
*/
function maxload_reached() {
- // Is the function called statically?
- if (!is_object($this))
- return(self::$a->maxload_reached());
-
if ($this->is_backend()) {
$process = "backend";
$maxsysload = intval(get_config('system', 'maxloadavg'));
function clean_urls() {
- global $a;
+ $a = get_app();
// if($a->config['system']['clean_urls'])
return true;
// return false;
}
function z_path() {
- global $a;
- $base = $a->get_baseurl();
+ $base = App::get_baseurl();
+
if(! clean_urls())
$base .= '/?q=';
+
return $base;
}
* @see App::get_baseurl()
*
* @return string
+ * @TODO Maybe super-flous and deprecated? Seems to only wrap App::get_baseurl()
*/
function z_root() {
- global $a;
- return $a->get_baseurl();
+ return App::get_baseurl();
}
/**
* Sets the base url for use in cmdline programs which don't have
* $_SERVER variables
*/
-function check_url(&$a) {
+function check_url(App &$a) {
$url = get_config('system','url');
// We will only change the url to an ip address if there is no existing setting
if(! x($url))
- $url = set_config('system','url',$a->get_baseurl());
- if((! link_compare($url,$a->get_baseurl())) && (! preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$a->get_hostname)))
- $url = set_config('system','url',$a->get_baseurl());
+ $url = set_config('system','url',App::get_baseurl());
+ if((! link_compare($url,App::get_baseurl())) && (! preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$a->get_hostname)))
+ $url = set_config('system','url',App::get_baseurl());
return;
}
/**
* @brief Automatic database updates
*/
-function update_db(&$a) {
+function update_db(App &$a) {
$build = get_config('system','build');
if(! x($build))
$build = set_config('system','build',DB_UPDATE_VERSION);
* @param App $a
*
*/
-function check_plugins(&$a) {
+function check_plugins(App &$a) {
$r = q("SELECT * FROM `addon` WHERE `installed` = 1");
- if(dbm::is_result($r))
+ if (dbm::is_result($r))
$installed = $r;
else
$installed = array();
* @return int
*/
function get_max_import_size() {
- global $a;
+ $a = get_app();
return ((x($a->config,'max_import_size')) ? $a->config['max_import_size'] : 0 );
}
$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'];
}
* @return string
*/
function current_theme_url() {
- global $a;
+ $a = get_app();
$t = current_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');
return("");
}
-function set_template_engine(&$a, $engine = 'internal') {
+/// @deprecated
+function set_template_engine(App &$a, $engine = 'internal') {
/// @note This function is no longer necessary, but keep it as a wrapper to the class method
/// to avoid breaking themes again unnecessarily