Ejemplo n.º 1
0
 public function installation()
 {
     $request = pathang::getInstance('request');
     if ($request->get('username')) {
         pathang::GetModel('install')->main($request);
         pathang::getInstance('node')->set('terminal_ext', 'html');
         pathang::Render('install', 'success');
     } else {
         pathang::getInstance('node')->set('terminal_ext', 'html');
         pathang::Render('install', 'main');
     }
 }
Ejemplo n.º 2
0
    public function page($username)
    {
        $basket = pathang::GetInstance('basket');
        $allowedType = array("text", "photo", "video", "link");
        $feed_type = pathang::GetInstance('node')->get('n2');
        $basket->set('feed_type', $feed_type);
        $limit = pathang::getInstance('pathang')->FEEDSTACK->FEED_COUNT;
        //check if user is admin
        if (isset(pathang::getInstance('session')->get('liveuser')->id)) {
            $liveuser_id = pathang::getInstance('session')->get('liveuser')->id;
        } else {
            $liveuser_id = null;
        }
        $allowed_delete = pathang::getModel('userlog')->isAdmin($liveuser_id);
        $basket->set('allowed_delete', $allowed_delete);
        //get user information
        $result = pathang::GetModel('profile')->getUserProfile($username);
        if (!$result) {
            pathang::GetInstance('pathang')->SITE->PAGE = 'login';
            $basket->set('heading', 'OPPS !');
            $basket->set('message', 'The page your searching for doesnot exist.
							Please contact the site administrator for further queries.');
            pathang::render('general', 'errorpage');
            exit;
        }
        $user = new stdclass();
        foreach ($result as $key => $item) {
            $user->{$key} = $item;
        }
        $user->image = pathang::getHelper('userlog')->getUserImage($user);
        $following = pathang::GetModel('profile')->isFollowing($liveuser_id, $user->id);
        $basket->set('following', $following);
        $basket->set('user', $user);
        //check if user profile is public
        if (!$user->access && $liveuser_id == null) {
            pathang::GetInstance('pathang')->SITE->PAGE = 'login';
            $basket->set('heading', 'Private Page');
            $basket->set('message', 'Requested profile is private, can be accessed only by
				registered users. Please <a href="' . ROOT . 'user/login"><b>login</b></a> to the website to view the profile.
					');
            pathang::render('general', 'errorpage');
            exit;
        }
        //get user feeds
        if (!$feed_type) {
            $feedArray = pathang::getModel('feed')->getFeeds($user->id, null, null, $limit);
            if ($feedArray) {
                $feedObj = new stdclass();
                foreach ($feedArray as $a => $b) {
                    $feedTemp = new stdClass();
                    foreach ($b as $c => $d) {
                        $feedTemp->{$c} = $d;
                    }
                    $feedTemp->image = '';
                    $feedTemp->feed = htmlspecialchars_decode($feedTemp->feed);
                    $feedTemp->profile_link = ROOT . $feedTemp->username;
                    $feedTemp->image = pathang::getHelper('userlog')->getUserImage($feedTemp);
                    $feedTemp->time_stamp = pathang::getHelper('feedprocess')->ago($feedTemp->time_stamp);
                    $feedTemp->like_count = pathang::getModel('feed')->getLikeCount($feedTemp->id);
                    $feedTemp->liveuser_like = pathang::getModel('feed')->checkLiveuserLike($liveuser_id, $feedTemp->id);
                    $feedTemp->comment_count = pathang::getModel('feed')->getCommentCount($feedTemp->id);
                    $feedObj->{$a} = $feedTemp;
                }
                $basket->set('feeds', $feedObj);
            }
        } else {
            $feedArray = pathang::getModel('feed')->getFeeds($user->id, $feed_type, null, $limit);
            if ($feedArray) {
                $feedObj = new stdclass();
                foreach ($feedArray as $a => $b) {
                    $feedTemp = new stdClass();
                    foreach ($b as $c => $d) {
                        $feedTemp->{$c} = $d;
                    }
                    $feedTemp->image = '';
                    $feedTemp->feed = htmlspecialchars_decode($feedTemp->feed);
                    $feedTemp->profile_link = ROOT . $feedTemp->username;
                    $feedTemp->image = pathang::getHelper('userlog')->getUserImage($feedTemp);
                    $feedTemp->time_stamp = pathang::getHelper('feedprocess')->ago($feedTemp->time_stamp);
                    $feedTemp->like_count = pathang::getModel('feed')->getLikeCount($feedTemp->id);
                    $feedTemp->liveuser_like = pathang::getModel('feed')->checkLiveuserLike($liveuser_id, $feedTemp->id);
                    $feedTemp->comment_count = pathang::getModel('feed')->getCommentCount($feedTemp->id);
                    $feedObj->{$a} = $feedTemp;
                }
                $basket->set('feeds', $feedObj);
            }
        }
        //set limit counter
        $basket->set('limit_counter', $limit);
        pathang::GetInstance('pathang')->SITE->PAGE = 'profile';
        pathang::Render('profile', 'profile');
        if ($user->id == $liveuser_id) {
            pathang::GetModel('profile')->updateReadNotifications($user->id);
        }
    }
Ejemplo n.º 3
0
    public function forgot()
    {
        $node = pathang::getInstance('node');
        $request = pathang::getInstance('request');
        $basket = pathang::getInstance('basket');
        $email = $request->filterHTMLSQL('email');
        $password = $request->filterHTMLSQL('password');
        $n3 = $node->get('n3');
        pathang::getInstance('pathang')->SITE->PAGE = 'login';
        if ($email) {
            $code = pathang::getModel('userlog')->setForgotCode($email);
            if ($code == 2) {
                $basket->set('heading', 'Error in Operation');
                $basket->set('message', 'There is an error in the operation performed.
						Please redo the process.');
            } elseif ($code == 3) {
                $basket->set('heading', 'Email Not Found');
                $basket->set('message', 'Email you have provided is not registered with our
					database.Please enter the correct email id and redo the process.');
            } else {
                $basket->set('heading', 'Reset Password Email');
                $basket->set('message', 'Password reset instructions has been sent to your email. Follow
					the instructions in the mail to create a new password. Please check your spam box
					if in case you dont recieve a mail.');
                //echo $code;
                pathang::getHelper('userlog')->sendForgotPasswordMail($code, $email);
            }
            pathang::Render('userlog', 'forgot_message');
        } elseif ($n3) {
            if ($password) {
                $update = pathang::getModel('userlog')->updateForgotPassword($n3, $password);
                if ($update == 1) {
                    $basket->set('heading', 'Successfully Updated Password');
                    $basket->set('message', 'Your password has been successfully updated.Please
						login to enter the site');
                } else {
                    $basket->set('heading', 'Error in Operation');
                    $basket->set('message', 'There is an error in the operation performed.
						Please redo the process.');
                }
                pathang::Render('userlog', 'forgot_message');
            } else {
                pathang::render('userlog', 'reset_password');
            }
        } else {
            pathang::getInstance('pathang')->SITE->PAGE = 'login';
            pathang::render('userlog', 'forgot');
        }
    }
Ejemplo n.º 4
0
 public function load()
 {
     $request = pathang::GetInstance('request');
     $lastid = $request->get('lastid');
     $type = $request->get('feed-type');
     $uid = $request->get('uid');
     $wall = $request->get('wall');
     //check if user is admin
     $liveuser_id = $request->get('liveuser-id');
     $allowed_delete = pathang::getModel('userlog')->isAdmin($liveuser_id);
     pathang::getInstance('basket')->set('allowed_delete', $allowed_delete);
     $limit = pathang::getInstance('pathang')->FEEDSTACK->FEED_COUNT;
     pathang::getInstance('basket')->set('limit_counter', $limit);
     pathang::getInstance('basket')->set('uid', $uid);
     pathang::getInstance('basket')->set('feed_type', $type);
     if (!$wall) {
         $feedArray = pathang::getModel('feed')->getFeeds($uid, $type, $lastid, $limit);
     } else {
         $feedArray = pathang::getModel('feed')->getFeedsFollowing($liveuser_id, $type, $lastid, $limit);
         pathang::getInstance('basket')->set('wall', 'wall');
     }
     if ($feedArray) {
         $feedObj = new stdclass();
         foreach ($feedArray as $a => $b) {
             $feedTemp = new stdClass();
             foreach ($b as $c => $d) {
                 $feedTemp->{$c} = $d;
             }
             $feedTemp->image = '';
             $feedTemp->profile_link = ROOT . $feedTemp->username;
             $feedTemp->feed = $feedTemp->feed;
             $feedTemp->image = pathang::getHelper('userlog')->getUserImage($feedTemp);
             $feedTemp->time_stamp = pathang::getHelper('feedprocess')->ago($feedTemp->time_stamp);
             $feedTemp->like_count = pathang::getModel('feed')->getLikeCount($feedTemp->id);
             $feedTemp->liveuser_like = pathang::getModel('feed')->checkLiveuserLike($liveuser_id, $feedTemp->id);
             $feedTemp->comment_count = pathang::getModel('feed')->getCommentCount($feedTemp->id);
             $feedObj->{$a} = $feedTemp;
         }
         pathang::GetInstance('pathang')->SITE->PAGE = 'index';
         pathang::getInstance('basket')->set('feeds', $feedObj);
         pathang::Render('feed', 'feed_loadmore');
     } else {
         $feedObj = null;
         pathang::GetInstance('pathang')->SITE->PAGE = 'index';
         pathang::getInstance('basket')->set('feeds', $feedObj);
         pathang::Render('feed', 'feed_loadmore');
     }
 }