Example #1
0
	/**
	 * Class constructor
	 *
	 * @return	void
	 */
	public function __construct()
	{
		self::$instance =& $this;

		// Assign all the class objects that were instantiated by the
		// bootstrap file (CodeIgniter.php) to local class variables
		// so that CI can run as one big super object.
		foreach (is_loaded() as $var => $class)
		{
			$this->$var =& load_class($class);
		}

		$this->load =& load_class('Loader', 'core');
		$this->load->initialize();
		log_message('info', 'Controller Class Initialized');
                user_logged_in();
                //echo $user_type = $this->session->userdata['department'];
                $valid_method = get_restricted_department();
                $user_type = strtolower($this->session->userdata['department']);
                if(in_array($user_type, $valid_method)) {
					user_authentication($user_type);
                }
                
               
	}
Example #2
0
function content()
{
    if (!user_logged_in()) {
        return must_log_in();
    }
    $user = fetch_one_or_none('users', 'id', user_logged_in());
    if (!array_key_exists('token', $_GET) || !$_GET['token'] || $_GET['token'] != sha1($user->new_email_address)) {
        $errors[] = 'Invalid reset token';
    }
    # This can happen if two accounts try to change address at similar times.
    if (count($errors) == 0 && count(fetch_all('users', 'email_address', $user->new_email_address))) {
        $errors[] = "A user with this email address already exists";
    }
    if (count($errors) == 0) {
        update_all('users', array('email_address' => $user->new_email_address, 'new_email_address' => null), 'id', user_logged_in());
        ?>
    <h2>Address changed</h2>
    <p>Your email address has been changed to
      <tt><?php 
        esc($user->new_email_address);
        ?>
</tt>.</p>
    <?php 
        return;
    }
    page_header('Address verification failed');
    show_error_list($errors);
}
Example #3
0
function content()
{
    if (!user_logged_in()) {
        return must_log_in();
    }
    $user = fetch_one_or_none('users', 'id', user_logged_in());
    $errors = array();
    if (array_key_exists('change', $_POST)) {
        if (!isset($_POST['email']) || !$_POST['email']) {
            $errors[] = "Please enter an email address";
        } else {
            $email = $_POST['email'];
            if ($email && !validate_email_address($email)) {
                $errors[] = "Invalid email address";
            }
            if (count($errors) == 0 && count(fetch_all('users', 'email_address', $email))) {
                $errors[] = "A user with this email address already exists";
            }
            if (count($errors) == 0) {
                update_all('users', array('new_email_address' => $email), 'id', user_logged_in());
                send_email_change_email($email, $user->name);
                ?>
        <p>We have sent an email to your new address requesting that you
          confirm that change of address.</p>
        <?php 
                return;
            }
        }
    }
    $fields = array();
    page_header('Change email address');
    show_error_list($errors);
    ?>
 
    <form method="post" action="" accept-charset="UTF-8">
      <div class="fieldrow">
        <div class="field">
          <label>Current address:</label>
          <div><tt><?php 
    esc($user->email_address);
    ?>
</tt></div>
        </div>
      </div>

      <div class="fieldrow">
        <?php 
    text_field($fields, 'email', 'New address');
    ?>
      </div>

      <div class="fieldrow">
        <input type="submit" name="change" value="Change"/>
      </div>
    </form>
  <?php 
}
function require_login($target_page = 'login.php')
{
    if (!user_logged_in()) {
        $src = strtolower(basename($_SERVER['PHP_SELF']));
        if (!in_array($src, array('login.php'))) {
            header('Location:' . $target_page);
        }
    }
}
Example #5
0
function content()
{
    global $config;
    if (!user_logged_in()) {
        return must_log_in();
    }
    $errors = array();
    if (!array_key_exists('id', $_GET)) {
        $errors[] = 'No user ID';
    }
    if (count($errors) == 0) {
        $user = fetch_one_or_none('users', 'id', $_GET['id']);
        if (!$user) {
            $errors[] = 'No such user';
        }
        if (!$user->date_verified) {
            $errors[] = 'User has not yet been verified';
        }
        if ($user->date_approved) {
            $errors[] = 'User has already been approved';
        }
    }
    if (count($errors)) {
        page_header("Error approving account");
        show_error_list($errors);
        return;
    }
    if (!$user->date_approved) {
        update_all('users', array('date_approved' => date('Y-m-d H:i:s'), 'approved_by' => user_logged_in()), 'id', $user->id);
    }
    $root = 'http://' . $config['domain'] . $config['http_path'];
    $msg = "Your " . $config['title'] . " account has been approved.  " . "To log in, please follow \n" . "the following link:\n" . "\n" . "  {$root}account/login\n" . "\n";
    mail(sprintf('"%s" <%s>', $user->name, $user->email_address), $config['title'] . " account approved", $msg) or die('Unable to send email');
    register_user_rdf($user);
    page_header("Account approved");
    ?>

  <p>Thank you for approving <?php 
    esc($user->name);
    ?>
's account.</p>

<?php 
}
Example #6
0
function menu()
{
    global $config;
    $root = $config['http_path'];
    ?>
  <ul>
    <li><a href="<?php 
    esc($root);
    ?>
">Home</a></li>
    <?php 
    if (user_logged_in()) {
        ?>
    <li><a href="<?php 
        esc($root);
        ?>
files">Files</a></li>
    <li><a href="<?php 
        esc($root);
        ?>
account">Account</a></li>
    <li><a href="<?php 
        esc($root);
        ?>
account/logout">Log out</a></li>
    <?php 
    } else {
        ?>
    <li><a href="<?php 
        esc($root);
        ?>
account/register">Register</a></li>
    <li><a href="<?php 
        esc($root);
        ?>
account/login">Log in</a></li>
    <?php 
    }
    ?>
  </ul>
<?php 
}
Example #7
0
function content()
{
    if (!user_logged_in()) {
        return must_log_in();
    }
    $errors = array();
    if (array_key_exists('upload', $_POST)) {
        if (!array_key_exists('file', $_FILES) || filesize($_FILES['file']['tmp_name']) == 0) {
            $errors[] = 'Please supply a file';
        }
        if (count($errors) == 0) {
            preg_match('/\\.([^\\/.]+)$/', $_FILES['file']['name'], $matches);
            $file_id = do_upload($_FILES['file']['tmp_name'], $_FILES['file']['type'], $matches[1], $_FILES['file']['size']);
            page_header('File uploaded');
            ?>


      <?php 
            return;
        }
    }
    page_header('Upload file');
    show_error_list($errors);
    ?>

    <form enctype="multipart/form-data" action="" method="post">
      <div class="fieldrow">
        <div>
          <label for="file">Select an image 
            <span class="label-extra">(size limit: 8MB)</span></label>
          <input id="file" name="file" type="file" />
        </div>
      </div>

  
      <div class="fieldrow">
        <input type="submit" name="upload" value="Upload" />
      </div>
    </form>

<?php 
}
Example #8
0
function content()
{
    if (!user_logged_in()) {
        return must_log_in();
    }
    $files = fetch_wol('*', 'files', sprintf("user_id=%d", user_logged_in()));
    if (count($files) == 0) {
        ?>
    <p>You have not <a href="upload">uploaded</a> any files.</p>
    <?php 
        return;
    }
    ?>
  <table class="data">
    <?php 
    foreach ($files as $f) {
        ?>
      <tr><td class="file-id"><a href="<?php 
        esc($f->id . '.' . $f->extension);
        ?>
"><?php 
        esc(sprintf("%06d", $f->id));
        ?>
</a></td>
        <td><?php 
        esc(date_format('Y-m-d H:i:s', $f->date_uploaded));
        ?>
</td>
        <td><?php 
        esc(format_size($f->length));
        ?>
</td>
      </tr>
    <?php 
    }
    ?>
  </table>

<?php 
}
Example #9
0
/**
 * Render the HTML on the page necessary for rendering a graph to the user.
 *
 * @param $graph = array(
 *    'graph_type' => $id,
 *    'width' => 8,
 *    'height' => 4,
 *    'page_order' => 0,
 *    'days' => $days,
 *    'id' => 0,
 *    'arg0_resolved' => $name,
 *    'delta' => $delta,
 *    'public' => true,
 *    'no_technicals' => true,
 *  );
 * @param $include_user_hash if true, include user_id and user_hash in the graph data, necessary for
 *        graphs that require user authentication; default is false
 */
function render_graph_new($graph, $include_user_hash = false)
{
    global $_rendered_graph_contents;
    if (!$_rendered_graph_contents) {
        // calculate the relevant text for outofdate indicators
        $title = "";
        if (user_logged_in()) {
            $user = get_user(user_id());
            $plural_hours = plural("hour", user_is_new($user) ? get_site_config('refresh_queue_hours_premium') : get_premium_value($user, "refresh_queue_hours"));
            if ($user['is_first_report_sent']) {
                $title = t("This graph will take up to :hours to be updated with recently added or removed accounts.", array(':hours' => $plural_hours));
            } else {
                if ($user['has_added_account']) {
                    $title = t("As a new user, it will take up to :hours for this graph to be populated with initial data.", array(':hours' => $plural_hours));
                } else {
                    $title = t("You need to add some account data for this graph to display.");
                }
            }
        }
        ?>
    <div id="graph_contents_template" style="display:none;">
      <div class="graph_headings">
        <h1 class="h1"></h1>
        <h2 class="h2"></h2>
        <h2 class="graph_title">
          <a href=""></a>
        </h2>
        <span class="outofdate" style="display:none;" title="<?php 
        echo htmlspecialchars($title);
        ?>
"></span>
        <span class="subheading"></span>
        <span class="last-updated"></span>
        <ul class="graph_controls">
          <li class="move_up"><a><?php 
        echo ht("Move up");
        ?>
</a></li>
          <li class="move_down"><a><?php 
        echo ht("Move down");
        ?>
</a></li>
          <li class="remove"><a><?php 
        echo ht("Remove");
        ?>
</a></li>
          <li class="edit"><a><?php 
        echo ht("Edit");
        ?>
</a></li>
        </ul>
        <div class="edit_target" style="display:none;">
          <ul class="graph_edit_controls">
            <li class="close"><a><?php 
        echo ht("Close");
        ?>
</a></li>
          </ul>
        </div>
      </div>
      <div class="graph-target"><span class="status_loading"><?php 
        echo ht("Loading...");
        ?>
</span></div>
      <div class="graph_extra extra" style="display:none;"><a href="#"></a></span></div>
      <div class="admin-stats-wrapper hide-admin"><span class="admin-stats render_time"></span></div>
    </div>
    <div id="graph_table_template" class="overflow_wrapper extra-text-container" style="display:none;">
      <table class="standard graph_table">
      </table>
    </div>
    <?php 
    }
    if (user_logged_in()) {
        $user = get_user(user_id());
        $graph['can_be_edited'] = !($user['graph_managed_type'] == 'auto' && isset($graph['is_managed']) && $graph['is_managed']);
    }
    if (isset($graph['page_id']) && isset($graph['id'])) {
        $graph['move_up_link'] = url_for('profile', array('page' => $graph['page_id'], 'move_up' => $graph['id']));
        $graph['move_down_link'] = url_for('profile', array('page' => $graph['page_id'], 'move_down' => $graph['id']));
        $graph['remove_link'] = url_for('profile', array('page' => $graph['page_id'], 'remove' => $graph['id']));
    }
    if (isset($graph['id']) && $graph['id']) {
        $graph_id = "graph_" . $graph['id'];
    } else {
        $graph_id = "graph_" . rand(0, 0xffff);
    }
    $graph['target'] = $graph_id;
    $graph['graphWidth'] = get_site_config('default_graph_width') * $graph['width'];
    $graph['computedWidth'] = $graph['graphWidth'];
    $graph['graphHeight'] = get_site_config('default_graph_height') * $graph['height'];
    $graph['computedHeight'] = $graph['graphHeight'] + 30;
    // if we are logged in, also provide the user ID and computed user hash, to verify that we can
    // correctly access this graph (also means that we don't have to initialise sessions on the API)
    if ($include_user_hash && user_logged_in()) {
        $graph['user_id'] = user_id();
        $graph['user_hash'] = compute_user_graph_hash(get_user(user_id()));
    }
    // enable demo if necessary
    if (require_get("demo", false)) {
        $graph['demo'] = true;
    }
    // we set the widths and heights initially here so that the page layout doesn't move around
    // a lot as the graphs are loaded via AJAX
    $inline_styles = "overflow: hidden; width: " . $graph['computedWidth'] . "px; height: " . $graph['computedHeight'] . "px;";
    switch ($graph['graph_type']) {
        case "linebreak":
        case "heading":
            // don't render anything! this rendering is handled by profile.php
            return;
        case "calculator":
            // a special case for the Calculator widget; it doesn't seem a good idea to
            // have this as an API call that returns a mixture of HTML and Javascript
            ?>
      <div id="<?php 
            echo htmlspecialchars($graph_id);
            ?>
" class="graph graph_calculator" style="<?php 
            echo $inline_styles;
            ?>
">
        <div class="graph_headings">
          <h2 class="graph_title"><?php 
            echo ht("Currency converter");
            ?>
</h2>
        </div>
        <div class="graph-target">
          <?php 
            require __DIR__ . "/../pages/_calculator.php";
            ?>
        </div>
      </div>
      <script type="text/javascript">
      $(document).ready(function() {
        Graphs.render(<?php 
            echo json_encode($graph);
            ?>
, true /* static graph */);
        initialise_calculator($("#<?php 
            echo htmlspecialchars($graph_id);
            ?>
"))
      });
      </script>
      <?php 
            return;
    }
    // 'overflow: hidden;' is to fix a Chrome rendering bug
    ?>
    <div id="<?php 
    echo htmlspecialchars($graph_id);
    ?>
" class="graph" style="<?php 
    echo $inline_styles;
    ?>
"></div>
    <script type="text/javascript">
      Graphs.render(<?php 
    echo json_encode($graph);
    ?>
);
    </script>
  <?php 
}
Example #10
0
<?php

require_once 'config.php';
require_once 'auth.php';
require_once 'verify_lib.php';
header("Content-Type: application/json");
if ($https && !isset($_SERVER['HTTPS'])) {
    // We're using mod_rewrite .htaccess for HTTPS redirect; this shouldn't happen
    header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
    exit;
}
if (!user_logged_in()) {
    exit(json_encode(array('error' => 'not_logged_in')));
}
if (!isset($_POST['email']) || !isset($_POST['new_password']) || !isset($_POST['old_password'])) {
    exit(json_encode(array('error' => 'invalid_parameters')));
}
$user = get_viewer_id();
$old_password = $_POST['old_password'];
$new_password = $_POST['new_password'];
$email = $_POST['email'];
$result = $conn->query("SELECT username, email, hash FROM users WHERE id=\"{$user}\"");
$user_row = $result->fetch_assoc();
if (!$user_row) {
    exit(json_encode(array('error' => 'internal_error')));
}
if (!password_verify($old_password, $user_row['hash'])) {
    exit(json_encode(array('error' => 'invalid_credentials')));
}
$change_email = "";
if ($user_row['email'] !== $email) {
Example #11
0
<?php

/**
 * This page displays historical data publically.
 */
require __DIR__ . "/../layout/graphs.php";
require __DIR__ . "/../layout/templates.php";
$messages = array();
$errors = array();
$historical_graphs = graph_types_public();
$permitted_days = get_permitted_days();
$permitted_deltas = get_permitted_deltas();
$days = isset($permitted_days[require_get('days', false)]) ? $permitted_days[require_get('days')]['days'] : 45;
$delta = isset($permitted_deltas[require_get('delta', false)]) ? require_get('delta') : '';
$user = user_logged_in() ? get_user(user_id()) : false;
$id = require_get("id", false);
if ($id && isset($historical_graphs[$id])) {
    // we're displaying a specific graph
    $name = require_get('name', false);
    $title = $name;
    // if we've got a name, then we want to get the title too
    if (isset($historical_graphs[$id]['title_callback'])) {
        $callback = $historical_graphs[$id]['title_callback'];
        $title = $callback($id, $title);
    }
    $heading = $historical_graphs[$id]["heading"] . ($title ? ": " . $title : "");
    page_header(t("Historical Data: :heading", array(':heading' => $heading)), "page_historical", array('jsapi' => true));
    $graph = array('graph_type' => $id, 'width' => 8, 'height' => 4, 'page_order' => 0, 'days' => $days, 'id' => 0, 'arg0_resolved' => $name, 'delta' => $delta, 'public' => true, 'no_technicals' => true);
    $extra_args = $name ? array("name" => $name) : array();
    $extra_args['id'] = $id;
    $extra_args['days'] = $days;
Example #12
0
if (isset($_POST['mode']) and $_POST['mode'] == 'login') {
    require $pathToFiles . 'bb_func_login.php';
}
if ($loginError == 0) {
    if (isset($_GET['mode']) and $_GET['mode'] == 'logout') {
        deleteMyCookie();
        if (isset($metaLocation)) {
            $meta_relocate = "{$main_url}/{$indexphp}";
            echo ParseTpl(makeUp($metaLocation));
            exit;
        } else {
            header("Location: {$main_url}/{$startIndex}");
            exit;
        }
    }
    user_logged_in();
    if ($user_id != 0 and isset($langu) and $langu = str_replace(array('.', '/', '\\'), '', $langu) and file_exists($pathToFiles . "lang/{$langu}.php")) {
        $lang = $langu;
    } elseif ($user_id == 0 and isset($_GET['setlang']) and $setlang = str_replace(array('.', '/', '\\'), '', $_GET['setlang']) and file_exists($pathToFiles . "lang/{$setlang}.php")) {
        $lang = $setlang;
        $indexphp .= 'setlang=' . $setlang . '&';
    }
    if ($user_id > 0 and !isset($_COOKIE[$cookiename . '_csrfchk'])) {
        setCSRFCheckCookie();
    }
    include $pathToFiles . "lang/{$lang}.php";
    $actEnable = isset($GLOBALS['user_activity']) ? $GLOBALS['user_activity'] : 1;
    $actTrue = ($actEnable == -1 and ($action == 'prefs' or $action == 'editprefs' or $action == 'confirmpasswd'));
    if ($actEnable == 0 or $actEnable != 1 and !$actTrue) {
        $forb = 2;
    } else {
Example #13
0
     if (isset($_COOKIE['nvsa_session'])) {
         $kp_session = (array) json_decode(base64_decode($_COOKIE['nvsa_session']));
         if (!isset($logged_in_user)) {
             $logged_in_user = new NVSA_USER($session_db, $kp_session);
         }
         $qry = "INSERT INTO `wb-user-meta` (user_id,meta_key,meta_value) VALUES ('" . $logged_in_user->ID() . "','last_accessed', CURRENT_TIMESTAMP)" . "ON DUPLICATE KEY UPDATE meta_value=CURRENT_TIMESTAMP;";
         $session_db->query($qry);
     }
     // note: tuck all echo statments away so they cannot accidentally fire
     // 	when this file is included. Only available upon "Action" request
     if (isset($_POST['action']) && $_POST['action'] !== '') {
         // if attempting to login
         if ($_POST['action'] == 'login') {
             //				if ( user_logged_in(true)==true )
             //					$_SESSION['session_id'] = $mySession->session_lock;
             $json['logged_in'] = user_logged_in(true);
             $json['login_html'] = get_login_link();
             // there is no else because the login_error would be set in the function user_logged_in
             echo json_encode($json);
         } elseif ($_POST['action'] == 'logout') {
             if (logged_out() == true) {
                 $json['login_html'] = get_login_link();
             }
             echo json_encode($json);
         }
         // end if login
     }
     // end if action set
 } else {
     ob_start();
     echo "<p>";
Example #14
0
/**
 * Is the current user an administrator?
 * Once called, may cached across the length of the script.
 *
 * @return true if admin, false if not. always returns false if NO_SESSION is defined
 */
function is_admin()
{
    if (defined('NO_SESSION')) {
        // a sessionless request can never be admin
        return false;
    }
    if (!user_logged_in()) {
        return false;
    }
    $q = db()->prepare("SELECT * FROM user_properties WHERE id=?");
    $q->execute(array(user_id()));
    $user = $q->fetch();
    return $user['is_admin'];
}
Example #15
0
function protect_page()
{
    if (user_logged_in() === false) {
        header('Location: protected.php');
        exit;
    }
}
Example #16
0
    if (!$curlcheck) {
        die("php cURL is not enabled. It is required to for paypal and ZEOTSS services.<br>1. Find your php.ini file.<br>2. Uncomment extension=php_curl<br>Restart web server.<br><br><b>If you don't want this then disable zeotss and paypal in config.php.</b>");
    }
}
require_once 'database/connect.php';
require_once 'function/general.php';
require_once 'function/users.php';
require_once 'function/cache.php';
require_once 'function/mail.php';
require_once 'function/token.php';
require_once 'function/itemparser/itemlistparser.php';
if (isset($_SESSION['token'])) {
    $_SESSION['old_token'] = $_SESSION['token'];
}
Token::generate();
if (user_logged_in() === true) {
    $session_user_id = getSession('user_id');
    $user_data = user_data($session_user_id, 'id', 'name', 'password', 'email', 'premdays');
    $user_znote_data = user_znote_account_data($session_user_id, 'ip', 'created', 'points', 'cooldown');
}
$errors = array();
// Log IP
if ($config['log_ip']) {
    $visitor_config = $config['ip_security'];
    $flush = $config['flush_ip_logs'];
    if ($flush != false) {
        $timef = $time - $flush;
        if (getCache() < $timef) {
            $timef = $time - $visitor_config['time_period'];
            mysql_delete("DELETE FROM znote_visitors_details WHERE time <= '{$timef}'");
            setCache($time);
Example #17
0
function content()
{
    if (!user_logged_in()) {
        return must_log_in();
    }
    $user = fetch_one_or_none('users', 'id', user_logged_in());
    page_header('Account');
    $errors = array();
    if (array_key_exists('apply', $_POST)) {
        if (!isset($_POST['name']) || !$_POST['name']) {
            $errors[] = "Please provide a name";
        }
        if (count($errors) == 0) {
            $sets = array('name' => $_POST['name']);
            update_all('users', $sets, 'id', $user->id);
            update_local_object($user, $sets);
            ?>
      <p>Your changes have been applied.  
        Return to <a href=".">account</a> page.</p> 
      <?php 
            return;
        }
        show_error_list($errors);
    }
    $fields = array('name' => $user->name, 'email' => $user->email_address);
    ?>

    <form method="post" action="" accept-charset="UTF-8">
      <fieldset>
        <legend>Details</legend>
        <div class="fieldrow">
          <?php 
    text_field($fields, 'name', 'Name', 'publicly visible');
    ?>
        </div>
        <div class="fieldrow">
          <div class="field">
            <label>Email address</label>
            <div><tt><?php 
    esc($fields['email']);
    ?>
</tt>
            <a class="control small" style="padding-left: 1em" 
               href="change-email">Change</a></div>
          </div>
        </div>
        <div class="fieldrow">
          <div class="field">
            <label>Password</label>
            <div><tt>********</tt>
            <a class="control small" style="padding-left: 1em" 
               href="reset-password">Change</a></div>
          </div>
        </div>
        <div class="fieldrow">
          <input type="submit" name="apply" value="Update"/>
        </div>
      </fieldset>

      <fieldset>
        <legend>Contact details</legend>
        <p>Any details entered here will be made publicly available.</p>
<?php 
    /*NAME, ADDR, PHON, EMAIL, FAX, WWW, OBJE, LANG, RFN, RIN, NOTE, CHAN*/
    ?>
      </fieldset>
    </form>
<?php 
}
Example #18
0
/**
 * Called when a graph has been rendered by the job framework.
 * {@link #performance_metrics_page_end()} can still be called for database metrics etc.
 */
function performance_metrics_graph_complete($graph)
{
    if (!performance_metrics_enabled()) {
        return;
    }
    global $_performance_metrics;
    $graph_time = microtime(true) - $_performance_metrics['page_start'];
    if (isset($_performance_metrics['graph_complete'])) {
        throw new PerformanceMetricsException("graph_complete called twice");
    }
    $_performance_metrics['graph_complete'] = true;
    // "What graph types take the longest to render?"
    // "What are the most common graph types?"
    // "How many ticker graphs are being requested?"
    if ($graph) {
        $query = "INSERT INTO performance_metrics_graphs SET graph_type=:graph_type, time_taken=:time_taken, is_logged_in=:is_logged_in,\n      days=:days, has_technicals=:has_technicals";
        $args = array('graph_type' => substr($graph['graph_type'], 0, 32), 'time_taken' => $graph_time * 1000, 'is_logged_in' => user_logged_in() ? 1 : 0, 'days' => $graph['days'] ? $graph['days'] : null, 'has_technicals' => isset($graph['technicals']) && $graph['technicals'] ? 1 : 0);
        $q = db()->prepare($query);
        $q->execute($args);
    }
}
Example #19
0
<h1><?php 
echo t("Support :site_name with Premium Accounts");
?>
</h1>

<?php 
if (user_logged_in() && ($user = get_user(user_id()))) {
    if ($user['is_premium']) {
        ?>
	<div class="success success_float">
		<?php 
        echo t("Thank you for supporting :site_name with :premium!", array(':premium' => link_to(url_for('user#user_premium'), ht("your premium account"))));
        ?>
		<br>
		<?php 
        echo t("Your premium account expires in :time.", array(":time" => recent_format_html($user['premium_expires'], " ago", "")));
        ?>
	</div>
<?php 
    }
}
?>

<p>
	<?php 
$result = array();
foreach (get_site_config('premium_currencies') as $currency) {
    $result[] = get_currency_name($currency);
}
echo t("You can support :site_name by purchasing a\n\tpremium account with :currencies currencies. You will also get access to exclusive, premium-only functionality such as\n\tvastly increased limits on the number of addresses and accounts you may track at once,\n\tand advanced reporting and notification functionality. Your jobs and reports will also have higher priority over free users.", array(":currencies" => implode_english($result)));
Example #20
0
function make_comment_from_id($comment_id)
{
    $comment = get_comment_by_id($comment_id);
    $user = find_user_by_id($comment["user_id"]);
    $votes = get_votes_by_comment_id($comment_id);
    $formatted_votes = format_votes($votes);
    $avatar = get_user_avatar($comment["user_id"])["file_path"];
    // bug where time since doesn;'t show, figure it out later (edit, this fixes that)
    $time = format_time_in_words(strtotime($comment["date"]));
    if ($time == "") {
        $time_text = "now";
    } else {
        $time_text = $time . " ago ";
    }
    $output = "<div class=\"row comment_output_panel\" data-comment-id=\"{$comment_id}\">";
    $output .= "<div>";
    $output .= "<img class=\"left\" src=\"" . $avatar . "\"/>";
    $output .= "</div>";
    $output .= "<div class=\"comment_output\">";
    $output .= "<div ><span class=\"comment_output_info_label\">";
    $output .= "<a href=\"user.php?user="******"user_id"] . "\">" . $user["username"] . "</a>";
    $output .= "</span> ";
    $output .= "<span> " . $time_text . " </span></div>";
    $output .= "<div>";
    $output .= $comment["text"];
    $output .= "</div>";
    $output .= "<div class=\"vote_panel\">";
    $output .= "<span class=\"upvote_button  ";
    if (user_logged_in() && already_upvoted($_SESSION["user_id"], $comment_id)) {
        $output .= "upvote_button_clicked";
    }
    $output .= "\">";
    $output .= "<i class=\"fi-like\" ></i> Upvote <span class=\"vote_display_box ";
    if ($votes != "null" && (int) $votes > 0) {
        $output .= " positive_votes ";
    } else {
        if ($votes != "null" && (int) $votes < 0) {
            $output .= " negative_votes ";
        } else {
            if ($votes != "null" && (int) $votes == 0) {
                $output .= " zero_votes ";
            }
        }
    }
    $output .= "\" >" . $formatted_votes . "</span>";
    $output .= "</span>";
    $output .= "<span class=\"downvote_button ";
    if (user_logged_in() && already_downvoted($_SESSION["user_id"], $comment_id)) {
        $output .= "downvote_button_clicked";
    }
    $output .= "\">";
    $output .= "<i class=\"fi-dislike\" >   </i>";
    $output .= "</span>";
    $output .= "</div>";
    $output .= "</div>";
    $output .= "</div>";
    return $output;
}
Example #21
0
<?php

require_once 'engine/init.php';
include 'layout/overall/header.php';
$logged_in = user_logged_in();
if ($logged_in === true) {
    if (!empty($_POST['new'])) {
        ?>
		<h1>Create image article</h1>
		<p>Only works with "Direct link" URLs from <a href="http://www.imgland.net/">imgland.net</a>
		<br />Don't understand? Don't worry! Watch this <a href="http://youtu.be/r9pEc7T3cJg" target="_BLANK">video guide!</a></p>
		<form action="" method="post">
			Image URL:<br /><input type="text" name="image" size="70"><br />
			Image Title:<br /><input type="text" name="title" size="70"><br />
			Image Description:<br /><textarea name="desc" cols="55" rows="15"></textarea><br />
			<input type="submit" name="Submit" value="Post Image Article">
		</form>
		<?php 
    }
    if (!empty($_POST['image']) && !empty($_POST['title']) && !empty($_POST['desc'])) {
        $image = sanitize($_POST['image']);
        $image = str_replace("www", "", str_replace(":", "", str_replace("/", "", str_replace(".", "!", str_replace("1m.yt", "", str_replace("http", "", $image))))));
        $title = sanitize($_POST['title']);
        $desc = sanitize($_POST['desc']);
        // Insert to database
        insertImage((int) $session_user_id, $title, $desc, $image);
        $pw = explode("!", $image);
        ?>
		<h1>Image Posted</h1>
		<p>However, your image will not be listed until a GM have verified it.<br />
		Feel free to remind the GM in-game to login on website and approve the image post.</p>
Example #22
0
<div id="sidebar_container">
	<?php 
if (user_logged_in() === true) {
    include 'layout/widgets/loggedin.php';
} else {
    include 'layout/widgets/login.php';
}
if (user_logged_in() && is_admin($user_data)) {
    include 'layout/widgets/Wadmin.php';
}
include 'layout/widgets/charactersearch.php';
include 'layout/widgets/topplayers.php';
include 'layout/widgets/highscore.php';
include 'layout/widgets/serverinfo.php';
if ($config['TFSVersion'] !== 'TFS_02') {
    include 'layout/widgets/houses.php';
}
// Remove // to enable twitter, edit twitter stuff in /widgets/twitter.php
//include 'layout/widgets/twitter.php';
?>
</div>
<?php

require_once "../includes/session.php";
require_once "../includes/db_connection.php";
require_once "../includes/functions.php";
if (isset($_POST["submit"])) {
    $user_id = mysqli_real_escape_string($connection, $_POST["user_id"]);
    $comment_id = mysqli_real_escape_string($connection, $_POST["comment_id"]);
    if ($_POST["user_id"] == "-1" || !user_logged_in()) {
        die("<scirpt>window.location.replace(\"log_in.php\");");
    }
    if (already_downvoted($user_id, $comment_id)) {
        update_vote($user_id, $comment_id, "0");
    } else {
        if (already_upvoted($user_id, $comment_id) || exists_but_neutral($user_id, $comment_id)) {
            update_vote($user_id, $comment_id, "-1");
        } else {
            add_vote($user_id, $comment_id, "-1");
        }
    }
}
Example #24
0
function login($login, $password)
{
    $is_login_email = preg_match("/.+\\@.+/", $login);
    if ($is_login_email == false) {
        //BAD preg_match failed.
    }
    $user = (bool) $is_login_email ? login_with_email($login, $password) : login_with_username($login, $password);
    if ($user === false) {
        return [false, "Invalid login information!"];
    }
    $successful_login = password_verify($password, $user->password);
    if ($successful_login) {
        user_logged_in($user->id);
        return [true, "Loggin in..."];
    } else {
        if (!$successful_login) {
            return [false, "Invalid login information."];
        }
    }
}
Example #25
0
function page_footer_old()
{
    ?>
  </div>
</div>

<?php 
    require_template("templates_footer");
    ?>

<div id="footer_nav">
  <ul class="footer_nav_list">
    <li><span class="title"><?php 
    echo htmlspecialchars(get_site_config('site_name'));
    ?>
</span>
      <ul>
        <li><a href="<?php 
    echo htmlspecialchars(url_for('index'));
    ?>
"><?php 
    echo ht("About");
    ?>
</a></li>
        <li><a href="<?php 
    echo htmlspecialchars(url_for('premium'));
    ?>
"><?php 
    echo ht("Get Premium");
    ?>
</a></li>
        <li><a href="<?php 
    echo htmlspecialchars(get_site_config('version_history_link'));
    ?>
"><?php 
    echo ht("Release History");
    ?>
</a></li>
        <li><a href="http://openclerk.org" target="_blank">Openclerk.org</a></li>
      </ul>
    </li>
    <li><span class="title"><?php 
    echo ht("Your Account");
    ?>
</span>
      <ul>
        <?php 
    if (user_logged_in()) {
        ?>
        <li><a href="<?php 
        echo htmlspecialchars(url_for('user'));
        ?>
"><?php 
        echo ht("User Profile");
        ?>
</a></li>
        <li><a href="<?php 
        echo htmlspecialchars(url_for('wizard_currencies'));
        ?>
"><?php 
        echo ht("Currency Preferences");
        ?>
</a></li>
        <li><a href="<?php 
        echo htmlspecialchars(url_for('wizard_accounts'));
        ?>
"><?php 
        echo ht("Configure Accounts");
        ?>
</a></li>
        <li><a href="<?php 
        echo htmlspecialchars(url_for('profile'));
        ?>
"><?php 
        echo ht("Your Reports");
        ?>
</a></li>
        <?php 
    } else {
        ?>
        <li><a href="<?php 
        echo htmlspecialchars(url_for('signup'));
        ?>
"><?php 
        echo ht("Signup");
        ?>
</a></li>
        <li><a href="<?php 
        echo htmlspecialchars(url_for('login'));
        ?>
"><?php 
        echo ht("Login");
        ?>
</a></li>
        <?php 
    }
    ?>
      </ul>
    </li>
    <li><span class="title"><?php 
    echo ht("Tools");
    ?>
</span>
      <ul>
        <li><a href="<?php 
    echo htmlspecialchars(url_for('historical'));
    ?>
"><?php 
    echo ht("Historical Data");
    ?>
</a></li>
        <li><a href="<?php 
    echo htmlspecialchars(url_for('average'));
    ?>
"><?php 
    echo ht("Market Averages");
    ?>
</a></li>
        <li><a href="<?php 
    echo htmlspecialchars(url_for('calculator'));
    ?>
"><?php 
    echo ht("Calculator");
    ?>
</a></li>
        <li><a href="<?php 
    echo htmlspecialchars(url_for('api'));
    ?>
"><?php 
    echo ht("API");
    ?>
</a></li>
      </ul>
    </li>
    <li><span class="title"><?php 
    echo ht("Support");
    ?>
</span>
      <ul>
        <li><a href="<?php 
    echo htmlspecialchars(url_for('help'));
    ?>
"><?php 
    echo ht("Help Centre");
    ?>
</a></li>
        <li><a href="<?php 
    echo htmlspecialchars(get_site_config('blog_link'));
    ?>
" target="_blank"><?php 
    echo ht("Blog");
    ?>
</a> <span class="new"><?php 
    echo ht("new");
    ?>
</span></li>
        <li><a href="<?php 
    echo htmlspecialchars(url_for('contact'));
    ?>
"><?php 
    echo ht("Contact Us");
    ?>
</a></li>
        <li><a href="<?php 
    echo htmlspecialchars(url_for('external'));
    ?>
"><?php 
    echo ht("External API Status");
    ?>
</a></li>
      </ul>
    </li>
  </ul>

  <div id="copyright">
    <?php 
    require_template("templates_copyright");
    ?>
  </div>

</div>
<?php 
    if (!(has_required_admin() || defined('BATCH_SCRIPT'))) {
        ?>
<script type="text/javascript">
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', '<?php 
        echo get_site_config('google_analytics_account');
        ?>
', 'auto');
  ga('send', 'pageview');
</script>
<?php 
    }
    ?>
</body>
</html>
<?php 
    if (defined('PAGE_RENDER_START')) {
        $end_time = microtime(true);
        $time_diff = ($end_time - PAGE_RENDER_START) * 1000;
        echo "<!-- rendered in " . number_format($time_diff, 2) . " ms -->";
    }
    performance_metrics_page_end();
    echo "\n<!--\n" . print_r(Openclerk\MetricsHandler::getInstance()->printResults(), true) . "\n-->";
    if (is_admin()) {
        echo "\n<!-- " . print_r($_SESSION, true) . "\n-->";
    }
}
Example #26
0
        }
    }
}
if ($single_user == "Y") {
    $login = $single_user_login;
} else {
    if ($use_http_auth) {
        // HTTP server did validation for us....
        if (empty($PHP_AUTH_USER)) {
            $session_not_found = true;
        } else {
            $login = $PHP_AUTH_USER;
        }
    } elseif (substr($user_inc, 0, 9) == 'user-app-') {
        // Use another application's authentication
        if (!($login = user_logged_in())) {
            app_login_screen(clean_whitespace($login_return_path));
        }
    } else {
        if (!empty($settings['session']) && $settings['session'] == 'php') {
            session_start();
            if (!empty($_SESSION['webcalendar_session'])) {
                $webcalendar_session = $_SESSION['webcalendar_session'];
            }
        } else {
            if (empty($webcalendar_session) && empty($login)) {
                $session_not_found = true;
            } else {
                // Check for cookie...
                if (!empty($webcalendar_session)) {
                    $encoded_login = $webcalendar_session;
Example #27
0
function content()
{
    $errors = array();
    if (user_logged_in()) {
        $uid = user_logged_in();
    } else {
        if (!array_key_exists('token', $_GET) || !$_GET['token']) {
            $errors[] = 'Invalid reset token';
        }
        $token = $_GET['token'];
        $user = fetch_one_or_none('users', 'activation_token', $_GET['token']);
        if (count($user) != 1) {
            $errors[] = 'Invalid reset token';
        }
        if (count($errors)) {
            page_header('Reset failed');
            show_error_list($errors);
            return;
        }
        $uid = $user->id;
    }
    page_header('Reset password');
    if (array_key_exists('reset', $_POST)) {
        if (!isset($_POST['password']) || !isset($_POST['password2']) || !$_POST['password']) {
            $errors[] = "Please provide a password";
        } else {
            $password = $_POST['password'];
            $password2 = $_POST['password2'];
            if ($password != $password2) {
                $errors[] = "Passwords do not match";
            } else {
                update_all('users', array('password_crypt' => crypt($password), 'activation_token' => null), 'id', $uid);
                ?>
        <p>Your password has been reset.<?php 
                if (!user_logged_in()) {
                    ?>
          You may now wish to <a href="login">log in</a>.<?php 
                }
                ?>
</p>
        <?php 
                return;
            }
        }
        show_error_list($errors);
    }
    ?>

    <form method="post" action="" accept-charset="UTF-8">
       <div class="fieldrow">
        <div>
          <label for="password">Password</label>
          <input type="password" id="password" name="password" 
            value="<?php 
    esc($_POST['password']);
    ?>
" />
        </div>
        <div>
          <label for="password2">Confirm password</label>
          <input type="password" id="password2" name="password2" 
            value="<?php 
    esc($_POST['password2']);
    ?>
" />
        </div>
      </div>

      <div class="fieldrow">
        <input type="submit" name="reset" value="Reset" />
      </div>
    </form>
<?php 
}
Example #28
0
/**
 * Get all of the defined graph types. Used for display and validation.
 */
function graph_types()
{
    $total_fiat_currencies = array();
    foreach (get_total_conversion_summary_types() as $c) {
        $total_fiat_currencies[] = $c['title'];
    }
    $total_fiat_currencies = implode_english($total_fiat_currencies);
    $data = array('category_general' => array('title' => t('General'), 'category' => true), 'subcategory_general' => array('title' => t('General graphs'), 'subcategory' => true), 'btc_equivalent' => array('title' => t('Equivalent BTC balances (pie)'), 'heading' => t('Equivalent BTC'), 'description' => t('A pie chart representing the overall proportional value of all currencies if they were all converted into BTC.') . '<p>' . t('Exchanges used:') . ' ' . get_default_exchange_text(array_diff(get_all_currencies(), array('btc'))) . '.', 'default_width' => get_site_config('default_user_graph_height'), 'uses_summaries' => true), 'btc_equivalent_graph' => array('title' => t('Equivalent BTC balances (graph)'), 'heading' => t('Equivalent BTC'), 'description' => t('A line graph displaying the historical value of all currencies if they were all converted into BTC.') . '<p>' . t('Exchanges used:') . ' ' . get_default_exchange_text(array_diff(get_all_currencies(), array('btc'))) . '.', 'days' => true, 'uses_summaries' => true), 'btc_equivalent_stacked' => array('title' => t('Equivalent BTC balances (stacked)'), 'heading' => t('Equivalent BTC'), 'description' => t('A stacked area graph displaying the historical value of all currencies if they were all converted into BTC.') . '<p>' . t('Exchanges used:') . ' ' . get_default_exchange_text(array_diff(get_all_currencies(), array('btc'))) . '.', 'days' => true, 'uses_summaries' => true), 'btc_equivalent_proportional' => array('title' => t('Equivalent BTC balances (proportional)'), 'heading' => t('Equivalent BTC'), 'description' => t('A stacked area graph displaying the proportional historical value of all currencies if they were all converted into BTC.') . '<p>' . t('Exchanges used:') . ' ' . get_default_exchange_text(array_diff(get_all_currencies(), array('btc'))) . '.', 'days' => true, 'uses_summaries' => true), 'ticker_matrix' => array('title' => t('All currencies exchange rates (matrix)'), 'heading' => t('All exchanges'), 'description' => t('A matrix displaying the current bid/ask of all of the currencies and exchanges :interested_in.', array(':interested_in' => link_to(url_for('wizard_currencies'), t('you are interested in'))))), 'balances_table' => array('title' => t('Total balances (table)'), 'heading' => t('Total balances'), 'description' => t('A table displaying the current sum of all your currencies (before any conversions).'), 'default_width' => get_site_config('default_user_graph_height'), 'uses_summaries' => true), 'total_converted_table' => array('title' => t('Total converted fiat balances (table)'), 'heading' => t('Converted fiat'), 'description' => t('A table displaying the equivalent value of all cryptocurrencies and fiat currencies if they were immediately converted into fiat currencies. Cryptocurrencies are converted via BTC.') . '<p>' . t('Supports :currencies.', array(':currencies' => $total_fiat_currencies)) . '<p>' . t('Exchanges used:') . ' ' . get_default_exchange_text(array_diff(get_all_currencies(), array('btc'))) . '.', 'default_width' => get_site_config('default_user_graph_height'), 'uses_summaries' => true), 'crypto_converted_table' => array('title' => t('Total converted crypto balances (table)'), 'heading' => t('Converted crypto'), 'description' => t('A table displaying the equivalent value of all cryptocurrencies - but not fiat currencies - if they were immediately converted into other cryptocurrencies.') . '<p>' . t('Exchanges used:') . ' ' . get_default_exchange_text(array_diff(get_all_cryptocurrencies(), array('btc'))) . '.', 'default_width' => get_site_config('default_user_graph_height'), 'uses_summaries' => true), 'balances_offset_table' => array('title' => t('Total balances with offsets (table)'), 'heading' => t('Total balances'), 'description' => t('A table displaying the current sum of all currencies (before any conversions), along with the current total offset values of each currency.'), 'uses_summaries' => true));
    $summaries = array();
    $conversions = array();
    if (user_logged_in()) {
        $summaries = get_all_summary_currencies();
        $conversions = get_all_conversion_currencies();
    }
    $data['category_summaries'] = array('title' => t('Your summaries'), 'category' => true);
    $data['subcategory_summaries_total'] = array('title' => t('Historical currency value'), 'subcategory' => true);
    // we can generate a list of summary daily graphs from all the currencies that we support
    foreach (get_summary_types() as $key => $summary) {
        $cur = $summary['currency'];
        $data["total_" . $cur . "_daily"] = array('title' => t("Total :currency historical (graph)", array(':currency' => get_currency_name($cur))), 'heading' => t("Total :currency", array(':currency' => get_currency_abbr($cur))), 'description' => t("A line graph displaying the historical sum of your :currency (before any conversions).", array(':currency' => get_currency_name($cur))), 'hide' => !isset($summaries[$cur]), 'days' => true, 'delta' => true, 'technical' => true, 'uses_summaries' => true);
    }
    $data['subcategory_summaries_crypto2'] = array('title' => t('Historical converted value'), 'subcategory' => true);
    foreach (get_crypto_conversion_summary_types() as $key => $summary) {
        $cur = $summary['currency'];
        $data["crypto2" . $key . "_daily"] = array('title' => t("Converted :title historical (graph)", array(':title' => $summary['title'])), 'heading' => t("Converted :title", array(':title' => $summary['short_title'])), 'description' => t("A line graph displaying the historical equivalent value of all cryptocurrencies - and not other fiat currencies - if they were immediately converted to :title.", array(':title' => $summary['title'])), 'hide' => !isset($conversions['summary_' . $key]), 'days' => true, 'delta' => true, 'technical' => true, 'uses_summaries' => true);
    }
    /*
     * Issue #112 reported that 'all2CUR' was not correctly converting fiat currencies other than CUR.
     * Rather than renaming 'all2CUR' as 'all cryptocurrencies and CUR', which doesn't seem to be particularly useful
     * - and it will mean we'll have to track two new summaries for every currency -
     * as of 0.19 this will now correctly be calculated as 'all cryptocurrencies and fiat currencies'. This means that there
     * will be a jump in the value of data when deployed.
     */
    foreach (get_total_conversion_summary_types() as $key => $summary) {
        $cur = $summary['currency'];
        $data["all2" . $key . "_daily"] = array('title' => t("Converted :title historical (graph)", array(':title' => $summary['title'])), 'heading' => t("Converted :title", array(':title' => $summary['short_title'])), 'description' => t("A line graph displaying the historical equivalent value of all cryptocurrencies and fiat currencies if they were immediately converted to :title (where possible).", array(':title' => $summary['title'])), 'hide' => !isset($conversions['summary_' . $key]), 'days' => true, 'delta' => true, 'technical' => true, 'uses_summaries' => true);
    }
    $data['subcategory_summaries_composition'] = array('title' => t('Total balance composition'), 'subcategory' => true);
    // we can generate a list of composition graphs from all of the currencies that we support
    foreach (get_all_currencies() as $currency) {
        $data["composition_" . $currency . "_pie"] = array('title' => t("Total :currency balance composition (pie)", array(':currency' => get_currency_name($currency))), 'heading' => t("Total :currency", array(':currency' => get_currency_abbr($currency))), 'description' => t("A pie chart representing all of the sources of your total :currency balance (before any conversions).", array(':currency' => get_currency_name($currency))), 'hide' => !isset($summaries[$currency]), 'default_width' => get_site_config('default_user_graph_height'), 'uses_summaries' => true);
    }
    $data['subcategory_summaries_graph'] = array('title' => t('All balances (graph)'), 'subcategory' => true);
    foreach (get_all_currencies() as $currency) {
        $data["composition_" . $currency . "_daily"] = array('title' => t("All :currency balances (graph)", array(':currency' => get_currency_name($currency))), 'heading' => t("All :currency balances", array(':currency' => get_currency_abbr($currency))), 'description' => t("A line graph representing all of the sources of your total :currency balance (before any conversions).", array(':currency' => get_currency_name($currency))), 'days' => true, 'hide' => !isset($summaries[$currency]), 'uses_summaries' => true);
    }
    $data['subcategory_summaries_table'] = array('title' => t('All balances (table)'), 'subcategory' => true);
    foreach (get_all_currencies() as $currency) {
        $data["composition_" . $currency . "_table"] = array('title' => t("Your :currency balances (table)", array(':currency' => get_currency_name($currency))), 'heading' => t("Your :currency balances", array(':currency' => get_currency_abbr($currency))), 'description' => t("A table displaying all of your :currency balances and the total balance (before any conversions).", array(':currency' => get_currency_name($currency))), 'hide' => !isset($summaries[$currency]), 'uses_summaries' => true);
    }
    $data['subcategory_summaries_stacked'] = array('title' => t('All balances (stacked)'), 'subcategory' => true);
    foreach (get_all_currencies() as $currency) {
        $data["composition_" . $currency . "_stacked"] = array('title' => t("All :currency balances (stacked)", array(':currency' => get_currency_name($currency))), 'heading' => t("All :currency balances", array(':currency' => get_currency_abbr($currency))), 'description' => t("A stacked area graph displaying the historical value of your total :currency balance (before any conversions).", array(':currency' => get_currency_name($currency))), 'days' => true, 'hide' => !isset($summaries[$currency]), 'uses_summaries' => true);
    }
    $data['subcategory_summaries_proportional'] = array('title' => t('All balances (proportional)'), 'subcategory' => true);
    foreach (get_all_currencies() as $currency) {
        $data["composition_" . $currency . "_proportional"] = array('title' => t("All :currency balances (proportional)", array(':currency' => get_currency_name($currency))), 'heading' => t("All :currency balances", array(':currency' => get_currency_abbr($currency))), 'description' => t("A stacked area graph displaying the proportional historical value of your total :currency balance (before any conversions).", array(':currency' => get_currency_name($currency))), 'days' => true, 'hide' => !isset($summaries[$currency]), 'uses_summaries' => true);
    }
    $data['category_hashrate'] = array('title' => t('Your mining'), 'category' => true);
    $data['category_hashrate_hashrate'] = array('title' => t('Historical hashrates'), 'subcategory' => true);
    // and for each cryptocurrency that can be hashed
    foreach (get_all_hashrate_currencies() as $cur) {
        $data["hashrate_" . $cur . "_daily"] = array('title' => t(":currency historical MHash/s (graph)", array(':currency' => get_currency_name($cur))), 'heading' => t(":currency MHash/s", array(':currency' => get_currency_abbr($cur))), 'description' => t("A line graph displaying the historical hashrate sum of all workers mining :currency across all mining pools (in MHash/s).", array(':currency' => get_currency_name($cur))), 'hide' => !isset($summaries[$cur]), 'days' => true, 'delta' => true, 'technical' => true, 'uses_summaries' => true);
    }
    // merge in graph_types_public() here
    foreach (graph_types_public($summaries) as $key => $public_data) {
        // but add 'hide' parameter to hide irrelevant currencies
        if (isset($public_data['pairs'])) {
            $pairs = $public_data['pairs'];
            $public_data['hide'] = !(isset($summaries[$pairs[0]]) && isset($summaries[$pairs[1]]));
        }
        $data[$key] = $public_data;
    }
    $data['subcategory_layout'] = array('title' => t('Layout tools'), 'subcategory' => true);
    $data['linebreak'] = array('title' => t('Line break'), 'description' => t('Forces a line break at a particular location. Select \'Enable layout editing\' to move it.'), 'heading' => t('Line break'));
    $data['heading'] = array('title' => t('Heading'), 'description' => t("Displays a line of text as a heading at a particular location. Also functions as a line break. Select 'Enable layout editing' to move it.'"), 'string0' => t("Example heading"), 'heading' => t('Heading'));
    // add sample images
    $images = array('btc_equivalent' => 'btc_equivalent.png', 'composition_btc_pie' => 'composition_btc_pie.png', 'composition_ltc_pie' => 'composition_ltc_pie.png', 'composition_nmc_pie' => 'composition_nmc_pie.png', 'btce_btcnmc_daily' => 'btce_btcnmc_daily.png', 'btce_btcftc_daily' => 'btce_btcftc_daily.png', 'btce_btcltc_daily' => 'btce_btcltc_daily.png', 'bitstamp_usdbtc_daily' => 'bitstamp_usdbtc_daily.png', 'bitnz_nzdbtc_daily' => 'bitnz_nzdbtc_daily.png', 'btcchina_cnybtc_daily' => 'btcchina_cnybtc_daily.png', 'cexio_btcghs_daily' => 'cexio_btcghs_daily.png', 'vircurex_btcltc_daily' => 'vircurex_btcltc_daily.png', 'vircurex_btcdog_daily' => 'vircurex_btcdog_daily.png', 'themoneyconverter_usdeur_daily' => 'themoneyconverter_usdeur_daily.png', 'themoneyconverter_usdaud_daily' => 'themoneyconverter_usdaud_daily.png', 'themoneyconverter_usdcad_daily' => 'themoneyconverter_usdcad_daily.png', 'themoneyconverter_usdnzd_daily' => 'themoneyconverter_usdnzd_daily.png', 'crypto2btc_daily' => 'crypto2btc_daily.png', 'crypto2ltc_daily' => 'crypto2ltc_daily.png', 'crypto2nmc_daily' => 'crypto2nmc_daily.png', 'crypto2dog_daily' => 'crypto2dog_daily.png', 'all2nzd_bitnz_daily' => 'all2nzd_bitnz_daily.png', 'all2cad_virtex_daily' => 'all2cad_virtex_daily.png', 'all2usd_bitstamp_daily' => 'all2usd_bitstamp_daily.png', 'all2usd_btce_daily' => 'all2usd_btce_daily.png', 'btc_equivalent_graph' => 'btc_equivalent_graph.png', 'btc_equivalent_proportional' => 'btc_equivalent_proportional.png', 'btc_equivalent_stacked' => 'btc_equivalent_stacked.png', 'total_btc_daily' => 'total_btc_daily.png', 'total_ltc_daily' => 'total_ltc_daily.png', 'total_nmc_daily' => 'total_nmc_daily.png', 'total_ghs_daily' => 'total_ghs_daily.png', 'hashrate_ltc_daily' => 'hashrate_ltc_daily.png', 'balances_table' => 'balances_table.png', 'balances_offset_table' => 'balances_offset_table.png', 'crypto_converted_table' => 'crypto_converted_table.png', 'total_converted_table' => 'total_converted_table.png', 'composition_btc_daily' => 'composition_btc_daily.png', 'composition_ltc_daily' => 'composition_ltc_daily.png', 'composition_nmc_daily' => 'composition_ltc_daily.png', 'composition_ftc_daily' => 'composition_ltc_daily.png', 'composition_ppc_daily' => 'composition_ltc_daily.png', 'composition_nvc_daily' => 'composition_ltc_daily.png', 'composition_dog_daily' => 'composition_dog_daily.png', 'composition_btc_table' => 'composition_btc_table.png', 'composition_ltc_table' => 'composition_ltc_table.png', 'composition_nmc_table' => 'composition_nmc_table.png', 'composition_ftc_table' => 'composition_ltc_table.png', 'composition_ppc_table' => 'composition_ltc_table.png', 'composition_nvc_table' => 'composition_ltc_table.png', 'composition_dog_table' => 'composition_dog_table.png', 'composition_btc_proportional' => 'composition_btc_proportional.png', 'composition_ltc_proportional' => 'composition_ltc_proportional.png', 'composition_nmc_proportional' => 'composition_nmc_proportional.png', 'composition_ftc_proportional' => 'composition_ltc_proportional.png', 'composition_ppc_proportional' => 'composition_ltc_proportional.png', 'composition_nvc_proportional' => 'composition_ltc_proportional.png', 'composition_btc_stacked' => 'composition_btc_stacked.png', 'composition_ltc_stacked' => 'composition_ltc_stacked.png', 'composition_nmc_stacked' => 'composition_ltc_stacked.png', 'composition_ftc_stacked' => 'composition_ltc_stacked.png', 'composition_ppc_stacked' => 'composition_ltc_stacked.png', 'composition_nvc_stacked' => 'composition_ltc_stacked.png', 'composition_ghs_stacked' => 'composition_ghs_stacked.png', 'average_usdbtc_daily' => 'average_usdbtc_daily.png', 'average_usdbtc_markets' => 'average_usdbtc_markets.png', 'average_cadbtc_daily' => 'average_cadbtc_daily.png', 'average_cadbtc_markets' => 'average_cadbtc_markets.png', 'average_audbtc_daily' => 'average_audbtc_daily.png', 'average_audbtc_markets' => 'average_audbtc_markets.png', 'average_nzdbtc_daily' => 'average_nzdbtc_daily.png', 'average_nzdbtc_markets' => 'average_nzdbtc_markets.png', 'average_btcdog_daily' => 'average_btcdog_daily.png', 'average_btcdog_markets' => 'average_btcdog_markets.png', 'average_btcltc_daily' => 'average_btcltc_daily.png', 'average_btcltc_markets' => 'average_btcltc_markets.png', 'ticker_matrix' => 'ticker_matrix.png', 'calculator' => 'calculator.png');
    $data = add_example_images($data, $images);
    return $data;
}
<?php

include_once '../cores/definition.php';
include_once '../cores/session.php';
$on_login_page = true;
include_once '../cores/session.php';
if (user_logged_in()) {
    header('location:index.php');
}
?>

<?php 
$skip_morris = true;
include "_head.php";
?>


<body>

    <div class="container">
        <div class="row">
            <div class="col-md-4 col-md-offset-4">
                <div class="login-panel panel panel-default">
                    <div class="panel-heading">
                        <a class="btn btn-info btn-xs" href="../front-end">
                            <i class="fa fa-fw fa-home"></i>
                        </a>
                        <span class="panel-title"><strong><?php 
echo SP_APP_NAME_SHORT . ' v' . SP_APP_VERSION . PHP_EOL;
?>
</strong> - Sign In</span>
Example #30
0
<?php

require_once 'engine/init.php';
if (user_logged_in() === false) {
    header('Location: register.php');
}
include 'layout/overall/header.php';
$view = isset($_GET['view']) && (int) $_GET['view'] > 0 ? (int) $_GET['view'] : false;
if ($view !== false) {
    if (!empty($_POST['reply_text'])) {
        // Save ticket reply on database
        $query = array('tid' => $view, 'username' => getValue($_POST['username']), 'message' => getValue($_POST['reply_text']), 'created' => time());
        $fields = '`' . implode('`, `', array_keys($query)) . '`';
        $data = '\'' . implode('\', \'', $query) . '\'';
        mysql_insert("INSERT INTO `znote_tickets_replies` ({$fields}) VALUES ({$data})");
        mysql_update("UPDATE `znote_tickets` SET `status`='Player-Reply' WHERE `id`='{$view}' LIMIT 1;");
    }
    $ticketData = mysql_select_single("SELECT * FROM znote_tickets WHERE id='{$view}' LIMIT 1;");
    if ($ticketData['owner'] != $session_user_id) {
        echo 'You can not view this ticket!';
        include 'layout/overall/footer.php';
        die;
    }
    ?>
	<h1>View Ticket #<?php 
    echo $ticketData['id'];
    ?>
</h1>
	<table class="znoteTable ThreadTable table table-striped">
		<tr class="yellow">
			<th>