예제 #1
0
/**
 * Prints arbitrary data from the image object
 *
 * @param string $field the field name of the data desired
 * @param string $label text to label the field.
 * @author Ozh
 */
function printImageData($field, $label = '')
{
    global $_zp_current_image;
    $text = getImageData($field);
    if (!empty($text)) {
        echo html_encodeTagged($label . $text);
    }
}
<?php

//Include database connection details
require_once 'system-db.php';
require_once 'sqlfunctions.php';
start_db();
try {
    $imageid = getImageData("image", 100, 100);
} catch (Exception $e) {
    $errmsg_arr[] = $e->getMessage();
}
//Array to store validation errors
$errmsg_arr = array();
//Validation error flag
$errflag = false;
//Sanitize the POST values
$fname = clean($_POST['fname']);
$lname = clean($_POST['lname']);
$password = clean($_POST['password']);
$cpassword = clean($_POST['cpassword']);
$email = clean($_POST['email']);
$cemail = clean($_POST['confirmemail']);
$customerid = clean($_POST['customerid']);
$mobile = "";
//Input Validations
if ($fname == '') {
    $errmsg_arr[] = 'First name missing';
    $errflag = true;
}
if ($lname == '') {
    $errmsg_arr[] = 'Last name missing';
예제 #3
0
파일: image.php 프로젝트: eyalfyber/zpbase
    ?>
</div>
					<?php 
    if (function_exists('printGoogleMap')) {
        ?>
<div id="map-wrap"><?php 
        printGoogleMap('Google Map', null, 'hide');
        ?>
</div><?php 
    }
    ?>
					<?php 
    if (getImageData('copyright')) {
        ?>
<p class="image-copy"><?php 
        echo getImageData('copyright');
        ?>
</p><?php 
    }
    ?>
					
					<?php 
    if (getOption('zpbase_archive')) {
        $singletag = getTags();
        $tagstring = implode(', ', $singletag);
        if (strlen($tagstring) > 0) {
            ?>
					<div class="block"><?php 
            echo gettext('Tags: ');
            printTags('links', '', 'taglist', ', ');
            ?>
예제 #4
0
}
if (isset($_POST['dataTypeA'])) {
    getAudioData($data);
}
//if audioRecordings
if (isset($_POST['dataTypeI'])) {
    getImageData($data);
}
//end if images
if (isset($_POST['dataTypeS'])) {
    getScalarData($data);
}
//end if scalardata
if (!isset($_POST['dataTypeA']) && !isset($_POST['dataTypeI']) && !isset($_POST['dataTypeS'])) {
    getAudioData($data);
    getImageData($data);
    getScalarData($data);
}
function getAudioData($data)
{
    $sqlA = 'select audio_recordings.recording_id ,audio_recordings.sensor_id ,audio_recordings.date_created ,audio_recordings.length, audio_recordings.description, 			audio_recordings.recorded_data , sensors.location
		from audio_recordings, subscriptions, sensors	
		where subscriptions.person_id = ' . $_SESSION['person_id'] . '
		and subscriptions.sensor_id = sensors.sensor_id
		and audio_recordings.sensor_id = subscriptions.sensor_id ';
    if ($data['location'] != '') {
        $sqlA = $sqlA . 'and sensors.location = \'' . $data['location'] . '\' ';
    }
    if (sizeof($data['keywords']) > 0) {
        //check all keywords
        foreach ($data['keywords'] as $keyword) {
예제 #5
0
        $typeId = intval($_GET['type']);
    }
    // сессия - typeId
    if (stripos($_SERVER['REQUEST_URI'], 'APimageViewer')) {
        $_SESSION['adminImgTypeId'] = $typeId;
    }
    $gameId = -1;
    if (isset($_GET['game'])) {
        $gameId = intval($_GET['game']);
    }
    // сессия - gameId
    if (stripos($_SERVER['REQUEST_URI'], 'APimageViewer')) {
        $_SESSION['adminImgGameId'] = $gameId;
    }
    // сбор инфы из бд
    $imageData = getImageData($typeId, $gameId);
    ?>

    <script>
        changeActiveAdminButton('imageViewerButton');
    </script>

    <script>
        function loadViewerData(type, game)
        {
            $('#dataContainer').load('APimageViewer.php?type=' + type + '&game=' + game);
        }
        
        function setSelectedIndexInSelector(selector, selectedData)
        {
            var selector = document.getElementById(selector); 
예제 #6
0
 public function insert()
 {
     try {
         $qry = "INSERT INTO " . $this->table . " (";
         $first = true;
         foreach ($this->columns as $col) {
             if ($col['bind']) {
                 if ($first) {
                     $first = false;
                 } else {
                     $qry = $qry . ", ";
                 }
                 $qry = $qry . $col['name'];
             }
         }
         $qry = $qry . ", metacreateddate, metacreateduserid, metamodifieddate, metamodifieduserid) VALUES (";
         $first = true;
         foreach ($this->columns as $col) {
             if ($col['bind']) {
                 if ($first) {
                     $first = false;
                 } else {
                     $qry = $qry . ", ";
                 }
                 if ($col['type'] == "IMAGE") {
                     $qry = $qry . "'" . getImageData($col['name']) . "'";
                 } else {
                     if ($col['type'] == "FILE") {
                         $qry = $qry . "'" . getFileData($col['name']) . "'";
                     } else {
                         if ($col['type'] == "PASSWORD") {
                             $qry = $qry . "'" . md5($_POST[$col['name']]) . "'";
                         } else {
                             if ($col['type'] == "CHECKBOX") {
                                 $qry = $qry . (isset($_POST[$col['name']]) ? $_POST[$col['name']] == "on" ? 1 : 0 : 0);
                             } else {
                                 if (isset($_POST[$col['name']])) {
                                     if ($col['datatype'] == "timestamp" || $col['datatype'] == "") {
                                         $mysql_date = convertStringToDate($_POST[$col['name']]);
                                         $mysql_time = $_POST[$col['name'] . "_time"];
                                         $qry = $qry . "'" . mysql_escape_string($mysql_date) . " {$mysql_time}'";
                                     } else {
                                         if ($col['datatype'] == "date") {
                                             $mysql_date = convertStringToDate($_POST[$col['name']]);
                                             $qry = $qry . "'" . mysql_escape_string($mysql_date) . "'";
                                         } else {
                                             $qry = $qry . "'" . mysql_escape_string($_POST[$col['name']]) . "'";
                                         }
                                     }
                                 } else {
                                     if ($col['default'] == "TODAY") {
                                         $qry = $qry . "NOW()";
                                     } else {
                                         if ($col['default'] == "USER") {
                                             $qry = $qry . getLoggedOnMemberID();
                                         } else {
                                             $qry = $qry . "'" . mysql_escape_string($col['default']) . "'";
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $memberid = getLoggedOnMemberID();
         $qry = $qry . ", NOW(), {$memberid}, NOW(), {$memberid})";
         $result = mysql_query($qry);
         if (!$result) {
             logError($qry . " = " . mysql_error());
         }
         $this->postInsertEvent();
     } catch (Exception $e) {
         $this->errorDescriptions[] = $e->getMessage();
     }
 }
예제 #7
0
<?php

define("UPLOAD_DIR", "uploads/");
if (isset($_POST["file"])) {
    $file_base64 = $_POST["file"];
    $decoded = getImageData($file_base64);
    $name = generate_name($decoded);
    $path = UPLOAD_DIR . $name;
    $wasWritten = file_put_contents($path, $decoded);
    if ($wasWritten === false) {
        error("File wasn't written");
    }
    chmod($path, 0644);
    echo getSavedImageUrl($path);
} else {
    error("No files provided");
}
function generate_name($data)
{
    $fileType = getFileType($data);
    $base = "temp";
    if (isset($_POST["guid"])) {
        $base = $_POST["guid"];
    }
    $date = new DateTime();
    $timestamp = $date->getTimestamp();
    return $base . "-" . $timestamp . $fileType;
}
function getImageData($file_base64)
{
    $file_base64_extracted = preg_replace('#^data:image/\\w+;base64,#i', '', $file_base64);