<?php require '../vendor/autoload.php'; require APP_PATH . '/lib/fatal_handler.php'; processKeywords('mail');
function processNewArticle() { $coverMade = FALSE; $content = $_POST['content']; $numOfImages = $_POST['numOfImages']; global $erm; // Process the titles if (!processTitles()) { return FALSE; } if (!processKeywords()) { return FALSE; } if (!processDescription()) { return FALSE; } if (empty($content) || strlen($content) > 60000) { $erm = "Content empty or too large. [max] = 60000 characters."; return FALSE; } //Finished processing the title if (!$numOfImages) { $numOfImages = 0; } /* Process the image */ if ($numOfImages > 0 && $numOfImages < 6) { if (!processImageAlt()) { return FALSE; } for ($i = 0; $i < $numOfImages; $i++) { if ($_FILES['images']['size'][$i] < 1024 || $_FILES['images']['size'][$i] > 500000 || $_FILES['images']['error'][$i] != 0) { @unlink($_FILES['images']['tmp_name'][$i]); continue; } if (($ext = check_file_type($_FILES['images']['name'][$i])) == FALSE) { @unlink($_FILES['images']['tmp_name'][$i]); continue; } $newFileName = $_SESSION['author_id'] . "-" . time() . mt_rand($i * 10, $i * 10 + 9); move_uploaded_file($_FILES['images']['tmp_name'][$i], "../Images/" . $newFileName . ".{$ext}"); if ($coverMade === FALSE) { img_resize("../Images/" . $newFileName . "." . $ext, "../Images/med_thumbs/{$newFileName}.{$ext}", 300, 200, $ext); //Create a medium sized thumb just for one image in the set $coverMade = TRUE; } img_resize("../Images/" . $newFileName . "." . $ext, "../Images/large_thumbs/{$newFileName}.{$ext}", 675, 450, $ext); //Create a large thumb for every image $imageArray[] = $newFileName . "." . $ext; //$imageArray contains the name of every successfully uploaded image file } } if (empty($imageArray)) { $imgExists = 0; } else { $imgExists = 1; } if (($id = write_text_to_database($imgExists)) === FALSE) { $erm = "Database error"; return FALSE; } if ($imgExists) { write_images_to_database($id, $imageArray); } return $id; }
<?php require '../vendor/autoload.php'; require APP_PATH . '/lib/fatal_handler.php'; processKeywords('yandex');
<?php require '../vendor/autoload.php'; require APP_PATH . '/lib/fatal_handler.php'; processKeywords('google');