diff --git a/.htaccess b/.htaccess index 83d67e8f8..1b63f9ad6 100644 --- a/.htaccess +++ b/.htaccess @@ -12,7 +12,7 @@ Deny from all # Protect repository directory from browsing RewriteRule "(^|/)\.git" - [F] - # Rewrite current-style URLs of the form 'index.php?q=x'. + # Rewrite current-style URLs of the form 'index.php?pagename=x'. # Also place auth information into REMOTE_USER for sites running # in CGI mode. @@ -28,7 +28,7 @@ Deny from all RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d - RewriteRule ^(.*)$ index.php?q=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA] + RewriteRule ^(.*)$ index.php?pagename=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA] diff --git a/boot.php b/boot.php index 5ef24f494..189f7bf8a 100644 --- a/boot.php +++ b/boot.php @@ -507,13 +507,20 @@ if(! class_exists('App')) { set_include_path("include/$this->hostname" . PATH_SEPARATOR . get_include_path()); - if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=") { + if((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,9) === "pagename=") { + $this->query_string = substr($_SERVER['QUERY_STRING'],9); + // removing trailing / - maybe a nginx problem + if (substr($this->query_string, 0, 1) == "/") + $this->query_string = substr($this->query_string, 1); + } elseif((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,2) === "q=") { $this->query_string = substr($_SERVER['QUERY_STRING'],2); // removing trailing / - maybe a nginx problem if (substr($this->query_string, 0, 1) == "/") $this->query_string = substr($this->query_string, 1); } - if(x($_GET,'q')) + if (x($_GET,'pagename')) + $this->cmd = trim($_GET['pagename'],'/\\'); + elseif (x($_GET,'q')) $this->cmd = trim($_GET['q'],'/\\'); // unix style "homedir" @@ -865,6 +872,10 @@ if(! class_exists('App')) { $this->performance["markstart"] = microtime(true) - $this->performance["markstart"] - $this->performance["marktime"]; } + function get_useragent() { + return(FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION."; ".$this->get_baseurl()); + } + } } @@ -1019,7 +1030,8 @@ if(! function_exists('update_db')) { $t = get_config('database','dbupdate_'.DB_UPDATE_VERSION); if($t !== false) - break; + return; + set_config('database','dbupdate_'.DB_UPDATE_VERSION, time()); require_once("include/dbstructure.php"); diff --git a/include/api.php b/include/api.php index ade783662..69dc51bac 100644 --- a/include/api.php +++ b/include/api.php @@ -122,7 +122,6 @@ // preset $type="json"; - foreach ($API as $p=>$info){ if (strpos($a->query_string, $p)===0){ $called_api= explode("/",$p); @@ -936,6 +935,35 @@ } api_register_func('api/users/show','api_users_show'); + + function api_users_search(&$a, $type) { + $page = (x($_REQUEST,'page')?$_REQUEST['page']-1:0); + + $userlist = array(); + + if (isset($_GET["q"])) { + $r = q("SELECT id FROM unique_contacts WHERE name='%s'", dbesc($_GET["q"])); + if (!count($r)) + $r = q("SELECT id FROM unique_contacts WHERE nick='%s'", dbesc($_GET["q"])); + + if (count($r)) { + foreach ($r AS $user) { + $user_info = api_get_user($a, $user["id"]); + //echo print_r($user_info, true)."\n"; + $userdata = api_apply_template("user", $type, array('user' => $user_info)); + $userlist[] = $userdata["user"]; + } + $userlist = array("users" => $userlist); + } else + die(api_error($a, $type, t("User not found."))); + } else + die(api_error($a, $type, t("User not found."))); + + return ($userlist); + } + + api_register_func('api/users/search','api_users_search'); + /** * * http://developer.twitter.com/doc/get/statuses/home_timeline diff --git a/include/bbcode.php b/include/bbcode.php index 017673423..25d60647f 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -674,10 +674,12 @@ function bb_RemovePictureLinks($match) { $text = Cache::get($match[1]); if(is_null($text)){ + $a = get_app(); + $ch = @curl_init($match[1]); @curl_setopt($ch, CURLOPT_NOBODY, true); @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")"); + @curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent()); @curl_exec($ch); $curl_info = @curl_getinfo($ch); @@ -722,10 +724,12 @@ function bb_CleanPictureLinksSub($match) { $text = Cache::get($match[1]); if(is_null($text)){ + $a = get_app(); + $ch = @curl_init($match[1]); @curl_setopt($ch, CURLOPT_NOBODY, true); @curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")"); + @curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent()); @curl_exec($ch); $curl_info = @curl_getinfo($ch); diff --git a/include/network.php b/include/network.php index 4c6af8e71..0f6e61705 100644 --- a/include/network.php +++ b/include/network.php @@ -35,7 +35,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_ } @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); - @curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")"); + @curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent()); if(intval($timeout)) { @@ -134,7 +134,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0) curl_setopt($ch, CURLOPT_RETURNTRANSFER,true); curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS,$params); - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")"); + curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent()); if(intval($timeout)) { curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); @@ -1114,6 +1114,8 @@ function xml2array($contents, $namespaces = true, $get_attributes=1, $priority = function original_url($url, $depth=1, $fetchbody = false) { + $a = get_app(); + // Remove Analytics Data from Google and other tracking platforms $urldata = parse_url($url); if (is_string($urldata["query"])) { @@ -1163,7 +1165,7 @@ function original_url($url, $depth=1, $fetchbody = false) { curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")"); + curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent()); $header = curl_exec($ch); $curl_info = @curl_getinfo($ch); diff --git a/mod/admin.php b/mod/admin.php index 24069c5d9..e2b5b52a1 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -1179,9 +1179,11 @@ function admin_page_themes(&$a){ foreach($files as $file) { $f = basename($file); $is_experimental = intval(file_exists($file . '/experimental')); - $is_supported = 1-(intval(file_exists($file . '/unsupported'))); // Is not used yet + $is_supported = 1-(intval(file_exists($file . '/unsupported'))); $is_allowed = intval(in_array($f,$allowed_themes)); - $themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed); + + if ($is_allowed OR $is_supported OR get_config("system", "show_unsupported_themes")) + $themes[] = array('name' => $f, 'experimental' => $is_experimental, 'supported' => $is_supported, 'allowed' => $is_allowed); } } diff --git a/mod/parse_url.php b/mod/parse_url.php index 5048f4fa5..4953b8f4c 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -52,6 +52,8 @@ function completeurl($url, $scheme) { function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1) { + $a = get_app(); + $siteinfo = array(); if ($count > 10) { @@ -71,7 +73,7 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co curl_setopt($ch, CURLOPT_TIMEOUT, 3); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); - curl_setopt($ch,CURLOPT_USERAGENT, "Mozilla/5.0 (compatible; ".FRIENDICA_PLATFORM." ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION.")"); + curl_setopt($ch, CURLOPT_USERAGENT, $a->get_useragent()); $header = curl_exec($ch); $curl_info = @curl_getinfo($ch); diff --git a/view/theme/easterbunny/unsupported b/view/theme/cleanzero/unsupported similarity index 100% rename from view/theme/easterbunny/unsupported rename to view/theme/cleanzero/unsupported diff --git a/view/theme/smoothly/unsupported b/view/theme/comix-plain/unsupported similarity index 100% rename from view/theme/smoothly/unsupported rename to view/theme/comix-plain/unsupported diff --git a/view/theme/comix/unsupported b/view/theme/comix/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/darkbubble/unsupported b/view/theme/darkbubble/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/darkzero-NS/unsupported b/view/theme/darkzero-NS/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/darkzero/unsupported b/view/theme/darkzero/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/decaf-mobile/unsupported b/view/theme/decaf-mobile/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/diabook/unsupported b/view/theme/diabook/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/dispy/unsupported b/view/theme/dispy/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/easterbunny/border.jpg b/view/theme/easterbunny/border.jpg deleted file mode 100644 index 66c7a6fcc..000000000 Binary files a/view/theme/easterbunny/border.jpg and /dev/null differ diff --git a/view/theme/easterbunny/head.jpg b/view/theme/easterbunny/head.jpg deleted file mode 100644 index 1acd2ddb8..000000000 Binary files a/view/theme/easterbunny/head.jpg and /dev/null differ diff --git a/view/theme/easterbunny/screenshot.jpg b/view/theme/easterbunny/screenshot.jpg deleted file mode 100644 index 5ac613e78..000000000 Binary files a/view/theme/easterbunny/screenshot.jpg and /dev/null differ diff --git a/view/theme/easterbunny/shiny.png b/view/theme/easterbunny/shiny.png deleted file mode 100644 index d3f71ee1d..000000000 Binary files a/view/theme/easterbunny/shiny.png and /dev/null differ diff --git a/view/theme/easterbunny/style.css b/view/theme/easterbunny/style.css deleted file mode 100644 index ab2e07053..000000000 --- a/view/theme/easterbunny/style.css +++ /dev/null @@ -1,48 +0,0 @@ -@import url('../duepuntozero/style.css'); - -.vcard .fn { - color: orange !important; -} - -.vcard .title { - color: #00BB00 !important; -} - -.wall-item-content-wrapper { - border: 1px solid red; - background: #FFDDFF; -} - -.wall-item-content-wrapper.comment { - background: #FFCCAA; -} - -.comment-edit-wrapper { - background: yellow; -} - -body { background-image: url('head.jpg'); } -section { background: #EEFFFF; } - -a, a:visited { color: #0000FF; text-decoration: none; } -a:hover {text-decoration: underline; } - - -aside( background-image: url('border.jpg'); } -.tabs { background-image: url('head.jpg'); } -div.wall-item-content-wrapper.shiny { background-image: url('shiny.png'); } - - -.nav-commlink, .nav-login-link { - background-color: #aed3b2; - -} - -.fakelink, .fakelink:visited { - color: #0000FF; -} - -.wall-item-name-link { - color: #0000FF; -} - diff --git a/view/theme/easterbunny/theme.php b/view/theme/easterbunny/theme.php deleted file mode 100644 index 35796d10a..000000000 --- a/view/theme/easterbunny/theme.php +++ /dev/null @@ -1,7 +0,0 @@ -theme_info = array( - 'extends' => 'duepuntozero', -); -} diff --git a/view/theme/greenzero/unsupported b/view/theme/greenzero/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/purplezero/unsupported b/view/theme/purplezero/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/quattro/templates/search_item.tpl b/view/theme/quattro/templates/search_item.tpl index 132d1d32d..8c9cf22e9 100644 --- a/view/theme/quattro/templates/search_item.tpl +++ b/view/theme/quattro/templates/search_item.tpl @@ -1,5 +1,5 @@
- {{$item.star.starred}} + {{if $item.star}}{{$item.star.starred}}{{/if}} {{if $item.lock}}{{$item.lock}}{{/if}}
diff --git a/view/theme/quattro/templates/wall_thread.tpl b/view/theme/quattro/templates/wall_thread.tpl index e5a7115e9..d4e9fc1d0 100644 --- a/view/theme/quattro/templates/wall_thread.tpl +++ b/view/theme/quattro/templates/wall_thread.tpl @@ -22,7 +22,7 @@ {{if $item.thread_level!=1}}
{{/if}}
- {{$item.star.starred}} + {{if $item.star}}{{$item.star.starred}}{{/if}} {{if $item.lock}}{{$item.lock}}{{/if}}
diff --git a/view/theme/slack-NS/unsupported b/view/theme/slack-NS/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/slackr/unsupported b/view/theme/slackr/unsupported new file mode 100644 index 000000000..e69de29bb diff --git a/view/theme/vier/templates/search_item.tpl b/view/theme/vier/templates/search_item.tpl index a5077533e..598eb4e9e 100644 --- a/view/theme/vier/templates/search_item.tpl +++ b/view/theme/vier/templates/search_item.tpl @@ -1,7 +1,7 @@
- {{$item.star.starred}} + {{if $item.star}}{{$item.star.starred}}{{/if}} {{if $item.lock}}{{$item.lock}}{{/if}}
diff --git a/view/theme/vier/templates/wall_thread.tpl b/view/theme/vier/templates/wall_thread.tpl index 8243a6aa7..764ff0517 100644 --- a/view/theme/vier/templates/wall_thread.tpl +++ b/view/theme/vier/templates/wall_thread.tpl @@ -23,8 +23,6 @@ {{if $item.thread_level!=1}}
{{/if}}
- -