Example #1
0
function insertGameData()
{
    $sql = "INSERT INTO `ca_letterTime`(`letter`, `duration`) VALUES (:letter,:time)";
    $namedParameters = array();
    $namedParameters[':letter'] = $_GET['letter'];
    $namedParameters[':time'] = $_GET['time'];
    insertRecord($sql, $namedParameters);
}
function readFromFile($conn, $fname, $dryrun)
{
    //This is my function to read from the csv file.
    if ($dryrun) {
        fwrite(STDOUT, "\n[DRYRUN: Reading from file (\"" . $fname . "\")]");
    } else {
        fwrite(STDOUT, "\n[Reading from file (\"" . $fname . "\") and Inserting into DB]");
    }
    $file = fopen($fname, "r");
    //Open the file.
    $firstLine = true;
    //We don't need the first line (it's the headers).
    while (!feof($file)) {
        //While we are not at the end of the file...
        if ($firstLine) {
            $firstLine = false;
            fgetcsv($file);
            //Read in the first line and don't do anything with it.
        } else {
            $person = fgetcsv($file);
            //Read in all details.
            $name = cleanString($person[0]);
            //Clean the string.
            $surname = cleanString($person[1]);
            //Clean the string.
            $email = trim(strtolower($person[2]));
            //trim trims whitespace, strtolower puts the string to lowercase.
            $emailFlag = filter_var($email, FILTER_VALIDATE_EMAIL);
            //Use php's function for checking valid emails.
            if ($emailFlag) {
                //If it's a valid email...
                if (!$dryrun) {
                    //If we are not on a dry run, we have access to the DB.
                    insertRecord($conn, $name, $surname, $email);
                    //Call function to insert.
                } else {
                    fwrite(STDOUT, "\nPerson: " . $name . " " . $surname . " (" . $email . ")");
                }
            } else {
                //If email isn't valid, tell the user.
                fwrite(STDOUT, "\n[ERROR]: The supplied email address, \"" . $email . "\", is invalid");
            }
        }
    }
    fclose($file);
    //Close the file after we are done.
}
Example #3
0
function elementoEquipaInsert($fields)
{
    unset($fields['id_elemento_equipa']);
    $fields['id_elemento_equipa'] = insertRecord('elementos_equipas', $fields, true);
}
Example #4
0
function modifrepInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("modifrep", $fields, true);
}
Example #5
0
function add_link($in)
{
    // establish whether the required variables are all present
    $precondition = array("url", "cap", "cat");
    $required_vars_are_present = checkVarsPresent($in, $precondition);
    if ($required_vars_are_present) {
        $results = insertRecord($in);
    } else {
        $results = [];
        $results["meta"]["ok"] = false;
        $results["meta"]["status"] = 400;
        $results["meta"]["msg"] = "Bad Request";
        $results["meta"]["feedback"] = "That request doesn't appear to have all the necessary fields for it to work.";
        $results["meta"]["developer"] = "See the required and received fields in json metadata to evaluate what was omitted.";
        $results["meta"]["received"] = $in;
        $results["meta"]["required"] = $precondition;
    }
    return $results;
}
Example #6
0
// load vars
$item_id = trim($_POST["item_id"]);
$coord_x1 = trim($_POST["coord_x1"]);
$coord_y1 = trim($_POST["coord_y1"]);
$coord_x2 = trim($_POST["coord_x2"]);
$coord_y2 = trim($_POST["coord_y2"]);
$width = trim($_POST["width"]);
$height = trim($_POST["height"]);
// verify if a row is already there in type_map for given item_id
$map_result = fetchSimpleTotal("sale_maps", "sales_id = " . $item_id);
// if not there yet, add it, else update
if ($map_result == 0) {
    // insert the item into [sale_maps]
    $sql_fields = "sales_id, coord_x1, coord_y1, coord_x2, coord_y2, width, height, date_modified";
    $sql_values = "'" . $item_id . "', '" . $coord_x1 . "', '" . $coord_y1 . "', '" . $coord_x2 . "', '" . $coord_y2 . "', '" . $width . "', '" . $height . "', NOW()";
    $image_id = insertRecord("sale_maps", $sql_fields, $sql_values, TRUE);
} else {
    // update item in [sale_maps]
    $sql = "UPDATE sale_maps SET ";
    $sql .= "coord_x1 = " . $coord_x1 . ", ";
    $sql .= "coord_y1 = " . $coord_y1 . ", ";
    $sql .= "coord_x2 = " . $coord_x2 . ", ";
    $sql .= "coord_y2 = " . $coord_y2 . ", ";
    $sql .= "width = " . $width . ", ";
    $sql .= "height = " . $height . ", ";
    $sql .= "date_modified = NOW() ";
    $sql .= "WHERE sales_id = '" . $item_id . "' ";
    $sqlConn->Execute($sql);
}
// Send back to edit page on #map anchor
header("Location: sales_edit.php?action=edit&result=update&item_id=" . $item_id . "#map");
Example #7
0
function recheioInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("pp_recheio", $fields, true);
}
Example #8
0
    }
    if ($mb_forbid_pattern != "") {
        if (preg_match($mb_forbid_pattern, $body)) {
            if (!preg_match($mb_forbid_except_pattern, $body)) {
                $body = "";
            }
        }
    }
    if ($body != "") {
        $fields = array("board", "created", "author", "body");
        $values = array("\"{$mb_board}\"", "now()", "\"{$author}\"", "\"{$body}\"");
        if ($mb_fld_subject != "") {
            $fields[] = $mb_fld_subject;
            $values[] = "\"{$subject}\"";
        }
        if (insertRecord($mb_table, $fields, $values)) {
            ?>
					<div style="<?php 
            echo $style1;
            ?>
">
					<div style="<?php 
            echo $style2;
            ?>
"><b>Info</b></div>
					<?php 
            echo $mb_posted_msg;
            ?>
					</div>
					<br>
				<?php 
// load vars
$item_id = trim($_POST["item_id"]);
$coord_x1 = trim($_POST["coord_x1"]);
$coord_y1 = trim($_POST["coord_y1"]);
$coord_x2 = trim($_POST["coord_x2"]);
$coord_y2 = trim($_POST["coord_y2"]);
$width = trim($_POST["width"]);
$height = trim($_POST["height"]);
// verify if a row is already there in type_map for given item_id
$map_result = fetchSimpleTotal("activity_maps", "activities_id = " . $item_id);
// if not there yet, add it, else update
if ($map_result == 0) {
    // insert the item into [activity_maps]
    $sql_fields = "activities_id, coord_x1, coord_y1, coord_x2, coord_y2, width, height, date_modified";
    $sql_values = "'" . $item_id . "', '" . $coord_x1 . "', '" . $coord_y1 . "', '" . $coord_x2 . "', '" . $coord_y2 . "', '" . $width . "', '" . $height . "', NOW()";
    $image_id = insertRecord("activity_maps", $sql_fields, $sql_values, TRUE);
} else {
    // update item in [activity_maps]
    $sql = "UPDATE activity_maps SET ";
    $sql .= "coord_x1 = " . $coord_x1 . ", ";
    $sql .= "coord_y1 = " . $coord_y1 . ", ";
    $sql .= "coord_x2 = " . $coord_x2 . ", ";
    $sql .= "coord_y2 = " . $coord_y2 . ", ";
    $sql .= "width = " . $width . ", ";
    $sql .= "height = " . $height . ", ";
    $sql .= "date_modified = NOW() ";
    $sql .= "WHERE activities_id = '" . $item_id . "' ";
    $sqlConn->Execute($sql);
}
// Send back to edit page on #map anchor
header("Location: activities_edit.php?action=edit&result=update&item_id=" . $item_id . "#map");
Example #10
0
 }
 // insert the item into [rentals], and return item_id
 $sql_fields = "locations_id, name, code, type, is_featured, highlights_en, highlights_fr, highlights_es, address, \r\n\t\t               rooms, sleeps, has_internet, has_longstay, has_safe, size_m2, \r\n\t\t\t       size_f2, has_pool, pool_type, has_smoking, has_animals, distance_beach, beds, beds_details_en, beds_details_fr, \r\n\t\t\t       beds_details_es, bathrooms, bathrooms_details, has_bbq, has_lastminute, price_low, price_medium, price_high, price_vacation, \r\n\t\t\t       price_long_stay, has_promotion, price_promotion, deadline_promotion, google_map, online, rank, date_created, date_modified, project_id";
 $sql_values = "'" . magicAddSlashes($locations_id) . "',\r\n\t\t\t       '" . magicAddSlashes($name) . "', \r\n\t\t\t       '" . magicAddSlashes($code) . "', \r\n\t\t\t       '" . magicAddSlashes($type) . "', \r\n\t\t\t       '" . magicAddSlashes($is_featured) . "',  \r\n\t\t\t       '" . magicAddSlashes($highlights_en) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_fr) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_es) . "', \r\n\t\t\t       '" . magicAddSlashes($address) . "', \r\n\t\t\t       '" . magicAddSlashes($rooms) . "', \r\n\t\t\t       '" . magicAddSlashes($sleeps) . "', \r\n\t\t\t       '" . magicAddSlashes($has_internet) . "', \r\n\t\t\t       '" . magicAddSlashes($has_longstay) . "', \r\n\t\t\t       '" . magicAddSlashes($has_safe) . "', \r\n\t\t\t       '" . magicAddSlashes($size_m2) . "', \r\n\t\t\t       '" . magicAddSlashes($size_f2) . "', \r\n\t\t\t       '" . magicAddSlashes($has_pool) . "', \r\n\t\t\t       '" . magicAddSlashes($pool_type) . "', \r\n\t\t\t       '" . magicAddSlashes($has_smoking) . "', \r\n\t\t\t       '" . magicAddSlashes($has_animals) . "', \r\n\t\t\t       '" . magicAddSlashes($distance_beach) . "', \r\n\t\t\t       '" . magicAddSlashes($beds) . "', \r\n\t\t\t       '" . magicAddSlashes($beds_details_en) . "', \r\n\t\t\t       '" . magicAddSlashes($beds_details_fr) . "', \r\n\t\t\t       '" . magicAddSlashes($beds_details_es) . "', \r\n\t\t\t       '" . magicAddSlashes($bathrooms) . "', \r\n\t\t\t       '" . magicAddSlashes($bathrooms_details) . "', \r\n\t\t\t       '" . magicAddSlashes($has_bbq) . "', \r\n\t\t\t\t   '" . magicAddSlashes($has_lastminute) . "', \r\n\t\t\t       '" . magicAddSlashes($price_low) . "', \r\n\t\t\t       '" . magicAddSlashes($price_medium) . "', \r\n\t\t\t       '" . magicAddSlashes($price_high) . "', \r\n\t\t\t       '" . magicAddSlashes($price_vacation) . "', \r\n\t\t\t       '" . magicAddSlashes($price_long_stay) . "', \r\n\t\t\t       '" . magicAddSlashes($has_promotion) . "', \r\n\t\t\t       '" . magicAddSlashes($price_promotion) . "', \r\n\t\t\t       '" . magicAddSlashes($deadline_promotion) . "', \r\n\t\t\t       '" . magicAddSlashes($google_map) . "', \r\n\t\t\t       '" . magicAddSlashes($online) . "', \r\n\t\t\t       '" . intval($db_rank) . "', \r\n\t\t\t       NOW(), \r\n\t\t\t       NOW(),\r\n\t\t\t\t   " . intval($project_id);
 $item_id = insertRecord("rentals", $sql_fields, $sql_values, TRUE);
 $estampa_large = imagecreatefrompng(FILES_PATH . 'logo_large.png');
 $estampa_medium = imagecreatefrompng(FILES_PATH . 'logo_medium.png');
 $estampa_thumbs = imagecreatefrompng(FILES_PATH . 'logo_thumbs.png');
 $rankImage = 1;
 // put file in DB, and place file in directory, if uploaded
 foreach ($file_image["name"] as $key => $name_file) {
     if ($name_file != "") {
         // insert the item into [news_images], and return photo_id
         $sql_fields = "rentals_id, image, rank, date_created, date_modified";
         $sql_values = "'" . magicAddSlashes($item_id) . "', '', '" . $rankImage . "', NOW(), NOW()";
         $photo_id = insertRecord("rental_photos", $sql_fields, $sql_values, TRUE);
         $rankImage++;
         // clean up filenames
         $filename = $name_file;
         $filename = $item_id . "_" . $photo_id . "_" . $filename;
         $filename = cleanData($filename);
         /// include auto cropper, to limit photo filesize
         include_once $path_to_dynamik . "auto_cropper.inc.php";
         // full - save the new (cropped) image to the folder
         $crop = new autoCropper(imagecreatefromjpeg($file_image["tmp_name"][$key]), FILES_PATH . FILES_RENTALS_LARGE . $filename, IMG_RENTALS_LARGE_WIDTH, IMG_RENTALS_LARGE_HEIGHT, IMG_RENTALS_LARGE_FIXED, 100, array(255, 255, 255));
         $crop->processImage();
         // chmod the file
         @chmod(FILES_PATH . FILES_RENTALS_LARGE . $filename, 0777);
         // Watermark large
         $margen_dcho = 0;
         $margen_inf = 0;
/**
 * call back function of classEmailProcessor
 *
 * @param mixed $email
 * @return true - then classEmailProcessor may remove this email
 */
function add_email_as_record($email)
{
    global $emails_processed, $emails_failed, $attachment_size_max, $sys_sender, $ownership, $oldFileArray;
    $emails_processed++;
    $description = $email->getBody();
    $rec_id = null;
    /* use UNIX-style lines
    		$description=str_replace("\r\n", "\n", $description);
    		$description=str_replace("\r", "\n", $description);
    		*/
    /*****DEBUG****/
    //error_log(">>>desc:".$description);
    $description = str_replace("\r\n", "", $description);
    $description = str_replace("\r", "", $description);
    $arr = json_decode($description, true);
    /*****DEBUG****/
    //error_log("arr=>>>>".is_array($arr)."  ".count($arr)."  ".print_r($arr, true));
    // assume all id (rtID, dtID, trmID and ontID) are all concept ids (dbID - ID)
    // get rectype concept id and  convert to local id or notes
    // for each detail type: convert to local ids
    //if type is file the save Attachment first
    //if type is enum then convert term ID to local
    // for any id that doesn't convert, save info in scratch in record.
    if (is_array($arr) && count($arr) > 2) {
        //this is from export record from another heurist instance
        $key_file = null;
        //id of field type for assoc files (attachments)
        $arrnew = array();
        //convert all global id to local id
        foreach ($arr as $key => $value) {
            $pos = strpos($key, "type:");
            /*****DEBUG****/
            error_log(">>>> " . (is_numeric($pos) && $pos == 0) . "    " . $pos);
            if (is_numeric($pos) && $pos == 0) {
                //@todo we have to convert the content of fields as well -
                // since it may contain terms and references to other rectypes !!!1
                $typeid = substr($key, 5);
                // temporay code to translate existing reports
                switch ($typeid) {
                    case "2-221":
                    case "68-221":
                        $typeid = DT_BUG_REPORT_FILE;
                        $oldFileArray = true;
                        break;
                    case "2-179":
                    case "68-179":
                        $typeid = DT_BUG_REPORT_NAME;
                        break;
                    case "2-303":
                    case "68-303":
                        $typeid = DT_BUG_REPORT_DESCRIPTION;
                        break;
                    case "2-560":
                    case "68-560":
                        $typeid = DT_BUG_REPORT_STEPS;
                        break;
                    case "2-725":
                    case "68-725":
                        $typeid = DT_BUG_REPORT_STATUS;
                        break;
                }
                $newkey = getDetailTypeLocalID($typeid);
                /*****DEBUG****/
                error_log(">>>> " . $newkey . "  dettype=" . $typeid);
                $value = str_replace("&#13;", "\n", $value);
                if ($newkey) {
                    $arrnew["type:" . $newkey] = $value;
                    if ($newkey == DT_FILE_RESOURCE) {
                        $key_file = "type:" . $newkey;
                    }
                } else {
                    $email->setErrorMessage("Can't find the local id for fieldtype #" . $typeid);
                    $key_file = null;
                    //avoid processing attachments
                    break;
                }
            } else {
                $arrnew[$key] = $value;
            }
        }
        //for
        $rectype = $arr["rectype"];
        switch ($rectype) {
            case "2-216":
            case "68-216":
                $rectype = RT_BUG_REPORT;
        }
        $newrectype = getRecTypeLocalID($rectype);
        if ($newrectype) {
            $arrnew["rectype"] = $newrectype;
            if ($rectype == RT_BUG_REPORT) {
            }
        } else {
            $email->setErrorMessage("Can't find the local id for rectype #" . $_POST["rectype"]);
            $key_file = null;
            //avoid processing attachments
            exit;
        }
        /*****DEBUG****/
        //error_log("KEY FILE ".$key_file);
        //assosiated files
        if ($key_file) {
            $files_arr = $arrnew[$key_file];
            if ($files_arr && count($files_arr) > 0) {
                /*****DEBUG****/
                //error_log(">>>>files_arr=".print_r($files_arr[0], true));
                $arrnew[$key_file] = saveAttachments($files_arr, $email);
                if ($arrnew[$key_file] == 0) {
                    return false;
                }
            } else {
                unset($arrnew[$key_file]);
            }
        }
        /*$bug_descr = $arrnew["type:".DT_BUG_REPORT_DESCRIPTION];
        		if($bug_descr){
        			$bug_descr = str_replace("<br>","\n",$bug_descr);
        			$arrnew["type:".DT_BUG_REPORT_DESCRIPTION] = $bug_descr;
        		}*/
        /*****DEBUG****/
        //error_log(">>>>ARRAY=".print_r($arrnew, true));
        $_POST = $arrnew;
        $statusKey = getDetailTypeLocalID(DT_BUG_REPORT_STATUS);
        /*****DEBUG****/
        //error_log("status key ".print_r($statusKey,true));
        if ($statusKey) {
            $_POST["type:" . $statusKey] = array("Received");
        }
    } else {
        if (defined('RT_NOTE')) {
            // this is from usual email - we will add email rectype
            //error_log(" in emailProccesor as Note");
            // liposuction away those unsightly double, triple and quadruple spaces
            $description = preg_replace('/ +/', ' ', $description);
            // trim() each line
            $description = preg_replace('/^[ \\t\\v\\f]+|[ \\t\\v\\f]+$/m', '', $description);
            $description = preg_replace('/^\\s+|\\s+$/s', '', $description);
            // reduce anything more than two newlines in a row
            $description = preg_replace("/\n\n\n+/s", "\n\n", $description);
            //consider this message as usual email and
            $_POST["save-mode"] = "new";
            $_POST["notes"] = "";
            $_POST["rec_url"] = "";
            /* FOR EMAIL RECORD TYPE  - BUT IAN REQUIRES POST "NOTE" RECORDTYPE
            			$_POST["type:160"] = array($email->getSubject());
            			$_POST["type:166"] = array(date('Y-m-d H:i:s')); //date sent
            			$_POST["type:521"] = array($email->getFrom()); //email owner
            			$_POST["type:650"] = array($email->getFrom()); //email sender
            			$_POST["type:651"] = array("*****@*****.**"); //recipients
            			//$_POST["type:221"] = array(); //attachments
            			$_POST["type:560"] = array($description);
            
            			$_POST["rectype"]="183";  //EMAIL
            			*/
            if (defined('DT_NAME')) {
                $_POST["type:" . DT_NAME] = array($email->getSubject());
            }
            //title
            //$_POST["type:158"] = array("email harvesting"); //creator (recommended)
            if (defined('DT_DATE')) {
                $_POST["type:" . DT_DATE] = array(date('Y-m-d H:i:s'));
            }
            //specific date
            if (defined('DT_SHORT_SUMMARY')) {
                $_POST["type:" . DT_SHORT_SUMMARY] = array($email->getFrom() . " " . $description);
            }
            //notes
            $_POST["rectype"] = RT_NOTE;
            //NOTE
            $_POST["check-similar"] = "1";
            $arr = saveAttachments(null, $email);
            if ($arr == 0) {
                return false;
            } else {
                if (count($arr) > 0) {
                    if (defined('DT_FILE_RESOURCE')) {
                        $_POST['type:' . DT_FILE_RESOURCE] = $arr;
                    }
                    //array_push($_POST['type:221'], $arr);
                    /*****DEBUG****/
                    //error_log(">>>>>>>>>ARRAY>>".print_r($arr, true));
                }
            }
            /*****DEBUG****/
            //error_log(">>>>>>>>>HERE>>>>>>".print_r($_POST['type:221'],true));
        }
    }
    if ($email->getErrorMessage() == null) {
        $_POST["owner"] = get_user_id();
        $sss = $email->getFrom();
        if (is_array($sys_sender)) {
            foreach ($sys_sender as $sys_sender_email) {
                if ($sys_sender_email == $sss || strpos($sss, "<" + $sys_sender_email + ">") >= 0) {
                    $_POST["owner"] = $ownership;
                    break;
                }
            }
        }
        $_POST["visibility"] = 'hidden';
        /*****DEBUG****/
        //error_log(">>>>before insert POST=".print_r($_POST, true));
        $updated = insertRecord($_POST['rectype']);
        //from saveRecordDetails.php
        if ($updated) {
            $rec_id = $_REQUEST["recID"];
            $email->setRecId($rec_id);
        }
        /*****DEBUG****/
        //error_log("updated = $updated  recID = $rec_id ");
    }
    printEmail($email);
    //$rec_id=null;
    if ($rec_id) {
        //($rec_id){
        return true;
    } else {
        $emails_failed++;
        return false;
    }
}
Example #12
0
function modifBolosInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("pp_modif_bolos", $fields, true);
}
Example #13
0
// submit data if no form_error and for was submitted
if ($form_submit == "Y" && $form_error == "") {
    //all data checks out, can proceed with inserting / updating [activities]
    if ($action == "add") {
        // rank check - new item at top of list - others go down a rank
        if ($online == "Y") {
            $db_rank = 1;
            $sql = "UPDATE activities SET rank = rank + 1 WHERE online = 'Y' ";
            $sqlConn->Execute($sql);
        } else {
            $db_rank = 0;
        }
        // insert the item into [activities], and return item_id
        $sql_fields = "name_en, name_fr, name_es, description_en, description_fr, description_es, intro_en, intro_fr, intro_es, highlights_en, highlights_fr, \r\n\t\t\t       highlights_es, online, rank, date_created, date_modified";
        $sql_values = "'" . magicAddSlashes($name_en) . "',\r\n\t\t\t\t   '" . magicAddSlashes($name_fr) . "', \r\n\t\t\t\t   '" . magicAddSlashes($name_es) . "', \r\n\t\t\t\t   '" . magicAddSlashes($description_en) . "', \r\n\t\t\t\t   '" . magicAddSlashes($description_fr) . "', \r\n\t\t\t\t   '" . magicAddSlashes($description_es) . "', \r\n\t\t\t\t   '" . magicAddSlashes($intro_en) . "', \r\n\t\t\t\t   '" . magicAddSlashes($intro_fr) . "', \r\n\t\t\t\t   '" . magicAddSlashes($intro_es) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_en) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_fr) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_es) . "', \r\n\t\t\t       '" . magicAddSlashes($online) . "', \r\n\t\t\t       '" . intval($db_rank) . "', \r\n\t\t\t       NOW(), \r\n\t\t\t       NOW()";
        $item_id = insertRecord("activities", $sql_fields, $sql_values, TRUE);
        //echo  $item_id;
        //exit();
        /* // put file in DB, and place file in directory, if uploaded
                  if ($file_image["name"] != "") {
                  // insert the item into [news_images], and return photo_id
                  $sql_fields = "activities_id, image, rank, date_created, date_modified";
                  $sql_values = "'".magicAddSlashes($item_id)."', '', '1', NOW(), NOW()";
                  $photo_id = insertRecord("activity_photos", $sql_fields, $sql_values, TRUE);
        
                  // clean up filenames
                  $filename = $file_image["name"];
                  $filename = $item_id."_".$photo_id."_".$filename;
                  $filename = cleanData($filename);
        
                  /// include auto cropper, to limit photo filesize
function provaClassificacaoInsert($fields)
{
    unset($fields['id_classificacao']);
    $fields['id_classificacao'] = insertRecord('provas_classificacoes', $fields, true);
}
Example #15
0
function reparadorInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("reparador", $fields, true);
}
Example #16
0
function loginInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("users", $fields, true);
}
Example #17
0
function visitanteInsert(&$fields)
{
    unset($fields['id_visitante']);
    $fields['id_visitante'] = insertRecord("visitantes", $fields, true);
}
Example #18
0
    }
}
// submit data if no form_error and for was submitted
if ($form_submit == "Y" && $form_error == "") {
    //all data checks out, can proceed with inserting / updating [contacts]
    if ($action == "add") {
        // rank check - new item at top of list - others go down a rank
        if ($online == "Y") {
            $db_rank = 1;
        } else {
            $db_rank = 0;
        }
        // insert the item into [contacts], and return item_id
        $sql_fields = "name, job_es, job_en, job_fr, descr_job_es, descr_job_en, descr_job_fr, email, description_en, description_fr, description_es, online";
        $sql_values = "'" . magicAddSlashes($name) . "',\r\n\t\t\t\t   '" . magicAddSlashes($job_es) . "', \r\n\t\t\t\t   '" . magicAddSlashes($job_en) . "', \r\n\t\t\t\t   '" . magicAddSlashes($job_fr) . "', \r\n\t\t\t\t   '" . magicAddSlashes($descr_job_es) . "', \r\n\t\t\t\t   '" . magicAddSlashes($descr_job_en) . "', \r\n\t\t\t\t   '" . magicAddSlashes($descr_job_fr) . "', \r\n\t\t\t\t   '" . magicAddSlashes($email) . "', \r\n\t\t\t\t   '" . magicAddSlashes($description_en) . "', \r\n\t\t\t\t   '" . magicAddSlashes($description_fr) . "', \r\n\t\t\t\t   '" . magicAddSlashes($description_es) . "', \r\n\t\t\t       '" . magicAddSlashes($online) . "'";
        $item_id = insertRecord("contacts", $sql_fields, $sql_values, TRUE);
        // put file in DB, and place file in directory, if uploaded
        if ($file_image["name"] != "") {
            // clean up filenames
            $filename = $file_image["name"];
            $filename = $item_id . "_" . $filename;
            $filename = cleanData($filename);
            /// include auto cropper, to limit photo filesize
            include_once $path_to_dynamik . "auto_cropper.inc.php";
            // full - save the new (cropped) image to the folder
            $crop = new autoCropper(imagecreatefromjpeg($file_image["tmp_name"]), FILES_PATH . FILES_CONTACTS_LARGE . $filename, IMG_CONTACTS_LARGE_WIDTH, IMG_CONTACTS_LARGE_HEIGHT, IMG_CONTACTS_LARGE_FIXED, 100, array(255, 255, 255));
            $crop->processImage();
            // chmod the file
            @chmod(FILES_PATH . FILES_CONTACTS_LARGE . $filename, 0777);
            // medium - save the new (cropped) image to the folder
            $crop = new autoCropper(imagecreatefromjpeg($file_image["tmp_name"]), FILES_PATH . FILES_CONTACTS_MEDIUM . $filename, IMG_CONTACTS_MEDIUM_WIDTH, IMG_CONTACTS_MEDIUM_HEIGHT, IMG_CONTACTS_MEDIUM_FIXED, 100, array(255, 255, 255));
Example #19
0
function sugestaoInsert($fields)
{
    unset($fields['id_sugestao']);
    $fields['id_sugestao'] = insertRecord('sugestoes', $fields, true);
}
Example #20
0
function localInsert($fields)
{
    unset($fields['id_local']);
    $fields['id_local'] = insertRecord('locais', $fields, true);
}
Example #21
0
function massaInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("pp_massa", $fields, true);
}
Example #22
0
 }
 // insert the item into [sales], and return item_id
 $sql_fields = "locations_id, name, type, is_featured, highlights_en, highlights_fr, \r\n\t\t\t       highlights_es, address, rooms, size_m2, \r\n\t\t\t       size_f2, has_pool, pool_type, distance_beach, beds, beds_details_en, beds_details_fr, \r\n\t\t\t       beds_details_es, bathrooms, bathrooms_details, has_bbq, \r\n\t\t\t       price, has_promotion, price_promotion, deadline_promotion, google_map, online, rank, date_created, date_modified";
 $sql_values = "'" . magicAddSlashes($locations_id) . "', \r\n\t\t\t       '" . magicAddSlashes($name) . "', \r\n\t\t\t       '" . magicAddSlashes($type) . "', \r\n\t\t\t       '" . magicAddSlashes($is_featured) . "',  \r\n\t\t\t       '" . magicAddSlashes($highlights_en) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_fr) . "', \r\n\t\t\t       '" . magicAddSlashes($highlights_es) . "', \r\n\t\t\t       '" . magicAddSlashes($address) . "', \r\n\t\t\t       '" . magicAddSlashes($rooms) . "',\r\n\t\t\t       '" . magicAddSlashes($size_m2) . "', \r\n\t\t\t       '" . magicAddSlashes($size_f2) . "', \r\n\t\t\t       '" . magicAddSlashes($has_pool) . "', \r\n\t\t\t       '" . magicAddSlashes($pool_type) . "', \r\n\t\t\t       '" . magicAddSlashes($distance_beach) . "', \r\n\t\t\t       '" . magicAddSlashes($beds) . "', \r\n\t\t\t       '" . magicAddSlashes($beds_details_en) . "', \r\n\t\t\t       '" . magicAddSlashes($beds_details_fr) . "', \r\n\t\t\t       '" . magicAddSlashes($beds_details_es) . "', \r\n\t\t\t       '" . magicAddSlashes($bathrooms) . "', \r\n\t\t\t       '" . magicAddSlashes($bathrooms_details) . "', \r\n\t\t\t       '" . magicAddSlashes($has_bbq) . "', \r\n\t\t\t       '" . magicAddSlashes($price) . "', \r\n                   '" . magicAddSlashes($has_promotion) . "',\r\n\t\t\t       '" . magicAddSlashes($price_promotion) . "', \r\n\t\t\t       '" . magicAddSlashes($deadline_promotion) . "', \r\n\t\t\t       '" . magicAddSlashes($google_map) . "', \r\n\t\t\t       '" . magicAddSlashes($online) . "', \r\n\t\t\t       '" . intval($db_rank) . "', \r\n\t\t\t       NOW(), \r\n\t\t\t       NOW()";
 $item_id = insertRecord("sales", $sql_fields, $sql_values, TRUE);
 $estampa_large = imagecreatefrompng(FILES_PATH . 'logo_large.png');
 $estampa_medium = imagecreatefrompng(FILES_PATH . 'logo_medium.png');
 $estampa_thumbs = imagecreatefrompng(FILES_PATH . 'logo_thumbs.png');
 $rankImage = 1;
 // put file in DB, and place file in directory, if uploaded
 foreach ($file_image["name"] as $key => $name_file) {
     if ($name_file != "") {
         // insert the item into [news_images], and return photo_id
         $sql_fields = "sales_id, image, rank, date_created, date_modified";
         $sql_values = "'" . magicAddSlashes($item_id) . "', '', '" . $rankImage . "', NOW(), NOW()";
         $photo_id = insertRecord("sale_photos", $sql_fields, $sql_values, TRUE);
         $rankImage++;
         // clean up filenames
         $filename = $name_file;
         $filename = $item_id . "_" . $photo_id . "_" . $filename;
         $filename = cleanData($filename);
         /// include auto cropper, to limit photo filesize
         include_once $path_to_dynamik . "auto_cropper.inc.php";
         // full - save the new (cropped) image to the folder
         $crop = new autoCropper(imagecreatefromjpeg($file_image["tmp_name"][$key]), FILES_PATH . FILES_SALES_LARGE . $filename, IMG_SALES_LARGE_WIDTH, IMG_SALES_LARGE_HEIGHT, IMG_SALES_LARGE_FIXED, 100, array(255, 255, 255));
         $crop->processImage();
         // chmod the file
         @chmod(FILES_PATH . FILES_SALES_LARGE . $filename, 0777);
         // Watermark large
         $margen_dcho = 0;
         $margen_inf = 0;
Example #23
0
function encomendasInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("pp_encomendas", $fields, true);
}
Example #24
0
function provaInsert(&$fields)
{
    unset($fields['id_prova']);
    $fields['id_prova'] = insertRecord('provas', $fields, true);
}
Example #25
0
<?php

if (isset($_GET['addForm'])) {
    //admin submitted form to add product
    include './includes/genericDataAccess.inc.php';
    $sql = "INSERT INTO oe_product ( productName, productDescription, price, categoryId) \n          VALUES ( :productName, :productDescription, :price, :categoryId)";
    $namedParameters = array();
    $namedParameters[':productName'] = $_GET['productName'];
    $namedParameters[':productDescription'] = $_GET['productDescription'];
    $namedParameters[':price'] = $_GET['price'];
    $namedParameters[':categoryId'] = $_GET['categoryId'];
    insertRecord($sql, $namedParameters);
    echo "Record has been added!";
}
?>

<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8">

		<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
		Remove this if you use the .htaccess -->
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

		<title>Add Products</title>
		<meta name="description" content="Otter Express Add Product admin page">
		<meta name="author" content="Richard Ciampa">

		<meta name="viewport" content="width=device-width; initial-scale=1.0">
		
        $rtyID = $rtyID[0];
    }
}
$TL = array();
$query = 'SELECT trm_ID, trm_Label, trm_ParentTermID, trm_OntID, trm_Code FROM defTerms';
$res = mysql_query($query);
while ($row = mysql_fetch_assoc($res)) {
    $TL[$row['trm_ID']] = $row;
}
/*****DEBUG****/
//error_log(" Save dtl Post before  ".print_r($_POST,true));
if ($_POST["save-mode"] == "edit" && intval($_POST["recID"])) {
    $updated = updateRecord(intval($_POST["recID"]), $rtyID);
} else {
    if ($_POST["save-mode"] == "new") {
        $updated = insertRecord($rtyID);
    } else {
        $updated = false;
    }
}
/*****DEBUG****/
//error_log(" Save dtl Request  ".print_r($_REQUEST,true));
/*****DEBUG****/
//error_log(" Save dtl Post  ".print_r($_POST,true));
if ($updated) {
    updateRecTypeUsageCount();
    //getRecordInfoLibrary
    // Update bib record data
    // Update recDetails, rec_ScratchPad and rec_Title in (parent.parent).HEURIST.record
    print "(";
    define("JSON_RESPONSE", 1);
Example #27
0
function modalidadeInsert($fields)
{
    unset($fields['id_modalidade']);
    $fields['id_modalidade'] = insertRecord('modalidades', $fields, true);
}
Example #28
0
function coberturaInsert($fields)
{
    #$fields['id'] = insertRecord("grep", $fields, true);
    return insertRecord("pp_cobertura", $fields, true);
}
Example #29
0
function equipaInsert(&$fields)
{
    unset($fields['id_equipa']);
    $fields['id_equipa'] = insertRecord('equipas', $fields, true);
}
Example #30
0
function delegacaoInsert($fields)
{
    unset($fields['id_delegacao']);
    $fields['id_delegacao'] = insertRecord("delegacoes", $fields, true);
}