public function cats_search() { function vals($str) { } $qu = explode("&", $this->get->search_query); // echo '<pre>'; $q = preg_replace("/[^a-zA-Z0-9\\=]+/", "", $qu); $query = ''; foreach ($q as $key => $val) { $v = explode("=", $val); if ($v[1] > 0) { if ($key < count($q) && $key > 0) { $query .= ' AND '; } $query .= ' ' . $v[0] . " LIKE '%" . $v[1] . "%' "; } if ($v[0] == 'gender' && $v[1] != '') { $query .= ' AND ' . $v[0] . " LIKE '%" . $v[1] . "%' "; } } // var_dump($query); // echo '</pre>'; //----------- Gatos $m = Model::Factory('cats'); $m->where($query . ' AND id > 6000'); $this->views->data->cats = $m->all(); $this->views->display('novo/search_cats_results.phtml'); }
public function cats_search() { $qu = explode("&", $this->get->search_query); // echo '<pre>'; $q = preg_replace("/[^a-zA-Z0-9\\=]+/", "", $qu); $query = ''; $query2 = ''; foreach ($q as $key => $val) { $v = explode("=", $val); switch ($v[0]) { case 'gender': if (strlen($v[1]) == 1) { $query2 .= $v[0] . " LIKE '%" . $v[1] . "%' AND "; } else { if (strlen($v[1]) == 2) { $p1 = substr($v[1], 0, 1); $p2 = substr($v[1], 1, 2); $query2 .= " (" . $v[0] . " LIKE '%" . $p1 . "%' OR " . $v[0] . " LIKE '%" . $p2 . "%') AND "; } } break; default: if ($v[1] != "0") { $query2 .= $v[0] . " LIKE '%" . $v[1] . "%' AND "; } } } $query = $query2 . " (status LIKE '0' AND section LIKE '1' AND inactive LIKE '0')"; //----------- Gatos $m = Model::Factory('cats'); $m->where($query . ' AND id > 3000'); $this->views->data->cats = $m->all(); $this->views->display('search_cats_results.phtml'); }
public function delete() { $m = Model::Factory('billboard'); $m->where("id={$this->get->id}"); $m->delete(); Request::redirect(HOST . 'adm/destaques/'); }
public function delete() { $m = Model::Factory('newsletter'); $m->where("id='{$this->get->id}'"); $m->delete(); Request::redirect(HOST . 'adm/newsletter'); }
public function delete() { $m = Model::Factory('pressreleases'); $m->where('id=' . $this->get->id); $m->delete(); Request::redirect(HOST . 'adm/aug-na-midia/'); }
public function delete() { $m = Model::Factory('news'); $m->where('id=' . $this->get->id); $m->delete(); Request::redirect(HOST . 'adm/materias/'); }
public function delete() { $m = Model::Factory('mailing'); $m->where('id=' . $this->get->id); $m->delete(); Request::redirect(HOST . 'adm/boletins/'); }
public function save() { if (isset($this->files->cat_picture['name']) and $this->files->cat_picture['name'] != '') { $dirname = UPLOAD_DIR . 'cats' . SEPD; $filename = date('YmdHis') . md5($this->files->cat_picture['name']) . '.' . end(explode('.', $this->files->cat_picture['name'])); if (!is_dir($dirname)) { mkdir($dirname, 0777, true); } move_uploaded_file($this->files->cat_picture['tmp_name'], $dirname . $filename); } $mdl = Model::Factory('cats'); $mdl->name = $this->post->cat_name; $mdl->description = $this->post->cat_desc; $mdl->full_description = $this->post->cat_full_desc; $mdl->social = $this->post->social; $mdl->playful = $this->post->playful; $mdl->lovely = $this->post->lovely; $mdl->special = 1; if (isset($filename)) { $mdl->picture = $filename; } if (isset($this->post->id)) { $mdl->where("id='{$this->post->id}'"); $mdl->update(); } else { $mdl->insert(); } Request::redirect(HOST . 'adm/gatos-especiais/'); }
public function SignUpProccess() { $o = new stdClass(); $o->username = !(bool) Model::Factory('user', false, false)->where("login='******'")->get(); $o->email = !(bool) Model::Factory('user', false, false)->where("email='{$this->post->email}'")->get(); $o->status = $o->username && $o->email; if ($o->status) { $m = Model::Factory('user'); $m->login = $this->post->login; $m->email = $this->post->email; $m->password = md5($this->post->password); $m->name = $this->post->real_name; $m->active = 1; $m->created_at = date('Y-m-d H:i:s'); $user_id = $m->insert(); $m = Model::Factory('user_data'); $m->genre = 'M'; $m->avatar = 'default.jpg'; $m->user_id = $user_id; $m->insert(); $m = Model::Factory('user_points'); $m->exp = 0; $m->hp = 10; $m->gold = 0; $m->current_level = 1; $m->exp_needed = 0; $m->exp_to_next_level = 600; $m->insert(); } header("Content-type:text/html;charset=utf-8"); die(json_encode($o)); }
public function delete() { $m = Model::Factory('want_to_adopt'); $m->where("id=" . $this->get->id); $m->delete(); Request::redirect(HOST . 'adm/querem-adotar/'); }
public function delete() { $m = Model::Factory('testimonials'); $m->where('id=' . $this->get->id); $m->delete(); Request::redirect(HOST . 'adm/depoimentos/'); }
public static function get_total_pages() { $m = Model::Factory('newsletter'); $m->fields('COUNT(*) AS qtd'); $data = $m->get(); return ceil($data->qtd / 25); }
public static function remove($uid, $list_id) { Model::Factory('user_lists_has_social_network')->where("user_lists_id='{$list_id}'")->delete(); Model::Factory('user_lists_has_category')->where("user_lists_id='{$list_id}'")->delete(); Model::Factory('user_lists')->where("user_id='{$uid}' AND id='{$list_id}'")->delete(); PhxMemcache::delete('lists_' . $this->session->user->id); }
public function delete() { $m = Model::Factory('pages'); $m->inactive = 1; $m->where("id=" . $this->get->page_id); $m->update(); Request::redirect(HOST . 'adm/paginas/'); }
public static function grant($uid, $bid) { $m = Model::Factory('user_has_badge uhb'); $m->user_id = $uid; $m->badge_id = $bid; $m->date = date('Y-m-d H:i:s'); return $m->insert(); }
public function DeleteMessage() { $m = Model::Factory('messages'); $m->status = 'D'; $m->where("id='{$this->get->msgid}' AND to_user_id='{$this->session->user->id}'"); $status = $m->update(); Request::redirect(HOST); }
public static function get($pid) { $m = Model::Factory('posts p', false); $m->fields('p.id', 'p.date', 'p.like_count', 'p.dislike_count', 'p.comment_count', 'p.reblog_count', 'p.title', 'p.content', 'u.login'); $m->innerJoin('user u', 'u.id = p.user_id'); $m->where("p.id='{$pid}' AND promoted IS NULL"); return $m->get(); }
public static function get_names(array $ids) { $m = Model::Factory('godfather'); $m->fields('id', 'nome'); $m->where("id IN (" . implode(', ', $ids) . ")"); $m->order("nome ASC"); return $m->all(); }
public function change_permission() { $m = Model::Factory('users'); $m->level = 1; $m->where("id=" . $this->get->uid); $m->update(); Request::redirect(HOST . 'adm/usuarios/'); }
public static function get_details($id = NULL) { $mdl = Model::Factory('cats'); if (isset($id)) { $mdl->where("id='{$id}'"); return $mdl->get(); } }
public function Delete() { $m = Model::Factory('accounting'); $m->inactive = 1; $m->where("id=" . $this->get->id); $m->update(); Request::redirect(HOST . 'adm/prestacao-de-contas'); }
public function delete() { $m = Model::Factory('godfather'); $m->inactive = 1; $m->where("id=" . $this->get->id); $m->update(); Request::redirect(HOST . 'adm/padrinhos'); }
public function Unblog() { $s = Posts::Unblog($this->get->postID, $this->session->user->id); $o = new stdClass(); $o->status = $s; $o->count = Model::Factory('posts')->fields('reblog_count')->where("id='{$this->get->postID}'")->get()->reblog_count; header("Content-type:application/json;charset=utf-8"); die(json_encode($o)); }
public static function addQuote($wpID, $uid, $data) { $m = Model::Factory('nerdtrack'); $m->user_id = $uid; $m->posts_id = Model::Factory('posts')->where("wp_posts_ID='{$wpID}'")->get()->id; $m->content = serialize($data); $m->nerdtrack_types_id = NerdtrackType::QUOTE; return (bool) $m->insert(); }
public static function get($id = null) { $mdl = Model::Factory('testimonials'); if (isset($id)) { $mdl->where("id='{$id}'"); return $mdl->get(); } return $mdl->all(); }
public function Promover() { $m = Model::Factory('posts'); $m->promoted = 1; $m->promoted_on = date('Y-m-d H:i:s'); $m->where("id='{$this->get->pid}'"); $m->update(); Request::redirect(HOST . 'adm/posts-em-destaque'); }
public function unban() { $m = Model::Factory('user'); $m->banned = NULL; $m->ban_date = NULL; $m->where("login='******'"); $m->update(); Request::redirect(HOST . "adm/usuarios?user={$this->get->user}"); }
public static function set($uid, stdClass $data) { $m = Model::Factory('user_privacy_settings'); foreach ($data as $k => $v) { $m->{$k} = $v; } $m->where("user_id='{$uid}'"); return $m->update(); }
public static function from_user($uid) { if (empty($uid)) { return; } $m = Model::Factory('user_gamertags'); $m->where("user_id='{$uid}'"); return $m->get(); }
public function deleteReply() { $m = Model::Factory('comment'); $m->status = 0; $m->deleted_by_uid = $this->session->user->id; $m->delete_date = date('Y-m-d H:i:s'); $m->where("in_reply_to='{$this->get->id}'"); $m->update(); Request::redirect(HOST . "adm/moderar-comentarios/?id={$this->get->pid}&wpid={$this->get->wpid}"); }