} else {
     if ($_option == "--update-check") {
         $returnValue = updateCheck();
         exit($returnValue);
     } else {
         if (0 === strpos($_option, "--base=")) {
             global $BASE;
             $BASE = substr($_option, strpos($_option, "=") + 1);
             consoleWriteLine("\$BASE was set to " . $BASE);
         } else {
             if ($_option == "--export-config") {
                 exportConfig();
                 exit(0);
             } else {
                 if ($_option == "--extract-config") {
                     extractConfig();
                     exit(0);
                 } else {
                     if ($_option == "--dump") {
                         $DUMP = "true";
                     } else {
                         if (0 === strpos($_option, "--get=")) {
                             $GET_VARIABLE = substr($_option, strpos($_option, "=") + 1);
                         } else {
                             if (0 === strpos($_option, "--set=")) {
                                 $SET_VARIABLE = substr($_option, strpos($_option, "=") + 1);
                             } else {
                                 if (0 === strpos($_option, "--value=")) {
                                     $VARIABLE_VALUE = substr($_option, strpos($_option, "=") + 1);
                                 } else {
                                     if ($_option == "--merge") {
Exemple #2
0
$app->post('/admin/action/addImages', function (Silex\Application $app, Request $request) {
    if ('POST' == $request->getMethod()) {
        $carouselPath = $request->get('carouselPath');
        $carouselName = $request->get('carouselName');
        $carouselImages = $_FILES;
        $overlayText = $request->get('overlayText');
    }
    if (true === empty($carouselPath)) {
        return 'carouselPath cannot be empty';
    } else {
        if (true === empty($carouselImages)) {
            return 'carouselImages cannot be empty';
        } else {
            $carouselObj = new pbalan\CarouselBuilder\CarouselBuilder();
            $carouselObj->uploadImages($carouselPath, $carouselImages);
            $carousels = extractConfig($carouselName, $overlayText);
            $thumb_width = $carousels["carouselWidth"];
            $thumb_height = $carousels["carouselHeight"];
            $carouselPath = $carouselObj->checkDirectoryFlow($carouselPath);
            for ($i = 0; $i <= count($carouselImages["file"]["name"]); $i++) {
                $imageName = $carouselImages["file"]["name"][$i];
                $carouselObj->generateThumb($carouselPath . $imageName, $thumb_width, $thumb_height, false);
            }
        }
    }
    return $app->redirect("edit/{$carouselName}");
});
$app->get('/admin/{id}', function (Silex\Application $app, $id) use($blogPosts) {
    if (!isset($blogPosts[$id])) {
        $app->abort(404, "Post {$id} does not exist.");
    }