Example #1
0
 public function initUserSession($id)
 {
     $sql = $this->_db->select()->from('freniz', array('freniz_userid' => 'userid', 'freniz_url' => 'url', 'freniz_adminpages' => 'adminpages', 'username', 'type'))->joinLeft($this->_name, 'freniz.userid=user_info.userid')->joinLeft('image as propic', 'propic.imageid=user_info.propic', array('propic_url' => 'url'))->joinLeft('friends_vote', 'freniz.userid=friends_vote.userid')->joinLeft('places', 'places.id=user_info.hometown', array('name as ht_name', 'id as ht_id', 'vote as ht_vote', 'placepic as ht_pic', 'infoid as ht_info'))->joinLeft('image as htpic', 'htpic.imageid=places.placepic', 'url as htpic_url')->joinLeft('apps', 'freniz.userid=apps.userid', 'apps.diary')->joinLeft('places as ccplaces', 'ccplaces.id=user_info.currentcity', array('name as cc_name', 'id as cc_id', 'vote as cc_vote', 'placepic as cc_pic', 'infoid as cc_info'))->joinLeft('image as ccpic', 'ccpic.imageid=ccplaces.placepic', 'url as ccpic_url')->where('freniz.userid=?', $id);
     $results = $this->_db->fetchRow($sql, null, Zend_Db::FETCH_ASSOC);
     $results['userid'] = $results['freniz_userid'];
     unset($results['freniz_userid']);
     $results['url'] = $results['freniz_url'];
     unset($results['freniz_url']);
     $results['adminpages'] = unserialize($results['freniz_adminpages']);
     unset($results['freniz_adminpages']);
     if ($results['type'] == 'user') {
         $results['school'] = unserialize($results['school']);
         $results['college'] = unserialize($results['college']);
         $results['language'] = unserialize($results['language']);
         $results['employer'] = unserialize($results['employer']);
         $results['musics'] = unserialize($results['musics']);
         $results['books'] = unserialize($results['books']);
         $results['celebrities'] = unserialize($results['celebrities']);
         $results['movies'] = unserialize($results['movies']);
         $results['games'] = unserialize($results['games']);
         $results['other'] = unserialize($results['other']);
         $results['pinnedpic'] = unserialize($results['pinnedpic']);
         $results['sports'] = unserialize($results['sports']);
         $results['playlist'] = unserialize($results['playlist']);
         $results['blocklist'] = unserialize($results['blocklist']);
         $results['blockedby'] = unserialize($results['blockedby']);
         $results['blocklistmerged'] = array_merge($results['blocklist'], $results['blockedby']);
         $results['reviews'] = unserialize($results['reviews']);
         $results['reqfrmme'] = unserialize($results['reqfrmme']);
         $results['personalinfo'] = unserialize($results['personalinfo']);
         $results['friends'] = unserialize($results['friendlist']);
         unset($results['friendlist']);
         $results['incomingrequest'] = unserialize($results['incomingrequest']);
         $results['sentrequest'] = unserialize($results['sentrequest']);
         $results['vote'] = unserialize($results['vote']);
         $results['voted'] = unserialize($results['voted']);
         $results['diary'] = unserialize($results['diary']);
         $privacyModel = new Application_Model_Privacy($this->_db);
         $privacy = $privacyModel->getUserPrivacy($id);
         $results['privacy'] = $privacy;
     }
     $adminpages = array_merge(array($id), $results['adminpages']);
     $sql1 = $this->_db->select()->from('freniz', array('userid', 'username', 'url'))->joinLeft('image', 'freniz.propic=image.imageid', 'url as propic_url')->where('freniz.userid in (?)', $adminpages);
     $results['adminpages_details'] = $this->_db->fetchAssoc($sql1);
     $results['latime'] = time();
     $this->_db->update('user_info', array('latime' => new Zend_Db_Expr('now()')), array('userid=?' => $id));
     return (object) $results;
 }
 public function privacysettingsAction()
 {
     if (isset($this->authidentity)) {
         $privacy = new Application_Model_Privacy($this->registry->DB);
         $this->view->privacy = $privacy->getUserPrivacy($this->authidentity->userid, true);
         $this->view->myDetails = $this->authidentity;
     }
 }
 public function updateinfoprivacyAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $data = $this->getRequest()->getParams();
     if (isset($this->authIdentity) && !empty($data['types'])) {
         $privacy = new Application_Model_Privacy($this->registry['DB']);
         $privacy->updateinfoprivacy($data);
         echo json_encode(array('status' => 'success'));
     } else {
         echo json_encode(array('status' => 'error'));
     }
 }
Example #4
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.");
     }
 }