Example #1
0
 public function run_default()
 {
     global $geo_cities, $geo_countries;
     $formData = $_REQUEST["formData"];
     $formData["country_id"] = (int) $formData["country_id"];
     $formData["city_id"] = (int) $formData["city_id"];
     $Q = new UsersExec();
     $Q->limit = $this->app->getCONFIG("users_ipp");
     $Q->start = (int) $_REQUEST["start"];
     if ($formData["sex"]) {
         $Q->where("sex", $formData["sex"]);
     }
     if ($formData["country_id"]) {
         $Q->where("country_id", $formData["country_id"]);
     }
     if ($formData["city_id"]) {
         $Q->where("city_id", $formData["city_id"]);
     }
     if ($formData["age_from"]) {
         $Q->where("age_from", $formData["age_from"]);
     }
     if ($formData["age_to"]) {
         $Q->where("age_to", $formData["age_to"]);
     }
     if ($formData["sex"] || $formData["country_id"] || $formData["city_id"] || $formData["age_from"] || $formData["age_to"]) {
         $title .= "<!--[Sex_familiar_" . (int) $formData["sex"] . "]--> ";
         if ($formData["city_id"]) {
             $title .= "<!--[in]--> " . ($geo_cities[$formData["city_id"]]["name2"] ? $geo_cities[$formData["city_id"]]["name2"] : $geo_cities[$formData["city_id"]]["name"]) . " ";
         } elseif ($formData["country_id"]) {
             $title .= "<!--[in]--> " . $geo_countries[$formData["country_id"]]["name2"] . " ";
         }
         if ($formData["age_from"]) {
             $title .= "<!--[s]--> " . $formData["age_from"];
         }
         if ($formData["age_to"]) {
             $title .= "<!--[do]--> " . $formData["age_to"];
         }
         if ($formData["age_from"] || $formData["age_to"]) {
             $title .= " <!--[let]--> ";
         }
     }
     $link_ar = array();
     $link_ar["CID"] = "main";
     $link_ar["formData[sex]"] = $formData["sex"];
     $link_ar["formData[country_id]"] = $formData["country_id"];
     $link_ar["formData[city_id]"] = $formDat["city_id"];
     $link_ar["formData[age_from]"] = $formData["age_from"];
     $link_ar["formData[age_to]"] = $formData["age_to"];
     $data = $Q->f();
     if ($rws = $data["data"]) {
         foreach ($rws as $rw) {
             $tmp .= $this->displayUser($rw);
         }
     } else {
         $tmp .= displayError("<!--[People_not_found]-->", 0, 1);
     }
     $out = "\n\t\t\t<table class='wide'><tr>\n\t\t\t\t<td class='top'>\n\t\t\t\t\t" . ($title ? "<h1>" . $title . "</h1>" : "") . "\n\t\t\t\t\t<div class='mainpage_photos'>" . $tmp . "</div>\n\t\t\t\t\t" . makePages($this->app->makeLink($link_ar), $Q->start, $Q->limit, $data["data_cnt"]) . "\n\t\t\t\t</td>\n\t\t\t\t<td class='top' style='width:230px;'>" . $this->displayFilter() . "</td>\n\t\t\t</tr></table>\n\t\t";
     $this->data["title"] = $title;
     $this->data["content"] = $out;
 }
 protected function load_messages_users($rws)
 {
     $users_ar = array();
     foreach ($rws as $rw) {
         $users_ar[$rw["from"]] = $users_ar[$rw["to"]] = 1;
     }
     $Q = new UsersExec();
     $Q->where("ids", join(",", array_keys($users_ar)));
     $Q->nolimit = 1;
     if ($rws_users = $Q->f()) {
         foreach ($rws as $i => $rw) {
             $rw["rw_from"] = $rws_users["data"][$rw["from"]];
             $rw["rw_to"] = $rws_users["data"][$rw["to"]];
             $rws[$i] = $rw;
         }
     }
     return $rws;
 }