$log->create(); $message = "success"; } } else { $log = new Log($session->user_id, $clientip, "WEB", "CREATE SCHOOL NOT FILLED"); $log->create(); $message = "All fields are required."; } } else { if ($_POST['what'] == "batch") { if (isset($_POST['fromyear']) && $_POST['fromyear'] != "" && isset($_POST['about']) && $_POST['about'] != "") { if (strtotime(date("Y-m-d")) < strtotime($_POST['pubdate'])) { //$school = School::get_by_id($_POST['schoolselect']); $school = School::get_by_id(CSNTRID); if ($school != false && $school != null && $school != "") { if (!Batch::batch_exists($_POST['fromyear'], $school->id)) { $object = new Batch(); $object->fromyear = $_POST['fromyear']; $object->about = $_POST['about']; $object->comments = $_POST['comments']; $object->fbcomments = $_POST['fbcomments']; $object->schoolid = $school->id; $object->enabled = 1; $object->pending = 0; $object->pubdate = $_POST['pubdate']; $object->published = 0; $file = new File($_FILES['cover']); if ($file->valid) { $object->picture = $file->data; } $object->create();
<?php require_once "../initialize.php"; $message = ""; if (isset($_POST['batchid']) && $_POST['batchid'] != "" && isset($_POST['fromyear']) && $_POST['fromyear'] != "" && isset($_POST['about']) && $_POST['about'] != "") { if (strtotime(date("Y-m-d")) < strtotime($_POST['pubdate'])) { //$school = School::get_by_id($_POST['schoolselect']); $object = Batch::get_by_id($_POST['batchid']); $school = School::get_by_id(CSNTRID); if ($school != false && $school != null && $school != "") { if (!Batch::batch_exists($_POST['fromyear'], $school->id) || $object->fromyear == $_POST['fromyear']) { $file = new File($_FILES['cover']); if ($file->valid) { $object->picture = $file->data; } else { $object->picture = base64_decode($object->picture); } $object->fromyear = $_POST['fromyear']; $object->about = $_POST['about']; $object->comments = $_POST['comments']; $object->fbcomments = $_POST['fbcomments']; $object->enabled = $_POST['enabled']; if (isset($_POST['pubdate'])) { $object->pubdate = $_POST['pubdate']; } //$object->schoolid = $school->id; $object->update(); $log = new Log($session->user_id, $clientip, "WEB", "UPDATED BATCH: " . $object->id); $log->create(); $message = "success"; } else {