当前位置: 首页>>代码示例>>PHP>>正文


PHP Package::save方法代码示例

本文整理汇总了PHP中Package::save方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::save方法的具体用法?PHP Package::save怎么用?PHP Package::save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Package的用法示例。


在下文中一共展示了Package::save方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: export

 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']);
     }
 }
开发者ID:swk,项目名称:bluebox,代码行数:25,代码来源:Datastore.php

示例2: createPackage

 /**
  * @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");
     }
 }
开发者ID:HLitmus,项目名称:WebApp,代码行数:17,代码来源:promotion.php

示例3: testCascadingInsert

 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);
 }
开发者ID:dennybrandes,项目名称:doctrine1,代码行数:15,代码来源:UnsortedTestCase.php

示例4: actionCreate

 /**
  * 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));
 }
开发者ID:black2279,项目名称:Tracy-openshift,代码行数:20,代码来源:PackageController.php

示例5: packages_post

 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.');
     }
 }
开发者ID:jacobDaeHyung,项目名称:PHPLaravelGymManagementSystem,代码行数:21,代码来源:PackagesController.php

示例6: Package

 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');
 }
开发者ID:black2279,项目名称:Tracy-openshift,代码行数:24,代码来源:Src_loaderController.php

示例7: finalize

 /**
  * 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);
//.........这里部分代码省略.........
开发者ID:swk,项目名称:bluebox,代码行数:101,代码来源:Bluebox_Installer.php

示例8: actionEntry

 /**
  * 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));
 }
开发者ID:jimminababan,项目名称:kontrol-anggaran,代码行数:87,代码来源:PackageController.php

示例9: explode

    <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/>";
    }
开发者ID:Coalas,项目名称:mailing,代码行数:31,代码来源:send.php

示例10: installPackage

 /**
  * 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;
 }
开发者ID:varvanin,项目名称:currycms,代码行数:68,代码来源:PackageManager.php

示例11: _savePackage

 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);
 }
开发者ID:SwiftDeal,项目名称:detectr,代码行数:17,代码来源:marketing.php

示例12: Package

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'));
开发者ID:nim94sha,项目名称:Online-Job-Portal,代码行数:31,代码来源:new_package.php

示例13: duplicate

 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;
 }
开发者ID:kuzmina-mariya,项目名称:happy-end,代码行数:16,代码来源:Package.php

示例14: create_package

 /**
  * @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)) {
//.........这里部分代码省略.........
开发者ID:shreyanshgoel,项目名称:tours,代码行数:101,代码来源:admin.php


注:本文中的Package::save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。