Exemplo n.º 1
0
 public function show($condition = '', $orderby = '', $limit = '')
 {
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'notice WHERE 1' . $condition . $orderby . $limit;
     $q = $this->db->query($sql);
     while ($r = $this->db->fetch_array($q)) {
         $r['send_time'] = $r['send_time'] ? date('Y-m-d H:i:s', $r['send_time']) : 0;
         $r['notice_state'] = get_states($r['from_time'], $r['to_time']);
         $r['from_time'] = $r['from_time'] ? date('Y-m-d H:i:s', $r['from_time']) : 0;
         $r['to_time'] = $r['to_time'] ? date('Y-m-d H:i:s', $r['to_time']) : 0;
         $r['create_time'] = $r['create_time'] ? date('Y-m-d H:i:s', $r['create_time']) : 0;
         $r['update_time'] = $r['update_time'] ? date('Y-m-d H:i:s', $r['update_time']) : 0;
         $r['audit_time'] = $r['audit_time'] ? date('Y-m-d H:i:s', $r['audit_time']) : 0;
         $r['content'] = htmlspecialchars_decode(stripslashes($r['content']));
         $r['type_name'] = $this->settings['type'][$r['type']];
         if ($r['type'] == 5) {
             $r['owner_uname'] = '所有人';
         }
         $ret[] = $r;
     }
     return $ret;
 }
Exemplo n.º 2
0
 public function edit_profile()
 {
     if ($this->session->userdata('is_logged_in')) {
         $email = $this->session->userdata('email');
         $user_data = $this->User_model->get_user_data($email);
         $id = $user_data['id'];
         $profile_data = $this->User_model->get_user_profile($id);
         $this->load->helper('common');
         $view_data['statelist'] = get_states();
         $view_data['countries'] = get_countries();
         $view_data['title'] = "Edit My Profile";
         $view_data['page_header'] = "User Profile for: <strong>" . $user_data['first'] . " " . $user_data['last'] . "</strong>";
         $data = array_merge($view_data, $user_data, $profile_data);
         $audit = array('primary' => 'PROF', 'secondary' => 'UPDV', 'status' => true, 'controller' => 'Profile', 'value' => $id, 'extra_1' => null, 'extra_2' => null, 'extra_3' => null);
         $this->Audit_model->log_entry($audit);
         $this->load->view("header", $data);
         $this->load->view("navbar", $data);
         $this->load->view('edit_profile_view', $data);
         $this->load->view("footer", $data);
     } else {
         redirect('User/restricted');
     }
 }
Exemplo n.º 3
0
    $type = get_all_event_type();
    $term = strtolower($_GET['term']);
    $result = array();
    $max_result = isset($_GET["maxRows"]) ? (int) $_GET["maxRows"] : 10;
    $i = 0;
    foreach ($type as $t) {
        if (stripos(strtolower($t), $term) !== false && $i < $max_result) {
            array_push($result, array("term" => $t, "value" => ucwords($t)));
            $i++;
        }
    }
    echo json_encode($result);
    exit;
}
if (isset($_GET['term']) && $_GET['type'] == "state") {
    $states = get_states();
    $term = strtolower($_GET['term']);
    $result = array();
    $max_result = isset($_GET["maxRows"]) ? (int) $_GET["maxRows"] : 10;
    $i = 0;
    foreach ($states as $code => $state) {
        if (stripos(strtolower($state), $term) !== false && $i < $max_result) {
            array_push($result, array("term" => $code, "value" => $state));
            $i++;
        }
    }
    echo json_encode($result);
    exit;
}
if (isset($_GET['term']) && $_GET['type'] == "venues") {
    global $wpdb;
Exemplo n.º 4
0
 public function update($id)
 {
     if ($this->session->userdata('is_logged_in') && $this->has_permission_to_edit()) {
         $user_data = $this->User_model->get_user($id);
         $profile_data = $this->User_model->get_user_profile($id);
         $data = array_merge($user_data, $profile_data);
         $this->load->helper('common');
         $data['statelist'] = get_states();
         $data['countries'] = get_countries();
         $lookup['selected_roles'] = $this->User_model->list_user_roles($id);
         $lookup['active_roles'] = $this->Roles_permissions_model->list_active_roles();
         $active_roles = array();
         foreach ($lookup['active_roles'] as $role) {
             $role_id = $role->id;
             $role = $role->role;
             $active_roles[$role_id] = $role;
         }
         $selected_roles = array();
         foreach ($lookup['selected_roles'] as $role) {
             $selected_roles[] = $role->role_id;
         }
         $data['id'] = $id;
         $data['active'] = $active_roles;
         $data['selected'] = $selected_roles;
         $data['title'] = "Edit the user";
         $data['page_header'] = "Edit the user";
         $audit = array('primary' => 'USRA', 'secondary' => 'UPDV', 'status' => true, 'controller' => 'UserAdmin', 'value' => $id, 'extra_1' => null, 'extra_2' => null, 'extra_3' => null);
         $this->Audit_model->log_entry($audit);
         $this->load->view("header", $data);
         $this->load->view("navbar", $data);
         $this->load->view('edit_user_view', $data);
         $this->load->view("footer", $data);
     } else {
         redirect('User/restricted');
     }
 }
Exemplo n.º 5
0
 /**
  * 用户读取通知
  * @param access_token
  * @param user_id 如果未传入access_token值,则需要传入user_id
  * @param utype 1-会员(默认) 2-m2o用户
  */
 public function read()
 {
     $uid = $this->user['user_id'];
     //提交会员id
     $utype = $this->input['utype'] ? intval($this->input['utype']) : 1;
     //提交用户为会员还是m20管理员
     if (!$uid) {
         $this->errorOutput(NOT_LOGIN);
     }
     $notice_id = intval($this->input['id']);
     //读取通知的id
     if (!$notice_id) {
         $this->errorOutput(NOID);
     }
     $sql = 'SELECT id,send_uname,title,content,send_time,to_time FROM ' . DB_PREFIX . 'notice WHERE id =' . $notice_id;
     $notice = $this->db->query_first($sql);
     if (!$notice) {
         $this->errorOutput(NO_NOTICE);
     }
     $notice['send_time'] = $notice['send_time'] ? date('Y-m-d H:i:s', $notice['send_time']) : 0;
     $notice['content'] = htmlspecialchars_decode(stripslashes($notice['content']));
     $notice['notice_state'] = get_states($notice['from_time'], $notice['to_time']);
     //查询通知日志中是否有此通知
     $sql = 'SELECT * FROM ' . DB_PREFIX . 'notice_log WHERE notice_id =' . $notice_id . ' AND user_id = ' . $uid . ' AND user_type = ' . $utype;
     $log = $this->db->query_first($sql);
     if ($log && $log['statu'] == 0) {
         $sql = 'UPDATE ' . DB_PREFIX . 'notice_log SET statu = 1 WHERE notice_id =' . $notice_id . ' AND user_id = ' . $uid . ' AND user_type = ' . $utype;
         $this->db->query($sql);
     } elseif (!$log) {
         $sql = 'INSERT INTO ' . DB_PREFIX . 'notice_log' . '(notice_id,user_id,statu,user_type) VALUES (' . $notice_id . ',' . $uid . ',1,' . $utype . ')';
         $this->db->query($sql);
     }
     $this->addItem($notice);
     $this->output();
 }
Exemplo n.º 6
0
											<td class="gray-login">City</td>
											<td>
											<input name="s_city" type="text" id="s_city" size="30" 
											value="<?php 
echo $_POST["s_city"];
?>
" />											</td>
											</tr>
										  
										  <tr>
											<td class="gray-login">State</td>
											<td>
											<select name="s_state">
											  <option value="">Select state</option>
											  <?php 
get_states($_POST["s_state"]);
?>
											</select>											</td>
										  </tr>
										  
										  <tr>
											<td class="gray-login">Subject</td>
											<td>
											<select name="s_subject">
											  <option value="">Select subject</option>
											  <?php 
get_subject($_POST["s_subject"]);
?>
											</select>											</td>
										  </tr>
										  
Exemplo n.º 7
0
include 'functions.php';
include 'ChromePhp.php';
// include 'oo.php';
//Home
Flight::route('/', function () {
    Flight::render('hello.php');
    ChromePhp::log('I used ChromePhp for troubleshooting.');
});
// List all states
Flight::route('/v1/states/', function () {
    Flight::render('states.php');
});
// List cities from a certain state
Flight::route('GET /v1/states/@state/cities', function ($state) {
    $state = strtoupper($state);
    $json_states = get_states('cities.csv', $state);
    Flight::json($json_states);
});
// Lists a single city, can receive radius query data
Flight::route('GET /v1/states/@state/cities/@city', function ($state, $city) {
    $state = strtoupper($state);
    if (is_numeric($city)) {
        $current_city = find_city_by_id('cities.csv', $city);
    } else {
        $current_city = find_city_by_name('cities.csv', $city, $state);
    }
    if (isset($current_city)) {
        $cityname = $current_city->name;
        $radius = Flight::request()->query->radius;
        $nearby = find_distance($state, $cityname, $radius, 'cities.csv');
        Flight::json($nearby);
Exemplo n.º 8
0
function get_state_by_name($state = '')
{
    $c = get_states();
    foreach ($c as $code => $name) {
        if (strtolower($state) === strtolower($name)) {
            return $code;
            break;
        }
    }
    return "";
}
Exemplo n.º 9
0
<?php

include 'get_connection.php';
try {
    get_states($conn);
} catch (PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
    return;
}
$conn = null;
function get_states($conn)
{
    $stmt = "SELECT name FROM states";
    $sth = $conn->prepare($stmt, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY));
    $sth->execute();
    $result = $sth->fetchAll();
    $length = count($result);
    for ($i = 0; $i < $length; $i++) {
        $state = $result[$i][0];
        $url = "http://10.171.204.135/state-polls.html?topic=" . $state;
        //echo $county ."\n". $url . $county . "\n";
        $state = str_replace("_", " ", $state);
        $state = ucwords($state);
        echo "<a class='list-group-item' href = " . $url . ">" . $state . "</a>";
    }
}