예제 #1
0
파일: admin.php 프로젝트: mrj0909/sf
 public function edit_content($edit_id)
 {
     if (!$edit_id) {
         show_404();
         exit;
     }
     if ($this->input->post('add')) {
         $this->content_model->update_content($edit_id);
         #code for image upload
         $filename = $_FILES['c_image']['name'];
         $extention = $this->uploadimages->getExtension($filename);
         $imageError = $this->uploadimages->isValidImg($extention);
         $imageName = '';
         if (empty($imageError)) {
             $baseName = basename($edit_id . "." . $extention);
             $target_path = dirname(BASEPATH) . '/assets/uploads/images/page_contents/' . $baseName;
             $temp = move_uploaded_file($_FILES['c_image']['tmp_name'], $target_path);
             $imageName = $baseName;
             updateImage($edit_id, $imageName);
         }
         $this->session->set_flashdata('message', '<div class="message success"><p>Content Update successfully</p></div>');
         redirect('admin/contents/');
     }
     $data['edit_data'] = $this->content_model->get_content($edit_id);
     $data['page'] = "contents";
     $this->load->view('admin/edit_contents.html', $data);
 }
예제 #2
0
                } else {
                    if ($_FILES['profile']['size'] > 1000000) {
                        // 1MB limitation
                        $ret = HandleResponse::badRequestReturn("Image is too big");
                    } else {
                        $fp = fopen($_FILES["profile"]["tmp_name"], "rb");
                        // name=image
                        $imgdat = fread($fp, filesize($_FILES["profile"]["tmp_name"]));
                        fclose($fp);
                        if ($imgdat != null) {
                            // Image Check
                            if (!ImageUtil::isSupport($imgdat)) {
                                $ret = HandleResponse::badRequestReturn("Invalid image(please upload png or jpg");
                            } else {
                                // Save Image
                                $ret = updateImage($conn, $user_id, $imgdat);
                            }
                        }
                    }
                }
            }
            mysqli_query($conn, "commit");
        } catch (Exception $e) {
            mysqli_query($conn, "rollback");
            $ret = HandleResponse::badRequestReturn($e->getMessage());
        }
        print json_encode($ret);
    }
} else {
    // NOT POST request
    http_response_code(404);
예제 #3
0
    }
    if (is_null($result[0]['contactWebsite']) || empty($result[0]['contactWebsite'])) {
        $result[0]['contactWebsite'] = "Not provided. Please update contact.";
    }
    if (is_null($result[0]['contactNotes']) || empty($result[0]['contactNotes'])) {
        $result[0]['contactNotes'] = "Not provided. Please update contact.";
    }
    //output currently store profile information for user review before updating
    echo "<div class='indUpdate'>\n        <h1>Your Current Contact Profile:</h1>\n        <div class='updateImg'>\n            <h3>Contact Picture:</h3>\n            <img src='{$result[0]['contactImage']}'/>\n        </div>\n        <div class='updateInfo'>\n            <h3>Conact Information:</h3>\n            <h1>{$result[0]['firstname']} {$result[0]['lastname']}</h1>\n            <h3><span>Phone:</span> {$result[0]['contactPhone']}</h3>\n            <h3><span>Primary Email:</span> {$result[0]['contactEmail']}</h3>\n            <h3><span>Other Email:</span> {$result[0]['altEmail']}</h3>\n            <h3><span>Website:</span> {$result[0]['contactWebsite']}</h3>\n            <h3><span>Notes:</span> {$result[0]['contactNotes']}</h3>\n        </div>\n    </div>";
}
//on submit logic
if (isset($_POST['submit'])) {
    $fname = $_POST['first_name'];
    $lname = $_POST['last_name'];
    $phone = $_POST['phone'];
    $primeEml = $_POST['prim_email'];
    $otherEml = $_POST['other_email'];
    $website = $_POST['website'];
    $notes = $_POST['comments'];
    //calls the update image function on submit
    $img = updateImage();
    //creates confirmaiton session message on post
    $_SESSION["message"] = "<div class='confirmed'><h4>Update Successful!</h4></div>";
    //calls update function on any inputed data to form
    databaseUpdate($fname, $lname, $phone, $primeEml, $otherEml, $website, $notes, $img);
    //returns user to index.php page
    header("Location: index.php");
}
echo "\n<!doctype html>\n<html lang='en'>\n<head>\n    <meta charset='UTF-8'>\n    <title>Contact Dashboard</title>\n    <link rel='stylesheet' href='css/normalize.css'>\n    <link rel='stylesheet' href='css/style.css'>\n</head>\n<body>\n<nav>\n    <h1>iForget Contact Manager</h1>\n    <a href='index.php'><button id='cancel'>Cancel</button></a>\n    <button id='showTog2'>Update Contact</button>\n</nav>\n<aside class='showForm'>\n    <div id='formSection'>\n        <h4>Update Contact</h4>\n        <form action='' enctype='multipart/form-data' method='post'>\n            <label for='first_name'>First Name : </label><input id='first_name' type='text' name='first_name' value='' /><br/>\n            <label for='last_name'>Last Name : </label><input  id='last_name' type='text' name='last_name' value='' /><br />\n            <label for='phone'>Phone : XXX-XXX-XXXX </label><input id='phone' type='tel' name='phone' value='' maxlength='20' /><br />\n            <label for='prim_email'>Primary Email : </label><input id='prim_email' type='email' name='prim_email' value='' /><br />\n            <label for='other_email'>Other Email : </label><input id='other_email' type='email' name='other_email' value='' /><br />\n            <label for='website'>Web Site: </label><input id='website' type='url' name='website' value='' /><br />\n            <label for='notes'>Notes:</label><br /><textarea name='comments' id='notes'   maxlength='150'></textarea><br />\n            <label for='img_upload'>Upload Image: </label><input id='img_upload' type='file' name='img_upload' value='upload' /><br />\n            <input type='submit' name='submit' value='submit' />\n            <input type='reset' name='reset' value='reset'' />\n        </form>\n    </div>\n</aside>\n<div class='instructions'>\n    <h1>Update Contacts.<br></h1>\n    <h2>Update your contacts.</h2>\n    <h2>Update whatever field you like.</h2>\n    <h3>Click the update contact button to get started.</h3>\n\n</div>\n\n<section id='update'>";
updateContacts();
echo "</section>\n<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js'></script>\n<script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js'></script>\n<script language='JavaScript' type='text/javascript' src='js/scripts.js'></script>\n</body>\n</html>\n";
예제 #4
0
파일: images.php 프로젝트: gw-acadtech/VCL
function submitEditImage()
{
    $data = getContinuationVar();
    updateImage($data);
    viewImages();
}
예제 #5
0
//print_r($config);
$arrayUser = initArrayUser();
if (isset($_GET['action'])) {
    $action = $_GET['action'];
} else {
    $action = 'select';
}
switch ($action) {
    case 'update':
        // 		die("esto es update");
        //ob_start();
        if ($_POST) {
            //Leer el array
            $arrayUser = readUsersFromFile($config['filename']);
            //Modificar el usuario segun ID
            $imageName = updateImage($_FILES);
            //print_r($arrayUser);
            $arrayUser[$_GET['id']] = implode('|', $_POST);
            //Escrivir todo el array en un archivo
            updateToFile($imageName, $_GET['id']);
        } else {
            $arrayUser = readUser($_GET['id']);
            echo "<pre>";
            print_r($arrayUser);
            echo "</pre>";
        }
        //$content=ob_get_flush();
        //ob_end_clean();
    //$content=ob_get_flush();
    //ob_end_clean();
    case 'insert':
예제 #6
0
require_once 'engine/init.php';
include 'layout/overall/header.php';
protect_page();
admin_only($user_data);
// start
// Delete
if (isset($_POST['delete'])) {
    $data = explode(":", $_POST['delete']);
    echo 'Image ' . $data[0] . ' deleted.';
    updateImage($data[0], 3);
}
// Accept
if (isset($_POST['accept'])) {
    $data = explode(":", $_POST['accept']);
    echo 'Image ' . $data[0] . ' accepted and is now public.';
    updateImage($data[0], 2);
}
// Wether we accept or delete, re-create the cache
if (isset($_POST['accept']) || isset($_POST['delete'])) {
    $cache = new Cache('engine/cache/gallery');
    $images = fetchImages(2);
    if ($images != false) {
        $data = array();
        foreach ($images as $image) {
            $row['title'] = $image['title'];
            $row['desc'] = $image['desc'];
            $row['date'] = $image['date'];
            $row['image'] = $image['image'];
            $data[] = $row;
        }
    } else {
예제 #7
0
$place = $_POST['place'];
$date = $_POST['image_date'];
$description = $_POST['description'];
if (strtolower($_POST['permission']) == 'public') {
    $groupID = "1";
} else {
    if (strtolower($_POST['permission']) == 'private') {
        $groupID = "2";
    } else {
        $groupID = $_POST['groupID'];
    }
}
// Update all the images selected by the user
if (isset($_POST['check_list1'])) {
    foreach ($_POST['check_list1'] as $check) {
        updateImage($newDB, $check, $subject, $place, $date, $description, $groupID);
    }
} else {
    $_SESSION['autherror'] = 'notchecked';
    header("Location: ../display/update.php");
    exit;
}
$_SESSION['check_list1'] = '';
$_SESSION['success'] = 'successupdate';
header("Location: ../display/display.php");
$newDB->disconnect();
exit;
// Update the database record for the image with the new descriptive information
function updateImage($db, $photo_id, $subject, $place, $date, $description, $groupID)
{
    $sql = 'UPDATE images SET permitted = :permitted, subject = :subject, place = :place, timing = TO_DATE(:datetime, \'MM/DD/YYYY\'), description = :description WHERE photo_id = :image_id';