*/
class App
{
+ const MODE_NORMAL = 0;
+ const MODE_INSTALL = 1;
+ const MODE_MAINTENANCE = 2;
+
public $module_loaded = false;
public $module_class = null;
public $query_string;
public $argv;
public $argc;
public $module;
+ public $mode = App::MODE_NORMAL;
public $pager;
public $strings;
public $basepath;
// Register template engines
$this->register_template_engine('Friendica\Render\FriendicaSmartyEngine');
+ /**
+ * Load the configuration file which contains our DB credentials.
+ * Ignore errors. If the file doesn't exist or is empty, we are running in
+ * installation mode. *
+ */
+ $this->mode = ((file_exists('.htconfig.php') && filesize('.htconfig.php')) ? App::MODE_NORMAL : App::MODE_INSTALL);
+
+
self::$a = $this;
}
unset($this->config[$uid][$cat][$k]);
}
}
+
+ /**
+ * Generates the site's default sender email address
+ *
+ * @return string
+ */
+ public function getSenderEmailAddress()
+ {
+ $sender_email = Config::get('config', 'sender_email');
+ if (empty($sender_email)) {
+ $hostname = $this->get_hostname();
+ if (strpos($hostname, ':')) {
+ $hostname = substr($hostname, 0, strpos($hostname, ':'));
+ }
+
+ $sender_email = 'noreply@' . $hostname;
+ }
+
+ return $sender_email;
+ }
+
+ /**
+ * @note Checks, if the App is in the Maintenance-Mode
+ *
+ * @return boolean
+ */
+ public function checkMaintenanceMode()
+ {
+ if (Config::get('system', 'maintenance')) {
+ $this->mode = App::MODE_MAINTENANCE;
+ return true;
+ }
+
+ return false;
+ }
}