Exemplo n.º 1
0
 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');
 }
Exemplo n.º 2
0
 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');
 }
Exemplo n.º 3
0
 public function delete()
 {
     $m = Model::Factory('billboard');
     $m->where("id={$this->get->id}");
     $m->delete();
     Request::redirect(HOST . 'adm/destaques/');
 }
Exemplo n.º 4
0
 public function delete()
 {
     $m = Model::Factory('newsletter');
     $m->where("id='{$this->get->id}'");
     $m->delete();
     Request::redirect(HOST . 'adm/newsletter');
 }
Exemplo n.º 5
0
 public function delete()
 {
     $m = Model::Factory('pressreleases');
     $m->where('id=' . $this->get->id);
     $m->delete();
     Request::redirect(HOST . 'adm/aug-na-midia/');
 }
Exemplo n.º 6
0
 public function delete()
 {
     $m = Model::Factory('news');
     $m->where('id=' . $this->get->id);
     $m->delete();
     Request::redirect(HOST . 'adm/materias/');
 }
Exemplo n.º 7
0
 public function delete()
 {
     $m = Model::Factory('mailing');
     $m->where('id=' . $this->get->id);
     $m->delete();
     Request::redirect(HOST . 'adm/boletins/');
 }
Exemplo n.º 8
0
 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/');
 }
Exemplo n.º 9
0
 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));
 }
Exemplo n.º 10
0
 public function delete()
 {
     $m = Model::Factory('want_to_adopt');
     $m->where("id=" . $this->get->id);
     $m->delete();
     Request::redirect(HOST . 'adm/querem-adotar/');
 }
Exemplo n.º 11
0
 public function delete()
 {
     $m = Model::Factory('testimonials');
     $m->where('id=' . $this->get->id);
     $m->delete();
     Request::redirect(HOST . 'adm/depoimentos/');
 }
Exemplo n.º 12
0
 public static function get_total_pages()
 {
     $m = Model::Factory('newsletter');
     $m->fields('COUNT(*) AS qtd');
     $data = $m->get();
     return ceil($data->qtd / 25);
 }
Exemplo n.º 13
0
 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);
 }
Exemplo n.º 14
0
 public function delete()
 {
     $m = Model::Factory('pages');
     $m->inactive = 1;
     $m->where("id=" . $this->get->page_id);
     $m->update();
     Request::redirect(HOST . 'adm/paginas/');
 }
Exemplo n.º 15
0
 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();
 }
Exemplo n.º 16
0
 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);
 }
Exemplo n.º 17
0
 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();
 }
Exemplo n.º 18
0
 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();
 }
Exemplo n.º 19
0
 public function change_permission()
 {
     $m = Model::Factory('users');
     $m->level = 1;
     $m->where("id=" . $this->get->uid);
     $m->update();
     Request::redirect(HOST . 'adm/usuarios/');
 }
Exemplo n.º 20
0
 public static function get_details($id = NULL)
 {
     $mdl = Model::Factory('cats');
     if (isset($id)) {
         $mdl->where("id='{$id}'");
         return $mdl->get();
     }
 }
Exemplo n.º 21
0
 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');
 }
Exemplo n.º 22
0
 public function delete()
 {
     $m = Model::Factory('godfather');
     $m->inactive = 1;
     $m->where("id=" . $this->get->id);
     $m->update();
     Request::redirect(HOST . 'adm/padrinhos');
 }
Exemplo n.º 23
0
 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));
 }
Exemplo n.º 24
0
 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();
 }
Exemplo n.º 25
0
 public static function get($id = null)
 {
     $mdl = Model::Factory('testimonials');
     if (isset($id)) {
         $mdl->where("id='{$id}'");
         return $mdl->get();
     }
     return $mdl->all();
 }
Exemplo n.º 26
0
 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');
 }
Exemplo n.º 27
0
 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}");
 }
Exemplo n.º 28
0
 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();
 }
Exemplo n.º 29
0
 public static function from_user($uid)
 {
     if (empty($uid)) {
         return;
     }
     $m = Model::Factory('user_gamertags');
     $m->where("user_id='{$uid}'");
     return $m->get();
 }
Exemplo n.º 30
0
 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}");
 }