Пример #1
0
 public function index()
 {
     $message_info = '';
     if (isset($_POST) && !empty($_POST)) {
         $name = $this->input->post('name');
         $email = $this->input->post('email');
         $phone = $this->input->post('phone');
         $subject = $this->input->post('subject');
         $message = $this->input->post('message');
         if (IsNullOrEmptyString($name) || IsNullOrEmptyString($email) || IsNullOrEmptyString($subject)) {
             $message_info = add_message_info($message_info, 'Name, Email & Subject cannot be empty.');
         } else {
             $this->form_validation->set_rules('email', 'E-mail', 'required|valid_email');
             if ($this->form_validation->run() == true) {
                 $email_data = array('name' => $name, 'email' => $email, 'phone' => $phone, 'subject' => $subject, 'message' => $message);
                 $this->session->set_flashdata('mail_info', $email_data);
                 redirect('contact_us/send_mail_process', 'refresh');
             } else {
                 $message_info = add_message_info($message_info, 'E-mail not valid. Please use a valid email.');
             }
         }
         $this->session->set_flashdata('message', $message_info);
     }
     $this->data['message'] = $this->session->flashdata('message');
     $this->data['page_path_name'] = 'page/contact_us';
     $this->load->view('template/layout', $this->data);
 }
Пример #2
0
 function config()
 {
     $config = array('url' => 'http://127.0.0.1/ticket.tuagencia24.com/upload/api/tickets.json', 'key' => 'E9059472F7AC91544A453862B5D10C7B');
     if ($config['url'] === 'http://your.domain.tld/api/tickets.json') {
         echo "<p style=\"color:red;\"><b>Error: No URL</b><br>You have not configured this script with your URL!</p>";
         echo "Please edit this file " . __FILE__ . " and add your URL at line 18.</p>";
         die;
     }
     if (IsNullOrEmptyString($config['key']) || $config['key'] === 'PUTyourAPIkeyHERE') {
         echo "<p style=\"color:red;\"><b>Error: No API Key</b><br>You have not configured this script with an API Key!</p>";
         echo "<p>Please log into osticket as an admin and navigate to: Admin panel -> Manage -> Api Keys then add a new API Key.<br>";
         echo "Once you have your key edit this file " . __FILE__ . " and add the key at line 19.</p>";
         die;
     }
     return $config;
 }
Пример #3
0
function isDate($dateString)
{
    if (IsNullOrEmptyString($dateString)) {
        return FALSE;
    }
    if (!is_numeric(substr($dateString, 0, 1))) {
        return FALSE;
    }
    global $formats;
    foreach ($formats as $format) {
        $date = DateTime::createFromFormat($format, $dateString);
        if ($date == false) {
        } else {
            return TRUE;
        }
    }
    return FALSE;
}
function getExternalDocId($session)
{
    header("Cache-Control: no-cache, must-revalidate");
    //HTTP 1.1
    header("Pragma: no-cache");
    //HTTP 1.0
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    $viewingSessionId = $session;
    // Call PCCIS
    // DocumentID query parameter already includes the "u" prefix so no need to add here
    $url = PccConfig::getImagingService() . "/ViewingSession/{$viewingSessionId}";
    $acsApiKey = PccConfig::getApiKey();
    $options = array('http' => array('method' => 'GET', 'header' => "Accept: application/json\r\n" . "Acs-Api-Key: {$acsApiKey}\r\n"));
    $context = stream_context_create($options);
    $result = file_get_contents($url, false, $context);
    $response = json_decode($result);
    if (IsNullOrEmptyString($response->origin->documentMarkupId)) {
        throw new Exception('It appears that the demo is not configured to use PCCIS. Please check the config values in "full-viewer-sample/viewer-webtier/pcc.conifg" and try again.');
    }
    return $response->origin->documentMarkupId;
}
Пример #5
0
 function trans_config_set($set_id, $update_value = NULL, $field_name = 'amount_change')
 {
     if (!IsNullOrEmptyString($update_value)) {
         $the_data = array($field_name => $update_value);
         if ($this->m_custom->compare_before_update('transaction_config', $the_data, 'trans_conf_id', $set_id)) {
             if ($this->ion_auth->logged_in()) {
                 $login_id = $this->ion_auth->user()->row()->id;
                 $the_data = array($field_name => $update_value, 'last_modify_by' => $login_id);
             }
             $this->db->where('trans_conf_id', $set_id);
             $this->db->update('transaction_config', $the_data);
         }
     }
 }
Пример #6
0
function getNoticies($dbParams, $lang)
{
    $dbhandle = getDBConnection($dbParams);
    if (IsNullOrEmptyString($lang)) {
        $result = mysql_query("SELECT no.title, fdb.body_value as body FROM node no, field_data_body fdb where no.type='noticia' and fdb.entity_id=no.nid order by no.created desc");
    } else {
        $result = mysql_query("SELECT no.title, fdb.body_value as body FROM node no, field_data_body fdb where no.type='noticia' and fdb.entity_id=no.nid and no.language='" . $lang . "' order by no.created desc");
    }
    mysql_close($dbhandle);
    return $result;
}
Пример #7
0
<h1>Upload SSM</h1>
<br/>

<div id='register-form'>
    <?php 
echo form_open_multipart(uri_string());
?>
    
    Select File To Upload : <input type="file" name="userfile" multiple="multiple"  /><br/><br/>

    <button name="button_action" type="submit" value="upload_ssm" >Upload</button><br/><br/>

    <?php 
if (!IsNullOrEmptyString($me_ssm_file)) {
    ?>
        Current SSM File : <?php 
    echo $me_ssm_file;
    ?>
<br/><br/>

        <button name="button_action" type="submit" value="download_ssm" >Download</button><br/><br/>

    <?php 
}
echo form_close();
?>
</div>
Пример #8
0
 function displayTime($time)
 {
     if (IsNullOrEmptyString($time)) {
         return '';
     }
     $ci =& get_instance();
     $return_time = date_create($time);
     return $return_time->format($ci->config->item('keppo_format_time_display'));
 }
Пример #9
0
print "duplicateRecordCount     :" . $response->ExtCreateBroadcastResult->duplicateRecrodCountOnFile . "\n";
print "totalRecordCount         :" . $response->ExtCreateBroadcastResult->totalRecordCountOnFile . "\n";
*/
if (!IsNullOrEmptyString($response->ExtCreateBroadcastResult->fileUploadErrors->ExtFileUploadError)) {
    $isError = 1;
    /*
    foreach ($response->ExtCreateBroadcastResult->fileUploadErrors->ExtFileUploadError as $detail) {
     
            print "===================================== \n";
            print "Line Number      :" . $detail->lineNumber . "\n";
            print "errorCode        :" . $detail->errorCode . "\n";
            print "errorMessage     :" . $detail->errorMessage . "\n";
    }
    */
}
$x = 1;
while ($isError) {
    $response = $client->ExtCreateBroadcast(array("myRequest" => $request));
    if (!IsNullOrEmptyString($response->ExtCreateBroadcastResult->fileUploadErrors->ExtFileUploadError)) {
        $isError = 1;
        $x++;
    }
    if ($x == 3) {
        $isError = 0;
        $mail_for_error = mail('*****@*****.**', 'Order Placed - Call Not', "Order ID: " . $order_id . "\n Restaurant: " . $rest_row['name'] . "\n Call-in-order: " . $PhoneNumbers, $headers_for_customer);
    }
}
function IsNullOrEmptyString($question)
{
    return !isset($question) || trim($question) === '';
}
Пример #10
0
    {
        $this->status = $status;
        $this->message = $message;
    }
}
try {
    include "../dbopen.php";
} catch (Exception $e) {
    die("Error on db open " . $e->getMessage());
}
if (IsNullOrEmptyString($_POST['name'])) {
    $a = new RestResponse("error", "name is null");
    echo json_encode($a);
    exit(0);
}
if (IsNullOrEmptyString($_POST['nid'])) {
    $a = new RestResponse("error", "id is null");
    echo json_encode($a);
    exit(0);
}
$nid = $_POST['nid'];
$newCatName = $_POST['name'];
//Inserting Parent Category
$sql = "SELECT dpth, rgt, lft FROM nested_category WHERE CategoryId={$nid}";
$result = $conn->query($sql);
if ($result === null) {
    $a = new RestResponse("error", "Can not find the parent Category with id: " . $nid);
    echo json_encode($a);
    exit(0);
}
$row = $result->fetch_assoc();
Пример #11
0
            $image_path = $image_path_merchant_profile;
            $dashboard_url = "merchant_dashboard/{$slug}";
        }
        ?>
                <div id='follow-box'>
                    <div id="follow-box-photo">
                        <div id="follow-box-photo-box">
                            <a href='<?php 
        echo base_url();
        ?>
all/<?php 
        echo $dashboard_url;
        ?>
'>
                                <?php 
        if (IsNullOrEmptyString($profile_image)) {
            ?>
                                    <img src="<?php 
            echo base_url() . $empty_image;
            ?>
">
                                    <?php 
        } else {
            ?>
                                    <img src="<?php 
            echo base_url() . $image_path . $profile_image;
            ?>
">
                                    <?php 
        }
        ?>
Пример #12
0
 public function get_merchant_today_hotdeal_removed($merchant_id, $date = NULL)
 {
     if (!IsNullOrEmptyString($date)) {
         $search_date = $date;
     } else {
         $search_date = date(format_date_server());
     }
     $this->db->where('hide_flag', 1);
     $condition = "start_time like '%" . $search_date . "%'";
     $this->db->where('advertise_type', 'hot');
     $this->db->where($condition);
     $query = $this->db->get_where('advertise', array('merchant_id' => $merchant_id));
     return $query->num_rows();
 }
Пример #13
0
<?php

try {
    include "../dbopen.php";
} catch (Exception $e) {
    die("Error on db open " . $e->getMessage());
}
$nid = 1;
if (isset($_POST['nid']) && !IsNullOrEmptyString($_POST['nid'])) {
    $nid = $_POST['nid'];
}
if ($nid == 1 || IsNullOrEmptyString($nid)) {
    echo "must provide category id!";
    exit(0);
}
function IsNullOrEmptyString($question)
{
    return !isset($question) || trim($question) === '';
}
$sql = "SELECT dpth, rgt, lft FROM nested_category WHERE CategoryId={$nid}";
$result = $conn->query($sql);
$row = $result->fetch_assoc();
if ($row === null) {
    exit;
}
$parentDpth = array_shift($row);
$parentRgt = array_shift($row);
$parentLft = array_shift($row);
//echo "parent dpth and rgt is: ".$parentDpth." and Rgt".$parentRgt."<br/>";
//actual deletion
$sql = "DELETE FROM nested_category WHERE lft >= {$parentLft} and rgt <= {$parentRgt}";
Пример #14
0
 function banner_change($edit_id = NULL, $view_status = NULL)
 {
     if (!$this->m_admin->check_is_any_admin(69)) {
         redirect('/', 'refresh');
     }
     $message_info = '';
     $login_id = $this->login_id;
     $login_type = $this->login_type;
     $is_edit = 0;
     $main_table = 'banner';
     $main_table_id_column = 'banner_id';
     if ($edit_id != NULL) {
         $is_edit = 1;
     }
     if (isset($_POST) && !empty($_POST)) {
         $can_redirect_to = 0;
         //$edit_id = $this->input->post('edit_id');
         $merchant_id = $this->input->post('merchant_id');
         $banner_position_id = $this->input->post('banner_position_id');
         $banner_start_time = validateDate($this->input->post('banner_start_time'));
         $banner_end_time = validateDate($this->input->post('banner_end_time'));
         $banner_url = $this->input->post('banner_url');
         $banner_position = $this->m_custom->display_static_option($banner_position_id);
         $view_status = $this->input->post('view_status');
         $upload_rule = array('upload_path' => $this->album_banner, 'allowed_types' => $this->config->item('allowed_types_image'), 'max_size' => $this->config->item('max_size'), 'max_width' => $this->config->item('max_width'), 'max_height' => $this->config->item('max_height'));
         $this->load->library('upload', $upload_rule);
         $upload_file = "image-file-name";
         if ($edit_id == 0) {
             $is_edit = 0;
         } else {
             $is_edit = 1;
         }
         if ($this->input->post('button_action') == "save") {
             // validate form input
             $this->form_validation->set_rules('banner_position_id', $this->lang->line('banner_position'), 'callback_check_banner_position_id');
             $this->form_validation->set_rules('merchant_id', $this->lang->line('banner_merchant'));
             $this->form_validation->set_rules('banner_start_time', $this->lang->line('banner_start_time'), 'trim|required');
             $this->form_validation->set_rules('banner_end_time', $this->lang->line('banner_end_time'), 'trim|required');
             $this->form_validation->set_rules('banner_url', $this->lang->line('banner_url'), 'trim|required');
             if ($this->form_validation->run() === TRUE) {
                 if ($is_edit == 0) {
                     if (!empty($_FILES[$upload_file]['name'])) {
                         if (!$this->upload->do_upload($upload_file)) {
                             $message_info = add_message_info($message_info, $this->upload->display_errors());
                         } else {
                             $image_data = array('upload_data' => $this->upload->data());
                         }
                     }
                     $banner_image = empty($image_data) ? '' : $image_data['upload_data']['file_name'];
                     $new_id = $this->m_admin->banner_insert($merchant_id, NULL, $banner_start_time, $banner_end_time, $banner_image, $banner_url, $banner_position_id);
                     if ($new_id) {
                         $message_info = add_message_info($message_info, 'Success create a banner on this banner position ' . $banner_position);
                         $edit_id = $new_id;
                         $can_redirect_to = 2;
                     } else {
                         $message_info = add_message_info($message_info, 'Fail to create banner on this banner position ' . $banner_position . ' because it still have another banner occupy, please select an empty banner position');
                         $can_redirect_to = 1;
                     }
                 } else {
                     $result_update = $this->m_custom->get_one_table_record($main_table, $main_table_id_column, $edit_id, 1);
                     $previous_image_name = $result_update['banner_image'];
                     if (!empty($_FILES[$upload_file]['name'])) {
                         if (!$this->upload->do_upload($upload_file)) {
                             $message_info = add_message_info($message_info, $this->upload->display_errors());
                         } else {
                             $image_data = array('upload_data' => $this->upload->data());
                             if (!IsNullOrEmptyString($previous_image_name)) {
                                 delete_file($this->album_banner . $previous_image_name);
                             }
                         }
                     }
                     $banner_image = empty($image_data) ? $previous_image_name : $image_data['upload_data']['file_name'];
                     if ($this->m_admin->banner_update($merchant_id, NULL, $banner_start_time, $banner_end_time, $banner_image, $banner_url, $banner_position_id, $edit_id, $result_update['hide_flag'])) {
                         $message_info = add_message_info($message_info, 'Success update the banner on banner position ' . $banner_position);
                         $can_redirect_to = 2;
                     } else {
                         $message_info = add_message_info($message_info, 'Fail to update banner on this banner position ' . $banner_position . ' because it still have another banner occupy, please select an empty banner position');
                         $can_redirect_to = 3;
                     }
                 }
                 $this->m_custom->remove_image_temp();
             }
         }
         if ($this->input->post('button_action') == "back") {
             $can_redirect_to = 2;
         }
         if ($this->input->post('button_action') == "frozen") {
             $message_info = add_message_info($message_info, $banner_position . ' success hide.');
             $this->m_custom->update_hide_flag(1, $main_table, $edit_id, $login_id);
         }
         if ($this->input->post('button_action') == "recover") {
             $status = $this->m_admin->banner_recover($edit_id);
             if ($status) {
                 $message_info = add_message_info($message_info, $banner_position . ' success recover.');
             } else {
                 $message_info = add_message_info($message_info, $banner_position . ' fail to recover. Because already have other active banner in the same banner position');
             }
         }
         direct_go:
         if ($message_info != NULL) {
             $this->session->set_flashdata('message', $message_info);
         }
         if ($can_redirect_to == 1) {
             redirect(uri_string(), 'refresh');
         } elseif ($can_redirect_to == 2) {
             redirect('admin/banner_management/' . $view_status, 'refresh');
         } elseif ($can_redirect_to == 3) {
             redirect('admin/banner_change/' . $edit_id . '/' . $view_status, 'refresh');
         }
     }
     // set the flash data error message if there is one
     $this->data['message'] = validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message'));
     $result = $this->m_custom->get_one_table_record($main_table, $main_table_id_column, $edit_id, 1);
     $this->data['result'] = $result;
     $this->data['edit_id'] = array('edit_id' => empty($result) ? '0' : $result[$main_table_id_column], 'is_edit' => $is_edit, 'view_status' => $view_status);
     $this->data['is_edit'] = $is_edit;
     $this->data['image_item'] = empty($result) ? $this->config->item('empty_image') : $this->album_banner . $result['banner_image'];
     $this->data['banner_position_list'] = $this->m_custom->get_static_option_array('banner_position', '0', 'Please Select', 0, 'option_value');
     $this->data['banner_position_id'] = array('name' => 'banner_position_id', 'id' => 'banner_position_id');
     $this->data['banner_position_selected'] = $result['banner_position'] == NULL ? $this->form_validation->set_value('banner_position_id', '0') : $result['banner_position'];
     $this->data['merchant_list'] = $this->m_merchant->getMerchantList('0', 'Please Select');
     $this->data['merchant_id'] = array('name' => 'merchant_id', 'id' => 'merchant_id', 'class' => 'chosen-select');
     $this->data['merchant_selected'] = $result['merchant_id'] == NULL ? $this->form_validation->set_value('merchant_id', '0') : $result['merchant_id'];
     $this->data['banner_start_time'] = array('name' => 'banner_start_time', 'id' => 'banner_start_time', 'type' => 'text', 'readonly' => 'true', 'value' => empty($result) ? $this->form_validation->set_value('banner_start_time') : $this->form_validation->set_value('banner_start_time', displayDate($result['start_time'])));
     $this->data['banner_end_time'] = array('name' => 'banner_end_time', 'id' => 'banner_end_time', 'type' => 'text', 'readonly' => 'true', 'value' => empty($result) ? $this->form_validation->set_value('banner_end_time') : $this->form_validation->set_value('banner_end_time', displayDate($result['end_time'])));
     $this->data['banner_url'] = array('name' => 'banner_url', 'id' => 'banner_url', 'value' => empty($result) ? $this->form_validation->set_value('banner_url') : $this->form_validation->set_value('banner_url', $result['banner_url']));
     $this->data['temp_folder'] = $this->temp_folder;
     $this->data['page_path_name'] = 'admin/banner_change';
     $this->load->view('template/index', $this->data);
 }
Пример #15
0
 public function home_search_promotion($search_value = NULL, $state_id = 0)
 {
     if (!IsNullOrEmptyString($search_value)) {
         $merchant_list_id = $this->m_merchant->searchMerchant($search_value, 1);
         $search_word = $this->db->escape('%' . $search_value . '%');
         if (!empty($merchant_list_id)) {
             $merchant_string = implode(',', $merchant_list_id);
             $this->db->where("((`title` LIKE {$search_word} OR `description` LIKE {$search_word}) OR `merchant_id` IN ({$merchant_string}))");
         } else {
             $this->db->where("(`title` LIKE {$search_word} OR `description` LIKE {$search_word})");
         }
     }
     $this->db->where('end_time >=', get_part_of_date('all'));
     $this->db->where('start_time is not null AND end_time is not null');
     $this->db->order_by("advertise_id", "desc");
     $query = $this->db->get_where('advertise', array('advertise_type' => 'pro', 'hide_flag' => 0));
     $result = $query->result_array();
     $return = array();
     foreach ($result as $row) {
         $advertise_id = $row['advertise_id'];
         if ($state_id != 0) {
             $branch_list = $this->m_custom->many_get_childlist('candie_branch', $advertise_id, 1);
             foreach ($branch_list as $branch) {
                 $branch_query = $this->db->get_where('merchant_branch', array('branch_id' => $branch['many_child_id']))->row_array();
                 if ($state_id == $branch_query['state_id']) {
                     $return[] = $row;
                 }
             }
             $return = array_unique($return, SORT_REGULAR);
         } else {
             $return[] = $row;
         }
     }
     return $return;
 }
/**
* Update row into tables
* 
* @param    table variables
* @param    $id      passed by reference. returns primar key of row 
* @return   $status  true if the operation is successful
*/
function UpdateInto_TodoList($dbhandle, $id, $userId, $priority, $task_status, $task, $createdDate, $estimatedDate, $completedDate, $remainderDate)
{
    $logger = LoggerSingleton::GetInstance();
    $logger->LogInfo("UpdateInto_TodoList : Enter");
    global $TodoListTable_Name;
    global $TodoListTable_Id;
    global $TodoListTable_UserId;
    global $TodoListTable_Priority;
    global $TodoListTable_Status;
    global $TodoListTable_CreatedDate;
    global $TodoListTable_EstimatedDate;
    global $TodoListTable_CompletedDate;
    global $TodoListTable_Remainder;
    global $TodoListTable_TaskDescription;
    $status = true;
    // validate input argumets
    if (IsNullOrEmptyString($userId) || IsNullOrEmptyString($priority) || IsNullOrEmptyString($task_status) || IsNullOrEmptyString($createdDate) || IsNullOrEmptyString($task) || IsNullOrEmptyString($id)) {
        $logger->LogError("UpdateInto_TodoList : Null or empty input parameters");
        $status = false;
    }
    // insert a TodoList row
    if (true == $status) {
        $query = "UPDATE {$TodoListTable_Name} \n        SET     {$TodoListTable_UserId} = {$userId},\n                {$TodoListTable_Priority} = {$priority},\n                {$TodoListTable_Status} = {$task_status},\n                {$TodoListTable_CreatedDate} = '{$createdDate}',\n                {$TodoListTable_EstimatedDate} = '{$estimatedDate}',\n                {$TodoListTable_CompletedDate} = '{$completedDate}',\n                {$TodoListTable_Remainder} = '{$remainderDate}',\n                {$TodoListTable_TaskDescription} = '{$task}'\n        WHERE   {$TodoListTable_Id} = {$id}";
        $status = $dbhandle->query($query);
        if (false == $status) {
            $logger->LogError("UpdateInto_TodoList : Unable to insert record - {$dbhandle->error}");
        }
    }
    $logger->LogInfo("UpdateInto_TodoList : {$status}");
    return $status;
}
Пример #17
0
/**
* Update row into tables. This is not a selective upgrade where
* we upgrade only few fields. the whole row is written back. 
* 
* @param    table variables
* @param    $id      provide id of the record to update
* @return   $status  true if the operation is successful
*/
function UpdateInto_Version($dbhandle, $id, $MajorVersion, $MinorVersion, $dbState)
{
    $logger = LoggerSingleton::GetInstance();
    $logger->LogInfo("UpdateInto_Version : Enter");
    global $VersionTable_Id;
    global $VersionTable_Name;
    global $VersionTable_MajorVersion;
    global $VersionTable_MinorVersion;
    global $VersionTable_DbState;
    $status = true;
    // validate input argumets
    if (IsNullOrEmptyString($MajorVersion) || IsNullOrEmptyString($MinorVersion) || IsNullOrEmptyString($dbState) || IsNullOrEmptyString($id)) {
        $logger->LogError("UpdateInto_Version : Null or empty input parameters");
        $status = false;
    }
    // update a version row
    $query = null;
    if (true == $status) {
        $query = "UPDATE {$VersionTable_Name} SET \n            {$VersionTable_MajorVersion} = {$MajorVersion},\n            {$VersionTable_MinorVersion} = {$MinorVersion},\n            {$VersionTable_DbState} = {$dbState}\n            WHERE {$VersionTable_Id} = {$id}";
        // execute update query
        $status = $dbhandle->query($query);
    }
    if (false == $status) {
        $logger->LogError("UpdateInto_Version : Unable to insert record - {$dbhandle->error}");
    }
    $logger->LogInfo("UpdateInto_Version : {$status}");
    return $status;
}
Пример #18
0
<?php

session_start();
function returnHome($message)
{
    $_SESSION['message'] = $message;
    header('location: ./');
}
function IsNullOrEmptyString($question)
{
    return !isset($question) || trim($question) === '';
}
if (isset($_POST['g-recaptcha-response'])) {
    require_once './recaptcha/autoload.php';
    $recaptcha = new \ReCaptcha\ReCaptcha('6Lcj4wkTAAAAAM1DLFAzfyBxE7vT_8PVPnZ-88dQ');
    $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
    if ($resp->isSuccess()) {
        $name = $_POST['name'];
        $email = $_POST['email'];
        $message = $_POST['message'];
        if (!IsNullOrEmptyString($name) and !IsNullOrEmptyString($email) and !IsNullOrEmptyString($message)) {
            mail("*****@*****.**", "Web contact", "Name: " . $_POST['name'] . "\r\nE-mail: " . $_POST['email'] . "\r\nMessage: " . $_POST['message']);
            returnHome("Message sent successfully.");
        } else {
            returnHome("Error sending message. All fields are mandatory.");
        }
    } else {
        returnHome("Error verifying captcha. Try again later.");
    }
}
Пример #19
0
 public function home_search()
 {
     if (isset($_POST) && !empty($_POST)) {
         if ($this->input->post('button_action') == "search") {
             $search_value = $this->input->post('search_word');
             $state_id = $this->input->post('me_state_id');
             if (IsNullOrEmptyString($search_value)) {
                 $search_value = 0;
             }
             $this->data['home_search_merchant'] = $this->m_custom->home_search_merchant($search_value, $state_id);
             $this->data['home_search_hotdeal'] = $this->m_custom->home_search_hotdeal($search_value, $state_id);
             $this->data['home_search_promotion'] = $this->m_custom->home_search_promotion($search_value, $state_id);
             $this->data['state_name'] = "";
             if ($state_id != 0) {
                 $this->data['state_name'] = " : " . $this->m_custom->display_static_option($state_id);
             }
             $this->data['page_path_name'] = 'all/search_result';
             $this->load->view('template/index_background_blank', $this->data);
         }
     } else {
         redirect('/', 'refresh');
     }
 }
Пример #20
0
                    <?php 
if (!IsNullOrEmptyString($facebook_url)) {
    ?>
                    <tr>
                        <td>Facebook URL</td>
                        <td>:</td>
                        <td><div class="text-ellipsis"><?php 
    echo "<a target='_blank' href='" . display_url($facebook_url) . "' >" . $facebook_url . "</a>";
    ?>
</div></td>
                    </tr>
                    <?php 
}
?>
                    <?php 
if (!IsNullOrEmptyString($website_url)) {
    ?>
                    <tr>
                        <td>Website</td>
                        <td>:</td>
                        <td><div class="text-ellipsis"><?php 
    echo "<a target='_blank' href='" . display_url($website_url) . "' >" . $website_url . "</a>";
    ?>
</div></td>
                    </tr>  
                    <?php 
}
?>
                </table>
            </div>
        </div>
Пример #21
0
        if (is_null($row)) {
            return;
        }
        $this->categoryName = array_shift($row);
        $myDpth = array_shift($row);
        $myRgt = array_shift($row);
        $myLft = array_shift($row);
        $sql = "SELECT categoryName, categoryId FROM nested_category WHERE lft>{$myLft} and rgt<{$myRgt} and dpth={$myDpth}+1";
        $result = $conn->query($sql);
        if (is_null($result)) {
            return;
        }
        while ($row = mysqli_fetch_array($result)) {
            $b = new SimpleClass($row["categoryName"], $row["categoryId"]);
            $b->find_children($row["categoryId"], $conn);
            array_push($this->child_categories, $b);
        }
    }
}
$nid = 1;
if (isset($_POST['nid']) && !IsNullOrEmptyString($_POST['nid'])) {
    $nid = $_POST['nid'];
}
$a = new SimpleClass("root", "1");
$a->find_children($nid, $conn);
echo json_encode($a);
$conn->close();
function IsNullOrEmptyString($question)
{
    return !isset($question) || trim($question) === '';
}
Пример #22
0
 * params - [members], date_start, date_end, time_start, time_end, duration
 * url /freetimes   
 */
$app->get('/freetimes', 'authenticate', function () use($app) {
    verifyRequiredParams(array('date_start', 'date_end', 'time_start', 'time_end', 'duration'));
    global $user_id;
    $response = array();
    $db = new DbHandler();
    $members = array();
    $date_start = $app->request->get('date_start');
    $date_end = $app->request->get('date_end');
    $time_start = $app->request->get('time_start');
    $time_end = $app->request->get('time_end');
    $duration = $app->request->get('duration');
    // optional members param
    if (!IsNullOrEmptyString($app->request->get('members'))) {
        $members = explode(',', $app->request->get('members'));
    }
    if (($key = array_search($user_id, $members)) !== false) {
        unset($members[$key]);
    }
    $response_code = 200;
    // user doesn't belong to event, not privileged to get comments
    if (!$db->hasMultiUserPriv($user_id, $members)) {
        $response["error"] = true;
        $response["message"] = "Failed to get free times. Insufficient Privileges";
        $response_code = 403;
    } else {
        array_push($members, $user_id);
        // get events for users in time range
        $events = $db->getEventsInTimeRange($members, $date_start, $date_end, $time_start, $time_end);
if (!IsNullOrEmptyString($BookingAddress)) {
    $FormattedAddress = $BookingAddress;
}
if (!IsNullOrEmptyString($BookingStreet)) {
    $FormattedAddress = $FormattedAddress . ', ' . $BookingStreet;
}
if (!IsNullOrEmptyString($BookingTown)) {
    $FormattedAddress = $FormattedAddress . ', ' . $BookingTown;
}
if (!IsNullOrEmptyString($BookingCounty)) {
    $FormattedAddress = $FormattedAddress . ', ' . $BookingCounty;
}
if (!IsNullOrEmptyString($BookingPostcode)) {
    $FormattedAddress = $FormattedAddress . ', ' . $BookingPostcode;
}
if (!IsNullOrEmptyString($BookingCountry)) {
    $FormattedAddress = $FormattedAddress . ', ' . $BookingCountry;
}
$html = $html . 'Address : ' . $FormattedAddress . '<br>';
$html = $html . 'Contact : ' . $BookingContactName . '<br>';
$html = $html . 'Tel : ' . $BookingTel . '<br>';
$html = $html . 'Mobile : ' . $BookingMobile . '<br>';
$html = $html . 'Bank Details : <br>';
$html = $html . '</td>';
$html = $html . '</tr>';
$html = $html . '</table><br><br>';
$html = $html . '<h3>Project</h3>';
$html = $html . '<table width="250">';
$html = $html . '<tr>';
$html = $html . '<td>';
$html = $html . 'Working Title : ' . $WorkingTitle . '<br>';
Пример #24
0
                header('Location: ' . $url);
            } else {
                echo 'Thank you for accepting';
            }
        } else {
            echo 'There was a problem with the link please contact the sender of the invite';
        }
    } else {
        if ($response == 'decline') {
            //check to see if they have already responded to the email
            $check_q = 'SELECT email_responded FROM fp_events_leads_1_c WHERE fp_events_leads_1fp_events_ida="' . $event->id . '" AND fp_events_leads_1leads_idb="' . $delegate_id . '"';
            $check = $db->getOne($check_q);
            //update contact to accepted
            $query = 'UPDATE fp_events_leads_1_c SET accept_status="Declined", email_responded="1" WHERE fp_events_leads_1fp_events_ida="' . $event->id . '" AND fp_events_leads_1leads_idb="' . $delegate_id . '" AND email_responded="0"';
            if ($db->query($query) && $check != '1') {
                if (!IsNullOrEmptyString($event->decline_redirect)) {
                    $url = $event->decline_redirect;
                    header('Location: ' . $url);
                } else {
                    echo 'Thank you for declining';
                }
            } else {
                echo 'There was a problem with the link please contact the sender of the invite';
            }
        }
    }
}
// Function for basic field validation (present and neither empty nor only white space nor just 'http://')
function IsNullOrEmptyString($question)
{
    return !isset($question) || trim($question) === '' || $question == 'http://';
Пример #25
0
    ?>
<div id="message"><?php 
    echo $message;
    ?>
</div><?php 
}
?>

<div id="profile">
    <h1>Profile</h1>
    <div id='profile-content'>
        
        <div id="profile-photo">
            <div id="profile-photo-box">
                <?php 
if (IsNullOrEmptyString($image)) {
    ?>
                    <img src="<?php 
    echo base_url() . $this->config->item('empty_image');
    ?>
" id="userimage">
                    <?php 
} else {
    ?>
                    <img src="<?php 
    echo base_url() . $image_path . $image;
    ?>
" id="userimage">
                    <?php 
}
?>
Пример #26
0
 function upload_hotdeal()
 {
     if (!check_correct_login_type($this->main_group_id) && !check_correct_login_type($this->group_id_supervisor)) {
         redirect('/', 'refresh');
     }
     $message_info = '';
     $merchant_id = $this->ion_auth->user()->row()->id;
     $do_by_type = $this->main_group_id;
     $do_by_id = $merchant_id;
     //merchant or supervisor also can use this assign because this is depend on login
     //if is login by supervisor then need change some setting
     if (check_correct_login_type($this->group_id_supervisor)) {
         $merchant_id = $this->ion_auth->user()->row()->su_merchant_id;
         $do_by_type = $this->group_id_supervisor;
     }
     $merchant_data = $this->m_custom->get_one_table_record('users', 'id', $merchant_id);
     $hotdeal_per_day = $this->m_custom->web_setting_get('merchant_max_hotdeal_per_day');
     $search_date = NULL;
     //$search_date = '31-08-2015';
     //$search_date = toggle_date_format($search_date);
     //If more then 5 active hotdeal for today uploaded already, auto increase 1 more upload box
     $box_number_update = $this->box_number;
     $hotdeal_today_count = $this->m_merchant->get_merchant_today_hotdeal($merchant_id, 1, $search_date);
     if ($hotdeal_today_count >= $box_number_update) {
         $box_number_update = $hotdeal_today_count + 1;
     }
     if (isset($_POST) && !empty($_POST)) {
         if ($this->input->post('button_action') == "upload_hotdeal") {
             $upload_rule = array('upload_path' => $this->album_merchant, 'allowed_types' => $this->config->item('allowed_types_image'), 'max_size' => $this->config->item('max_size'), 'max_width' => $this->config->item('max_width'), 'max_height' => $this->config->item('max_height'));
             $this->load->library('upload', $upload_rule);
             //To loop hotdeal box dynamic
             for ($i = 0; $i < $box_number_update; $i++) {
                 $hotdeal_today_count_update = $this->m_merchant->get_merchant_today_hotdeal($merchant_id, 1, $search_date, 1);
                 $hotdeal_id = $this->input->post('hotdeal_id-' . $i);
                 $hotdeal_file = "hotdeal-file-" . $i;
                 //$sub_category_id = $this->input->post('category-' . $i);
                 $sub_category_id = $merchant_data->me_sub_category_id;
                 //merchant cannot change sub category anymore
                 $title = $this->input->post('title-' . $i);
                 $description = $this->input->post('desc-' . $i);
                 $hotdeal_hour = check_is_positive_numeric($this->input->post('hour-' . $i));
                 $hotdeal_hour = $hotdeal_hour * 24;
                 $original_price = check_is_positive_decimal($this->input->post('original_price-' . $i));
                 $hotdeal_price_before = check_is_positive_decimal($this->input->post('price_before-' . $i));
                 $hotdeal_price_after = check_is_positive_decimal($this->input->post('price_after-' . $i));
                 $price_before_show = $this->input->post('price_before_show-' . $i) == null ? 0 : 1;
                 $price_after_show = $this->input->post('price_after_show-' . $i) == null ? 0 : 1;
                 if ($hotdeal_hour > 1440) {
                     $message_info = add_message_info($message_info, 'Food & Beverage please put in a valid hour between 0 to 60(Max 2 months only).', $title);
                     $hotdeal_hour = 0;
                 }
                 //To check is this an old food & beverage or new food & beverage, if new food & beverage is 0
                 if ($hotdeal_id == 0) {
                     if ($hotdeal_today_count_update >= $hotdeal_per_day) {
                         $message_info = add_message_info($message_info, 'Already reach max ' . $hotdeal_per_day . ' food & beverage per day.');
                         //redirect('merchant/upload_hotdeal', 'refresh');
                         goto direct_go;
                     }
                     //For Multiple Image Upload
                     $have_hidden_image = 0;
                     $post_hidden_image = $this->input->post('hideimage-' . $i);
                     if (!empty($post_hidden_image)) {
                         $have_hidden_image = 1;
                         goto HiddenImageSkip;
                     }
                     //To check new food & beverage is it got image upload or not
                     if (!empty($_FILES[$hotdeal_file]['name'])) {
                         if (!$this->upload->do_upload($hotdeal_file)) {
                             //$error = array('error' => $this->upload->display_errors());
                             $message_info = add_message_info($message_info, $this->upload->display_errors(), $title);
                         } else {
                             HiddenImageSkip:
                             $image_file_name = '';
                             if ($have_hidden_image == 0) {
                                 $image_data = array('upload_data' => $this->upload->data());
                                 $image_file_name = $image_data['upload_data']['file_name'];
                             } else {
                                 $from_path = $this->temp_folder_cut . $post_hidden_image;
                                 $to_path = $this->album_merchant . $post_hidden_image;
                                 if (file_exists($from_path)) {
                                     rename($from_path, $to_path);
                                 }
                                 $image_file_name = $post_hidden_image;
                             }
                             resize_image($this->album_merchant . $image_file_name);
                             $data = array('advertise_type' => 'hot', 'merchant_id' => $merchant_id, 'sub_category_id' => $sub_category_id, 'title' => $title, 'description' => $description, 'image' => $image_file_name, 'post_hour' => $hotdeal_hour, 'original_price' => $original_price, 'price_before' => $hotdeal_price_before, 'price_after' => $hotdeal_price_after, 'price_before_show' => $price_before_show, 'price_after_show' => $price_after_show, 'start_time' => get_part_of_date('all'), 'end_time' => $hotdeal_hour == 0 ? add_hour_to_date(99999) : add_hour_to_date($hotdeal_hour), 'month_id' => get_part_of_date('month'), 'year' => get_part_of_date('year'));
                             $new_id = $this->m_custom->get_id_after_insert('advertise', $data);
                             if ($new_id) {
                                 $this->m_custom->insert_row_log('advertise', $new_id, $do_by_id, $do_by_type);
                                 if ($do_by_type == $this->group_id_supervisor) {
                                     $this->m_custom->notification_process('advertise', $new_id);
                                 }
                                 $message_info = add_message_info($message_info, 'Food & Beverage success create.', $title);
                             } else {
                                 $message_info = add_message_info($message_info, $this->ion_auth->errors(), $title);
                             }
                         }
                     }
                 } else {
                     $image_data = NULL;
                     $previous_image_name = $this->m_custom->get_one_table_record('advertise', 'advertise_id', $hotdeal_id)->image;
                     //To check old deal got change image or not, if got then upload the new one and delete previous image
                     if (!empty($_FILES[$hotdeal_file]['name'])) {
                         if (!$this->upload->do_upload($hotdeal_file)) {
                             //$error = array('error' => $this->upload->display_errors());
                             $message_info = add_message_info($message_info, $this->upload->display_errors(), $title);
                         } else {
                             $image_data = array('upload_data' => $this->upload->data());
                             if (!IsNullOrEmptyString($previous_image_name)) {
                                 delete_file($this->album_merchant . $previous_image_name);
                             }
                         }
                     }
                     $previous_start_time = $this->m_custom->get_one_table_record('advertise', 'advertise_id', $hotdeal_id)->start_time;
                     //To update previous food & beverage
                     $data = array('sub_category_id' => $sub_category_id, 'title' => $title, 'description' => $description, 'image' => empty($image_data) ? $previous_image_name : $image_data['upload_data']['file_name'], 'post_hour' => $hotdeal_hour, 'original_price' => $original_price, 'price_before' => $hotdeal_price_before, 'price_after' => $hotdeal_price_after, 'price_before_show' => $price_before_show, 'price_after_show' => $price_after_show, 'end_time' => $hotdeal_hour == 0 ? add_hour_to_date(99999, $previous_start_time) : add_hour_to_date($hotdeal_hour, $previous_start_time));
                     $hotdeal_hide = $this->input->post('hotdeal_hide-' . $i);
                     if ($hotdeal_hide == null) {
                         if ($this->m_custom->simple_update('advertise', $data, 'advertise_id', $hotdeal_id)) {
                             $this->m_custom->update_row_log('advertise', $hotdeal_id, $do_by_id, $do_by_type);
                             $message_info = add_message_info($message_info, 'Food & Beverage success update.', $title);
                         } else {
                             $message_info = add_message_info($message_info, $this->ion_auth->errors(), $title);
                         }
                     } else {
                         //If this food & beverage is being remove by tick the remove check box
                         $data = array('hide_flag' => 1);
                         if ($this->m_custom->simple_update('advertise', $data, 'advertise_id', $hotdeal_id)) {
                             $this->m_custom->remove_row_log('advertise', $hotdeal_id, $do_by_id, $do_by_type);
                             $this->m_merchant->hotdeal_hide($hotdeal_id);
                             $message_info = add_message_info($message_info, 'Food & Beverage success remove.', $title);
                         } else {
                             $message_info = add_message_info($message_info, $this->ion_auth->errors(), $title);
                         }
                     }
                 }
             }
             direct_go:
             $this->session->set_flashdata('message', $message_info);
             $this->m_custom->remove_image_temp();
             //redirect('merchant/upload_hotdeal', 'refresh');
             redirect('all/merchant_dashboard/' . $this->session->userdata('company_slug') . '//' . $merchant_id, 'refresh');
         }
     }
     //To get today food & beverage result row
     $hotdeal_today_result = $this->m_merchant->get_merchant_today_hotdeal($merchant_id, 0, $search_date);
     $this->data['hotdeal_today_count'] = $this->m_merchant->get_merchant_today_hotdeal($merchant_id, 1, $search_date, 1);
     $this->data['hotdeal_today_count_removed'] = $this->m_merchant->get_merchant_today_hotdeal_removed($merchant_id, $search_date);
     //$this->data['hour_list'] = generate_number_option(1, 24);
     $this->data['sub_category_list'] = $this->m_custom->getSubCategoryList(NULL, NULL, $merchant_data->me_category_id);
     //To dynamic create the food & beverage box
     for ($i = 0; $i < $box_number_update; $i++) {
         $hotdeal_title = 'hotdeal_title' . $i;
         $this->data[$hotdeal_title] = array('name' => 'title-' . $i, 'id' => 'title-' . $i, 'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['title'], 'maxlength' => '20');
         $hotdeal_image = 'hotdeal_image' . $i;
         $this->data[$hotdeal_image] = empty($hotdeal_today_result[$i]) ? $this->config->item('empty_image') : $this->album_merchant . $hotdeal_today_result[$i]['image'];
         $hotdeal_category = 'hotdeal_category' . $i;
         $this->data[$hotdeal_category] = array('name' => 'category-' . $i, 'id' => 'category-' . $i);
         $hotdeal_category_selected = 'hotdeal_category_selected' . $i;
         $this->data[$hotdeal_category_selected] = empty($hotdeal_today_result[$i]) ? $merchant_data->me_sub_category_id : $hotdeal_today_result[$i]['sub_category_id'];
         //$default_desc = PHP_EOL . PHP_EOL . PHP_EOL . '<b>Original Price RM</b>';
         $hotdeal_desc = 'hotdeal_desc' . $i;
         $this->data[$hotdeal_desc] = 'desc-' . $i;
         $hotdeal_desc_value = 'hotdeal_desc_value' . $i;
         $this->data[$hotdeal_desc_value] = empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['description'];
         //            $hotdeal_desc = 'hotdeal_desc' . $i;
         //            $this->data[$hotdeal_desc] = array(
         //                'name' => 'desc-' . $i,
         //                'id' => 'desc-' . $i,
         //                'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['description'],
         //            );
         $hotdeal_hour = 'hotdeal_hour' . $i;
         $this->data[$hotdeal_hour] = array('name' => 'hour-' . $i, 'id' => 'hour-' . $i, 'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['post_hour'] / 24, 'onkeypress' => 'return isNumber(event)');
         //$hotdeal_hour_selected = 'hotdeal_hour_selected' . $i;
         //$this->data[$hotdeal_hour_selected] = empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['post_hour'];
         $hotdeal_original_price = 'original_price' . $i;
         $this->data[$hotdeal_original_price] = array('name' => 'original_price-' . $i, 'id' => 'original_price-' . $i, 'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['original_price'], 'onkeypress' => 'return isNumber(event)');
         $hotdeal_price_before = 'hotdeal_price_before' . $i;
         $this->data[$hotdeal_price_before] = array('name' => 'price_before-' . $i, 'id' => 'price_before-' . $i, 'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['price_before'], 'onkeypress' => 'return isNumber(event)');
         $hotdeal_price_after = 'hotdeal_price_after' . $i;
         $this->data[$hotdeal_price_after] = array('name' => 'price_after-' . $i, 'id' => 'price_after-' . $i, 'value' => empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['price_after'], 'onkeypress' => 'return isNumber(event)');
         $price_before_show = 'price_before_show' . $i;
         $price_before_show_value = empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['price_before_show'];
         $this->data[$price_before_show] = array('name' => 'price_before_show-' . $i, 'id' => 'price_before_show-' . $i, 'checked' => $price_before_show_value == "1" ? TRUE : FALSE, 'value' => empty($hotdeal_today_result[$i]) ? '99' : $hotdeal_today_result[$i]['advertise_id']);
         $price_after_show = 'price_after_show' . $i;
         $price_after_show_value = empty($hotdeal_today_result[$i]) ? '' : $hotdeal_today_result[$i]['price_after_show'];
         $this->data[$price_after_show] = array('name' => 'price_after_show-' . $i, 'id' => 'price_after_show-' . $i, 'checked' => $price_after_show_value == "1" ? TRUE : FALSE, 'value' => empty($hotdeal_today_result[$i]) ? '99' : $hotdeal_today_result[$i]['advertise_id']);
         $advertise_id = empty($hotdeal_today_result[$i]) ? '0' : $hotdeal_today_result[$i]['advertise_id'];
         $advertise_id_value = 'advertise_id_value' . $i;
         $this->data[$advertise_id_value] = $advertise_id;
         $hotdeal_id = 'hotdeal_id' . $i;
         $this->data[$hotdeal_id] = array('hotdeal_id-' . $i => $advertise_id);
         $hotdeal_hide = 'hotdeal_hide' . $i;
         $this->data[$hotdeal_hide] = array('name' => 'hotdeal_hide-' . $i, 'id' => 'hotdeal_hide-' . $i, 'value' => $advertise_id);
     }
     $this->data['box_number'] = $box_number_update;
     $this->data['hotdeal_per_day'] = $this->m_custom->web_setting_get('merchant_max_hotdeal_per_day');
     $this->data['temp_folder'] = $this->temp_folder;
     $this->data['temp_folder_cut'] = $this->temp_folder_cut;
     $this->data['empty_image'] = $this->config->item('empty_image');
     $this->data['message'] = $this->session->flashdata('message');
     $this->data['page_path_name'] = 'merchant/upload_hotdeal';
     $this->load->view('template/index', $this->data);
 }
/**
* Update row into tables
* 
* @param    table variables
* @param    $id      passed by reference. returns primar key of row 
* @return   $status  true if the operation is successful
*/
function UpdateInto_UserDetails($dbhandle, $id, $user)
{
    $logger = LoggerSingleton::GetInstance();
    $logger->LogInfo("UpdateInto_UserDetails : Enter");
    global $UserDetailsTable_Id;
    global $UserDetailsTable_Name;
    global $UserDetailsTable_UserName;
    $status = true;
    // validate input argumets
    if (IsNullOrEmptyString($user)) {
        $logger->LogError("UpdateInto_UserDetails : Null or empty input parameters");
        $status = false;
    }
    // insert a UserDetails row
    if (true == $status) {
        $query = "UPDATE {$UserDetailsTable_Name} \n        SET     {$UserDetailsTable_UserName} = '{$user}'\n        WHERE   {$UserDetailsTable_Id} = {$id}";
        $status = $dbhandle->query($query);
        if (false == $status) {
            $logger->LogError("UpdateInto_UserDetails : Unable to insert record - {$dbhandle->error}");
        }
    }
    $logger->LogInfo("UpdateInto_UserDetails : {$status}");
    return $status;
}
Пример #28
0
});
$app->post('/Cikis', function () use($app) {
    SetUyeID(null);
    $response = array();
    $response["Sonuc"] = true;
    $response8["Mesaj"] = "Çıkış Yapıldı";
    echoRespnse(200, $response);
});
$app->post('/Kayit', function () use($app) {
    $db = new DbHandler();
    $response = array();
    $User = Decrypt($app->request->post("KullaniciAdi"));
    $Pass = Decrypt($app->request->post("Sifre"));
    $Name = Decrypt($app->request->post("AdiSoyadi"));
    $Email = Decrypt($app->request->post("Email"));
    if (isset($User) && isset($Pass) && isset($Name) && isset($Email) && !IsNullOrEmptyString($User) && !IsNullOrEmptyString($Pass) && !IsNullOrEmptyString($Name) && !IsNullOrEmptyString($Email)) {
        if (!filter_var($Email, FILTER_VALIDATE_EMAIL)) {
            $response["Sonuc"] = false;
            $response["Mesaj"] = "Geçersiz Mail Adresi.";
            echoRespnse(200, $response);
            return;
        }
        if (preg_match('/^[a-zA-Z0-9]{5,}$/', $username)) {
            $response["Sonuc"] = false;
            $response["Mesaj"] = "Lütfen geçerli bir kullanıcı adı giriniz.";
            echoRespnse(200, $response);
            return;
        }
        $sonuc = $db->UyeEkle($Name, $Email, $User, $Pass);
        if ($sonuc != false) {
            $response["Mesaj"] = 'Üyeliğiniz Başarıyla Tamamlandı';
Пример #29
0
 function upload_for_merchant($merchant_id_pass = NULL)
 {
     if (!check_correct_login_type($this->main_group_id)) {
         redirect('/', 'refresh');
     }
     $message_info = '';
     $user_id = $this->ion_auth->user()->row()->id;
     $login_type = $this->session->userdata('user_group_id');
     $user_data = $this->m_custom->get_one_table_record('users', 'id', $user_id);
     if (!IsNullOrEmptyString($merchant_id_pass)) {
         $merchant_id = $merchant_id_pass;
         $merchant_info = $this->m_custom->getMerchantInfo($merchant_id);
         if ($merchant_info) {
             $merchant_category = $merchant_info['me_category_id'];
         }
     }
     $this->data['box_number'] = $this->box_number;
     if (isset($_POST) && !empty($_POST)) {
         if ($this->input->post('button_action') == "upload_image") {
             $can_redirect = 0;
             $upload_rule = array('upload_path' => $this->album_user_merchant, 'allowed_types' => $this->config->item('allowed_types_image'), 'max_size' => $this->config->item('max_size'), 'max_width' => $this->config->item('max_width'), 'max_height' => $this->config->item('max_height'));
             $this->load->library('upload', $upload_rule);
             $validate_fail = 0;
             for ($i = 0; $i < $this->box_number; $i++) {
                 $user_today_upload_count = $this->m_user->get_user_today_upload_count($user_id);
                 $user_max_picture_per_day = $this->m_custom->web_setting_get('user_max_picture_per_day');
                 if ($user_today_upload_count >= $user_max_picture_per_day) {
                     $message_info = add_message_info($message_info, 'You already reach max ' . $user_max_picture_per_day . ' picture upload per day. Please upload again after today.');
                     $this->session->set_flashdata('message', $message_info);
                     redirect('user/upload_for_merchant', 'refresh');
                 }
                 $post_file = "image-file-" . $i;
                 $post_title = $this->input->post('image-title-' . $i);
                 $post_merchant_id = $this->input->post('image-merchant-' . $i);
                 $post_desc = $this->input->post('image-desc-' . $i);
                 //For Multiple Image Upload
                 $have_hidden_image = 0;
                 $post_hidden_image = $this->input->post('hideimage-' . $i);
                 if (!empty($post_hidden_image)) {
                     $have_hidden_image = 1;
                     goto HiddenImageSkip;
                 }
                 if (!empty($_FILES[$post_file]['name'])) {
                     //to do todo if want to add auto populate back
                     //                        $this->form_validation->set_rules('image-title-' . $i, $this->lang->line('album_title_label'), 'required');
                     //                        $this->form_validation->set_rules('image-merchant-' . $i, $this->lang->line('album_merchant_label'), 'required');
                     //                        $this->form_validation->set_rules('image-desc-' . $i, $this->lang->line('album_description_label'));
                     //if ($this->form_validation->run() == false)
                     if ($post_merchant_id == null) {
                         $validate_fail = 1;
                         //$message_info = add_message_info($message_info, 'Merchant cannot be empty.', $post_title);
                         $message_info = add_message_info($message_info, 'Merchant cannot be empty.', $post_desc);
                         goto ValidateFail;
                     }
                     if (!$this->upload->do_upload($post_file)) {
                         $validate_fail = 1;
                         //$message_info = add_message_info($message_info, $this->upload->display_errors(), $post_title);
                         $message_info = add_message_info($message_info, $this->upload->display_errors(), $post_desc);
                     } else {
                         HiddenImageSkip:
                         $image_file_name = '';
                         if ($have_hidden_image == 0) {
                             $image_data = array('upload_data' => $this->upload->data());
                             $image_file_name = $image_data['upload_data']['file_name'];
                         } else {
                             $from_path = $this->temp_folder_cut . $post_hidden_image;
                             $to_path = $this->album_user_merchant . $post_hidden_image;
                             if (file_exists($from_path)) {
                                 rename($from_path, $to_path);
                             }
                             $image_file_name = $post_hidden_image;
                         }
                         resize_image($this->album_user_merchant . $image_file_name);
                         $data = array('post_type' => 'mer', 'user_id' => $user_id, 'merchant_id' => $post_merchant_id, 'post_id' => $post_merchant_id, 'title' => '', 'description' => $post_desc, 'image' => $image_file_name);
                         $new_id = $this->m_custom->get_id_after_insert('merchant_user_album', $data);
                         if ($new_id) {
                             $this->m_custom->insert_row_log('merchant_user_album', $new_id, $user_id, $login_type);
                             $this->m_user->candie_history_insert(4, $new_id, 'merchant_user_album');
                             //$this->m_merchant->transaction_history_insert($post_merchant_id, 14, $new_id, 'merchant_user_album');
                             //$this->m_user->user_trans_history_insert($user_id, 21, $new_id);   //Temporary comment this because user upload image for merchant cannot get cash back already
                             $this->m_custom->notification_process('merchant_user_album', $new_id);
                             //$message_info = add_message_info($message_info, 'Image for merchant ' . $this->m_custom->display_users($post_merchant_id) . ' success create.', $post_title);
                             $message_info = add_message_info($message_info, 'Image for merchant ' . $this->m_custom->display_users($post_merchant_id) . ' success create.', $post_desc);
                         } else {
                             //$message_info = add_message_info($message_info, $this->ion_auth->errors(), $post_title);
                             $message_info = add_message_info($message_info, $this->ion_auth->errors(), $post_desc);
                         }
                     }
                 }
                 ValidateFail:
             }
             $this->session->set_flashdata('message', $message_info);
             if ($validate_fail == 0) {
                 $this->m_custom->remove_image_temp();
                 redirect('all/album_user_merchant/' . $user_id, 'refresh');
             }
         }
     }
     $this->data['category_list'] = $this->m_custom->getCategoryList('0', '');
     $this->data['merchant_list'] = $this->m_merchant->getMerchantList();
     for ($i = 0; $i < $this->box_number; $i++) {
         $image_title = 'image_title' . $i;
         $this->data[$image_title] = array('name' => 'image-title-' . $i, 'id' => 'image-title-' . $i, 'value' => $this->form_validation->set_value('image-title-' . $i));
         $image_url = 'image_url' . $i;
         $this->data[$image_url] = $this->config->item('empty_image');
         $image_category = 'image_category' . $i;
         $this->data[$image_category] = array('name' => 'image-category-' . $i, 'id' => 'image-category-' . $i, 'value' => $this->form_validation->set_value('image-category-' . $i), 'onChange' => "get_Merchant(" . $i . ")");
         $image_category_selected = 'image_category_selected' . $i;
         $this->data[$image_category_selected] = empty($merchant_category) ? '' : $merchant_category;
         $image_merchant = 'image_merchant' . $i;
         $this->data[$image_merchant] = array('name' => 'image-merchant-' . $i, 'id' => 'image-merchant-' . $i, 'class' => 'chosen-select');
         $image_merchant_selected = 'image_merchant_selected' . $i;
         $this->data[$image_merchant_selected] = empty($merchant_id) ? '' : $merchant_id;
         $image_desc = 'image_desc' . $i;
         $this->data[$image_desc] = array('name' => 'image-desc-' . $i, 'id' => 'image-desc-' . $i, 'value' => $this->form_validation->set_value('image-desc-' . $i));
     }
     $this->data['temp_folder'] = $this->temp_folder;
     $this->data['temp_folder_cut'] = $this->temp_folder_cut;
     $this->data['empty_image'] = $this->config->item('empty_image');
     $this->data['message'] = $this->session->flashdata('message');
     $this->data['page_path_name'] = 'user/upload_for_merchant';
     $this->load->view('template/index_background_blank', $this->data);
 }
Пример #30
0
try {
    include "../../dbopen.php";
} catch (Exception $e) {
    die("Error on db open " . $e->getMessage());
}
if (IsNullOrEmptyString($_POST['cid'])) {
    $a = new RestResponse("error", "cid is null");
    echo json_encode($a);
    exit(0);
}
if (IsNullOrEmptyString($_POST['owner'])) {
    $a = new RestResponse("error", "owner is null");
    echo json_encode($a);
    exit(0);
}
if (IsNullOrEmptyString($_POST['ownerId'])) {
    $a = new RestResponse("error", "owner id is null");
    echo json_encode($a);
    exit(0);
}
$cid = $_POST['cid'];
$atitle = $_POST['atitle'];
$description = $_POST['description'];
$owner = $_POST['owner'];
$ownerId = $_POST['ownerId'];
echo $cid . $atitle . $description . $owner . $ownerId;
$sql = "INSERT INTO advertisements (categoryId, title, description,owner, ownerId) VALUES ({$cid},'{$atitle}','{$description}','{$owner}', {$ownerId})";
if ($conn->query($sql) === TRUE) {
    //    echo "Inserted new Parent Category values successfully<br/>";
} else {
    $a = new RestResponse("error", "Error processing Category: " . $conn->error);