Exemplo n.º 1
0
function updateEvent($push)
{
    $bdd = new PDO(DSN, DBUSER, DBPASS);
    require MODELES . 'functions/adresse.php';
    require MODELES . 'functions/insertMedia.php';
    require MODELES . 'functions/updateMedia.php';
    require MODELES . 'functions/removeMedia.php';
    $id_type = $push["id_type"];
    $adresse_id = insertAddress($push['adresse']);
    $media_id = NULL;
    if (!empty($push['id_media_principal'])) {
        if (!empty($push['lien_photo'])) {
            if ($push['lien_photo'] == -1) {
                unlink(PHOTO_EVENT . $push['old_lien_photo']);
                removeMedia($push['id_media_principal']);
                $media_id = NULL;
            } else {
                updateMedia($push['lien_photo'], $push['id_media_principal']);
                $media_id = $push['id_media_principal'];
            }
        }
    } else {
        if (!empty($push['lien_photo'])) {
            $media_id = insertMedia($push['lien_photo']);
        }
    }
    // insérer dans organise ou organise = coming soon
    foreach ($push as $key => $value) {
        if ($value == '') {
            $push[$key] = NULL;
        }
    }
    $updateQuery = $bdd->prepare('UPDATE 
		evenement SET 
		titre = :titre, 
		debut = :debut, 
		fin = :fin, 
		age_min = :age_min, 
		age_max = :age_max, 
		visibilite = :visibilite, 
		invitation = :invitation, 
		tarif = :tarif, 
		description = :description, 
		site = :site, 
		langue = :langue, 
		id_type = :id_type, 
		id_adresse = :id_adresse, 
		id_media_principal = :id_media_principal, 
		sponsor = :sponsor, 
		organisateur = :organisateur, 
		organisateur_contact = :organisateur_contact, 
		max_participants = :max_participants
		WHERE id = :id;');
    if ($updateQuery->execute([':titre' => $push['titre'], ':debut' => $push['date_debut'] . ' ' . $push['beginning'], ':fin' => $push['date_fin'] . ' ' . $push['end'], ':age_min' => $push['age_min'], ':age_max' => $push['age_max'], ':visibilite' => $push['visibilite'], ':invitation' => $push['invitation'], ':tarif' => $push['price'], ':description' => $push['description'], ':site' => $push['website'], ':langue' => $push['langue'], ':id_type' => $id_type, ':id_adresse' => $adresse_id, ':id_media_principal' => $media_id, ':sponsor' => $push['sponsors'], ':max_participants' => $push['max_attendees'], ':organisateur' => $push['hosts'], ':organisateur_contact' => $push['hosts_contact'], ':id' => $push['id']])) {
        return True;
    } else {
        var_dump($updateQuery->errorInfo());
        return False;
    }
}
Exemplo n.º 2
0
     $requestJSON = $_POST['requestJSON'];
 }
 //Triage the request based on ACTION
 switch ($action) {
     // Function to either create a user or create a session if exists
     case 'createSession':
         createSession($swid, $email, $login, $fName, $lName, $device);
         break;
     case 'createMedia':
         createMedia($contentItemName, $contentItemDescription, $contentItemExternalReference, $contentItemUrl, $drmKeyId, $drmKeySeed);
         break;
     case 'createSimpleMedia':
         createSimpleMedia($contentItemName, $contentItemDescription, $contentItemExternalReference, $contentItemUrl);
         break;
     case 'updateMedia':
         updateMedia($contentItemName, $contentItemDescription, $contentItemExternalReference, $contentItemUrl, $drmKeyId, $drmKeySeed, $scrubberURL, $englishCaption, $frenchCaption, $italianCaption, $germanCaption, $spanishCaption);
         break;
     case 'simpleUpdateMedia':
         simpleUpdateMedia($contentItemName, $contentItemDescription, $contentItemExternalReference, $contentItemUrl, $drmKeyId, $drmKeySeed);
         break;
     case 'createProduct':
         createProduct($productName, $productExternalReference, $englishCID, $frenchCID, $italianCID, $germanCID, $spanishCID);
         break;
     case 'createStandardProduct':
         createStandardProduct($productName, $productExternalReference, $CID);
         break;
     case 'retrieveMedia':
         retrieveMedia($contentItemExternalReference);
         break;
     case 'JSONUpdateMedia':
         JSONUpdateMedia($requestJSON);
Exemplo n.º 3
0
Arquivo: media-s3.php Projeto: rjha/sc
        break;
    }
    //we have rows to process
    foreach ($rows as $row) {
        printf("processing row id %d \n", $row['id']);
        //write a pipe that can return fileData
        $abspath = "/home/rjha/web/upload/" . $row["stored_name"];
        $uploader->process($prefix, $abspath);
        $errors = $uploader->getErrors();
        if (sizeof($errors) > 0) {
            print_r($errors);
            exit;
        } else {
            $mediaVO = $uploader->getMediaData();
            //print_r($mediaVO);
            updateMedia($mysqli, $row["id"], $mediaVO);
        }
        sleep(3);
    }
    //loop
    sleep(1);
    $count++;
    printf("loop iteration number %d \n", $count);
}
function updateMedia($mysqli, $mediaId, $mediaVO)
{
    //update m.thumbnail,m.stored_name,m.bucket,m.store
    $updateSQL = " update sc_media set thumbnail = ?,stored_name = ?,bucket = ?, store = ? where id = ? ";
    $stmt = $mysqli->prepare($updateSQL);
    $store = "s3";
    if ($stmt) {
Exemplo n.º 4
0
    $sql = " select id,images_json from sc_post where  (id <= {end}) and (id >= {start} ) ";
    $sql = str_replace(array("{end}", "{start}"), array(0 => $end, 1 => $start), $sql);
    $rows = MySQL\Helper::fetchRows($mysqli, $sql);
    foreach ($rows as $row) {
        //remove malformed utf-8 characters
        $fjson = iconv('UTF-8', 'UTF-8//IGNORE', $row['images_json']);
        $images = json_decode($fjson);
        //printf("code from json_decode is %d \n",json_last_error());
        $data = array();
        if (!empty($images)) {
            foreach ($images as $image) {
                $image->thumbnailName = Util::getThumbnailName($image->originalName);
                //printf("tname is %s \n",$image->thumbnailName);
                array_push($data, $image);
                //update sc_media.thumbnail_name
                updateMedia($mysqli, $image->id, $image->thumbnailName);
            }
            //new mediaVO
            $strMediaVO = json_encode($data);
            //push new mediaVO to sc_post
            updatePost($mysqli, $row['id'], $strMediaVO);
        } else {
            //no images case
            $strMediaVO = '[]';
            updatePost($mysqli, $row['id'], $strMediaVO);
        }
    }
    sleep(1);
    $count++;
}
function updateMedia($mysqli, $mediaId, $tname)
Exemplo n.º 5
0
    }
    return $media->getId();
}
$id = FALSE;
switch ($_POST['area']) {
    case 'category':
        $id = createCategory();
        break;
    case 'cofilter':
        $id = createCommentfilter();
        break;
    case 'comment':
        $id = updateComment();
        break;
    case 'media':
        $id = updateMedia();
        break;
    case 'page':
        $id = createPage();
        break;
    case 'post':
        $id = createPost();
        deletePost2CategoryRelations($id);
        createPost2CategoryRelations($id);
        break;
    case 'user':
        $id = createUser();
        break;
}
if ($id === FALSE) {
    ae_Log::printAll();