Пример #1
0
 public function create($title, $text, $jssor = null, $meta_descr)
 {
     $art = new Article();
     $art->data['TITLE'] = $title;
     $art->data['TEXT'] = $text;
     $art->data['JSSOR'] = $jssor;
     $art->data['VANITY'] = translateToGreeklish($title);
     $art->data['METADESCRIPTION'] = $meta_descr;
     $art->data['LASTUPDATEON'] = KdObject::now();
     /**@todo this is unsafe**/
     $art->save();
     return $art->id;
 }
 public function create(array $dt)
 {
     $ev = new Event();
     $ev->data['TITLE'] = $dt['TITLE'];
     $ev->data['PLACE'] = $dt['PLACE'];
     $ev->data['EVENTDATE'] = $dt['EVENTDATE'];
     $ev->data['DESCRIPTION'] = $dt['DESCRIPTION'];
     $ev->data['EMAIL'] = $dt['EMAIL'];
     $ev->data['PLACELNGLAT'] = 'POINT(' . $dt['PLACELNGLAT'] . ')';
     $ev->data['URL'] = translateToGreeklish($dt['TITLE']);
     $ev->data['FACEBOOKID'] = $dt['FACEBOOKID'];
     $ev->data['FACEBOOKEVENTID'] = $dt['FACEBOOKEVENTID'];
     $ev->data['ACTIVE'] = '1';
     $ev->data['LASTUPDATEON'] = KdObject::now();
     $ev_result = $ev->prepared_save();
     if (!$ev_result) {
         return false;
     } else {
         return $ev->id;
     }
 }
Пример #3
0
<?php

/*Get post Parameters. Add the event. */
if (!empty($_FILES["eventImageN"]["name"])) {
    $vanity = translateToGreeklish($_POST["eventTitleN"]);
} else {
    $vanity = '';
}
$event = array('TITLE' => $_POST["eventTitleN"], 'PLACE' => $_POST["eventPlaceN"], 'EVENTDATE' => $_POST["dateSelector"], 'DESCRIPTION' => $_POST["summernote"], 'EMAIL' => $_POST["eventEmailN"], 'PLACELNGLAT' => $_POST["eventLngN"] . ' ' . $_POST["eventLatN"], 'URL' => $vanity, 'FACEBOOKID' => '', 'FACEBOOKEVENTID' => '');
$addEvent = new Event();
$ret_id = $addEvent->create($event);
/*Upload the images. */
if (!empty($_FILES["eventImageN"]["name"])) {
    $url = PHP_EOL . 'RewriteRule ^events/' . $vanity . "[/]*\$ events_dir/event_details.php?id=" . $ret_id;
    file_put_contents("../.htaccess", $url, FILE_APPEND);
    $errorMsg = "";
    $target_dir = "../resources/images/uploaded/";
    $formName = "eventImageN";
    require "../inc/uploadImage.php";
    /*Store image in the DB */
    $addImage = new Image();
    $addImage->create(basename($_FILES[$formName]["name"]), "", "/resources/images/uploaded/" . basename($_FILES[$formName]["name"]), $ret_id);
} else {
    $errorMsg = "";
}