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


PHP util::cleanup方法代码示例

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


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

示例1:

$readonly = '';
$submissionValue = 'register';
$postType = util::getParam($_POST, 'submissionType');
if (!empty($postType) && ($postType == 'register' || $postType == 'update')) {
    $matricule = util::cleanup($_POST['user']);
    if ($postType == "register") {
        $password = util::cleanup($_POST['passw']);
    }
    $email = util::cleanup($_POST['email']);
    $emailconf = util::cleanup($_POST['emailconf']);
    $firstName = util::cleanup($_POST['firstname']);
    $lastName = util::cleanup($_POST['lastname']);
    $phone = util::cleanup($_POST['phone']);
    $address = util::cleanup($_POST['addr']);
    $city = util::cleanup($_POST['city']);
    $postalCode = util::cleanup($_POST['postal']);
    $isSubmissionValid = true;
    // Username check
    if (empty($matricule) || strlen($matricule) != MATRICULE_LENGTH || !is_numeric($matricule)) {
        // Must be a valid 7 digit valid number
        $errMessagesArray["matricule"] = "L'identifiant doit être un matricule valide" . is_numeric($matricule);
        $isSubmissionValid = false;
    } else {
        if ($postType == 'register') {
            $usernameCheck = $database->requete("SELECT * FROM st_authentication WHERE matricule = '" . $matricule . "'");
            if (mysql_num_rows($usernameCheck) != 0) {
                $errMessagesArray["matricule"] = "Le matricule existe déjà";
                $isSubmissionValid = false;
            }
        }
    }
开发者ID:Gwagz,项目名称:stationnement_aep,代码行数:31,代码来源:register.php

示例2: saveToDatabase

 public function saveToDatabase($matricule)
 {
     try {
         $this->database->beginTransaction();
         $result = $this->database->requete("SELECT * FROM st_demande WHERE matricule = '" . $matricule . "'");
         $hasDemandInDatabase = mysql_num_rows($result) != 0;
         $resultsArray = mysql_fetch_array($result);
         // Saving first car
         $firstCarId = $resultsArray[demande::CAR1_DB_FIELD];
         $doesFirstCarExistInDatabse = isset($firstCarId);
         $this->car1->saveToDatabase($firstCarId, $doesFirstCarExistInDatabse);
         // Saving second car
         $secondCarId = $resultsArray[demande::CAR2_DB_FIELD];
         $doesSecondCarExistInDatabse = isset($secondCarId);
         // Trip info
         $this->tripInfo = new tripInfo($this->userData->getAddress(), $this->userData->getCity(), $this->userData->getZipCode());
         $this->tripInfo->computeValues();
         $this->tripInfo->saveToDatabase($resultsArray[demande::TRIP_DB_FIELD]);
         $save_car2 = false;
         if ($this->car2->hasValuesInAtLeastOneField()) {
             $this->car2->saveToDatabase($secondCarId, $doesSecondCarExistInDatabse);
             $save_car2 = true;
         }
         $query = "";
         if (!$hasDemandInDatabase) {
             $this->creationDate = date("Y-m-d");
             $this->modificationDate = date("Y-m-d");
             $this->drivingLicense->saveToServer($resultsArray[demande::DRIVING_LICENSE_DB_FIELD]);
             $this->proofOfResidence->saveToServer($resultsArray[demande::PROOF_OF_RESIDENCE_DB_FIELD]);
             if ($save_car2) {
                 $car2_field = "," . demande::CAR2_DB_FIELD;
                 $car2_value = "','" . util::cleanup($this->car2->getId());
             }
             $query = "INSERT INTO st_demande \n\t        \t\t\t (" . demande::MATRICULE_DB_FIELD . ",\n\t        \t\t\t  " . demande::CREATION_DATE_DB_FIELD . ",\n\t        \t\t\t  " . demande::MODIF_DATE_DB_FIELD . ",\n\t        \t\t\t  " . demande::PAYMENT_METHOD_DB_FIELD . ",\n\t        \t\t\t  " . demande::CARPOOLING_DB_FIELD . ",\n\t        \t\t\t  " . demande::DETAILS_DB_FIELD . ",\n\t        \t\t\t  " . demande::CARPOOLING_OTHERS_DB_FIELD . ",\n\t        \t\t\t  " . demande::DRIVING_LICENSE_DB_FIELD . ",\n\t        \t\t\t  " . demande::PROOF_OF_RESIDENCE_DB_FIELD . ",\n\t        \t\t\t  " . demande::TRIP_DB_FIELD . ",\n\t        \t\t\t  " . demande::CAR1_DB_FIELD . $car2_field . ") \n\t        \t\t\t VALUES\n\t        \t\t\t ('" . util::cleanup($matricule) . "',\n\t        \t\t\t  '" . util::cleanup($this->creationDate) . "',\n\t        \t\t\t  '" . util::cleanup($this->modificationDate) . "',\n\t        \t\t\t  '" . util::cleanup($this->paymentMethod) . "',\n\t        \t\t\t  '" . util::cleanup($this->carpooling) . "',\n\t        \t\t\t  '" . util::cleanup($this->details) . "',\n\t\t\t\t\t\t  '" . util::cleanup($this->carpoolingOthers) . "',\n\t\t\t\t\t\t  '" . util::cleanup($this->drivingLicense->getOutputLocation()) . "',\n\t\t\t\t\t\t  '" . util::cleanup($this->proofOfResidence->getOutputLocation()) . "',\n\t\t\t\t\t\t  '" . util::cleanup($this->tripInfo->getId()) . "',\n                          '" . util::cleanup($this->car1->getId()) . $car2_value . "')";
         } else {
             $this->modificationDate = date("Y-m-d");
             // Server and database URLs for this file may differ at this point, in which case we update the DB
             $licenseHasChangedOnServer = $this->drivingLicense->saveToServer($resultsArray[demande::DRIVING_LICENSE_DB_FIELD]);
             $licenseColumnString = $licenseHasChangedOnServer ? demande::DRIVING_LICENSE_DB_FIELD . " = " : "";
             $licenseValuesString = $licenseHasChangedOnServer ? "'" . util::cleanup($this->drivingLicense->getOutputLocation()) . "', " : "";
             // Server and database URLs for this file may differ at this point, in which case we update the DB
             $proofOfResidenceHasChangedOnServer = $this->proofOfResidence->saveToServer($resultsArray[demande::PROOF_OF_RESIDENCE_DB_FIELD]);
             $proofOfResidenceColumnString = $proofOfResidenceHasChangedOnServer ? demande::PROOF_OF_RESIDENCE_DB_FIELD . " = " : "";
             $proofOfResidenceValuesString = $proofOfResidenceHasChangedOnServer ? "'" . util::cleanup($this->proofOfResidence->getOutputLocation()) . "', " : "";
             if ($save_car2) {
                 $car2_field = "," . demande::CAR2_DB_FIELD;
                 $car2_value = " = '" . util::cleanup($this->car2->getId()) . "'";
             }
             $query = "UPDATE st_demande\n\t\t\t\t\t\t  SET\n\t        \t\t\t  " . demande::MODIF_DATE_DB_FIELD . " = '" . util::cleanup($this->modificationDate) . "',\n\t        \t\t\t  " . demande::PAYMENT_METHOD_DB_FIELD . " = '" . util::cleanup($this->paymentMethod) . "',\n\t        \t\t\t  " . $licenseColumnString . $licenseValuesString . "\n\t        \t\t\t  " . $proofOfResidenceColumnString . $proofOfResidenceValuesString . "\n\t        \t\t\t  " . demande::CARPOOLING_DB_FIELD . " = '" . util::cleanup($this->carpooling) . "',\n\t        \t\t\t  " . demande::DETAILS_DB_FIELD . " = '" . util::cleanup($this->details) . "',\n                          " . demande::CARPOOLING_OTHERS_DB_FIELD . " = '" . util::cleanup($this->carpoolingOthers) . "',\n\t        \t\t\t  " . demande::CAR1_DB_FIELD . " = '" . util::cleanup($this->car1->getId()) . "'\n\t        \t\t\t  " . $car2_field . $car2_value . "  \n\t        \t\t\t  WHERE \n\t        \t\t\t  matricule = '" . $matricule . "'";
         }
         $this->database->requete($query);
         $this->database->commitTransaction();
     } catch (Exception $e) {
         $this->database->abortTransaction();
         return false;
     }
     return true;
 }
开发者ID:Gwagz,项目名称:stationnement_aep,代码行数:58,代码来源:class.demande.php

示例3: saveToDatabase

 public function saveToDatabase($id, $doesCarExistInDatabase)
 {
     $database = database::instance();
     if ($doesCarExistInDatabase) {
         $this->id = $id;
         // TODO: POTENTIALLY PUT THIS IN FILE SUBCLASS METHOD SAVETOSERVER
         $results = $database->requete("SELECT * FROM st_car WHERE " . car::CAR_ID_DB_FIELD . " = '" . $this->id . "'");
         $resultsArray = mysql_fetch_array($results);
         // Server and database URLs may differ at this point, in which case we update the DB
         $insuranceHasChangedOnServer = $this->insurance->saveToServer($resultsArray[car::INSURANCE_DB_FIELD]);
         $insuranceColumnString = $insuranceHasChangedOnServer ? car::INSURANCE_DB_FIELD . " = " : "";
         $insuranceValuesString = $insuranceHasChangedOnServer ? "'" . util::cleanup($this->insurance->getOutputLocation()) . "', " : "";
         $database->requete("UPDATE st_car\n\t\t\t\t\t\t\t  SET  \t\t\t  \n\t\t        \t\t\t  " . car::MODEL_DB_FIELD . " = '" . util::cleanup($this->model) . "',\n\t\t        \t\t\t  " . car::COLOR_DB_FIELD . " = '" . util::cleanup($this->color) . "',\n\t\t        \t\t\t  " . car::YEAR_DB_FIELD . " = '" . util::cleanup($this->year) . "',\n\t\t        \t\t\t   " . $insuranceColumnString . $insuranceValuesString . "\n                               " . car::LICENSE_DB_FIELD . " = '" . util::cleanup($this->license) . "',\n                             " . car::ELECTRIC_DB_FIELD . " = '" . util::cleanup($this->isElectric) . "' \n\t\t        \t\t\t  WHERE \n\t\t        \t\t\t  " . car::CAR_ID_DB_FIELD . " = '" . $this->id . "'");
     } else {
         $this->insurance->saveToServer(car::INSURANCE_DB_FIELD);
         $database->requete("INSERT INTO st_car \n\t\t\t\t\t\t\t\t(" . car::CAR_ID_DB_FIELD . ",\n\t\t\t\t\t\t\t\t" . car::MODEL_DB_FIELD . ",\n\t\t\t\t\t\t\t\t" . car::COLOR_DB_FIELD . ",\n\t\t\t\t\t\t\t\t" . car::YEAR_DB_FIELD . ",\n\t\t\t\t\t\t\t\t" . car::INSURANCE_DB_FIELD . ",\n                                " . car::LICENSE_DB_FIELD . ",\n                                " . car::ELECTRIC_DB_FIELD . ") \n\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t(NULL, \n\t\t\t\t\t\t\t\t '" . $this->model . "',\n\t\t\t\t\t\t\t\t '" . $this->color . "', \n\t\t\t\t\t\t\t\t '" . $this->year . "',\n\t\t\t\t\t\t\t\t '" . $this->insurance->getOutputLocation() . "',\n                                 '" . $this->license . "',\n                                 '" . $this->isElectric . "')", true, true);
         $this->id = $database->dernierInsertId;
     }
     return $this->id;
 }
开发者ID:Gwagz,项目名称:stationnement_aep,代码行数:20,代码来源:class.car.php


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