]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Check for config file when running
[quix0rs-gnu-social.git] / lib / util.php
index 094b2750caf8ad73e3bb8d4ba0016d218b756b91..f9a787d473262b52ad9ea5862803c36feda6fc06 100644 (file)
@@ -81,7 +81,7 @@ function common_language()
 
     // If there is a user logged in and they've set a language preference
     // then return that one...
-    if (common_logged_in()) {
+    if (_have_config() && common_logged_in()) {
         $user = common_current_user();
         $user_language = $user->language;
         if ($user_language)
@@ -315,6 +315,10 @@ function common_current_user()
 {
     global $_cur;
 
+    if (!_have_config()) {
+        return null;
+    }
+
     if ($_cur === false) {
 
         if (isset($_REQUEST[session_name()]) || (isset($_SESSION['userid']) && $_SESSION['userid'])) {
@@ -456,6 +460,9 @@ function common_replace_urls_callback($text, $callback) {
 
         if (!in_array($url_parts[2], $tlds)) continue;
 
+        // Make sure we didn't capture a hash tag
+        if (strpos($url, '#') === 0) continue;
+
         // Put the url back the way we found it.
         $url = (mb_strpos($orig_url, htmlspecialchars($url)) === FALSE) ? $url:htmlspecialchars($url);
 
@@ -481,7 +488,7 @@ function common_linkify($url) {
     $url = (!preg_match('#^([a-z]+://|(mailto|aim|tel):)#i', $url)) ? 'http://'.$url : $url;
 
     $attrs = array('href' => $url, 'rel' => 'external');
-    
+
     if (in_array($ext, $video_ext)) {
         $attrs['class'] = 'media';
     }
@@ -596,7 +603,7 @@ function common_tag_link($tag)
     $xs->element('a', array('href' => $url,
                             'rel' => 'tag'),
                  $tag);
-    $xs->elementEnd();
+    $xs->elementEnd('span');
     return $xs->getString();
 }
 
@@ -705,10 +712,10 @@ function common_relative_profile($sender, $nickname, $dt=null)
     return null;
 }
 
-function common_local_url($action, $args=null, $fragment=null)
+function common_local_url($action, $args=null, $params=null, $fragment=null)
 {
     $r = Router::get();
-    $path = $r->build($action, $args, $fragment);
+    $path = $r->build($action, $args, $params, $fragment);
     if ($path) {
     }
     if (common_config('site','fancy')) {