function getLoggedinUser()
{
    $CI =& get_instance();
    if (isLoggedin()) {
        return $CI->session->userdata('user');
    }
    return FALSE;
}
Example #2
0
function loginRequired()
{
    if (isLoggedin()) {
        //print $_SESSION['userID'] . " is logged in";
    } else {
        print "not logged in, please log in";
    }
}
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 02111-1307, USA.

 The GNU General Public License is contained in the file COPYING.
*/
session_start();
include "../include/projectlib.inc.php";
include "../include/classes.php";
includeHeaders();
$Connect = processInputData();
isLoggedin();
$authorise = isAuthorize();
$filterValue = "";
if (isset($_GET['Submit'])) {
    if (isset($_GET['cboFilter'])) {
        $filterValue = $_GET['cboFilter'];
    }
} else {
    $filterValue = "";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <?php 
includeCss();
Example #4
0
 case "logout":
     session_destroy();
     header('Location: index.php?action=home');
     break;
 case "myaccount":
     if (isLoggedin()) {
         $pageTitle = "AlgimStore - My Account";
         require_once 'header.php';
         require_once 'myaccount.php';
         require_once 'footer.php';
     } else {
         header('Location: index.php?action=login');
     }
     break;
 case "final":
     if (!isLoggedin()) {
         header('Location: index.php?action=create');
     } else {
         if (isset($_GET['done']) != null) {
             $mysqli = new mysqli("localhost", "root", "killian", "store");
             if ($mysqli->connect_errno) {
                 echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
             }
             $query = mysqli_query($mysqli, "UPDATE SessionCart SET Status=1, CompleteDate=NOW() WHERE CID=" . $_SESSION["cartID"]);
             header('Location: index.php');
         } else {
             $pageTitle = "AlgimStore - Finalize";
             require_once 'header.php';
             require_once 'final.php';
             require_once 'footer.php';
         }
Example #5
0
<?php

session_start();
require dirname(__FILE__) . "/includes/config.php";
require dirname(__FILE__) . "/includes/functions.php";
if ($application["mode"] == DEVELOPMENT) {
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
}
if (isLoggedin()) {
    $userData = $_SESSION["userData"];
} else {
    header("Location: " . $application["rootPath"] . "account/login/?ref=//" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "");
    die;
}
if (time() - $_SESSION['accountLoggedinTime'] > 3600) {
    unset($_SESSION['userData']);
    unset($_SESSION['accountLoggedinTime']);
    header("Location: " . $application["rootPath"] . "account/login/?ref=//" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "");
    die;
}
?>
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Wurm Unlimited Admin</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
 public function deleteCreditLimit()
 {
     if (!isLoggedin()) {
         redirect($this->data["base_url"] . 'users/login');
     }
     $customerId = $this->uri->segment(3);
     $creditLimitId = $this->uri->segment(4);
     $response = $this->user_model->deleteCreditLimitByID($creditLimitId);
     if ($response) {
         $this->session->set_flashdata('action_status', 'The Credit Limit Entry has been deleted successfully.');
         $this->session->set_flashdata("success_status", true);
     } else {
         $this->session->set_flashdata('action_status', 'Something went wrong. Try again.');
         $this->session->set_flashdata("error_status", true);
     }
     redirect($this->data["base_url"] . "users/updateCreditLimit/" . $customerId);
 }
 public function sendProductActionMail($p_id, $action, $input_arr)
 {
     $product_details = Product::whereRaw('id = ?', array($p_id))->first();
     $user_details = CUtil::getUserDetails($product_details->product_user_id);
     $product_code = $product_details->product_code;
     $url_slug = $product_details->url_slug;
     $view_url = $this->getProductViewURL($product_details->id, $product_details);
     $user_type = CUtil::isSuperAdmin() ? 'Admin' : 'Staff';
     $logged_user_id = isLoggedin() ? getAuthUser()->user_id : 0;
     $staff_details = CUtil::getUserDetails($logged_user_id);
     $data = array('product_code' => $product_details['product_code'], 'product_name' => $product_details['product_name'], 'display_name' => $user_details['display_name'], 'user_email' => $user_details['email'], 'action' => $action, 'view_url' => $view_url, 'admin_notes' => isset($input_arr['comment']) ? $input_arr['comment'] : '', 'user_type' => $user_type);
     $data['product_details'] = $product_details;
     $data['user_details'] = $user_details;
     $data['staff_details'] = $staff_details;
     //Mail to User
     Mail::send('emails.mp_product.productStatusUpdate', $data, function ($m) use($data) {
         $m->to($data['user_email']);
         $subject = str_replace('VAR_PRODUCT_CODE', $data['product_code'], trans('email.productStatusUpdate'));
         $m->subject($subject);
     });
     //Send mail to admin
     $mailer = new AgMailer();
     $data['subject'] = str_replace('VAR_PRODUCT_CODE', $data['product_code'], trans('email.productStatusUpdateAdmin'));
     $mailer->sendAlertMail('mp_product_status_update', 'emails.mp_product.productStatusUpdateAdmin', $data);
 }
Example #8
0
function checkSession()
{
    if (!isset($_SESSION["sessionID"]) && !isLoggedin()) {
        $mysqli = new mysqli("localhost", "root", "killian", "store");
        if ($mysqli->connect_errno) {
            echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
        }
        $sqlSingle = "INSERT INTO `store`.`Sessions` (`ID`, `UserID`) VALUES (NULL, NULL);";
        $result = mysqli_query($mysqli, $sqlSingle);
        $_SESSION["sessionID"] = $mysqli->insert_id;
        $sqlSingle = "INSERT INTO `store`.`SessionCart` (`CID`, `SessionID`) VALUES (NULL, " . $_SESSION["sessionID"] . ");";
        $result = mysqli_query($mysqli, $sqlSingle);
        $_SESSION["cartID"] = $mysqli->insert_id;
    }
}
 public function chkIsAllowConversation($product_id = 0, $p_details = array(), $thread_id = 0)
 {
     $allow_to_suggestion = $allow_to_message = $allow_to_conversation = $allow_to_reply = $allow_to_communicate = false;
     $conversation_alert_msg = '';
     $message_thread_id = 0;
     $reply_suggestion_arr = array();
     if (isLoggedin()) {
         $allow_to_reply = true;
     }
     //		echo "<br>Product ID",$product_id;
     //		echo "<br>thread_id",$thread_id;
     /*
     if(isLoggedin())
     {
     	$logged_user_id = (Sentry::getUser())? Sentry::getUser()->user_id : 0;
     	//If request details not found, then get the request details
     	if(count($req_details) == 0)
     	{
     		$req_details = Requests::whereRaw('id = ?', array($request_id))->first();
     	}
     	if(count($req_details) > 0)
     	{
     		//$allow_to_suggestion = $allow_to_message = $allow_to_conversation = true;
     		$allow_to_conversation =  true;
     		$request_message_arr = array();
     		$request_thread_arr = array();
     		if($req_details['request_status'] != 'active')
     		{
     			//Don't allow any conversation
     			$allow_to_suggestion = $allow_to_message = $allow_to_conversation =  false;
     			$conversation_alert_msg = trans('request/form.view-request.recommend_own_request');
     			if($logged_user_id != $req_details['user_id'])
     			{
     				if($req_details['request_status'] == 'closed')
     				{
     					$conversation_alert_msg = trans('request/form.view-request.not_allow_conversation_closed');
     				}
     				else if($req_details['request_status'] == 'booked_closed')
     				{
     					$conversation_alert_msg = trans('request/form.view-request.not_allow_conversation_booked');
     				}
     			}
     		}
     		else if($logged_user_id == $req_details['user_id'])
     		{
     			$conversation_alert_msg = trans('request/form.view-request.recommend_own_request');
     			$allow_to_message = $allow_to_suggestion = false;
     			$allow_to_reply =  true;
     		}
     		else
     		{
     			$allow_to_communicate = $this->viewRequestService->checkIsUserAllowedToSuggest($req_details['id'], $logged_user_id);
     			//To operator validation...
     			//To check user has submit quote
     			//$allow_to_reply =  ($allow_to_communicate == 1) ? true : false;
     			$allow_to_reply =  true;
     			$request_thread_arr = RequestMessageThread::whereRaw('operator_id = ? AND request_id = ? AND is_quote = ? AND is_deleted = ?', array($logged_user_id, $req_details['id'], 'Yes', 0))->first();
     			if(count($request_thread_arr) > 0)
     			{
     				$allow_to_suggestion = false;
     				//To render quote details..
     				$quote_details =  RequestQuotes::whereRaw('id = ? ', array($request_thread_arr['quote_id']))->first();
     				$allow_to_edit_quote = ($quote_details['status'] == 'paid') ? 0 : 1;
     				$reply_suggestion_arr = array(
     										'adult_count_'.$request_thread_arr['id'] => $quote_details['adult_count'],
     										'child_count_'.$request_thread_arr['id'] => $quote_details['child_count'],
     										'tour_duration_'.$request_thread_arr['id'] => $quote_details['tour_duration'],
     										'tour_date_'.$request_thread_arr['id'] => date('m-d-Y', strtotime($quote_details['tour_date'])),
     										'quote_amount_'.$request_thread_arr['id'] => $quote_details['quote_amount'],
     										'format_tour_date_'.$request_thread_arr['id'] => date('M d, Y', strtotime($quote_details['tour_date'])),
     										'quote_currency_'.$request_thread_arr['id'] => $quote_details['quote_currency']
     										);
     			}
     			else
     			{
     				$allow_to_suggestion = true;
     			}
     			//To check user has submit message
     			$request_message_arr = RequestMessageThread::whereRaw('operator_id = ? AND request_id = ? AND is_quote = ? AND is_deleted = ?', array($logged_user_id, $req_details['id'], 'No', 0))->first();
     			if(count($request_message_arr) > 0)
     			{
     				$allow_to_message = false;
     			}
     			else
     			{
     				$allow_to_message = true;
     			}
     		}
     		//To get operator thread id to add server side validation
     		$operator_quote_thread_id = ((count($request_thread_arr) > 0)) ? $request_thread_arr['id'] : 0;
     		$message_thread_id = ((count($request_message_arr) > 0)) ? $request_message_arr['id'] : 0;
     	}
     }
     */
     $return_arr = array('allow_to_suggestion' => $allow_to_suggestion, 'allow_to_message' => $allow_to_message, 'allow_to_conversation' => $allow_to_conversation, 'conversation_alert_msg' => $conversation_alert_msg, 'allow_to_reply' => $allow_to_reply, 'message_thread_id' => $message_thread_id, 'allow_to_communicate' => $allow_to_communicate);
     return $return_arr;
 }