Exemplo n.º 1
0
 public function createalbumAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     if ($this->auth->hasIdentity()) {
         $create = new Application_Model_Album($this->registry['DB']);
         $albumname = $this->getRequest()->getParam('name');
         $create->createAlbum($albumname);
         echo json_encode(array('status' => 'success'));
     } else {
         echo json_encode(array('status' => 'error'));
     }
 }
Exemplo n.º 2
0
 public function galleryAction()
 {
     $album = new Application_Model_Album();
     $this->view->albums = $album->fetchAll("status='publish'", 'addedon desc');
     $this->view->totalItems = count($this->view->albums);
 }
Exemplo n.º 3
0
 public function changeAlbumStatusAction()
 {
     $id = $this->_getParam('id');
     $this->view->user_id = $id;
     $model1 = new Application_Model_Album();
     $model = $model1->find($id);
     if (false === $model) {
         $this->_flashMessenger->addMessage(array('error' => 'Invalid request! Please try again.'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/gallery/albums'));
     }
     if ($model->getStatus() == "publish") {
         $model->setStatus("unpublish");
     } else {
         $model->setStatus("publish");
     }
     if ($model->save()) {
         $this->_flashMessenger->addMessage(array('success' => 'Status changed for ' . $model->getTitle() . ' [ ID : ' . $model->getId() . ', Status : ' . $model->getStatus() . ']'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/gallery/albums'));
     } else {
         $this->_flashMessenger->addMessage(array('error' => 'Failed to change the status for ' . $model->getTitle() . ' [ ID : ' . $model->getId() . ', Status : ' . $model->getStatus() . ']'));
         $this->_helper->_redirector->gotoUrl($this->view->seoUrl('/gallery/albums'));
     }
 }
Exemplo n.º 4
0
 private function setModel($row)
 {
     $model = new Application_Model_Album();
     $model->setId($row->id)->setTitle($row->title)->setUserId($row->user_id)->setCoverImage($row->cover_image)->setDescription($row->description)->setStatus($row->status)->setAddedon($row->addedon)->setUpdatedon($row->updatedon);
     return $model;
 }
Exemplo n.º 5
0
 public function CreateUserAccount($username = null, $password, $fname = null, $lname = null, $email, $sex = null, $dob, $type = 'user', $fbuser)
 {
     if (!isset($username)) {
         $username = '******' . mt_rand() . "_" . mt_rand();
     }
     if ($this->checkUniqueUserid($username, $email) && strlen($username) >= 6) {
         $ip2c = new Application_Model_ip2c($this->_db);
         $a = array();
         $b = serialize($a);
         if ($sex == 'male') {
             $propic = 1;
         } else {
             $propic = 2;
         }
         if ($type == 'user') {
             $freniz = array('userid' => $username, 'type' => $type, 'url' => $username, 'adminpages' => $b, 'username' => $fname . ' ' . $lname, 'createdipadd' => $ip2c->getIpAdd(), 'propic' => $propic);
             $search = array('userid' => $username, 'username' => $fname . ' ' . $lname, 'type' => 'user');
             $user_info = array('userid' => $username, 'fname' => $fname, 'lname' => $lname, 'dob' => $dob, 'sex' => $sex, 'email' => $email, 'date' => new Zend_Db_Expr('NOW()'), 'musics' => $b, 'books' => $b, 'movies' => $b, 'games' => $b, 'celebrities' => $b, 'other' => $b, 'pinnedpic' => $b, 'sports' => $b, 'playlist' => $b, 'school' => $b, 'college' => $b, 'language' => $b, 'adminpages' => $b, 'employer' => $b, 'url' => $username, 'blocklist' => $b, 'blockedby' => $b, 'reviews' => $b, 'reqfrmme' => $b, 'style' => 'blue-world.css', 'groups' => $b, 'propic' => $propic);
             $apps = array('userid' => $username, 'slambook' => $b, 'diary' => $b, 'inivitation' => $b);
             $a1 = array();
             $b1 = array('post', 'image', 'admire', 'pin', 'video');
             foreach ($b1 as $c1) {
                 $a1[$c1] = array();
             }
             $d1 = serialize($a1);
             $friends_vote = array('userid' => $username, 'friendlist' => $b, 'incomingrequest' => $b, 'sentrequest' => $b, 'vote' => $b, 'voted' => $b);
             $privacy = array('userid' => $username, 'postignore' => $b, 'testyignore' => $b, 'postspeci' => $b, 'testyspeci' => $b, 'blogspeci' => $b, 'posthidden' => $b, 'testyhidden' => $b, 'bloghidden' => $b, 'autoacceptusers' => $d1, 'blockactivityusers' => $d1, 'hidestreams' => $b, 'hideusersstream' => $b, 'staturespeci' => $b, 'staturehidden' => $b, 'postspecificpeople' => $b, 'testyspecificpeople' => $b, 'videospecificpeople' => $b, 'staturespecificpeople' => $b, 'statureignore' => $b, 'albumignore' => $b, 'albumspecificpeople' => $b, 'albumspeci' => $b, 'albumhidden' => $b, 'messagespecificpeople' => $b, 'messageignore' => $b);
         } else {
             $freniz = array('userid' => $username, 'type' => $type, 'url' => $username, 'adminpages' => $b, 'username' => '', 'createdipadd' => $ip2c->getIpAdd(), 'propic' => $propic);
         }
         $userstable = array('userid' => $username, 'pass' => $password, 'email' => $email);
         if ($fbuser) {
             $userstable['facebook'] = $fbuser;
         }
         $notification = array('userid' => $username, 'notifications' => 'a:0:{}');
         $db = $this->_db;
         $this->insert($freniz);
         $userstableModel = new Application_Model_Userstable($db);
         $userstableModel->insert($userstable);
         if ($type == 'user') {
             $user_infoModel = new Application_Model_UserInfo($db);
             $user_infoModel->insert($user_info);
             $appsModel = new Application_Model_Apps($db);
             $appsModel->insert($apps);
             $friends_voteModel = new Application_Model_Friendsvote($db);
             $friends_voteModel->insert($friends_vote);
             $privacyModel = new Application_Model_Privacy($db);
             $privacyModel->insert($privacy);
             $albumModel = new Application_Model_Album($db);
             $profilepicalbum = $this->createAlbumData($username, 'Profile photos');
             $propicid = $albumModel->insert($profilepicalbum);
             $secpicalbum = $this->createAlbumData($username, 'Wallpapers');
             $secpicid = $albumModel->insert($secpicalbum);
             $chartpicalbum = $this->createAlbumData($username, 'Chart photos', true);
             $chartpicid = $albumModel->insert($chartpicalbum);
             $albumids = array('propicalbum' => $propicid, 'secondarypicalbum' => $secpicid);
             $where = "userid='{$username}'";
             $user_infoModel->update($albumids, $where);
             $this->_db->insert('searchtable', $search);
         }
         $notificationModel = new Application_Model_Notification($db);
         $notificationModel->insert($notification);
         return array('status' => "true", 'message' => '', 'un' => $username, 'pass' => $password);
     } else {
         return array('status' => "false", 'message' => "Name already taken. Please choose another one.");
     }
 }
Exemplo n.º 6
0
 public function createLeaf($pagename, $type, $category, $subcategory, $songurl = null)
 {
     $types = array('default', 'basic', 'standard', 'premium', 'songs', 'video');
     if (isset($this->authIdentity) && in_array($type, $types) && !empty($pagename) && !empty($category) && !empty($subcategory)) {
         $rand = mt_rand() . "_" . mt_rand();
         $a = array();
         if (strlen($rand) > 25) {
             $rand = substr($rand, 0, 25);
         }
         $admins = array($this->authIdentity->userid);
         $votes = array($this->authIdentity->userid);
         $creator = $this->authIdentity->userid;
         if ($type == 'default' || $type == 'places') {
             $creator = 'default';
             $admins = array('default');
         }
         $admins = serialize($admins);
         $votes = serialize($votes);
         switch ($category) {
             case 'musics':
                 $propic = 3;
                 break;
             case 'movies':
                 $propic = 13;
                 break;
             case 'celebrities':
                 $propic = 12;
                 break;
             case 'books':
                 $propic = 5;
                 break;
             case 'sports':
                 $propic = 6;
                 break;
             case 'games':
                 $propic = 7;
                 break;
             default:
                 $propic = 8;
         }
         $freniz_data = array('userid' => 'leaf_' . $rand, 'type' => 'page', 'url' => 'leaf_' . $rand, 'adminpages' => 'a:0:{}', 'username' => $pagename, 'propic' => $propic);
         $pages_data = array('pageid' => 'leaf_' . $rand, 'pagename' => $pagename, 'type' => $type, 'category' => $category, 'subcategory' => $subcategory, 'creator' => $creator, 'admins' => $admins, 'vote' => $votes, 'date' => new Zend_Db_Expr('now()'), 'url' => 'leaf_' . $rand, 'bannedusers' => 'a:0:{}', 'pagepic' => $propic);
         $pagesinfo_data = array('pageid' => 'leaf_' . $rand, 'info' => 'a:0:{}', 'tabs' => 'a:0:{}', 'tags' => 'a:0:{}', 'ratings' => 'a:0:{}');
         if ($type == 'songs' && isset($songurl)) {
             $pagesinfo_data['songurl'] = $songurl;
         }
         $this->_db->insert('freniz', $freniz_data);
         $this->_db->insert('pages', $pages_data);
         if (!($type == 'default' || $type == 'places')) {
             array_push($this->authIdentity->adminpages, 'leaf_' . $rand);
             $this->_db->update('freniz', array('adminpages' => serialize($this->authIdentity->adminpages)), array('userid=?' => $this->authIdentity->userid));
             $this->_db->update('user_info', array('adminpages' => serialize($this->authIdentity->adminpages)), array('userid=?' => $this->authIdentity->userid));
             $this->_db->insert('pages_info', $pagesinfo_data);
             $AlbumModel = new Application_Model_Album($this->_db);
             $UserModel = new Application_Model_Users($this->_db);
             $pagepicalbum = $UserModel->createAlbumData('leaf_' . $rand, 'Page Pics');
             $banners = $UserModel->createAlbumData('leaf_' . $rand, 'Banners');
             $chartpic = $UserModel->createAlbumData('leaf_' . $rand, 'Chart Pics', true, true);
             $pagepicAlbumid = $AlbumModel->insert($pagepicalbum);
             $bannersAlbum = $AlbumModel->insert($banners);
             $chartpicAlbum = $AlbumModel->insert($chartpic);
             $this->update(array('pagepicalbum' => $pagepicAlbumid, 'banners' => $bannersAlbum), array('pageid=?' => 'leaf_' . $rand));
         }
         //$user=array('userid'=>'leaf_'.$rand,'type'=>'page','username'=>$pagename,'user_url'=>'leaf_'.$rand,'pagepic_url'=>'default_page.jpg','page_vote'=>$votes,'category'=>$category,'subcategory'=>$subcategory,'bids'=>0);
         //$usersModel=new Application_Model_Users($this->_db);
         $search = array('userid' => 'leaf_' . $rand, 'type' => 'page', 'username' => $pagename);
         $this->_db->insert('searchtable', $search);
         //$usersModel->buildusers(array('leaf_'.$rand=>$user));
         return 'leaf_' . $rand;
     } else {
         return false;
     }
 }