public function showuser()
 {
     if (identity::active_user()->guest && !module::get_var("photoannotation", "allowguestsearch", false)) {
         message::error(t("You have to log in to perform a people search."));
         url::redirect(url::site());
         return;
     }
     $form = photoannotation::get_user_search_form("g-user-cloud-form");
     $user_id = Input::instance()->get("name", "");
     if ($user_id == "") {
         $user_id = Input::instance()->post("name", "");
     }
     $getuser = photoannotation::getuser($user_id);
     if ($getuser->found) {
         url::redirect(user_profile::url($getuser->user->id));
         return;
     }
     $page_size = module::get_var("gallery", "page_size", 9);
     $page = Input::instance()->get("page", 1);
     $offset = ($page - 1) * $page_size;
     // Make sure that the page references a valid offset
     if ($page < 1) {
         $page = 1;
     }
     list($count, $result) = photoannotation::search_user($user_id, $page_size, $offset);
     $max_pages = max(ceil($count / $page_size), 1);
     if ($page > 1) {
         $previous_page_url = url::site("photoannotation/showuser?name=" . $user_id . "&amp;page=" . ($page - 1));
     }
     if ($page < $max_pages) {
         $next_page_url = url::site("photoannotation/showuser?name=" . $user_id . "&amp;page=" . ($page + 1));
     }
     if ($user_id == "") {
         $user_id = "*";
     }
     $template = new Theme_View("page.html", "other", "usersearch");
     $template->set_global("position", $page);
     $template->set_global("total", $max_pages);
     $template->content = new View("photoannotation_user_search.html");
     $template->content->search_form = photoannotation::get_user_search_form(g - user - search - form);
     $template->content->users = $result;
     $template->content->q = $user_id;
     $template->content->count = $count;
     $template->content->paginator = new View("paginator.html");
     $template->content->paginator->previous_page_url = $previous_page_url;
     $template->content->paginator->next_page_url = $next_page_url;
     print $template;
 }
 static function get($block_id, $theme)
 {
     $block = "";
     if (!identity::active_user()->guest || module::get_var("photoannotation", "allowguestsearch", false)) {
         switch ($block_id) {
             case "photoannotation":
                 $block = new Block();
                 $block->css_id = "g-photoannotation";
                 $block->title = t("People");
                 $block->content = new View("photoannotation_block.html");
                 $block->content->cloud = photoannotation::cloud(30);
                 $block->content->form = photoannotation::get_user_search_form("g-user-cloud-form");
         }
     }
     return $block;
 }