public function deleteAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     if (isset($this->authIdentity)) {
         $id = $this->getRequest()->getParam('name');
         if (array_key_exists($id, $this->authIdentity->interestedlists)) {
             unset($this->authIdentity->interestedlists[$id]);
             $userModel = new Application_Model_UserInfo($this->registry->DB);
             $userModel->update(array('interestedlists' => serialize($this->authIdentity->interestedlists)), array('userid=?' => $this->authIdentity->userid));
         }
     }
 }
 public function createAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $types = array('default', 'basic', 'songs', 'video');
     $fav = array('school', 'college', 'work', 'books', 'musics', 'movies', 'celebrities', 'games', 'sports');
     $data = $this->getRequest()->getParams();
     if (isset($this->authIdentity) && isset($data['leafname']) && isset($data['category']) && isset($data['subcategory']) && in_array($data['type'], $types)) {
         $leaf = new Application_Model_Leaf($this->registry->DB);
         $leafid = $leaf->createLeaf($data['leafname'], $data['type'], $data['category'], $data['subcategory']);
         if ($leafid) {
             if (isset($data['fav']) && in_array(strtolower($data['fav']), $fav)) {
                 $UserInfoModel = new Application_Model_UserInfo($this->registry->DB);
                 $UserInfoModel->UpdateToFavorites($leafid, $data['fav'], 'add');
             }
             $this->getResponse()->setBody(json_encode(array('status' => 'success', 'leafid' => $leafid, 'name' => $data['leafname'])));
         } else {
             $this->getResponse()->setBody(json_encode(array('status' => 'error occured')));
         }
     }
 }
 public function changepassAction()
 {
     $this->_helper->viewRenderer->setNoRender(true);
     $change = new Application_Model_UserInfo($this->registry['DB']);
     $old = $this->getRequest()->getParam('old');
     $new = $this->getRequest()->getParam('new');
     $conf = $this->getRequest()->getParam('conf');
     echo $change->changepassword($old, $new, $conf);
 }
 public function getskillsAction()
 {
     $getskills = new Application_Model_UserInfo($this->registry['DB']);
     $skills = $this->getRequest()->getParam('key');
     $this->view->results = $getskills->getskills($skills);
 }
Example #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.");
     }
 }
 public function userunvoteAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     if ($this->auth->hasIdentity()) {
         $voteunuser = new Application_Model_UserInfo($this->registry['DB']);
         $userid = $this->getRequest()->getParam('userid');
         $this->view->result = $voteunuser->userUnvote($userid);
         echo json_encode(array('status' => 'success'));
     } else {
         echo json_encode(array('status' => 'error'));
     }
 }