# 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.
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]
</IfModule>
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"
$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");
// preset
$type="json";
-
foreach ($API as $p=>$info){
if (strpos($a->query_string, $p)===0){
$called_api= explode("/",$p);
}
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