Beispiel #1
0
 function go_page_list()
 {
     // Update the shopsetting to indicate this step is complete
     global $ROW, $TEMPLATE;
     LOG_MSG('INFO', "go_page_list(): START ");
     // Do we have a search string?
     // Get all the args from $_GET
     $name = get_arg($_GET, "name");
     $title = get_arg($_GET, "title");
     $type = get_arg($_GET, "type");
     LOG_MSG('DEBUG', "go_page_list(): Got args");
     // Validate parameters as normal strings
     LOG_MSG('DEBUG', "go_page_list(): Validated args");
     // Rebuild search string for future pages
     $search_str = "name={$name}&title={$title}&type={$type}";
     $ROW = $this->admin_model->db_page_select("", $name, $title, '', $type);
     if ($ROW[0]['STATUS'] != "OK") {
         add_msg("ERROR", "There was an error loading the Pages. Please try again later. ");
         return;
     }
     $this->data['rows'] = $ROW;
     $this->load->view('theme1/nav/header', $this->data, '');
     $this->load->view('theme1/nav/topbar', $this->data, '');
     $this->load->view('theme1/index', $this->data);
     $this->load->view('theme1/nav/footer', $this->data);
     LOG_MSG('INFO', "go_page_list(): END");
 }
Beispiel #2
0
function db_do_login($email_id, $password)
{
    LOG_MSG('INFO', "db_do_login(): START {\n\t\t\t\t\t\t\t\t\t\temail_id=[{$email_id}],\n\t\t\t\t\t\t\t\t\t\tpassword=[{$password}]\n}");
    $param_arr = _init_db_params();
    $param_arr = _db_prepare_param($param_arr, "s", "email_id", $email_id, true);
    $param_arr = _db_prepare_param($param_arr, "s", "password", $password, true);
    // Create Query
    $resp = execSQL("SELECT \n\t\t\t\t\t\tu.user_id,\n\t\t\t\t\t\tu.name,\n\t\t\t\t\t\tu.email_id,\n\t\t\t\t\t\tu.password,\n\t\t\t\t\t\tu.phone_no,\n\t\t\t\t\t\tu.address,\n\t\t\t\t\t\tu.type,\n\t\t\t\t\t\tu.is_active,\n\t\t\t\t\t\tu.created_dt,\n\t\t\t\t\t\ts.supervisor_id,\n\t\t\t\t\t\tt.travel_id,\n\t\t\t\t\t\tt.name travel_name,\n\t\t\t\t\t\tt.domain\n\t\t\t\t\tFROM\n\t\t\t\t\t\ttUser u\n\t\t\t\t\t\tLEFT OUTER JOIN tSupervisor s ON(s.user_id=u.user_id)\n\t\t\t\t\t\tLEFT OUTER JOIN tTravel t ON(u.travel_id=t.travel_id)\n\t\t\t\t\tWHERE \n\t\t\t\t\t\tu.email_id=? \n\t\t\t\t\t\tAND u.password=? AND\n\t\t\t\t\t\tt.travel_id=" . TRAVEL_ID, $param_arr['params'], false);
    LOG_MSG('INFO', "db_do_login(): END");
    return $resp;
}
Beispiel #3
0
function db_room_select($room_id = "", $room_name = "")
{
    LOG_MSG('INFO', "db_wallet_select: START { \n\t\t\t\t\t\t\troom_id=[{$room_id}],\n\t\t\t\t\t\t\troom_name=[{$room_name}] \n}");
    $param_arr = _init_db_params();
    $where_clause = "WHERE room_name={$room_name} AND room_id = {$room_id}";
    $param_arr['params'] = array();
    LOG_MSG('INFO', "db_room_select(): WHERE CLAUSE = [{$where_clause}]");
    $resp = execSQL("SELECT \n\t\t\t\t\t\troom_name,\n\t\t\t\t\t\troom_id,\n\t\t\t\t\t\tis_booked\n\t\t\t\t\tFROM \n\t\t\t\t\t\tbookrooms\n\t\t\t\t\t" . $where_clause, $param_arr['params'], false);
    LOG_MSG('INFO', "db_room_select(): END");
    return $resp;
}
Beispiel #4
0
 function db_page_delete($page_id)
 {
     $param_arr = _init_db_params();
     LOG_MSG('INFO', "db_page_delete(): START { page_id=[{$page_id}]");
     // For the where clause
     $where_clause = " WHERE page_id=? AND shop_id=" . SHOP_ID;
     $param_arr = _db_prepare_param($param_arr, "i", "page_id", $page_id, true);
     $resp = execSQL("DELETE FROM  \n\t\t\t\t\t\t\ttPage" . $where_clause, $param_arr['params'], true);
     LOG_MSG('INFO', "db_page_delete(): END");
     return $resp;
 }
Beispiel #5
0
function do_check_rooms()
{
    global $ROW, $TEMPLATE;
    LOG_MSG('INFO', "do_check_rooms(): START GET=" . print_r($_GET, true));
    // Get all the args from $_GET
    $room_name = get_arg($_GET, "room_name");
    $room_id = get_arg($_GET, "room_id");
    $ROW = db_room_select($room_id, $room_name);
    if ($ROW[0]['STATUS'] != "OK") {
        add_msg("ERROR", "There was an error loading the wallet. Please try again later. <br/>");
        return;
    }
    LOG_MSG('INFO', "do_check_rooms() : END");
}
Beispiel #6
0
function emailer()
{
    LOG_MSG('INFO', "do_confirm_order(): START");
    $htmldata = file_get_contents("php://input");
    echo "***************do_confirm_order() start *************************";
    echo "----GET----\n" . print_r($_GET, true);
    //echo "----RAW----\n [$htmldata]";
    echo "***************do_confirm_order() end   *************************";
    $to = get_arg($_GET, 'to');
    $from = get_arg($_GET, 'from');
    $subject = get_arg($_GET, 'sub');
    $message = $htmldata;
    send_email($to, $subject, $message, $from);
    LOG_MSG('INFO', "do_confirm_order(): END");
}
Beispiel #7
0
 function handleError($uploadDirectory)
 {
     if (!is_writable($uploadDirectory)) {
         return array('error' => "Server error. Upload directory isn't writable.");
     }
     if (!$this->file) {
         return array('error' => 'No files were uploaded.');
     }
     $size = $this->file->getSize();
     if ($size == 0) {
         return array('error' => 'File is empty');
     }
     if ($size > $this->sizeLimit) {
         return array('error' => 'File is too large');
     }
     $pathinfo = pathinfo($this->file->getName());
     $filename = $pathinfo['filename'];
     //$filename = md5(uniqid());
     $ext = $pathinfo['extension'];
     if ($this->allowedExtensions && !in_array(strtolower($ext), $this->allowedExtensions)) {
         $these = implode(', ', $this->allowedExtensions);
         return array('error' => 'File has an invalid extension, it should be one of ' . $these . '.');
     }
     LOG_MSG('INFO', "FILENAME IMAGE ============== {$filename}");
     return array('success' => true);
 }
Beispiel #8
0
function get_unique_field($table)
{
    LOG_MSG("INFO", "####### GETTING UNIQUE KEY COLUMN NAME : for " . DB_NAME . $table);
    $row = execSQL("\n\t\t\t\tSELECT \n\t\t\t\t\tcolumn_name\n\t\t\t\tFROM \n\t\t\t\t\tinformation_schema.COLUMNS\n\t\t\t\tWHERE \n\t\t\t\t\ttable_name = '" . $table . "' AND\n\t\t\t\t\ttable_schema = '" . DB_NAME . "' AND\n\t\t\t\t\tcolumn_key='UNI';", array(), false);
    // If no unique key was found above
    if (!isset($row[0]['column_name'])) {
        LOG_MSG("INFO", "####### GETTING PRIMARY KEY COLUMN NAME : for " . DB_NAME . $table);
        $row = execSQL("\n\t\t\t\tSELECT \n\t\t\t\t\tcolumn_name\n\t\t\t\tFROM \n\t\t\t\t\tinformation_schema.COLUMNS\n\t\t\t\tWHERE \n\t\t\t\t\ttable_name = '" . $table . "' AND\n\t\t\t\t\ttable_schema = '" . DB_NAME . "' AND\n\t\t\t\t\tcolumn_key='PRI';", array(), false);
    }
    return $row[0]['column_name'];
}
Beispiel #9
0
function db_is_sync_supervisor_update($is_sync)
{
    $param_arr = _init_db_params();
    LOG_MSG('INFO', "db_is_sync_supervisor_update(): START {\n\t\t\t\t\t\t\tis_sync=[{$is_sync}]\n}");
    // Add params to params_arr
    $param_arr = _db_prepare_param($param_arr, "i", "is_sync", $is_sync);
    // For the where clause
    $where_clause = " WHERE travel_id= " . TRAVEL_ID;
    $resp = execSQL("UPDATE  \n\t\t\t\t\t\ttSupervisor\n\t\t\t\t\tSET " . $param_arr['update_fields'] . $where_clause, $param_arr['params'], true);
    LOG_MSG('INFO', "db_is_sync_supervisor_update(): END");
    return $resp;
}
Beispiel #10
0
function modulesetting_db_get($name, $category = '')
{
    LOG_MSG('INFO', "modulesetting_db_get(): START { name=[{$name}] category=[{$category}] \n}");
    $param_arr = _init_db_params();
    // Where Clause
    $where_clause = "WHERE name = ? AND travel_id=" . TRAVEL_ID;
    $param_arr = _db_prepare_param($param_arr, "s", "name", $name, true);
    if ($category != '') {
        $where_clause .= " AND category=? ";
        $param_arr = _db_prepare_param($param_arr, "s", "category", $category, true);
    }
    $resp = execSQL("SELECT \n\t\t\t\t\t\tvalue\n\t\t\t\t\tFROM \n\t\t\t\t\t\ttSetting \n\t\t\t\t\t{$where_clause} ", $param_arr['params'], false);
    LOG_MSG('INFO', "modulesetting_db_get(): END");
    if ($resp[0]['STATUS'] != 'OK') {
        LOG_MSG('ERROR', "modulesetting_db_get(): There was an error loading name=[{$name}]");
        return false;
    }
    if ($resp[0]['NROWS'] != 1) {
        LOG_MSG('INFO', "modulesetting_get(): No value found for [{$name}]");
        return false;
    }
    return $resp[0]['value'];
}
Beispiel #11
0
function image_resize($source_image_path, $resize_width, $resize_height, $autocrop = 0)
{
    LOG_MSG("INFO", "image_resize() :START source_image_path=[{$source_image_path}],\n\t\t\t\t\t\t\t\t\t\t\tresize_width=[{$resize_width}],\n\t\t\t\t\t\t\t\t\t\t\tresize_height=[{$resize_height}],\n\t\t\t\t\t\t\t\t\t\t\tautocrop=[{$autocrop}]");
    $is_streched = false;
    // As the resize dimension changes as the flow goes, store it in a variable for the padding purpose
    $org_resize_width = $resize_width;
    $org_resize_height = $resize_height;
    /******************************************************************/
    /*     STEP1:Get the image properties                             */
    /******************************************************************/
    // Get source image properties
    list($source_image_width, $source_image_height, $source_image_type) = getimagesize($source_image_path);
    /******************************************************************/
    /*              STEP2:Create image resource                       */
    /******************************************************************/
    switch ($source_image_type) {
        case IMAGETYPE_GIF:
            $source_gd_image = imagecreatefromgif($source_image_path);
            break;
        case IMAGETYPE_JPEG:
            $source_gd_image = imagecreatefromjpeg($source_image_path);
            break;
        case IMAGETYPE_PNG:
            $source_gd_image = imagecreatefrompng($source_image_path);
            break;
    }
    if ($source_gd_image == false) {
        LOG_MSG("INFO", "image_resize() : Failed to create image resource source_gd_image=[{$source_gd_image}]");
        return false;
    }
    // Check whether the image is original image
    $is_org_image = false;
    if ($resize_width == '' && $resize_height == '') {
        $is_org_image = true;
    }
    // Check whether the image resize is required, else skip to padding
    $is_img_resize = true;
    if (!$is_streched && $resize_width >= $source_image_width && $resize_height >= $source_image_height) {
        $is_img_resize = false;
    }
    // If original image or image resize is not required, skip all the steps till padding
    if (!$is_org_image && $is_img_resize) {
        // If the image dimensions are equal to the required dimensions
        if ($source_image_width == $resize_width && $source_image_height == $resize_height) {
            return true;
        }
        // FIXED IMAGE - PROTRONICS
        // When the image width or height is too small, or if there is more difference in width and height
        // fixing the image will stretch or compress the image which will not look like the original image
        // To avoid this, we need to reduce the image by same percentage on all the sides. The percentage
        // can be calculated based on the max resize width or height.
        // If the modified width and height is greater than the resize width and height resp., then re-size with the minimum resize width or height
        // OUR LAST AIM IS EITHER WIDTH AND HEIGHT SHOULD NOT EXCEED THE ORIGINAL RESIZE WIDTH AND HEIGHT
        if (!$is_streched) {
            // Return if the image is smaller than the resize image
            LOG_MSG("INFO", "image_resize() : ############## ORIGINAL IMAGE SIZE AND RESIZE ################\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsource_image_width=[{$source_image_width}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsource_image_height=[{$source_image_height}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresize_width=[{$resize_width}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresize_height=[{$resize_height}]");
            // Find the new resize_height
            if ($resize_width >= $resize_height && $resize_width <= $source_image_width || $resize_width < $resize_height && $resize_height > $source_image_height) {
                $resize_percent = $resize_width * 100 / $source_image_width;
                $mod_resize_height = $resize_percent * $source_image_height / 100;
                // When mod_resize_height is > than original resize_height, then find the width based on the original resize_height
                if ($mod_resize_height > $resize_height) {
                    LOG_MSG("INFO", "image_resize() : mod_resize_height=[{$mod_resize_height}] > resize_height=[{$resize_height}]");
                    $resize_percent = $resize_height * 100 / $source_image_height;
                    $resize_width = $resize_percent * $source_image_width / 100;
                } else {
                    $resize_height = $mod_resize_height;
                }
            } elseif ($resize_width >= $resize_height && $resize_width > $source_image_width || $resize_width < $resize_height && $resize_height <= $source_image_height) {
                $resize_percent = $resize_height * 100 / $source_image_height;
                $mod_resize_width = $resize_percent * $source_image_width / 100;
                // When mod_resize_width is > than original resize_width, then find the height based on the original resize_width
                if ($mod_resize_width > $resize_width) {
                    LOG_MSG("INFO", "image_resize() : mod_resize_width=[{$mod_resize_width}] > resize_width=[{$resize_width}]");
                    $resize_percent = $resize_width * 100 / $source_image_width;
                    $resize_height = $resize_percent * $source_image_height / 100;
                } else {
                    $resize_width = $mod_resize_width;
                }
            }
            LOG_MSG("INFO", "image_resize() : ############## MODIFIED IMAGE SIZE AND RESIZE ################\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsource_image_width=[{$source_image_width}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tsource_image_height=[{$source_image_height}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresize_percent=[{$resize_percent}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresize_width=[{$resize_width}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tresize_height=[{$resize_height}]");
        }
        if ($autocrop == 1) {
            /******************************************************************/
            /*     STEP3:Find the crop ratio                                  */
            /******************************************************************/
            $crop_ratio = $resize_width * $source_image_height / ($resize_height * $source_image_width);
            /******************************************************************/
            /*     STEP4:Calculate the cropped image width and height         */
            /******************************************************************/
            if ($crop_ratio < 1) {
                $new_height = $source_image_height;
                $new_width = $source_image_width * $crop_ratio;
            } else {
                if ($crop_ratio > 1) {
                    $new_width = $source_image_width;
                    $new_height = $source_image_height / $crop_ratio;
                } else {
                    if ($crop_ratio == 1) {
                        $new_width = $source_image_width;
                        $new_height = $source_image_height;
                    }
                }
            }
            LOG_MSG("INFO", "image_resize() : new_width=[{$new_width}],\n\t\t\t\t\t\t\t\t\t\t\tnew_height=[{$new_height}]");
            /******************************************************************/
            /*     STEP4:Find the crop coordinates                            */
            /******************************************************************/
            $centreX = round($source_image_width / 2);
            $centreY = round($source_image_height / 2);
            $x = max(0, $centreX - round($new_width / 2));
            $y = max(0, $centreY - round($new_height / 2));
            LOG_MSG("INFO", "image_resize() : coordinates x=[{$x}],\n\t\t\t\t\t\t\t\t\t\t\t\t\t\ty=[{$y}]");
        } else {
            $x = 0;
            $y = 0;
            $new_width = $source_image_width;
            $new_height = $source_image_height;
        }
        /******************************************************************/
        /*     STEP5:Crop/Resize the image                                */
        /******************************************************************/
        // Create a black image of specified crop width and size into which the area to be cropped is interpolated
        if (!($resized_gd_image = imagecreatetruecolor($resize_width, $resize_height))) {
            LOG_MSG("INFO", "image_resize() : Function 'imagecreatetruecolor' failed to create image identifier representing black image of the size {$resize_widthX}{$resize_height}");
            return false;
        }
        // Copy the area to be cropped onto the black image
        if (!imagecopyresampled($resized_gd_image, $source_gd_image, 0, 0, $x, $y, $resize_width, $resize_height, $new_width, $new_height)) {
            LOG_MSG("INFO", "image_resize() : Function 'imagecopyresampled' failed to create the resized/cropped image");
            return false;
        }
        // Save the image file/Create a jpeg image
        if (!imagejpeg($resized_gd_image, $source_image_path, 100)) {
            LOG_MSG("INFO", "image_resize() : Function 'imagejpeg' failed to create the JPEG image file");
            return false;
        }
    }
    /******************************************************************/
    /*      STEP6: Image Padding (Only for non streched images)       */
    /******************************************************************/
    if (!$is_streched) {
        // Take maximum image width and height for zoom in case of original image
        if ($is_org_image) {
            if ($source_image_width > $source_image_height) {
                $output_w = $output_h = $source_image_width;
            } else {
                $output_w = $output_h = $source_image_height;
            }
            // calc new image dimensions
            $new_w = $source_image_width;
            $new_h = $source_image_height;
        } else {
            $output_w = $org_resize_width;
            $output_h = $org_resize_height;
            if ($is_img_resize) {
                $source_gd_image = $resized_gd_image;
                // calc new image dimensions
                $new_w = $resize_width;
                $new_h = $resize_height;
            } else {
                $new_w = $source_image_width;
                $new_h = $source_image_height;
            }
        }
        // determine offset coords so that new image is centered
        $offest_x = ($output_w - $new_w) / 2;
        $offest_y = ($output_h - $new_h) / 2;
        // create new image and fill with background colour
        $new_img = imagecreatetruecolor($output_w, $output_h);
        $bgcolor = imagecolorallocate($new_img, 255, 255, 255);
        // red
        imagefill($new_img, 0, 0, $bgcolor);
        // fill background colour
        // copy and resize original image into center of new image
        imagecopyresampled($new_img, $source_gd_image, $offest_x, $offest_y, 0, 0, $new_w, $new_h, $new_w, $new_h);
        LOG_MSG('INFO', "image_resize(): ############ PADDING IMAGE ############ \n\t\t\t\t\t\t\t\t\t\t\t\tis_img_resize=[{$is_img_resize}],\n\t\t\t\t\t\t\t\t\t\t\t\tNew Image=[{$new_img}],\n\t\t\t\t\t\t\t\t\t\t\t\tSource image = [{$source_gd_image}],\n\t\t\t\t\t\t\t\t\t\t\t\tOffset X = [{$offest_x}],\n\t\t\t\t\t\t\t\t\t\t\t\tOffset Y = [{$offest_y}],\n\t\t\t\t\t\t\t\t\t\t\t\tNew Width = [{$new_w}],\n\t\t\t\t\t\t\t\t\t\t\t\tNew Height= [{$new_h}],\n\t\t\t\t\t\t\t\t\t\t\t\tOutput Width = [{$output_w}],\n\t\t\t\t\t\t\t\t\t\t\t\tOutput Height = [{$output_h}]");
        //save it
        imagejpeg($new_img, $source_image_path, 80);
    }
    // Destroy the resource image file
    if (!imagedestroy($source_gd_image)) {
        LOG_MSG("INFO", "image_resize() : Function 'imagedestroy' failed to destroy the resource image file");
        return false;
    }
    LOG_MSG("INFO", "image_resize() :END");
    return true;
}
Beispiel #12
0
    }
} else {
    if (is_loggedin() && is_supervisor()) {
        include "modules/admin/vehicle/controller.php";
    } else {
        if (is_loggedin() && is_superuser()) {
            include "modules/admin/travel/controller.php";
        } else {
            add_msg('SUCCESS', "Welcome to {$DOMAIN}. Please login to start using your account");
            show_msgs();
        }
    }
}
?>
			</div>
			<!-- END CENTER CONTENT -->

			<!-- FOOTER -->
			<?php 
include "static/html/footer.html";
?>

		</div> 	<!-- END CONTAINER -->

</body>
</html>

<?php 
db_close();
LOG_MSG('INFO', "=========================================== END ===========================================");
Beispiel #13
0
function send_email($to, $from, $cc = '', $bcc = '', $subject, $message)
{
    LOG_MSG('INFO', "send_email(): START EMAILER_HOST=[" . EMAILER_HOST . "] to=[{$to}] from=[{$from}] cc=[{$cc}] bcc=[{$bcc}] subject=[{$subject}]");
    // Defaults
    if (!$bcc) {
        $bcc = EMAIL_BCC;
    }
    // Add footer to the message
    ob_start();
    include HTML_DIR . '/emails/email_footer.html';
    $message .= ob_get_contents();
    ob_get_clean();
    $headers = "Content-Type: text/html\r\n";
    //."MIME-Version: 1.0\r\n"
    //."charset=utf-8\r\n"
    //."Content-Transfer-Encoding: 8bit\r\n"
    //."X-Mailer: Shopnix - eCommerce Solution\r\n";
    // To store subject whithout appending with SHOP_NAME
    $plain_subject = $subject;
    $subject = "[" . SHOP_NAME . "] {$subject}";
    // Setup parameters
    $status = 'SUCCESS';
    if (EMAILER_HOST == 'LOCAL') {
        $emailer_host = $_SERVER['SERVER_NAME'];
        $headers .= "From: {$from}\r\n";
        $headers .= "CC: {$cc}\r\n";
        $headers .= "Bcc: {$bcc}\r\n";
        $resp = mail($to, $subject, $message, $headers);
        // SEND EMAIL
        if ($resp) {
            $status = 'SUCCESS';
        } else {
            $status = 'FAILED';
        }
    } elseif (EMAILER_HOST == 'REMOTE') {
        $headers .= "From:{$from} \nCC: {$cc} \nBcc: {$bcc}";
        $from = urlencode($from);
        $to = urlencode($to);
        $cc = urlencode($cc);
        $bcc = urlencode($bcc);
        $subject = urlencode($subject);
        $url = "";
        $resp = curl_post($url, $message);
        // SEND EMAIL
        $emailer_host = 'cloudnix.com';
    } elseif (EMAILER_HOST == 'MANDRILL') {
        // Setup data
        $sw_from = convert_email($from);
        $sw_to = convert_email($to);
        $text = strip_tags($message);
        $html = $message;
        $emailer_host = 'Mandrill';
        // Setup connection info
        $transport = Swift_SmtpTransport::newInstance('smtp.mandrillapp.com1', 587);
        $transport->setUsername(SMTP_USERNAME);
        $transport->setPassword(SMTP_PASSWORD);
        $swift = Swift_Mailer::newInstance($transport);
        // Setup Data object
        $sw_message = new Swift_Message($subject);
        $sw_message->setFrom($sw_from);
        $sw_message->setBody($html, 'text/html');
        $sw_message->setTo($sw_to);
        $sw_message->addPart($text, 'text/plain');
        if ($bcc) {
            $sw_bcc = convert_email($bcc);
            //echo "<pre>Setting BCC[$bcc] to [".print_r($sw_bcc,true)."]</pre>";
            $sw_message->setBcc($sw_bcc);
        }
        if ($cc) {
            $sw_cc = convert_email($cc);
            //echo "<pre>Setting CC[$cc] to [".print_r($sw_cc,true)."]</pre>";
            $sw_message->setCc($sw_cc);
        }
        // Send mail
        if ($recipients = $swift->send($sw_message, $failures)) {
            $resp = true;
            $status = 'SUCCESS';
        } else {
            LOG_MSG('ERROR', "send_email(MANDRILL): Error sending email=[" . print_r($failures, true) . "]");
            $resp = false;
            $status = 'FAILED';
        }
    } else {
        LOG_MSG("INFO", "EMAILER_HOST is OFF. Not sending email");
        $status = 'NOT SENT';
        $resp = true;
    }
    $email_resp = db_emails_insert($from, $to, $cc, $bcc, $plain_subject, $message, $status, $headers, EMAILER_HOST);
    if ($email_resp['STATUS'] != 'OK') {
        LOG_MSG('ERROR', "send_email(): Error while inserting in EMails talble from=[{$from}] to=[{$to}]");
    }
    LOG_MSG("INFO", "\n\t******************************EMAIL START[{$status}]******************************\n\tTO: [{$to}]\n\t{$headers}\n\tSUBJECT:[{$subject}]\n\t{$message}\n\t******************************EMAIL END******************************");
    return $resp;
}
Beispiel #14
0
function has_user_permission($function, $mode = "")
{
    return true;
    $return = true;
    $user_id = get_arg($_SESSION, 'user_id');
    $user_permission_row = db_permission_select($user_id, $function, $mode);
    if ($user_permission_row[0]['STATUS'] != 'OK' || $user_permission_row[0]['NROWS'] != 1) {
        add_msg("ERROR", "Sorry! You do not have the permission to perform this action.<br />");
        $return = false;
    }
    LOG_MSG("INFO", "has_user_permission(): user_id=[{$user_id}] function=[{$function}] mode=[{$mode}] has_premission=[{$return}]");
    return $return;
}
Beispiel #15
0
function app_sync($table_name, $primary_id, $status, $travel_id)
{
    LOG_MSG('INFO', "app_sync(): START");
    $ROW = db_appsync_insert($table_name, $primary_id, $status, $travel_id);
    if ($ROW['STATUS'] !== 'OK') {
        LOG_MSG('ERROR', "app_sync(): Error inserting app_sync or no row found");
        add_msg("ERROR", "There was an error adding to appsync");
        return false;
    }
    $supervisor_row = db_is_sync_supervisor_update(0);
    if ($ROW['STATUS'] != "OK") {
        add_msg("ERROR", "There was an error updating the supervisor .");
        return false;
    }
    LOG_MSG('INFO', "app_sync(): END");
    return true;
}
Beispiel #16
0
 function go_page_view($mode = "EDIT")
 {
     global $ROW, $TEMPLATE;
     LOG_MSG('INFO', "go_page_view(): START mode=[{$mode}]");
     // Don't load for add mode or when reloading the form
     if ($mode != "ADD" && (!isset($ROW[0]) || get_arg($ROW[0], 'STATUS') !== 'RELOAD')) {
         // Get the Page ID
         $page_id = $this->data['id'];
         // Get from DB
         $ROW = $this->admin_model->db_page_select($page_id);
         if ($ROW[0]['STATUS'] != "OK") {
             add_msg("ERROR", "There was an error loading the Page. Please try again later. ");
             return;
         }
         // No rows found
         if ($ROW[0]['NROWS'] == 0) {
             add_msg("ERROR", "No Pages found! <br />Click on <strong>Add Page</strong> to create a one.");
             return;
         }
     }
     $disabled = "";
     // Setup display parameters
     switch ($mode) {
         case "ADD":
             $_do = "add";
             break;
         case "EDIT":
             $_do = "save";
             break;
         case "DELETE":
             $_do = "remove";
             $disabled = "disabled";
             break;
         case "VIEW":
         default:
             $disabled = "disabled";
             break;
     }
     $this->data['rows'] = $ROW;
     $this->load->view('admin/html/header', $this->data);
     $this->load->view('admin/html/topbar', $this->data);
     $this->load->view('admin/html/leftnav', $this->data);
     $this->load->view('admin/page/record', $this->data);
     $this->load->view('admin/html/footer', $this->data);
     LOG_MSG('INFO', "go_page_view(): END");
 }