コード例 #1
0
ファイル: settings.php プロジェクト: teju/Android
function modulesetting_init()
{
    global $MODULE_SETTINGS;
    $MODULE_SETTINGS = array();
    LOG_MSG('INFO', "modulesetting_init(): START");
    $resp = execSQL("SELECT \n\t\t\t\t\t\tname,value\n\t\t\t\t\tFROM \n\t\t\t\t\t\ttSetting \n\t\t\t\t\tWHERE\n\t\t\t\t\t\tis_hidden=1 AND \n\t\t\t\t\t\tTRAVEL_ID=" . TRAVEL_ID, array(), false);
    if ($resp[0]['STATUS'] != 'OK') {
        add_msg("ERROR", "There was an error loading your module settings. Please contact customer care");
        return false;
    }
    LOG_MSG('INFO', "modulesetting_init(): Loaded " . $resp[0]['NROWS'] . " settings");
    for ($i = 0; $i < $resp[0]['NROWS']; $i++) {
        $name = $resp[$i]['name'];
        $value = $resp[$i]['value'];
        $MODULE_SETTINGS[$name] = $value;
    }
    LOG_ARR("INFO", "SHOP SETTINGS", $MODULE_SETTINGS);
    LOG_MSG('INFO', "modulesetting_init(): END");
    return true;
}
コード例 #2
0
ファイル: intercom.php プロジェクト: teju/Android
 /**
  * Make an HTTP call using curl.
  * 
  * @param  string $url       The URL to call
  * @param  string $method    The HTTP method to use, by default GET
  * @param  string $post_data The data to send on an HTTP POST (optional)
  * @return object
  **/
 private function httpCall($url, $method = 'GET', $post_data = null)
 {
     $headers = array('Content-Type: application/json');
     $ch = curl_init($url);
     #$ch = curl_init("http://shopnix.in/admin/index.php?mod=admin&ent=shop&go=intercom_curlpost_test");
     if ($this->debug) {
         curl_setopt($ch, CURLOPT_VERBOSE, true);
     }
     if ($method == 'POST') {
         curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
         curl_setopt($ch, CURLOPT_POST, true);
     } elseif ($method == 'PUT') {
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
         curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
         $headers[] = 'Content-Length: ' . strlen($post_data);
     } elseif ($method != 'GET') {
         curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
     }
     LOG_ARR("INFO", "====httpCall:POSTDATA====", $post_data);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ch, CURLOPT_BUFFERSIZE, 4096);
     curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
     curl_setopt($ch, CURLOPT_TIMEOUT, 60);
     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
     curl_setopt($ch, CURLOPT_USERPWD, $this->appId . ':' . $this->apiKey);
     $response = curl_exec($ch);
     // Set HTTP error, if any
     $this->lastError = array('code' => curl_errno($ch), 'message' => curl_error($ch));
     return json_decode($response);
 }
コード例 #3
0
ファイル: db.php プロジェクト: teju/Android
function db_get_list($TYPE = 'LIST', $fields, $table, $where_clause = "")
{
    LOG_MSG("INFO", "####### db_get_list(): TYPE={$TYPE}, fields={$fields},table={$table},where_clause={$where_clause} ");
    // Only allow single fields for LIST
    if ($TYPE == 'LIST' && preg_match('/,/', $fields)) {
        add_msg('ERROR', 'Internal error. Pease contact customer service.');
        LOG_MSG('ERROR', 'db_get_list(): Type LIST should have only one SELECT field');
        return false;
    }
    if ($where_clause) {
        $where_clause = " WHERE " . $where_clause;
    }
    $row = execSQL("\tSELECT \n\t\t\t\t\t\t{$fields} \n\t\t\t\t\tFROM \n\t\t\t\t\t\t{$table} \n\t\t\t\t\t\t{$where_clause}\n\t\t\t\t\tORDER \n\t\t\t\t\t\tBY 1", array(), false);
    if ($row[0]['STATUS'] != 'OK') {
        add_msg('ERROR', 'Internal error. Pease contact customer service.');
        LOG_ARR('INFO', 'row', $row);
        return false;
    }
    if ($TYPE == 'LIST') {
        $values = "";
        $seperator = "";
        //LOG_MSG('INFO',"=======================".print_r($row,true));
        for ($i = 0; $i < $row[0]['NROWS']; $i++) {
            $values = $values . $seperator . $row[$i][$fields];
            $seperator = ",";
            //LOG_MSG('INFO',"=========[$values]");
        }
        return $values;
    } else {
        return $row;
    }
}
コード例 #4
0
ファイル: header.php プロジェクト: abkiran/reddy
echo base_url();
?>
/assets/admin/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<link href="<?php 
echo base_url();
?>
/assets/admin/css/animate.css" rel="stylesheet" type="text/css" />
<link href="<?php 
echo base_url();
?>
/assets/admin/css/admin.css" rel="stylesheet" type="text/css" />
<link href="<?php 
echo base_url();
?>
/assets/admin/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<link href="<?php 
echo base_url();
?>
/assets/admin/plugins/kalendar/kalendar.css" rel="stylesheet">
<link rel="stylesheet" href="<?php 
echo base_url();
?>
/assets/admin/plugins/scroll/nanoscroller.css">
<link href="<?php 
echo base_url();
?>
/assets/admin/plugins/morris/morris.css" rel="stylesheet" />
</head>
<?php 
LOG_ARR('info', 'kk', $rows);
コード例 #5
0
ファイル: utils.php プロジェクト: teju/Android
function upload_image($html_img_name, $dest_img_file, $req_width = '', $req_height = '', $autocrop = 0)
{
    LOG_MSG("INFO", "upload_image():START html_img_name = [{$html_img_name}],\n\t\t\t\t\t\t\t\t\t\tdest_img_file = [{$dest_img_file}],\n\t\t\t\t\t\t\t\t\t\treq_width = [{$req_width}],\n\t\t\t\t\t\t\t\t\t\treq_height = [{$req_height}],\n\t\t\t\t\t\t\t\t\t\tautocrop = [{$autocrop}]");
    if (isset($_FILES[$html_img_name]) && validate_file($_FILES[$html_img_name])) {
        if ($_FILES[$html_img_name]['type'] != 'image/jpeg' && $_FILES[$html_img_name]['type'] != 'image/pjpeg' && $_FILES[$html_img_name]['type'] != 'image/png') {
            add_msg('ERROR', 'Sorry, you can only upload a jpg, jpeg or png image. Please try again.');
            LOG_MSG('ERROR', "upload_image(): Got file type=[" . $_FILES[$html_img_name]['type'] . "]");
            return false;
        }
        LOG_ARR('INFO', 'upload_image(): FILES', $_FILES);
        //Crop/Resize the image
        if ($req_width !== '' && $req_height !== '') {
            if (!image_resize(get_arg($_FILES[$html_img_name], 'tmp_name'), $req_width, $req_height, $autocrop)) {
                add_msg('ERROR', 'There was an error uploading the image. Please try later');
                LOG_MSG('ERROR', "upload_image(); Error resizing the file");
                return false;
            }
        }
        // Copy the file to the uploaded directory
        if (!copy(get_arg($_FILES[$html_img_name], 'tmp_name'), $dest_img_file)) {
            add_msg('ERROR', 'There was an error uploading the image. Please try later');
            LOG_ARR('INFO', 'upload_image(): FILES', $_FILES);
            LOG_MSG('ERROR', "upload_image(); Error copying file to the directory: [{$dest_img_file}]");
            return false;
        }
        LOG_MSG('INFO', "upload_image(): New File: is [{$dest_img_file}]");
        return true;
    }
    LOG_MSG("INFO", "upload_image():END");
    return false;
}
コード例 #6
0
ファイル: model.php プロジェクト: teju/Android
function do_login($auto_login = 0)
{
    global $GO;
    global $ROW;
    global $DOMAIN;
    // Are we already logged in?
    do_logout();
    // Auto login?
    if ($auto_login) {
        // Happens after registration
        session_regenerate_id(true);
        $_SESSION['logged_in'] = 1;
        $_SESSION['user_id'] = $auto_login;
        $_SESSION['name'] = $ROW["name"];
        // This is the row used for registration
        $_SESSION['email_id'] = $ROW["email_id"];
    } else {
        if (get_arg($_POST, "lemail_id") && get_arg($_POST, "lpassword")) {
            // Get parameters
            $_email_id = get_arg($_POST, "lemail_id");
            $_password = get_arg($_POST, "lpassword");
            // Validate ALL parameters
            if (!validate("Email ID", $_email_id, 5, 100, "EMAIL") || !validate("Password", $_password, 5, 100, "PASSWORD")) {
                add_msg('ERROR', "The email ID or password you entered is incorrect</br>");
                return;
            }
            ##################################################
            #                  DB LOGIN                      #
            ##################################################
            $ROW = db_do_login($_email_id, $_password, $DOMAIN);
            LOG_ARR("INFO", "ROW", $ROW);
            if ($ROW[0]['STATUS'] == "OK" && $ROW[0]["NROWS"] == 1) {
                session_regenerate_id(true);
                $_SESSION['email_id'] = $_email_id;
                $_SESSION['logged_in'] = 1;
                $_SESSION['user_id'] = $ROW[0]["user_id"];
                $_SESSION['name'] = $ROW[0]["name"];
                $_SESSION['is_admin'] = 0;
                $_SESSION['is_supervisor'] = 0;
                $_SESSION['is_superuser'] = 0;
                $_SESSION['is_viewer'] = 0;
                $_SESSION['travel_id'] = $ROW[0]["travel_id"];
                $_SESSION['domain'] = $ROW[0]["domain"];
                $_SESSION['travel_name'] = $ROW[0]["travel_name"];
                if ($ROW[0]["type"] == "ADMIN") {
                    $_SESSION['is_admin'] = 1;
                }
                if ($ROW[0]["type"] == "VIEWER") {
                    $_SESSION['is_viewer'] = 1;
                }
                if ($ROW[0]["type"] == "SUPERVISOR") {
                    $_SESSION['is_supervisor'] = 1;
                    $_SESSION['supervisor_id'] = $ROW[0]["supervisor_id"];
                }
                if ($ROW[0]["type"] == "SUPERUSER") {
                    $_SESSION['is_superuser'] = 1;
                }
                add_msg('SUCCESS', "Welcome " . $ROW[0]["name"] . "! </br>");
            }
        }
    }
    // logged_in will not be set if we failed anywhere above
    if (!isset($_SESSION['logged_in']) || !$_SESSION['logged_in']) {
        add_msg('ERROR', "The email ID or password you entered is incorrect</br>");
    }
    LOG_ARR("INFO", "SESSION", $_SESSION);
}