Beispiel #1
0
 public static function export(&$metadata)
 {
     $package = Doctrine::getTable('Package')->findOneByName($metadata['packageName']);
     if (!$package) {
         Package_Message::log('debug', 'Creating new package entry for ' . $metadata['packageName'] . '@' . $metadata['basedir']);
         $package = new Package();
     } else {
         Package_Message::log('debug', 'Updating package entry for ' . $metadata['packageName'] . '@' . $metadata['basedir'] . ' (' . $package['package_id'] . ')');
     }
     $registryIgnoreKeys = array_flip(array('packageName', 'displayName', 'version', 'packageStatus', 'directory', 'configure_instance', 'navStructures', 'datastore_id', 'type', 'upgrades', 'downgrades', 'basedir', 'status', 'models'));
     $package['name'] = $metadata['packageName'];
     $package['display_name'] = $metadata['displayName'];
     $package['version'] = $metadata['version'];
     $package['type'] = $metadata['type'];
     $package['status'] = $metadata['status'];
     $package['basedir'] = $metadata['basedir'];
     $package['navigation'] = $metadata['navStructures'];
     $package['registry'] = array_diff_key($metadata, $registryIgnoreKeys);
     $package->save();
     $metadata['datastore_id'] = $package['package_id'];
     if (!empty($metadata['models'])) {
         $models = Doctrine::loadModels($metadata['directory'] . '/models', Doctrine::MODEL_LOADING_CONSERVATIVE);
         self::integrateNumberType($models, $metadata['datastore_id']);
     }
 }
Beispiel #2
0
 /**
  * @before _secure, _vendor
  */
 public function createPackage()
 {
     $this->seo(array("title" => "Create Packages", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     if (RequestMethods::post("action") == "savePackage") {
         $package = new Package(array("user_id" => $this->user->id, "organization_id" => $this->organization->id, "title" => RequestMethods::post("title"), "charge" => RequestMethods::post("charge")));
         $package->save();
         foreach (RequestMethods::post("items") as $key => $value) {
             $item = new Item(array("package_id" => $package->id, "test_id" => $value, "organization_id" => $this->organization->id));
             $item->save();
         }
         $view->set("message", "Package Created Successfully");
     }
 }
 public function testCascadingInsert()
 {
     $package = new Package();
     $package->description = 'Package';
     $packageverison = new PackageVersion();
     $packageverison->description = 'Version';
     $packageverisonnotes = new PackageVersionNotes();
     $packageverisonnotes->description = 'Notes';
     $package->Version[0] = $packageverison;
     $package->Version[0]->Note[0] = $packageverisonnotes;
     $package->save();
     $this->assertNotNull($package->id);
     $this->assertNotNull($package->Version[0]->id);
     $this->assertNotNull($package->Version[0]->Note[0]->id);
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($parent = null)
 {
     $model = new Package();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($parent)) {
         $model->parent = $parent;
     }
     if (isset($_POST['Package'])) {
         $model->attributes = $_POST['Package'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id_package));
         }
     }
     $this->render('create', array('model' => $model));
 }
 public function packages_post()
 {
     $this->layout = '';
     $cycle_id = Input::get('cycle_id');
     $service_id = Input::get('service_id');
     $price = Input::get('price');
     if (!Package::exists($service_id, $cycle_id)) {
         if (!empty($price) || is_numeric($price)) {
             $package = new Package();
             $package->service_id = $service_id;
             $package->cycle_id = $cycle_id;
             $package->price = $price;
             $package->save();
             return Redirect::to('packages')->with('success', 'Package has been successfully saved.');
         } else {
             return Redirect::to('packages')->with('error', 'Price must be a number.');
         }
     } else {
         return Redirect::to('packages')->with('error', 'Package already exists.');
     }
 }
Beispiel #6
0
function parse_csv_file($downloadFilePath)
{
    global $fulfillmentID, $msql;
    $header = NULL;
    $data = array();
    if (($handle = fopen($downloadFilePath, 'r')) !== FALSE) {
        while (($row = fgetcsv($handle, 1000, ',')) !== FALSE) {
            if (!$header) {
                $header = $row;
            } else {
                $data[] = array_combine($header, $row);
            }
        }
        fclose($handle);
    }
    echo '<pre>';
    print_r($data);
    echo '</pre>';
    foreach ($data as $item) {
        if (isset($item['OrderID'])) {
            $orderID = (int) $item['OrderID'];
            $modelOrder = Order::model()->with('customer')->findByPk($orderID);
            if ($modelOrder) {
                $modelPackage = new Package();
                $modelPackage->sent = null;
                $modelPackage->customer_id = $modelOrder->customer->customer_id;
                $modelPackage->fulfillment_id = $fulfillmentID;
                $modelPackage->tracking_number = "";
                if ($modelPackage->save()) {
                    $sql = "INSERT INTO `packages_orders` SET `package_id`=?i, `order_id`=?i";
                    $msql->query($sql, $modelPackage->package_id, $orderID);
                }
            }
        }
    }
}
 function actionUpdate_namespace()
 {
     if (!isset(Yii::app()->session['namespace'])) {
         $this->redirect(array('index'));
     }
     $ns = Yii::app()->session['namespace'];
     if (count($ns) == 0) {
         $this->redirect(array('update_bind'));
     }
     if (isset($_POST['Package'])) {
         $model = new Package();
         $model->attributes = $_POST['Package'];
         if ($model->save()) {
             foreach ($ns as &$namespace) {
                 if (!isset($namespace->parent)) {
                     $namespace->parent = $model->id_package;
                     break;
                 }
             }
             Yii::app()->session['namespace'] = $ns;
         }
     }
     $this->render('upate/namespace');
 }
Beispiel #8
0
 /**
  * This function is designed to handle any INTERNAL routines that need
  * to be executed after the package has completed everything it may possible do...
  */
 private function finalize()
 {
     Bluebox_Installer::disableTelephony();
     foreach (self::$packages as $name => $package) {
         switch ($package['action']) {
             case 'downgrade':
             case 'install':
             case 'upgrade':
                 // If this module had errors during install DONT ADD IT
                 if (!empty(self::$errors[$name])) {
                     break;
                 }
                 try {
                     // If this module is already installed
                     if (!empty($package['installedAs']['package_id'])) {
                         Kohana::log('debug', 'Updating ' . $package['packageName'] . ' in Module');
                         $dbPackage = Doctrine::getTable('Package')->find($package['installedAs']['package_id']);
                         // If we coulnt get the current row then we will make a new one
                         if (!$dbPackage) {
                             Kohana::log('alert', 'Failed to find ' . $package['packageName'] . ' in Package, adding new package');
                             $dbPackage = new Package();
                         }
                     } else {
                         Kohana::log('debug', 'Adding ' . $package['packageName'] . ' to Package');
                         // Get a new row for the module
                         $dbPackage = new Package();
                     }
                     $registryIgnoreKeys = array_flip(array('packageName', 'displayName', 'version', 'directory', 'instance', 'navStructures', 'installedAs', 'type'));
                     $dbPackage['name'] = $package['packageName'];
                     $dbPackage['display_name'] = $package['displayName'];
                     $dbPackage['version'] = $package['version'];
                     $dbPackage['type'] = $package['type'];
                     $dbPackage['status'] = 'installed';
                     $dbPackage['basedir'] = str_replace(DOCROOT, '', $package['directory']);
                     $dbPackage['navigation'] = $package['navStructures'];
                     $dbPackage['registry'] = array_diff_key($package, $registryIgnoreKeys);
                     $dbPackage->save();
                     $package['installedAs']['package_id'] = $dbPackage['package_id'];
                     self::_integrateNumberType($package['models'], $dbPackage, $name);
                     $dbPackage->free(TRUE);
                 } catch (Exception $e) {
                     self::_setError('Unable to integrate ' . $package['packageName'] . ' into Package! <br /><small>' . $e->getMessage() . '</small>', $name);
                     break;
                 }
                 break;
             case 'repair':
                 // If this module had errors during repair skip this
                 if (!empty(self::$errors[$name])) {
                     break;
                 }
                 try {
                     // If this module is already installed
                     if (!empty($package['installedAs']['package_id'])) {
                         Kohana::log('debug', 'Updating ' . $package['packageName'] . ' in Module');
                         $dbPackage = Doctrine::getTable('Package')->find($package['installedAs']['package_id']);
                         // If we coulnt get the current row then we will make a new one
                         if (!$dbPackage) {
                             Kohana::log('alert', 'Failed to find ' . $package['packageName'] . ' in Package, adding new package');
                             $dbPackage = new Package();
                         }
                     } else {
                         Kohana::log('debug', 'Adding ' . $package['packageName'] . ' to Package');
                         // Get a new row for the module
                         $dbPackage = new Package();
                     }
                     $registryIgnoreKeys = array_flip(array('packageName', 'displayName', 'version', 'directory', 'instance', 'navStructures', 'installedAs', 'type'));
                     $dbPackage['name'] = $package['packageName'];
                     $dbPackage['display_name'] = $package['displayName'];
                     $dbPackage['version'] = $package['version'];
                     $dbPackage['type'] = $package['type'];
                     $dbPackage['basedir'] = str_replace(DOCROOT, '', $package['directory']);
                     $dbPackage['navigation'] = $package['navStructures'];
                     $dbPackage['registry'] = array_diff_key($package, $registryIgnoreKeys);
                     $dbPackage->save();
                     $package['installedAs']['package_id'] = $dbPackage['package_id'];
                     self::_integrateNumberType($package['models'], $dbPackage, $name);
                     $dbPackage->free(TRUE);
                 } catch (Exception $e) {
                     self::_setError('Unable to integrate ' . $package['packageName'] . ' into Package! <br /><small>' . $e->getMessage() . '</small>', $name);
                     break;
                 }
                 break;
             case 'enable':
                 if (!empty(self::$errors[$name])) {
                     break;
                 }
                 Kohana::log('debug', 'Update Package to enable ' . $package['packageName']);
                 try {
                     $dbModule = Doctrine::getTable('Package')->find($package['installedAs']['package_id']);
                     if (!$dbModule) {
                         self::_setError('Unable to locate the DB entry for ' . $package['displayName'], $name);
                     } else {
                         $dbModule['status'] = 'installed';
                         $dbModule->save();
                         self::_integrateNumberType($package['models'], $dbModule, $name);
                         $dbModule->free(TRUE);
                     }
                 } catch (Exception $e) {
                     self::_setError('Error during update of ' . $package['displayName'] . ' : ' . $e->getMessage(), $name);
                 }
                 break;
             case 'disable':
                 if (!empty(self::$errors[$name])) {
                     break;
                 }
                 Kohana::log('debug', 'Update Package to disable ' . $package['packageName']);
                 try {
                     $dbModule = Doctrine::getTable('Package')->find($package['installedAs']['package_id']);
                     if (!$dbModule) {
                         self::_setError('Unable to locate the DB entry for ' . $package['displayName'], $name);
                     } else {
                         $dbModule['status'] = 'disabled';
                         $dbModule->save();
                         self::_removeNumberType($package['models'], $name);
                         $dbModule->free(TRUE);
                     }
                 } catch (Exception $e) {
                     self::_setError('Error during update of ' . $package['displayName'] . ' : ' . $e->getMessage(), $name);
                 }
                 break;
             case 'uninstall':
                 if (!empty(self::$errors[$name])) {
                     break;
                 }
                 Kohana::log('alert', 'Removing ' . $package['packageName'] . ' from Package');
                 try {
                     $dbModule = Doctrine::getTable('Package')->find($package['installedAs']['package_id']);
                     if (!$dbModule) {
                         self::_setError('Unable to locate the DB entry for ' . $package['displayName'], $name);
                     } else {
                         $dbModule->delete();
                         self::_removeNumberType($package['models'], $name);
                         $dbModule->free(TRUE);
                     }
                 } catch (Exception $e) {
                     self::_setError('Error during removal of ' . $package['displayName'] . ' : ' . $e->getMessage(), $name);
                 }
                 break;
         }
     }
 }
 /**
  * Input multiple data to database
  */
 public function actionEntry()
 {
     $model = new Package();
     $lastDipa = Dipa::model()->find(array('order' => 'id DESC'));
     $lastDipaId = $lastDipa->id;
     if (isset($_POST['code'])) {
         if ($lastDipa) {
             $total = count($_POST['code']);
             for ($i = 0; $i < $total; $i++) {
                 if ($_POST['code'][$i] != NULL && $_POST['ppk_code'][$i] != NULL && $_POST['city_code'][$i] != NULL) {
                     $code = $_POST['code'][$i];
                     //Check existed record
                     $record = Package::model()->findByAttributes(array('code' => $code));
                     if ($record) {
                         $budgets = Budget::model()->findAllByAttributes(array('subcomponent_code' => "{$record->code}", 'dipa_id' => "{$lastDipaId}"));
                         $record->ppk_code = $_POST['ppk_code'][$i];
                         $record->city_code = $_POST['city_code'][$i];
                         $record->province_code = City::model()->findByAttributes(array('code' => "{$record->city_code}"))->province_code;
                         if ($budgets) {
                             foreach ($budgets as $budgetData) {
                                 $pAccount = PackageAccount::model()->findByAttributes(array('code' => "{$budgetData->code}"));
                                 if ($pAccount) {
                                     $pAccount->limit = $budgetData->total_budget_limit;
                                     $pAccount->ppk_code = $record->ppk_code;
                                     $pAccount->province_code = $record->province_code;
                                     $pAccount->city_code = $record->city_code;
                                     $pAccount->update();
                                 }
                             }
                         }
                         $record->update();
                     } else {
                         $data = new Package();
                         $data->code = $_POST['code'][$i];
                         $budget = Budget::model()->findByAttributes(array('subcomponent_code' => $_POST['code'][$i]), array('order' => 'dipa_id DESC'));
                         if ($budget) {
                             $data->satker_code = "{$budget->satker_code}";
                             $data->activity_code = "{$budget->activity_code}";
                             $data->output_code = "{$budget->output_code}";
                             $data->suboutput_code = "{$budget->suboutput_code}";
                             $data->name = $budget->subcomponentCode->name;
                             $data->component_code = "{$budget->component_code}";
                             $data->ppk_code = $_POST['ppk_code'][$i];
                             $data->city_code = $_POST['city_code'][$i];
                             $data->province_code = City::model()->findByAttributes(array('code' => "{$data->city_code}"))->province_code;
                             $budgets = Budget::model()->findAllByAttributes(array('subcomponent_code' => "{$data->code}", 'dipa_id' => "{$lastDipaId}"));
                             if ($budgets) {
                                 foreach ($budgets as $dataBudget) {
                                     $paModel = new PackageAccount();
                                     $paModel->code = "{$dataBudget->code}";
                                     $paModel->satker_code = "{$dataBudget->satker_code}";
                                     $paModel->activity_code = "{$dataBudget->activity_code}";
                                     $paModel->output_code = "{$dataBudget->output_code}";
                                     $paModel->suboutput_code = "{$dataBudget->suboutput_code}";
                                     $paModel->component_code = "{$dataBudget->component_code}";
                                     $paModel->package_code = "{$dataBudget->subcomponent_code}";
                                     $paModel->account_code = "{$dataBudget->account_code}";
                                     $paModel->ppk_code = "{$data->ppk_code}";
                                     $paModel->province_code = "{$data->province_code}";
                                     $paModel->city_code = "{$data->city_code}";
                                     $paModel->limit = "{$dataBudget->total_budget_limit}";
                                     $paModel->save();
                                 }
                             }
                             $data->save();
                         } else {
                             Yii::app()->user->setFlash('notice', 'Data DIPA belum diinput dengan lengkap. Beberapa data informasi tambahan gagal ditambahkan.');
                             $this->redirect(array('index'));
                         }
                     }
                 } else {
                     Yii::app()->user->setFlash('error', "Mohon isikan data secara lengkap.");
                     $this->redirect(array('entry'));
                 }
             }
         } else {
             Yii::app()->user->setFlash('error', 'Data DIPA/POK belum diinput.');
             $this->redirect(array('index'));
         }
         Yii::app()->user->setFlash('success', 'Data berhasil disimpan.');
         $this->redirect(array('index'));
     }
     $this->render('entry', array('model' => $model));
 }
Beispiel #10
0
    <body>
        <?php 
require_once 'config.php';
$models = Doctrine_Core::loadModels('models');
if (isset($_POST['data'])) {
    $recipients = explode(',', $_POST['data']);
    $houseTable = Doctrine_Core::getTable('House');
    $stored = array();
    $rejected = array();
    foreach ($recipients as $value) {
        $house = $houseTable->find($value);
        if ($house->email !== null) {
            $package = new Package();
            $package->recipient = $value;
            $package->status = 0;
            $package->save();
            $package->free();
            array_push($stored, $house->name . " " . $house->city);
        } else {
            array_push($rejected, $house->name . " " . $house->city);
        }
        $house->free();
    }
    echo "Dodano nastepujacych odbiorców:\n";
    foreach ($stored as $value) {
        echo $value . "<br/>";
    }
    echo "Brak adresow email nastepujacych odbiorców:\n";
    foreach ($rejected as $value) {
        echo $value . "<br/>";
    }
Beispiel #11
0
 /**
  * Installs a package.
  * 
  * @param string $name
  * @param bool $simulate
  * @return bool
  */
 public static function installPackage($name, $simulate = false)
 {
     $package = Curry_PackageManager::getPackage($name);
     if (!$package) {
         throw new Exception('Package not found');
     }
     $installedPackage = PackageQuery::create()->findPk($name);
     if ($installedPackage) {
         throw new Exception('Package already installed');
     }
     if (!$simulate && !self::execTask($package, 'preInstall', true)) {
         return new Exception('Package installation prevented by preInstall hook.');
     }
     if (!$simulate) {
         $installedPackage = new Package();
         $installedPackage->setName($package['name']);
         $installedPackage->setVersion($package['version']);
         $installedPackage->save();
     }
     $tar = new Curry_Archive(self::getCachedFile($package['source'], true));
     foreach ($tar as $tarFile) {
         $file = $tarFile->getPathname();
         try {
             $target = PackageFile::mapFile($file);
         } catch (Exception $e) {
             self::log('Skipping: ' . $file);
             continue;
         }
         // create directory
         if ($tarFile->isDir()) {
             if (!$simulate) {
                 if (!file_exists($target)) {
                     mkdir($target, 0777, true);
                 }
             }
             continue;
         }
         // Extract file
         self::log('Adding: ' . $file, Curry_Backend::MSG_SUCCESS);
         if (!$simulate) {
             if (file_exists($target)) {
                 $backupTarget = $target . "." . date("-Ymd_His");
                 if (file_exists($backupTarget)) {
                     throw new Exception('Unable to backup existing file.');
                 }
                 rename($target, $backupTarget);
             }
             $tarFile->extract($target);
             $packageFile = new PackageFile();
             $packageFile->setPackage($installedPackage);
             $packageFile->setFilename($file);
             $packageFile->setChecksum(sha1_file($target));
             $packageFile->save();
         }
     }
     if (!$simulate) {
         self::execTaskWithReload($package, 'postInstall');
     }
     self::$installed = null;
     return true;
 }
Beispiel #12
0
 protected function _savePackage($package = null)
 {
     if (!$package) {
         $package = new Package(array());
     }
     $package->name = RequestMethods::post("name");
     $package->item = json_encode(RequestMethods::post("items"));
     $package->price = RequestMethods::post("price");
     $package->tax = RequestMethods::post("tax");
     $package->user_id = $this->user->id;
     $package->period = RequestMethods::post("period", 30);
     if ($package->validate()) {
         $package->save();
         return array("success" => true, "package" => $package);
     }
     return array("success" => false, "errors" => $package->errors);
 }
require_once "../initialise_files.php";
include_once "sessioninc.php";
$NoYes = get_lang("select", "NoYes");
$smarty->assign('NoYes', $NoYes);
$_SESSION['package']['standard'] = !isset($_SESSION['package']['standard']) ? "Y" : $_SESSION['package']['standard'];
if (isset($_POST['bt_add'])) {
    $package = new Package();
    $package->package_name = $_SESSION['package']['name'] = $_POST['txt_name'];
    $package->package_desc = $_SESSION['package']['desc'] = $_POST['txt_desc'];
    $package->package_price = $_SESSION['package']['price'] = $_POST['txt_price'];
    $package->package_job_qty = $_SESSION['package']['qty'] = $_POST['txt_qty'];
    $package->standard = $_SESSION['package']['standard'] = $_POST['txt_standard'];
    $package->spotlight = $_SESSION['package']['spotlight'] = $_POST['txt_spotlight'];
    $package->cv_views = $_SESSION['package']['cv_views'] = $_POST['txt_cv_views'];
    $package->is_active = $_SESSION['package']['active'] = $_POST['txt_active'];
    if ($package->save()) {
        $session->message("<div class='success'> Package has been successfully added. </div>");
        destroy_my_session();
        redirect_to($_SERVER['PHP_SELF']);
        die;
    } else {
        $message = "<div class='error'> following error(s) found: <ul> <li />";
        $message .= join(" <li /> ", $package->errors);
        $message .= " </ul></div>";
    }
}
$smarty->assign('titles', get_lang('titles'));
$html_title = SITE_NAME . " Add New Employer ";
$smarty->assign('lang', $lang);
$smarty->assign('message', $message);
$smarty->assign('rendered_page', $smarty->fetch('admin/new_package.tpl'));
Beispiel #14
0
 public function duplicate()
 {
     $clone = new Package();
     $clone->attributes = $this->attributes;
     $clone->id = null;
     $clone->title .= ' - копия';
     if ($clone->save()) {
         // Сохраняем дни
         $result = true;
         foreach ($this->days as $day) {
             $result = $day->duplicate(array('package_id' => $clone->id));
         }
         return $result;
     }
     return false;
 }
Beispiel #15
0
 /**
  * @before _secure, changeLayout
  */
 public function create_package()
 {
     $this->seo(array("title" => "Dashboard", "view" => $this->getLayoutView()));
     $view = $this->getActionView();
     $states = State::all();
     $view->set('states', $states);
     if (RequestMethods::post('name')) {
         $imageFileType1 = pathinfo($_FILES["package1"]["name"], PATHINFO_EXTENSION);
         if (!empty($_FILES["package2"]["name"])) {
             $imageFileType2 = pathinfo($_FILES["package2"]["name"], PATHINFO_EXTENSION);
         } else {
             $imageFileType2 = NULL;
         }
         if (!empty($_FILES["package3"]["name"])) {
             $imageFileType3 = pathinfo($_FILES["package3"]["name"], PATHINFO_EXTENSION);
         } else {
             $imageFileType3 = NULL;
         }
         if (!empty($_FILES["package4"]["name"])) {
             $imageFileType4 = pathinfo($_FILES["package4"]["name"], PATHINFO_EXTENSION);
         } else {
             $imageFileType4 = NULL;
         }
         if (!empty($_FILES["package5"]["name"])) {
             $imageFileType5 = pathinfo($_FILES["package5"]["name"], PATHINFO_EXTENSION);
         } else {
             $imageFileType5 = NULL;
         }
         $package = new Package(array('name' => RequestMethods::post('name'), 'source' => RequestMethods::post('source'), 'destination' => RequestMethods::post('dest'), 'desc' => RequestMethods::post('desc'), 'start_date' => RequestMethods::post('startdate'), 'end_date' => RequestMethods::post('enddate'), 'month' => RequestMethods::post('month'), 'year' => RequestMethods::post('year'), 'price' => RequestMethods::post('price'), 'people' => RequestMethods::post('people'), 'people_left' => RequestMethods::post('people'), 'imgext1' => $imageFileType1, 'imgext2' => $imageFileType2, 'imgext3' => $imageFileType3, 'imgext4' => $imageFileType4, 'imgext5' => $imageFileType5));
         if ($package->validate()) {
             $package->save();
             $view->set('success', 'success');
             $count = Package::count();
             $target_dir = "/public/uploads/packages/";
             $target_file = APP_PATH . $target_dir . $count . '_';
             $img = 0;
             // Check if image file is a actual image or fake image
             $check = getimagesize($_FILES["package1"]["tmp_name"]);
             if ($check !== false) {
                 $img++;
             }
             if ($imageFileType1 != "jpg" && $imageFileType1 != "png" && $imageFileType1 != "jpeg" && $_FILES["package"]["size"] > 5000000) {
                 $img--;
             }
             if ($img == 1) {
                 $flag = 0;
                 if (move_uploaded_file($_FILES["package1"]["tmp_name"], $target_file . '1.' . $imageFileType1)) {
                     $flag++;
                 }
                 if ($flag == 1) {
                 } else {
                     $view->set('errorimg', 'Error in first image. Not uploaded');
                 }
             }
             if (!empty($imageFileType2)) {
                 $img = 0;
                 // Check if image file is a actual image or fake image
                 $check = getimagesize($_FILES["package2"]["tmp_name"]);
                 if ($check !== false) {
                     $img++;
                 }
                 if ($imageFileType2 != "jpg" && $imageFileType2 != "png" && $imageFileType2 != "jpeg" && $_FILES["package2"]["size"] > 5000000) {
                     $img--;
                 }
                 if ($img == 1) {
                     $flag = 0;
                     if (move_uploaded_file($_FILES["package2"]["tmp_name"], $target_file . '2.' . $imageFileType2)) {
                         $flag++;
                     }
                     if ($flag == 1) {
                     } else {
                         $view->set('errorimg', 'Error in second image. Not uploaded');
                     }
                 }
             }
             if (!empty($imageFileType3)) {
                 $img = 0;
                 // Check if image file is a actual image or fake image
                 $check = getimagesize($_FILES["package3"]["tmp_name"]);
                 if ($check !== false) {
                     $img++;
                 }
                 if ($imageFileType3 != "jpg" && $imageFileType3 != "png" && $imageFileType3 != "jpeg" && $_FILES["package3"]["size"] > 5000000) {
                     $img--;
                 }
                 if ($img == 1) {
                     $flag = 0;
                     if (move_uploaded_file($_FILES["package3"]["tmp_name"], $target_file . '3.' . $imageFileType3)) {
                         $flag++;
                     }
                     if ($flag == 1) {
                     } else {
                         $view->set('errorimg', 'Error in third image. Not uploaded');
                     }
                 }
             }
             if (!empty($imageFileType4)) {
                 $img = 0;
                 // Check if image file is a actual image or fake image
                 $check = getimagesize($_FILES["package4"]["tmp_name"]);
                 if ($check !== false) {
                     $img++;
                 }
                 if ($imageFileType4 != "jpg" && $imageFileType4 != "png" && $imageFileType4 != "jpeg" && $_FILES["package4"]["size"] > 5000000) {
                     $img--;
                 }
                 if ($img == 1) {
                     $flag = 0;
                     if (move_uploaded_file($_FILES["package4"]["tmp_name"], $target_file . '4.' . $imageFileType4)) {
                         $flag++;
                     }
                     if ($flag == 1) {
                     } else {
                         $view->set('errorimg', 'Error in fourth image. Not uploaded');
                     }
                 }
             }
             if (!empty($imageFileType5)) {
                 $img = 0;
                 // Check if image file is a actual image or fake image
                 $check = getimagesize($_FILES["package5"]["tmp_name"]);
                 if ($check !== false) {
                     $img++;
                 }
                 if ($imageFileType5 != "jpg" && $imageFileType5 != "png" && $imageFileType5 != "jpeg" && $_FILES["package5"]["size"] > 5000000) {
                     $img--;
                 }
                 if ($img == 1) {
                     $flag = 0;
                     if (move_uploaded_file($_FILES["package5"]["tmp_name"], $target_file . '5.' . $imageFileType5)) {
                         $flag++;
                     }
                     if ($flag == 1) {
                     } else {
                         $view->set('errorimg', 'Error in fifth image. Not uploaded');
                     }
                 }
             }
         } else {
             echo 'validation not good';
         }
     }
 }