X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=boot.php;h=05a334a1fa50ddd33ef1fb08a4194dbebcdb7e6d;hb=e97a6dfb77f27c03da63d96a2995891f05856d0c;hp=7f3238013a779c3f720f04f4e71335b6cf930438;hpb=17b1d459687ec068dd5bd968196f8afc8660b14d;p=friendica.git diff --git a/boot.php b/boot.php index 7f3238013a..05a334a1fa 100644 --- a/boot.php +++ b/boot.php @@ -17,9 +17,9 @@ require_once('include/dbstructure.php'); define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_CODENAME', 'Lily of the valley'); -define ( 'FRIENDICA_VERSION', '3.4.1' ); +define ( 'FRIENDICA_VERSION', '3.4.3-rc' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); -define ( 'DB_UPDATE_VERSION', 1188 ); +define ( 'DB_UPDATE_VERSION', 1191 ); define ( 'EOL', "
\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); @@ -163,7 +163,8 @@ define ( 'NETWORK_TWITTER', 'twit'); // Twitter define ( 'NETWORK_DIASPORA2', 'dspc'); // Diaspora connector define ( 'NETWORK_STATUSNET', 'stac'); // Statusnet connector define ( 'NETWORK_APPNET', 'apdn'); // app.net - +define ( 'NETWORK_NEWS', 'nntp'); // Network News Transfer Protocol +define ( 'NETWORK_ICALENDAR', 'ical'); // iCalendar define ( 'NETWORK_PHANTOM', 'unkn'); // Place holder /** @@ -189,7 +190,9 @@ $netgroup_ids = array( NETWORK_TWITTER => (-14), NETWORK_DIASPORA2 => (-15), NETWORK_STATUSNET => (-16), - NETWORK_APPNET => (-17), + NETWORK_APPNET => (-17), + NETWORK_NEWS => (-18), + NETWORK_ICALENDAR => (-19), NETWORK_PHANTOM => (-127), ); @@ -270,6 +273,10 @@ define ( 'NAMESPACE_ATOM1', 'http://www.w3.org/2005/Atom' ); define ( 'ACTIVITY_LIKE', NAMESPACE_ACTIVITY_SCHEMA . 'like' ); define ( 'ACTIVITY_DISLIKE', NAMESPACE_DFRN . '/dislike' ); +define ( 'ACTIVITY_ATTEND', NAMESPACE_ZOT . '/activity/attendyes' ); +define ( 'ACTIVITY_ATTENDNO', NAMESPACE_ZOT . '/activity/attendno' ); +define ( 'ACTIVITY_ATTENDMAYBE', NAMESPACE_ZOT . '/activity/attendmaybe' ); + define ( 'ACTIVITY_OBJ_HEART', NAMESPACE_DFRN . '/heart' ); define ( 'ACTIVITY_FRIEND', NAMESPACE_ACTIVITY_SCHEMA . 'make-friend' ); @@ -408,6 +415,7 @@ if(! class_exists('App')) { public $videoheight = 350; public $force_max_items = 0; public $theme_thread_allow = true; + public $theme_events_in_profile = true; // An array for all theme-controllable parameters // Mostly unimplemented yet. Only options 'stylesheet' and @@ -626,6 +634,9 @@ if(! class_exists('App')) { $basepath = get_config("system", "basepath"); + if ($basepath == "") + $basepath = dirname(__FILE__); + if ($basepath == "") $basepath = $_SERVER["DOCUMENT_ROOT"]; @@ -726,10 +737,22 @@ if(! class_exists('App')) { function init_pagehead() { $interval = ((local_user()) ? get_pconfig(local_user(),'system','update_interval') : 40000); + + // If the update is "deactivated" set it to the highest integer number (~24 days) + if ($interval < 0) + $interval = 2147483647; + if($interval < 10000) $interval = 40000; - $this->page['title'] = $this->config['sitename']; + // compose the page title from the sitename and the + // current module called + if (!$this->module=='') + { + $this->page['title'] = $this->config['sitename'].' ('.$this->module.')'; + } else { + $this->page['title'] = $this->config['sitename']; + } /* put the head template at the beginning of page['htmlhead'] * since the code added by the modules frequently depends on it @@ -1433,21 +1456,42 @@ if(! function_exists('proc_run')) { return; if(count($args) && $args[0] === 'php') { - $argv = $args; - array_shift($argv); - $parameters = json_encode($argv); - $found = q("SELECT `id` FROM `workerqueue` WHERE `parameter` = '%s'", - dbesc($parameters)); + if (get_config("system", "worker")) { + $argv = $args; + array_shift($argv); - if (!$found) - q("INSERT INTO `workerqueue` (`parameter`, `created`, `priority`) - VALUES ('%s', '%s', %d)", - dbesc($parameters), - dbesc(datetime_convert()), - intval(0)); + $parameters = json_encode($argv); + $found = q("SELECT `id` FROM `workerqueue` WHERE `parameter` = '%s'", + dbesc($parameters)); - // return; + if (!$found) + q("INSERT INTO `workerqueue` (`parameter`, `created`, `priority`) + VALUES ('%s', '%s', %d)", + dbesc($parameters), + dbesc(datetime_convert()), + intval(0)); + + // Should we quit and wait for the poller to be called as a cronjob? + if (get_config("system", "worker_dont_fork")) + return; + + // Checking number of workers + $workers = q("SELECT COUNT(*) AS `workers` FROM `workerqueue` WHERE `executed` != '0000-00-00 00:00:00'"); + + // Get number of allowed number of worker threads + $queues = intval(get_config("system", "worker_queues")); + + if ($queues == 0) + $queues = 4; + + // If there are already enough workers running, don't fork another one + if ($workers[0]["workers"] >= $queues) + return; + + // Now call the poller to execute the jobs that we just added to the queue + $args = array("php", "include/poller.php", "no_cron"); + } $args[0] = ((x($a->config,'php_path')) && (strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); } @@ -1636,7 +1680,7 @@ if(! function_exists('load_contact_links')) { if(! $uid || x($a->contacts,'empty')) return; - $r = q("SELECT `id`,`network`,`url`,`thumb` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `thumb` != ''", + $r = q("SELECT `id`,`network`,`url`,`thumb`, `rel` FROM `contact` WHERE `uid` = %d AND `self` = 0 AND `blocked` = 0 AND `thumb` != ''", intval($uid) ); if(count($r)) { @@ -1827,7 +1871,11 @@ function get_lockpath() { if ($temppath != "") { $lockpath = $temppath."/lock"; - mkdir($lockpath); + + if (!is_dir($lockpath)) + mkdir($lockpath); + elseif (!is_writable($lockpath)) + $lockpath = $temppath; if (is_dir($lockpath) AND is_writable($lockpath)) { set_config("system", "lockpath", $lockpath); @@ -1872,3 +1920,31 @@ if(!function_exists('exif_imagetype')) { return($size[2]); } } + +function validate_include(&$file) { + $orig_file = $file; + + $file = realpath($file); + + if (strpos($file, getcwd()) !== 0) + return false; + + $file = str_replace(getcwd()."/", "", $file, $count); + if ($count != 1) + return false; + + if ($orig_file !== $file) + return false; + + $valid = false; + if (strpos($file, "include/") === 0) + $valid = true; + + if (strpos($file, "addon/") === 0) + $valid = true; + + if (!$valid) + return false; + + return true; +}