]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Contact names with ">" and "<" are a problem ...
[friendica.git] / boot.php
index 3bbbef3c96520e2bb4685a21f9937c00019ecf37..b395d3423a586cde34ecdd7df0ad87858a427cae 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -17,7 +17,7 @@ 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.2' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
 define ( 'DB_UPDATE_VERSION',      1189      );
 define ( 'EOL',                    "<br />\r\n"     );
@@ -408,6 +408,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
@@ -1449,7 +1450,25 @@ if(! function_exists('proc_run')) {
                                                dbesc(datetime_convert()),
                                                intval(0));
 
-                               return;
+                               // 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');
@@ -1830,7 +1849,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);
@@ -1875,3 +1898,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;
+}