function admin_order_index()
{
    $pagination = pagination(15, 'orders');
    $subject_index = '<table class="table table-hover table-bordered">';
    $subject_index .= '<tr><th>Order #</th><th>Order by</th><th>Order Total</th><th>Status</th><th>Modification</th></tr>';
    while ($subject = mysql_fetch_array($pagination['query'])) {
        $subject_index .= '<tr>';
        $subject_index .= '<td>' . $subject['id'] . '</td>';
        // get user name by its id !
        $order_by = get_user_by_id($subject['user_id']);
        $subject_index .= '<td>' . $order_by['username'] . '</td>';
        $subject_index .= '<td style="color: green;">$' . $subject['order_total'] . '</td>';
        if ($subject['status'] == 1) {
            $subject_index .= '<td style="color: red;">Recieved</td>';
        } elseif ($subject['status'] == 2) {
            $subject_index .= '<td style="color: orange;">Process</td>';
        } elseif ($subject['status'] == 3) {
            $subject_index .= '<td style="color: green;">Completed</td>';
        } else {
            $subject_index .= '<td>No Status !</td>';
        }
        $subject_index .= '<td><a href="' . site_options('link') . 'admin/edit_order.php?order=' . $subject['id'] . '">Details </a>';
        $alert = "'Are you sure you want to delete this page?'";
        $subject_index .= '/&nbsp;<a href="' . site_options('link') . 'admin/delete_order.php?order=' . $subject['id'] . '" onclick="return confirm(' . $alert . ');">Delete</a></td>';
        $subject_index .= '</tr>';
    }
    $subject_index .= '</table>';
    $subject_index .= $pagination['index'];
    return $subject_index;
}
 /**
  * Get User Permissions
  *
  * Allows you to get all permissions user has based
  * on their user ID
  *
  * @access public
  * @param $user_id
  * @return array
  *
  */
 public function get_user_permissions($user_id)
 {
     $user = get_user_by_id($user_id);
     if ($user) {
         $this->db->select('' . $this->db->dbprefix . 'permissions.permission_string AS permission');
         $this->db->where('' . $this->db->dbprefix . 'permissions_roles.role_id', $user->row('role_id'));
         $this->db->join('' . $this->db->dbprefix . 'permissions_roles', '' . $this->db->dbprefix . 'permissions_roles.permission_id = ' . $this->db->dbprefix . 'permissions.permission_id');
         $permissions = $this->db->get('permissions');
         return $permissions->num_rows() >= 1 ? $permissions->result_array() : array();
     }
     return FALSE;
 }
Beispiel #3
0
 /**
  * Calculate Average Submissions
  * 
  * Calculates a users average submission score
  * 
  * @param int $user_id
  * 
  */
 public function calculate_average_submissions($user_id)
 {
     $user = get_user_by_id($user_id);
     if ($user) {
         $user_meta = $this->wolfauth->get_user_meta($user_id);
         $days = ceil(abs($user->row('register_date') - now()) / 86400);
         if (isset($user_meta->submissions)) {
             $submissions = $user_meta->submissions;
         } else {
             $submissions = 0;
         }
         $average = round($submissions / $days, 2);
         return $average;
     }
 }
Beispiel #4
0
function user_change_password($userid, $old_password, $new_password)
{
    $user_entry = get_user_by_id($userid);
    $checksum = md5(md5($old_password) . $user_entry['salt']);
    if ($checksum == $user_entry['password']) {
        // valid old password, set new password
        $new_checksum = md5(md5($new_password) . $user_entry['salt']);
        $s = q("UPDATE user SET password = '******' WHERE userid = '" . clean_query($userid) . "' LIMIT 1;");
        if (a() > 0) {
            return true;
        }
        return false;
    } else {
        // invalid old password
        return false;
    }
}
function send_password_reset_email($email)
{
    $login = get_login_by_email($email);
    $uid = $login["id"];
    $user = get_user_by_id($uid);
    if ($user) {
        $subject = "[GT Water Ski] Password Reset Request";
        $link = "http://www.DavidEsposito.info/gtwaterski/ChangePassword.php?email={$email}&key={$user->password}";
        $msg = '
A password reset request from the GT Waterski Scheduling website has been submitted. If you did not' . 'submit a request, you may ignore this message or contact an administrator of the site.<br /><br />

Please visit the following link to reset your password:<br />
&emsp;' . $link . '
<br /><br />
Feel free to contact the site administrators with any questions. Thanks,
<br /><br />
Georgia Tech Waterski Club
';
        return sendEmail($subject, $msg, $email, $email);
    }
    return 0;
}
Beispiel #6
0
function create_job($ticket, $values)
{
    $CI =& get_instance();
    $product = $ticket['product'];
    $to = $values['to'];
    $agent = get_user_by_id($ticket['agent']);
    $price = get_price($product['id'], $agent['level']);
    if (!change_credit($agent['id'], -$price, $ticket['number'])) {
        return 'INSUFFICIENT_BALANCE_FROM_AGENT';
    }
    if ($product['cate'] == 4) {
        $this->load->helper('user');
        $user = get_user();
        if (!$user) {
            return 'LOGIN_REQUIRED';
        }
        // hack self business here
        if ($product['subcate'] == 900) {
            // increase balance
            change_credit($user['id'], $product['norm_value'], $ticket['number']);
        }
        if ($product['subcate'] == 910) {
            // upgrade agent
            $from = $product['province'] % 10;
            $to = int($product['province'] / 10);
            if ($user['level'] != $from) {
                return 'INVALID_CURRENT_LEVEL';
            }
            if ($user['parent'] && $user['parent'] != $ticket['agent']) {
                return 'PARENT_CONFLICTED';
            }
            $this->db->update('agent', array('level' => $to, 'parent' => $ticket['agent']), array('name' => $username));
        }
    } else {
        $this->db->insert('job', array('create_time' => time(), 'commit_time' => 0, 'ticket_number' => $ticket['number'], 'to' => $values['to'], 'area' => $values['area'], 'product_id' => $product['id'], 'locking_on' => NULL, 'retried' => 0, 'result' => 0, 'reason' => NULL));
    }
    return 'SUCCESS';
}
Beispiel #7
0
function get_post_by_id($id)
{
    $mysqli = new mysqli(get_db_host(), get_db_user(), get_db_password(), get_db_database());
    $stmt = $mysqli->prepare("SELECT id, thread, reply_to, user, text, timestamp FROM post WHERE id = ? LIMIT 1");
    $stmt->bind_param("i", $id);
    $stmt->execute();
    $res = $stmt->get_result();
    if ($res->num_rows > 0) {
        $row = $res->fetch_assoc();
        $post = new Post();
        $post->set_id($row['id']);
        $post->set_thread(get_thread_by_id($row['thread']));
        if (!is_null($row['reply_to'])) {
            $post->set_reply_to(get_post_by_id($row['reply_to']));
        }
        $post->set_user(get_user_by_id($row['user']));
        $post->set_text($row['text']);
        $post->set_timestamp($row['timestamp']);
        $stmt->close();
        return $post;
    } else {
        return NULL;
    }
}
/**
 * [update_user description]
 * @param  [type] $data [description]
 * @return [type]       [description]
 */
function update_user($data)
{
    $output = false;
    $actual_data = get_user_by_id($data['id']);
    $new_data = $data;
    $full_file = get_json_content(LOCKPATH . 'users-config.json');
    $users = $full_file['users'];
    $updated_file;
    //Update Array
    foreach ($new_data as $attr => $value) {
        $actual_data[$attr] = $value;
    }
    //Attach user to file
    foreach ($users as $key => $user_data) {
        if ($user_data['id'] === $actual_data['id']) {
            $full_file['users'][$key] = $actual_data;
        }
    }
    //$updated_file = json_encode( $full_file );
    if (write_to_json(LOCKPATH . 'users-config.json', $full_file)) {
        $output = true;
    }
    return $output;
}
Beispiel #9
0
<?php
#
# (c) C4G, Santosh Vempala, Ruban Monu and Amol Shintre
# Main page for adding new lab user account
# Called from lab_config_home.php
#

include("../users/accesslist.php");
if( !(isAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $adminPageList)) 
     && !(isCountryDir(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $countryDirPageList)) 
	 && !(isSuperAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $superAdminPageList)) ) {
		header( 'Location: home.php' );
}

include("redirect.php");
include("includes/page_elems.php");
include("includes/script_elems.php");
LangUtil::setPageId("lab_config_home");

$script_elems = new ScriptElems();
$page_elems = new PageElems();
$reload_url = $_REQUEST['ru']."&show_u=1";
$lab_config_id = $_REQUEST['lid'];
?>
<script type="text/javascript">
function add_lab_user()
{
	var username = $('#lab_user').attr('value');
	var pwd = $('#pwd').attr('value');
	var email = $('#email').attr('value');
	var phone = $('#phone').attr('value');
Beispiel #10
0
# Main file for updating to new version
# Calls ajax/update.php which actually performs the update operations

/*include("../users/accesslist.php");
if( !(isCountryDir(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $countryDirPageList)) 
	&& !(isSuperAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $superAdminPageList)) &&
	!(isAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $adminPageList)) )
	header( 'Location: home.php' );
*/
include("redirect.php");
include("../includes/db_lib.php");
include("../includes/user_lib.php");

LangUtil::setPageId("update");

$user = get_user_by_id($_SESSION['user_id']);

$def = '';

if ( is_super_admin($user) || is_country_dir($user) ) {
	//$labConfigList = get_lab_configs($user->userId);
	//foreach($labConfigList as $labConfig) {
		//$labConfigId = $labConfig->id;
		//runUpdate($labConfigId);
//          }
	//runGlobalUpdate();
    $db_name = "blis_revamp";
        $ufile = "db_update_revamp";
        blis_db_update($lab_config_id, $db_name, $ufile);
        update_language_files();
        insertVersionDataEntry();
Beispiel #11
0
 public function change_password()
 {
     if ($this->input->post('update')) {
         $majorsalt = '';
         $newpassword = $this->input->post('new_password');
         $password = $this->input->post('old_password');
         $user_id = $this->dx_auth->get_user_id();
         $stored_hash = get_user_by_id($user_id)->password;
         $password = $this->dx_auth->_encode($password);
         if (crypt($password, $stored_hash) === $stored_hash) {
             // if PHP5
             if (function_exists('str_split')) {
                 $_pass = str_split($newpassword);
             } else {
                 $_pass = array();
                 if (is_string($newpassword)) {
                     for ($i = 0; $i < strlen($newpassword); $i++) {
                         array_push($_pass, $newpassword[$i]);
                     }
                 }
             }
             foreach ($_pass as $_hashpass) {
                 $majorsalt .= md5($_hashpass);
             }
             $final_pass = crypt(md5($majorsalt));
             $data['password'] = $final_pass;
             $this->db->where('id', 1);
             $this->db->update('users', $data);
             echo '<p>' . translate_admin('Settings updated successfully') . '</p>';
         } else {
             echo '<span style="color:red;">' . translate_admin('Your Old Password is wrong') . '</span>';
         }
     } else {
         $data['message_element'] = "administrator/settings/change_password";
         $this->load->view('administrator/admin_template', $data);
     }
 }
Beispiel #12
0
                                                </div>
            <?php 
        }
        ?>

                                        </div>
                                        <div class="clsConSamll_Pro_Img clsFloatLeft">
                                            <p><a href="<?php 
        echo site_url('users/profile') . '/' . $message->userby;
        ?>
"><img height="50" width="50" alt="" src="<?php 
        echo $this->Gallery->profilepic($message->userby, 2);
        ?>
" /></a></p>
                                            <p><?php 
        echo ucfirst(get_user_by_id($message->userby)->username);
        ?>
</p>
                                        </div>
                                    </li>

        <?php 
    }
}
?>
                    </ul>
                    <div style="clear:both"></div>
                </div>

            </div>
function process_login($method_name, $params, $userID)
{
    $config =& get_config();
    $userService = $config['user_service'];
    log_message('debug', "Processing new login request");
    $req = $params[0];
    $fullname = $req["first"] . ' ' . $req["last"];
    // Sanity check the request, make sure it's somewhat valid
    if (empty($userID)) {
        if (!isset($req["first"], $req["last"], $req["passwd"]) || empty($req["first"]) || empty($req["last"]) || empty($req["passwd"])) {
            return array('reason' => 'key', 'login' => 'false', 'message' => "Login request must contain a first name, last name, and password and they cannot be blank");
        }
        // Authorize the first/last/password and resolve it to a user account UUID
        log_message('debug', "Doing password-based authorization for user {$fullname}");
        $userID = authorize_identity($fullname, $req['passwd']);
        if (empty($userID)) {
            return array('reason' => 'key', 'login' => 'false', 'message' => "Sorry! We couldn't log you in.\nPlease check to make sure you entered the right\n    * Account name\n    * Password\nAlso, please make sure your Caps Lock key is off.");
        }
        log_message('debug', sprintf("Authorization success for %s", $userID));
    } else {
        log_message('debug', sprintf("Using pre-authenticated capability for %s", $userID));
    }
    // Get information about the user account
    $user = get_user_by_id($userID);
    if (empty($user)) {
        return array('reason' => 'key', 'login' => 'false', 'message' => "Sorry! We couldn't log you in. User account information could not be retrieved. If this problem persists, please contact the grid operator.");
    }
    $login_success = true;
    //ensure username has the same case as in the database
    $fullname = $user['Name'];
    if (!empty($user['UserFlags'])) {
        // get_user_by_id() fully decodes the structure, this is not needed
        //$userflags = json_decode($user['UserFlags'], TRUE);
        $userflags = $user['UserFlags'];
        if (!empty($userflags['Suspended']) && (bool) $userflags['Suspended'] === true) {
            $login_success = false;
            log_message('debug', "User " . $user['Name'] . " is banned.");
        } else {
            if ($user['AccessLevel'] < $config['access_level_minimum']) {
                if ($config['validation_required']) {
                    if (!empty($userflags['Validated'])) {
                        $login_success = $userflags['Validated'];
                    } else {
                        $login_success = false;
                    }
                    if (!$login_success) {
                        log_message('debug', "User " . $user['Name'] . " has not validated their email.");
                    }
                }
            }
        }
    } else {
        if ($user['AccessLevel'] < $config['access_level_minimum'] && $config['validation_required']) {
            $login_success = false;
            log_message('debug', "User " . $user['Name'] . " has not validated their email.");
        }
    }
    if (!$login_success) {
        return array('reason' => 'key', 'login' => 'false', 'message' => "Sorry!  We couldn't log you in.  User account has been suspended or is not yet activated.  If this problem persists, please contact the grid operator.");
    }
    $lastLocation = null;
    if (isset($user['LastLocation'])) {
        $lastLocation = SceneLocation::fromOSD($user['LastLocation']);
    }
    $homeLocation = null;
    if (isset($user['HomeLocation'])) {
        $homeLocation = SceneLocation::fromOSD($user['HomeLocation']);
    }
    log_message('debug', sprintf("User retrieval success for %s", $fullname));
    // Check for an existing session
    $existingSession = get_session($userID);
    if (!empty($existingSession)) {
        log_message('debug', sprintf("Existing session %s found for %s in scene %s", $existingSession["SessionID"], $fullname, $existingSession["SceneID"]));
        $sceneID = null;
        if (UUID::TryParse($existingSession["SceneID"], $sceneID)) {
            inform_scene_of_logout($sceneID, $userID);
        }
        if (remove_session($userID)) {
            log_message('debug', "Removed existing session for {$fullname} ({$userID})");
        } else {
            log_message('warn', "Failed to remove session for {$fullname} ({$userID})");
            return array('reason' => 'presence', 'login' => 'false', 'message' => "You are already logged in from another location. Please try again later.");
        }
    } else {
        log_message('debug', "No existing session found for {$fullname} ({$userID})");
    }
    // Create a login session
    $sessionID = null;
    $secureSessionID = null;
    $extradata = array('ClientIP' => $_SERVER['REMOTE_ADDR']);
    if (!add_session($userID, $sessionID, $secureSessionID, $extradata)) {
        return array('reason' => 'presence', 'login' => 'false', 'message' => "Failed to create a login session. Please try again later.");
    }
    log_message('debug', sprintf("Session creation success for %s (%s)", $fullname, $userID));
    // Find the starting scene for this user
    $scene = null;
    $startPosition = null;
    $startLookAt = null;
    if (!find_start_location($req['start'], $lastLocation, $homeLocation, $scene, $startPosition, $startLookAt) || !isset($scene->ExtraData['ExternalAddress'], $scene->ExtraData['ExternalPort'])) {
        return array('reason' => 'presence', 'login' => 'false', 'message' => "Error connecting to the grid. No suitable region to connect to.");
    }
    $lludpAddress = $scene->ExtraData['ExternalAddress'];
    $lludpPort = $scene->ExtraData['ExternalPort'];
    // Generate a circuit code
    srand(make_seed());
    $circuitCode = rand();
    // Prepare a login to the destination scene
    $seedCapability = NULL;
    $appearance = $user['LLPackedAppearance'];
    if (!create_opensim_presence($scene, $userID, $circuitCode, $fullname, $appearance, $sessionID, $secureSessionID, $startPosition, $seedCapability)) {
        return array('reason' => 'presence', 'login' => 'false', 'message' => "Failed to establish a presence in the destination region. Please try again later.");
    }
    log_message('debug', sprintf("Presence creation success for %s (%s) in %s with seedcap %s", $fullname, $userID, $scene->Name, $seedCapability));
    // Build the response
    $response = array();
    $response['seconds_since_epoch'] = time();
    $response['login'] = '******';
    $response['agent_id'] = (string) $userID;
    list($response['first_name'], $response['last_name']) = explode(' ', $fullname);
    $response['message'] = $config['message_of_the_day'];
    $response['udp_blacklist'] = $config['udp_blacklist'];
    $response['circuit_code'] = $circuitCode;
    $response['sim_ip'] = $lludpAddress;
    $response['sim_port'] = (int) $lludpPort;
    $response['seed_capability'] = $seedCapability;
    $response['region_x'] = (string) $scene->MinPosition->X;
    $response['region_y'] = (string) $scene->MinPosition->Y;
    $response['region_size_x'] = (string) ($scene->MaxPosition->X - $scene->MinPosition->X);
    $response['region_size_y'] = (string) ($scene->MaxPosition->Y - $scene->MinPosition->Y);
    $response['look_at'] = sprintf("[r%s, r%s, r%s]", $startLookAt->X, $startLookAt->Y, $startLookAt->Z);
    // TODO: If a valid $homeLocation is set, we should be pulling region_handle / position / lookat out of it
    $response['home'] = sprintf("{'region_handle':[r%s, r%s], 'position':[r%s, r%s, r%s], 'look_at':[r%s, r%s, r%s]}", $scene->MinPosition->X, $scene->MinPosition->Y, $startPosition->X, $startPosition->Y, $startPosition->Z, $startLookAt->X, $startLookAt->Y, $startLookAt->Z);
    $response['session_id'] = (string) $sessionID;
    $response['secure_session_id'] = (string) $secureSessionID;
    $req['options'][] = 'initial-outfit';
    for ($i = 0; $i < count($req['options']); $i++) {
        $option = str_replace('-', '_', $req['options'][$i]);
        if (file_exists(BASEPATH . "options/Class.{$option}.php")) {
            if (include_once BASEPATH . "options/Class.{$option}.php") {
                $instance = new $option($user);
                $response[$req["options"][$i]] = $instance->GetResults();
            } else {
                log_message('warn', "Unable to process login option: " . $option);
            }
        } else {
            log_message('debug', "Option " . $option . " not implemented.");
        }
    }
    $response["start_location"] = $req["start"];
    $response["agent_access"] = 'A';
    $response["agent_region_access"] = 'A';
    $response["agent_access_max"] = 'A';
    $response["agent_flags"] = 0;
    $response["ao_transition"] = 0;
    $response["inventory_host"] = "127.0.0.1";
    log_message('info', sprintf("Login User=%s %s Channel=%s Start=%s Viewer=%s id0=%s Mac=%s", $req["first"], $req["last"], $req["channel"], $req["start"], $req["version"], $req["id0"], $req["mac"]));
    return $response;
}
/**
 * If the form was submited with errors, show them here.
 */
$valid_me->list_errors();
?>
		
		<?php 
if (isset($edit_response)) {
    /**
     * Get the process state and show the corresponding ok or error message.
     */
    switch ($edit_response['query']) {
        case 1:
            $msg = __('User edited correctly.', 'cftp_admin');
            echo system_message('ok', $msg);
            $saved_user = get_user_by_id($user_id);
            /** Record the action log */
            $new_log_action = new LogActions();
            $log_action_args = array('action' => 13, 'owner_id' => $global_id, 'affected_account' => $user_id, 'affected_account_name' => $saved_user['username'], 'get_user_real_name' => true);
            $new_record_action = $new_log_action->log_action_save($log_action_args);
            break;
        case 0:
            $msg = __('There was an error. Please try again.', 'cftp_admin');
            echo system_message('error', $msg);
            break;
    }
} else {
    /**
     * If not $edit_response is set, it means we are just entering for the first time.
     */
    $direct_access_error = __('This page is not intended to be accessed directly.', 'cftp_admin');
Beispiel #15
0
                                    <p> <?php 
        echo get_list_by_id($row->list_id)->address;
        ?>
 </p> 
                                </td>
                                <td width="25%">
                                    <p> <img height="50" width="50" alt="image" style="float:left; margin:0 10px 10px 0;" src="<?php 
        echo $this->Gallery->profilepic($row->userby, 2);
        ?>
" />
                                        <span class="clsBold">
                                            <a href="<?php 
        echo site_url('users/profile') . '/' . $row->userby;
        ?>
"><?php 
        echo ucfirst(get_user_by_id($row->userby)->username);
        ?>
</a>
                                        </span></p>
                                    <p style="margin:5px 0 0 0;"><a class="clsLink2_Bg" href="<?php 
        echo site_url('trips/send_message/' . $row->userby);
        ?>
"><?php 
        echo translate("View") . ' / ' . translate("Send") . ' ' . translate("Message");
        ?>
</a></p>
                                </td>
                                <td width="15%">
                                    <p><?php 
        echo get_currency_symbol($row->list_id) . get_currency_value1($row->list_id, $row->price);
        ?>
Beispiel #16
0
<?php

#
# (c) C4G, Santosh Vempala, Ruban Monu and Amol Shintre
# Main page for editting result interpretation (remarks) values
# Done by lab admins on existing test measures (indicators) in lab configuration
#
include "../users/accesslist.php";
if (!(isAdmin(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $adminPageList)) && !(isCountryDir(get_user_by_id($_SESSION['user_id'])) && in_array(basename($_SERVER['PHP_SELF']), $countryDirPageList))) {
    displayForbiddenMessage();
}
include "redirect.php";
include "includes/header.php";
LangUtil::setPageId("blis_help_page");
$script_elems->enableJQueryForm();
$saved_session = SessionUtil::save();
$lab_config_id = $_REQUEST['id'];
$lab_config = LabConfig::getById($lab_config_id);
?>
<p style="text-align: right;"><a rel='facebox' href='#Tests_config'>Page Help</a></p><br/>
<a href='lab_config_home.php?id=<?php 
echo $lab_config_id;
?>
'>&laquo; <?php 
echo LangUtil::$generalTerms['CMD_BACK'];
?>
</a>|<b>Results Interpretation</b> 
 <br><br>
 
<div id='Tests_config' class='right_pane' style='display:none;margin-left:10px;'>
	<ul>
Beispiel #17
0
/** 
	DB Merging Helper Functions Begin Here
*/
function searchPatientByName($q)
{
    $user = get_user_by_id($_SESSION['user_id']);
    $country = strtolower($user->country);
    $saved_db = DbUtil::switchToCountry($country);
    # Searches for patients with exact name in the global database
    $query_string = "SELECT * FROM patient " . "WHERE name LIKE '{$q}'";
    $record = query_associative_one($query_string);
    DbUtil::switchRestore($saved_db);
    if ($record) {
        $patient = Patient::getObject($record);
    } else {
        $patient = null;
    }
    return $patient;
}
Beispiel #18
0
#
# Lists patient test history in printable format
#
/*
$load_time = microtime(); 
$load_time = explode(' ',$load_time); 
$load_time = $load_time[1] + $load_time[0]; 
$page_start = $load_time; 
*/
include "redirect.php";
include "includes/db_lib.php";
include "includes/script_elems.php";
include "includes/page_elems.php";
LangUtil::setPageId("reports");
include "../users/accesslist.php";
if (!isLoggedIn(get_user_by_id($_SESSION['user_id']))) {
    header('Location: home.php');
}
$date_from = "";
$date_to = "";
$hidePatientName = 0;
if (isset($_REQUEST['yf'])) {
    $date_from = $_REQUEST['yf'] . "-" . $_REQUEST['mf'] . "-" . $_REQUEST['df'];
    $date_to = $_REQUEST['yt'] . "-" . $_REQUEST['mt'] . "-" . $_REQUEST['dt'];
} else {
    $date_from = date("Y-m-d");
    $date_to = $date_from;
}
# Helper function to fetch test history records
function get_records_to_print($lab_config, $patient_id)
{
Beispiel #19
0
            echo 'style="background:#FFFFD0; color:#00B0FF"';
        }
        ?>
>
                                        <div class="clsMsg_User clsFloatLeft"> <a href="<?php 
        echo site_url('users/profile') . '/' . $row->userby;
        ?>
"><img height="50" width="50" alt="" src="<?php 
        echo $this->Gallery->profilepic($row->userby, 2);
        ?>
" /></a>
                                            <p><a href="<?php 
        echo site_url('users/profile') . '/' . $row->userby;
        ?>
"><?php 
        echo get_user_by_id($row->userby)->username;
        ?>
</a> <br />
                                                <!--31 minutes-->
                                            </p>
                                        </div>
                                        <div class="clsMeg_Detail clsFloatLeft">

                                            <?php 
        if ($row->conversation_id != 0) {
            $message_id = $row->conversation_id;
            $reservation_id = $row->reservation_id;
        } else {
            $message_id = $row->reservation_id;
            $reservation_id = $row->reservation_id;
        }
Beispiel #20
0
	public function getPatientSearchAttribSelect($hide_patient_name=false)
	{
            $userrr = get_user_by_id($_SESSION['user_id']);

		global $LIS_TECH_RO, $LIS_TECH_RW, $LIS_CLERK;
		if
		(
			$_SESSION['user_level'] == $LIS_TECH_RO ||
			$_SESSION['user_level'] == $LIS_TECH_RW ||
			$_SESSION['user_level'] == $LIS_CLERK ||
				$_SESSION['user_level'] == $LIS_PHYSICIAN 
		)
		{
			$lab_config = LabConfig::getById($_SESSION['lab_config_id']); 
                        $patientBarcodeSearch = patientSearchBarcodeCheck();
			if($hide_patient_name === false && $lab_config->pname != 0)
			{
				?>
				<option value='1'><?php echo LangUtil::$generalTerms['PATIENT_NAME']; ?></option>
				<?php
			}
			if($lab_config->dailyNum == 1 || $lab_config->dailyNum == 11 || $lab_config->dailyNum == 2 || $lab_config->dailyNum == 12)
			{
				?>
				<option value='3'><?php echo LangUtil::$generalTerms['PATIENT_DAILYNUM']; ?></option>
				<?php
			}
			if($lab_config->pid != 0)
			{
				?>
				<option value='0'><?php echo LangUtil::$generalTerms['PATIENT_ID']; ?></option>
				<?php
			}
			if($lab_config->patientAddl != 0)
			{
				?>
				<option value='2'><?php echo LangUtil::$generalTerms['ADDL_ID']; ?></option>
				<?php
			}
                        if($patientBarcodeSearch != 0 && is_country_dir($userrr) != 1 && is_super_admin($userrr) != 1 )
			{
				?>
				<option value='9'><?php echo 'Barcode Search'; ?></option>
				<?php
			}
		}
		else if(User::onlyOneLabConfig($_SESSION['user_id'], $_SESSION['user_level']))
		{
			# Lab admin
			$lab_config_list = get_lab_configs($_SESSION['user_id']);
			$lab_config = $lab_config_list[0];
                        $patientBarcodeSearch = patientSearchBarcodeCheck();
			if($lab_config->pname != 0)
			{
				?>
				<option value='1'><?php echo LangUtil::$generalTerms['PATIENT_NAME']; ?></option>
				<?php
			}
			if($lab_config->dailyNum == 1 || $lab_config->dailyNum == 11 || $lab_config->dailyNum == 2 || $lab_config->dailyNum == 12)
			{
				?>
				<option value='3'><?php echo LangUtil::$generalTerms['PATIENT_DAILYNUM']; ?></option>
				<?php
			}
			if($lab_config->pid != 0)
			{
				?>
				<option value='0'><?php echo LangUtil::$generalTerms['PATIENT_ID']; ?></option>
				<?php
			}
			if($lab_config->patientAddl != 0)
			{
				?>
				<option value='2'><?php echo LangUtil::$generalTerms['ADDL_ID']; ?></option>
				<?php
			}
                        if($patientBarcodeSearch != 0 && is_country_dir($userrr) != 1 && is_super_admin($userrr) != 1 )
			{
				?>
				<option value='9'><?php echo 'Barcode Search'; ?></option>
				<?php
			}
		}
		else
		{
                                            $patientBarcodeSearch = patientSearchBarcodeCheck();

			# Show all options
			?>
			<option value='1'><?php echo LangUtil::$generalTerms['PATIENT_NAME']; ?></option>
			<option value='3'><?php echo LangUtil::$generalTerms['PATIENT_DAILYNUM']; ?></option>
			<option value='0'><?php echo LangUtil::$generalTerms['PATIENT_ID']; ?></option>
			<option value='2'><?php echo LangUtil::$generalTerms['ADDL_ID']; ?></option>
                         <?php 
                         if($patientBarcodeSearch != 0 && is_country_dir($userrr) != 1 && is_super_admin($userrr) != 1 ){ ?>
                        				<option value='9'><?php echo 'Barcode Search'; ?></option>
                                                        <?php } ?>

			<?php
		}
	}
Beispiel #21
0
 /**
  * Checks if a user is logged in and remembered
  *
  * @access	private
  * @return	bool
  */
 private function _check_remember_me()
 {
     $this->CI->load->library('encrypt');
     // Is there a cookie to eat?
     if ($cookie_data = get_cookie('rememberme')) {
         $user_id = '';
         $token = '';
         $timeout = '';
         $cookie_data = $this->CI->encrypt->decode($cookie_data);
         if (strpos($cookie_data, ':') !== FALSE) {
             $cookie_data = explode(':', $cookie_data);
             if (count($cookie_data) == 3) {
                 list($user_id, $token, $timeout) = $cookie_data;
             }
         }
         // Cookie expired
         if ((int) $timeout < time()) {
             return FALSE;
         }
         if ($data = get_user_by_id($user_id)) {
             // Set session values
             $this->CI->session->set_userdata(array('user_id' => $user_id, 'username' => $data->row('email'), 'role_id' => $data->row('role_id'), 'role_name' => $data->row('role_name')));
             $this->_set_remember_me($user_id);
             return TRUE;
         }
         delete_cookie('rememberme');
     }
     return FALSE;
 }
Beispiel #22
0
save_user", data, function(){
                mw.tools.loading('#user-data', false);
           });
        }

    </script>
     <style>

     .profile-box > .mw-ui-row{
       margin-bottom: 24px;
     }

     </style>

     <?php 
$user = get_user_by_id(user_id());
?>

    <div class="mw-ui-row">
        <div class="mw-ui-col">
            <div class="mw-ui-col-container">
                <label class="mw-ui-label">Username</label>
                <input type="text" name="username" value="<?php 
print $user['username'];
?>
" class="mw-ui-field w100" />
            </div>
        </div>
        <div class="mw-ui-col">
            <div class="mw-ui-col-container">
                <label class="mw-ui-label">Email</label>
Beispiel #23
0
						url_to_go = url_to_go+'?editmode:y';
					}
 				//window.location.href=url_to_go;
				 $(this).attr('href' , url_to_go);;
  				 return false;
				 
			}); 
           


        });
    </script>
    <div id="user-menu" class="scroll-height-exception">
              <?php 
    $user_id = user_id();
    $user = get_user_by_id($user_id);
    if (!empty($user)) {
        $img = user_picture($user_id);
        if ($img != '') {
            ?>
              <a href="javascript:;" id="main-bar-user-menu-link" class="main-bar-user-menu-link-has-image"><span id="main-bar-profile-img" style="background-image: url('<?php 
            print $img;
            ?>
');"></span><span class="mw-icon-dropdown"></span></a>
              <?php 
        } else {
            ?>
              <a href="javascript:;" id="main-bar-user-menu-link" class="main-bar-user-menu-link-no-image"><span class="mw-icon-user" id="main-bar-profile-icon"></span><span class="mw-icon-dropdown"></span></a>
              <?php 
        }
    }
Beispiel #24
0
</th>
					<th>Description <?php 
echo get_sort_link('calendar', 'description', '#list');
?>
</th>
					<th></th>
				</tr>
			</thead>
			<tbody>
				<?php 
if (isset($resource_list) && sizeof($resource_list) > 0) {
    foreach ($resource_list as $list) {
        ?>
				<?php 
        $created_by = get_user_by_id($list->created_by);
        $person_in_charge = get_user_by_id($list->person_in_charge);
        ?>
				<tr class="ui-helper-reset">
					<td><?php 
        echo $created_by->meta['first_name'] . ' ' . $created_by->meta['last_name'];
        ?>
</td>
					<td><?php 
        echo $person_in_charge->meta['first_name'] . ' ' . $person_in_charge->meta['last_name'];
        ?>
</td>
					<td><?php 
        echo $list->room;
        ?>
</td>
					<td><?php 
Beispiel #25
0
 public function conversation($param = '')
 {
     $this->form_validation->set_error_delimiters('<p style="clear:both;color: #FF0000;"><label>&nbsp;</label>', '</p>');
     if ($param == 0) {
         redirect('info');
     }
     if ($param == '') {
         redirect('info');
     }
     $check = $this->db->where('conversation_id', $param)->get('messages');
     if ($check->num_rows() == 0) {
         redirect('info');
     }
     if ($this->input->post()) {
         $this->form_validation->set_rules('comment', 'Message', 'required|trim|xss_clean');
         if ($this->form_validation->run()) {
             if ($this->input->post('reservation_id') != 0) {
                 $insertData = array('list_id' => $this->input->post('list_id'), 'reservation_id' => $this->input->post('reservation_id'), 'userby' => $this->input->post('userby'), 'userto' => $this->input->post('userto'), 'message' => $this->input->post('comment'), 'created' => local_to_gmt(), 'message_type ' => 3);
             } else {
                 $insertData = array('list_id' => $this->input->post('list_id'), 'contact_id' => $this->input->post('contact_id'), 'userby' => $this->input->post('userby'), 'userto' => $this->input->post('userto'), 'message' => $this->input->post('comment'), 'created' => local_to_gmt(), 'message_type ' => 3);
             }
             $this->Message_model->sentMessage($insertData, 1);
             redirect('trips/conversation/' . $param);
         }
     }
     $data['conversation_id'] = $param;
     $conditions = array("messages.conversation_id" => $param, "messages.userby" => $this->dx_auth->get_user_id());
     $or_where = array("messages.userto" => $this->dx_auth->get_user_id());
     $query = $this->Message_model->get_messages($conditions, $or_where);
     if ($query->num_rows() == 0) {
         redirect('info');
     }
     $condition = array("messages.conversation_id" => $param);
     $orderby = array('id', "DESC");
     $result = $data['messages'] = $this->Message_model->get_messages($condition, NULL, $orderby);
     $row = $result->row();
     if ($row->userby == $this->dx_auth->get_user_id()) {
         $coversation_userID = $row->userto;
     } else {
         $coversation_userID = $row->userby;
     }
     $contact_id = $this->db->where('conversation_id', $param)->order_by("id", "desc")->limit(1)->get('messages')->row()->contact_id;
     $data['list_id'] = $row->list_id;
     $data['reservation_id'] = $row->reservation_id;
     $data['contact_id'] = $contact_id;
     $data['conv_userData'] = get_user_by_id($coversation_userID);
     $data['title'] = get_meta_details('Conversations', 'title');
     $data["meta_keyword"] = get_meta_details('Conversations', 'meta_keyword');
     $data["meta_description"] = get_meta_details('Conversations', 'meta_description');
     $data['message_element'] = 'trips/view_conversation';
     $this->load->view('template', $data);
 }
Beispiel #26
0
						</input>
					</td>
				</tr>
				<tr id='cat_row13'>
					<td><?php 
echo LangUtil::$generalTerms['LAB_SECTION'];
?>
 &nbsp;&nbsp;&nbsp;</td>
					<td>
						<select name='cat_code' id='cat_code13' class='uniform_width'>
							<option value='0'><?php 
echo LangUtil::$generalTerms['ALL'];
?>
</option>
							<?php 
if (is_country_dir(get_user_by_id($_SESSION['user_id']))) {
    $page_elems->getTestCategoryCountrySelect();
} else {
    $page_elems->getTestCategorySelect();
}
?>
						</select>
					</td>
				</tr>
				<tr id='ttype_row13'>
					<td><?php 
echo LangUtil::$generalTerms['TEST'];
?>
</td>
					<td>
						<select name='ttype' id='ttype13' class='uniform_width'>
Beispiel #27
0
<?php

#
# Main page for showing patient profile, test history,
# and options like updating profile, registering new specimen
#
include "redirect.php";
include "includes/header.php";
LangUtil::setPageId("patient_profile");
$pid = $_REQUEST['pid'];
$script_elems->enableJQueryForm();
$script_elems->enableDatePicker();
$script_elems->enableTableSorter();
$script_elems->enableLatencyRecord();
$admin = 0;
if (is_admin_check(get_user_by_id($_SESSION['user_id']))) {
    $admin = 1;
}
$rem_recs = get_removed_specimens($_SESSION['lab_config_id'], "test");
foreach ($rem_recs as $rem_rec) {
    $rem_specs[] = $rem_rec['r_id'];
    $rem_remarks[] = $rem_rec['remarks'];
}
$labsection = 0;
if (isset($_REQUEST['labsection'])) {
    $labsection = $_REQUEST['labsection'];
}
//print_r($rem_specs);
?>
<script type='text/javascript'>
function toggle_profile_divs()
Beispiel #28
0
				<h3>Welcome to ACP, <span><?php 
echo $_SESSION['username'];
?>
</span></h3>
				<br /><br />
				
				<h4>New Order Recieved</h4>
				<?php 
$recieved_orders = get_order_by_status('recieved');
echo '<table class="table table-hover table-bordered">';
echo '<tr><th>Order #</th><th>Order by</th><th>Order Total</th><th>Status</th><th>Modification</th></tr>';
while ($orders = mysql_fetch_array($recieved_orders)) {
    echo '<tr>';
    echo '<td>' . $orders['id'] . '</td>';
    // get user name by its id !
    $order_by = get_user_by_id($orders['user_id']);
    echo '<td>' . $order_by['username'] . '</td>';
    echo '<td style="color: green;">$' . $orders['order_total'] . '</td>';
    echo '<td style="color: red;">Recieved</td>';
    echo '<td><a href="' . site_options('link') . 'admin/edit_order.php?order=' . $orders['id'] . '">Details </a>';
    echo '</tr>';
}
echo '</table>';
?>
				
				<br /><br />
				
				<h4>Applications waiting approval</h4>
				
<?php 
$inactive_users = get_user_by_status('inactive');
Beispiel #29
0
    session_destroy();
    //unset cookies
    setcookie("username", "", time() - 7200);
    header('Location: login.php');
}
if (isset($_SESSION['admin_id']) && !get_published_batch_id()) {
    header('Location: admin.php');
}
?>
    <div class="content">
        <div class="topContent">
            <?php 
if (isset($_SESSION['user_id'])) {
    if (get_published_batch_id()) {
        $user = $_SESSION['user_id'];
        $name = get_user_by_id($user);
        $batch = get_published_batch_id();
        echo "<h2>" . get_text('Information') . " " . strtolower(get_text('About')) . ": {$name['0']} {$name['1']}</h2>";
        ?>
                    <p>
                        <a href="pdf.php?id=<?php 
        echo $_SESSION['user_id'];
        ?>
"><?php 
        echo get_text('View') . ' ' . get_text('PDF');
        ?>
</a>
                    </p>
                    <?php 
        get_user_info($user, $batch);
    }
Beispiel #30
0
            $value = get_donation_types();
            break;
        case "get_charity":
            //print_r("in switch");
            if (isset($_GET["charity_id"])) {
                $value = get_charity($_GET["charity_id"]);
            } else {
                $value = "Missing argument";
            }
            break;
        case "get_all_cause":
            $value = get_all_cause();
            break;
        case "get_all_charities":
            if (isset($_GET["id"])) {
                $value = get_user_by_id($_GET["id"]);
            } else {
                $value = "Missing argument";
            }
            break;
    }
}
/*
print_r("call back is ..");
print_r($_GET['callback']);
print_r("the value is ");
print_r($value);
print_r("jsonp result is");
*/
$jsonVal = $_GET['callback'] . "(" . $value . ");";
return print_r($jsonVal);