Example #1
0
 function paginate()
 {
     $this->num_pages = ceil($this->items_total / $this->items_per_page);
     $this->current_page = (int) $this->jak_get_page;
     // must be numeric > 0
     if ($this->current_page < 1 or !is_numeric($this->current_page)) {
         $this->current_page = 1;
     }
     if ($this->current_page > $this->num_pages) {
         $this->current_page = $this->num_pages;
     }
     $prev_page = $this->current_page - 1;
     $next_page = $this->current_page + 1;
     if ($this->num_pages > 1) {
         $this->return = ($this->current_page != 1 and $this->items_total >= 2) ? ' <ul class="pagination"><li><a class="' . $this->jak_prevstyle . '" href="' . $this->jak_where . LS_rewrite::lsParseurlpaginate($prev_page) . '">' . $this->jak_prevtext . '</a></li>' : '<ul class="pagination">';
         $this->start_range = $this->current_page - floor($this->mid_range / 2);
         $this->end_range = $this->current_page + floor($this->mid_range / 2);
         if ($this->start_range <= 0) {
             $this->end_range += abs($this->start_range) + 1;
             $this->start_range = 1;
         }
         if ($this->end_range > $this->num_pages) {
             $this->start_range -= $this->end_range - $this->num_pages;
             $this->end_range = $this->num_pages;
         }
         $this->range = range($this->start_range, $this->end_range);
         for ($i = 1; $i <= $this->num_pages; $i++) {
             // loop through all pages. if first, last, or in range, display
             if ($i == 1 or $i == $this->num_pages or in_array($i, $this->range)) {
                 $this->return .= $i == $this->current_page ? '<li class="active"><a title="Go to page ' . $i . ' of ' . $this->num_pages . '" href="' . $this->jak_where . LS_rewrite::lsParseurlpaginate($i) . '">' . $i . '</a></li>' : '<li><a title="Go to page ' . $i . ' of ' . $this->num_pages . '" href="' . $this->jak_where . LS_rewrite::lsParseurlpaginate($i) . '">' . $i . '</a></li>';
             }
         }
         $this->return .= ($this->current_page != $this->num_pages and $this->items_total >= 2) ? '<li><a href="' . $this->jak_where . LS_rewrite::lsParseurlpaginate($next_page) . '">' . $this->jak_nexttext . '</a></li></ul>' : '</ul>';
     }
     $this->low = ($this->current_page - 1) * $this->items_per_page;
     $this->high = $this->current_page * $this->items_per_page - 1;
     $this->limit = 'LIMIT ' . $this->low . ',' . $this->items_per_page;
 }
Example #2
0
define('LS_PARSE_REQUEST', $realrequest);
// We need the template folder, title, author and lang as template variable
$LS_CMSLANG = LS_LANG;
$LS_CONTACT_FORM = LS_CONTACTFORM;
$LS_REGISTER_FORM = LS_REGISTER;
define('LS_PAGINATE_ADMIN', 1);
// First check if the user is logged in
if (LS_USERID_RHINO) {
    define('LS_OPERATORACCESS', true);
    // Get the name from the user for the welcome message
    $LS_WELCOME_NAME = $lsuser->getVar("name");
} else {
    define('LS_OPERATORACCESS', false);
}
// Now get the forgot password link into the right shape
$P_FORGOT_PASS_ADMIN = LS_rewrite::lsParseurl($tl['login']['l12'], '', '', '', '');
// Delete the conversation if whish so
if (isset($_POST['delete_conv'])) {
    // check to see if conversation is to be stored
    $result = $lsdb->query('SELECT convid, name, email, contact FROM ' . DB_PREFIX . 'jrc_sessions WHERE convid = "' . $_POST['id'] . '"');
    $row = $result->fetch_assoc();
    $lsdb->query('UPDATE ' . DB_PREFIX . 'jrc_sessions SET status = 0, ended = "' . time() . '", hide = 1  WHERE convid = "' . $row['convid'] . '"');
    $lsdb->query('INSERT INTO ' . DB_PREFIX . 'jrc_transcript SET 
	name = "' . $lsuser->getVar("name") . '",
	message = "' . smartsql($tl['general']['g63']) . '",
	user = "******"username") . '",
	convid = "' . $row['convid'] . '",
	time = NOW(),
	class = "notice"');
}
$checkp = 0;
Example #3
0
// Stop the chat
if ($page == 'stop') {
    require_once 'stop.php';
    $LS_CHECK_PAGE = 1;
    $PAGE_SHOWTITLE = 1;
}
// Stop the chat
if ($page == 'feedback') {
    require_once 'feedback.php';
    $LS_CHECK_PAGE = 1;
    $PAGE_SHOWTITLE = 1;
}
// Get the button
if ($page == 'b') {
    require_once 'button.php';
    $LS_CHECK_PAGE = 1;
    $PAGE_SHOWTITLE = 1;
}
// Get the 404 page
if ($page == '404') {
    $PAGE_TITLE = '404 ';
    require_once '404.php';
    $LS_CHECK_PAGE = 1;
    $PAGE_SHOWTITLE = 1;
}
// if page not found
if ($LS_CHECK_PAGE == 0) {
    ls_redirect(LS_rewrite::lsParseurl('404', '', '', '', ''));
}
// Finally close all db connections
$lsdb->ls_close();
Example #4
0
if (LS_MYSQL_CONNECTION == 1) {
    require_once 'class/class.db.php';
} else {
    require_once 'class/class.dbn.php';
}
// MySQLi connection
$lsdb = new ls_mysql(DB_HOST, DB_USER, DB_PASS, DB_NAME, DB_PORT);
$lsdb->set_charset("utf8");
// All important files
include_once 'include/functions.php';
include_once 'class/class.lsbase.php';
include_once 'class/class.postmail.php';
include_once 'class/class.userlogin.php';
include_once 'class/class.user.php';
// Now launch the rewrite class, depending on the settings in db.
$getURL = new LS_rewrite($_SERVER['REQUEST_URI']);
// We are not using apache so take the ugly urls
$tempp = $getURL->lsGetseg(0);
$tempp1 = $getURL->lsGetseg(1);
$tempp2 = $getURL->lsGetseg(2);
$tempp3 = $getURL->lsGetseg(3);
$tempp4 = $getURL->lsGetseg(4);
$tempp5 = $getURL->lsGetseg(5);
$tempp6 = $getURL->lsGetseg(6);
// Check if we want caching
if (!is_dir(APP_PATH . LS_CACHE_DIRECTORY)) {
    mkdir(APP_PATH . LS_CACHE_DIRECTORY, 0755);
}
// define file better for caching
$cachedefinefile = APP_PATH . LS_CACHE_DIRECTORY . '/define.php';
if (!file_exists($cachedefinefile)) {
Example #5
0
			initiated = "' . time() . '",
			status = 1,
			contact = ' . $contactme);
        if ($result) {
            $cid = $lsdb->ls_last_id();
            $_SESSION['jrc_convid'] = $cid;
            $lsdb->query('UPDATE ' . DB_PREFIX . 'jrc_sessions SET convid = "' . $cid . '" WHERE userid = "' . smartsql($_SESSION['jrc_userid']) . '"');
            $lsdb->query('INSERT INTO ' . DB_PREFIX . 'jrc_transcript SET 
				name = "Admin",
				message = "' . smartsql(LS_WELCOME_MESSAGE) . '",
				convid = "' . $cid . '",
				time = NOW(),
				class = "admin"');
        }
        // Redirect page
        $gochat = LS_rewrite::lsParseurl('chat', '', '', '', '');
        /* Outputtng the error messages */
        if ($_SERVER['HTTP_X_REQUESTED_WITH']) {
            header('Cache-Control: no-cache');
            echo json_encode(array('login' => 1, 'link' => $gochat));
            exit;
        }
        ls_redirect($gochat);
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<title><?php 
echo $tl["general"]["g"];
Example #6
0
                            }
                        } else {
                            include 'include/nexmo/NexmoMessage.php';
                            while ($row = $result->fetch_assoc()) {
                                // Step 1: Declare new NexmoMessage. (Api Key) (Api Secret)
                                $nexmo_sms = new NexmoMessage(base64_decode(LS_TW_SID), base64_decode(LS_TW_TOKEN));
                                // Step 2: Use sendText( $to, $from, $message ) method to send a message.
                                $info = $nexmo_sms->sendText($row['phonenumber'], LS_TITLE, LS_TW_MSG);
                            }
                        }
                    }
                }
            }
        }
        // Redirect page
        $gochat = LS_rewrite::lsParseurl('chat', $_POST['slide_chat'], $_POST['lang'], '', '');
        /* Outputtng the error messages */
        if ($_SERVER['HTTP_X_REQUESTED_WITH']) {
            header('Cache-Control: no-cache');
            die(json_encode(array('login' => 1, 'link' => html_entity_decode($gochat))));
        }
        ls_redirect(html_entity_decode($gochat));
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<title><?php 
echo $tl["general"]["g"];
?>
Example #7
0
    ?>
</label>
					    <div class="controls">
					    	<textarea name="message" id="message" rows="5" class="input-large"></textarea>
						</div>
					</div>
					
					<input type="hidden" name="send_feedback" value="1" />
					<input type="hidden" name="convid" value="<?php 
    echo $page1;
    ?>
" />
					
					<div class="form-actions">
						<a href="<?php 
    echo LS_rewrite::lsParseurl('stop', $_SESSION['jrc_convid'], '', '', '');
    ?>
" class="btn btn-danger"><?php 
    echo $tl["general"]["g3"];
    ?>
</a> <button type="submit" id="formsubmit" class="btn btn-primary pull-right"><?php 
    echo $tl["general"]["g25"];
    ?>
</button>
					</div>
				
			</form>
			
			</div>
			<?php 
}
Example #8
0
// Forgot password
if ($_SERVER["REQUEST_METHOD"] == 'POST' && isset($_POST['forgotP'])) {
    $defaults = $_POST;
    if ($defaults['lsE'] == '' || !filter_var($defaults['lsE'], FILTER_VALIDATE_EMAIL)) {
        $errors['e'] = $tl['error']['e19'];
    }
    // transform user email
    $femail = filter_var($_POST['lsE'], FILTER_SANITIZE_EMAIL);
    $fwhen = time();
    // Check if this user exist
    $user_check = $lsuserlogin->lsForgotpassword($femail, $fwhen);
    if (!$errors['e'] && !$user_check) {
        $errors['e'] = $tl['error']['e19'];
    }
    if (count($errors) == 0) {
        $mail = new PHPMailer();
        // defaults to using php "mail()"
        $mail->SetFrom(LS_EMAIL, LS_TITLE);
        $address = $femail;
        $mail->AddAddress($address, $fusername);
        $mail->Subject = LS_TITLE . ' - ' . $tl['login']['l13'];
        $mail->Body = $tl['login']['l14'] . ' ' . BASE_URL . html_entity_decode(LS_rewrite::lsParseurl($tl['login']['l12'], $fwhen, '', '', ''));
        if ($mail->Send()) {
            $_SESSION['password_recover'] = 1;
            ls_redirect(BASE_URL);
        }
    } else {
        $errorfp = $errors;
    }
}
$template = 'login.php';
Example #9
0
if (!defined('LS_PREVENT_ACCESS')) {
    die('You cannot access this file directly.');
}
// start buffer
ob_start();
if (empty($_SESSION['jrc_userid']) || empty($_SESSION['convid']) || LS_base::lsCheckSession($_SESSION['jrc_userid'], $_SESSION['convid'])) {
    // Destroy Session
    unset($_SESSION['convid']);
    unset($_SESSION['jrc_userid']);
    unset($_SESSION['jrc_email']);
    ls_redirect(html_entity_decode(LS_rewrite::lsParseurl('start', $page1, $page2, '', '')));
}
if (LS_FEEDBACK) {
    $parseurl = LS_rewrite::lsParseurl('feedback', $page1, $page2, '', '');
} else {
    $parseurl = LS_rewrite::lsParseurl('stop', $page1, $page2, '', '');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
	<title><?php 
echo $tl["general"]["g"];
?>
 - <?php 
echo LS_TITLE;
?>
</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta name="author" content="Live Chat Rhino" />
Example #10
0
			message = "' . smartsql($tl['general']['g16']) . '",
			user = "******",
			convid = "' . $row['id'] . '",
			time = NOW(),
			class = "ended"');
        }
        // Now get the support time
        $result2 = $lsdb->query('SELECT initiated, ended FROM ' . DB_PREFIX . 'sessions WHERE id = "' . smartsql($page1) . '"');
        $row2 = $result2->fetch_assoc();
        $total_supporttime = $row2['ended'] - $row2['initiated'];
        // Write stuff into the user stats
        $lsdb->query('INSERT INTO ' . DB_PREFIX . 'user_stats SET
		userid = "' . smartsql($row["operatorid"]) . '",
		vote = 0,
		name = "' . smartsql($_SESSION['jrc_name']) . '",
		email = "' . smartsql($row["email"]) . '",
		support_time = "' . $total_supporttime . '",
		time = NOW()');
    }
    unset($_SESSION['convid']);
    unset($_SESSION['jrc_userid']);
    unset($_SESSION['jrc_email']);
    unset($_SESSION['jrc_captcha']);
    ls_redirect(html_entity_decode(LS_rewrite::lsParseurl('start', $page1, $page2, '', '')));
}
ob_flush();
?>

<script type="text/javascript">
	javascript:window.close();
</script>