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


PHP Validate::passed方法代码示例

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


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

示例1: set

 public function set($data)
 {
     foreach ($data as $key => $value) {
         $this->_fields[$key] = $value;
     }
     if (isset($this->schema)) {
         $validate = new Validate();
         $validate->check($this->_fields, $this->schema, $this->_identifier);
         if (!$validate->passed()) {
             $this->_errors = $validate->errors();
         }
     }
     $this->clean();
 }
开发者ID:Jay-En,项目名称:BonePHP,代码行数:14,代码来源:Mapper.php

示例2: validate

 /**
  * Validates the stored fields in session based on the given form id.
  */
 public function validate()
 {
     $formId = $_POST['form_id'];
     $data = Cache::get($formId);
     if ($data) {
         $fields = unserialize($data);
         foreach ($fields as $fieldName => $fieldData) {
             if (isset($fieldData['validate'])) {
                 Validate::check($fieldName, $fieldData['validate']);
             }
         }
         return Validate::passed();
     }
     return false;
 }
开发者ID:simudream,项目名称:caffeine,代码行数:18,代码来源:html_form.php

示例3: save_step2

 public function save_step2()
 {
     $validate = new Validate();
     $source = $_POST;
     $items = array('fb-app-id' => array('required' => true), 'fb-app-secret-id' => array('required' => true));
     $validate->check($source, $items);
     if (!$validate->passed()) {
         echo "Please provide all required <span class='required'>*</span> fields.";
         return;
     }
     $this->loadmodel("install");
     if ($this->model->step2()) {
         echo "Success";
     }
 }
开发者ID:CCNITSilchar,项目名称:Social-Login-Plugin,代码行数:15,代码来源:install.php

示例4: install

 /**
  * Used to run the admin install if it hasn't been created yet.
  */
 public static function install()
 {
     if ($_POST) {
         Validate::check('email', array('email'));
         Validate::check('password', array('required'));
         Validate::check('conf_password', array('matches:password'));
         if (Validate::passed()) {
             $userId = User::user()->insert(array('email' => $_POST['email'], 'pass' => md5($_POST['password']), 'is_admin' => 1));
             if ($userId) {
                 Message::ok('Admin install complete.');
                 Url::redirect('admin/login');
             } else {
                 Message::error('Error creating admin account. Please try again.');
             }
         }
     }
 }
开发者ID:simudream,项目名称:caffeine,代码行数:20,代码来源:admin.php

示例5: createPage

function createPage($smarty)
{
    if (Users::loggedIn()) {
        Redirect::to('?page=profile');
    }
    if (Input::exists()) {
        if (Input::get('action') === 'register') {
            $validation = new Validate();
            $validation->check($_POST, array_merge(Config::get('validation/register_info'), Config::get('validation/set_password')));
            if ($validation->passed()) {
                try {
                    Users::create(array('student_id' => Input::get('sid'), 'password' => Hash::hashPassword(Input::get('password')), 'permission_group' => 1, 'name' => Input::get('name'), 'email' => Input::get('email'), 'umail' => Input::get('sid') . '@umail.leidenuniv.nl', 'phone' => Phone::formatNumber(Input::get('phone')), 'joined' => DateFormat::sql()));
                    Users::login(Input::get('sid'), Input::get('password'));
                    Notifications::addSuccess('You have been succesfully registered!');
                    Redirect::to('?page=profile');
                } catch (Exception $e) {
                    Notifications::addError($e->getMessage());
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'login') {
            $validation = new Validate();
            $validation->check($_POST, Config::get('validation/login'));
            if ($validation->passed()) {
                $login = Users::login(Input::get('sid'), Input::get('password'), Input::getAsBool('remember'));
                if ($login) {
                    Notifications::addSuccess('You have been logged in!');
                    Redirect::to('?page=profile');
                } else {
                    Notifications::addValidationFail('Invalid student number or password.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
    }
    $smarty->assign('remember', Input::getAsBool('remember'));
    $smarty->assign('name', Input::get('name'));
    $smarty->assign('sid', Input::get('sid'));
    $smarty->assign('email', Input::get('email'));
    $smarty->assign('phone', Input::get('phone'));
    return $smarty;
}
开发者ID:Wicloz,项目名称:UniversityWebsite,代码行数:45,代码来源:login.php

示例6: changePassword

 function changePassword()
 {
     $input = Input::parse();
     if (Token::check($input['token'])) {
         $validate = new Validate();
         $validate->check($input, array('password_current' => ['required' => true, 'min' => 6], 'password' => ['required' => true, 'min' => 6], 'password_repeat' => ['required' => true, 'min' => 6, 'matches' => 'password']));
         if ($validate->passed()) {
             $user = new User();
             if (Hash::make($input['password_current'], config::get('encryption/salt')) !== $user->data()->password) {
                 echo "incorrent password";
             } else {
                 $user->update(array('password' => Hash::make($input['password'], config::get('ecryption/salt'))));
                 Session::flash('success', 'Successfully changed password');
                 Redirect::to('changepassword');
             }
         } else {
             Session::flash('error', $validate->errors());
             Redirect::to('changepassword');
         }
     }
 }
开发者ID:Jay-En,项目名称:BonePHP-starter,代码行数:21,代码来源:profileController.php

示例7: signup

 function signup()
 {
     $input = Input::parse();
     if (Token::check($input['token'])) {
         $validate = new Validate();
         $validate->check($input, array('username' => ['required' => true, 'min' => 5, 'max' => 20, 'unique' => 'users'], 'name' => ['required' => true, 'max' => 50], 'password' => ['required' => true, 'min' => 6]));
         if ($validate->passed()) {
             $user = new User();
             $salt = config::get("encription/hash");
             try {
                 $user->create(array('username' => $input['username'], 'password' => Hash::make($input['password']), 'name' => $input['name'], 'joined' => date('Y-m-d H:i:s'), 'group_id' => 1));
             } catch (Exception $e) {
                 die($e->getMessage());
             }
             Session::flash('login', 'You registered successfully! Please login!');
             Redirect::to('login');
         } else {
             Session::flash('error', $validate->errors());
             Redirect::to('signup');
         }
     } else {
         echo "Invalid token";
     }
 }
开发者ID:Jay-En,项目名称:BonePHP-starter,代码行数:24,代码来源:userController.php

示例8: createPage

function createPage($smarty)
{
    if (!Users::loggedIn()) {
        Redirect::to('?page=login');
    }
    if (Input::exists()) {
        if (Input::get('action') === 'logout') {
            if (Users::loggedIn()) {
                Users::logout();
                Notifications::addSuccess('You have been logged out!');
                Redirect::to('?page=login');
            }
        }
        if (Input::get('action') === 'update_info') {
            $validation = new Validate();
            $validation->check($_POST, Config::get('validation/user_info'));
            if ($validation->passed()) {
                $data = array('name' => Input::get('name'), 'student_id' => Input::get('sid'), 'email' => Input::get('email'), 'phone' => Phone::formatNumber(Input::get('phone')));
                if (Users::currentUser()->update($data)) {
                    Notifications::addSuccess('User information updated!');
                } else {
                    Notifications::addError('Could not update user information.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'update_pass') {
            $validation = new Validate();
            $validation->check($_POST, array_merge(Config::get('validation/set_password'), array('password_current' => array('name' => 'Current Password', 'required' => true, 'max' => 72))));
            if ($validation->passed()) {
                if (Hash::checkPassword(Input::get('password_current'), Users::currentData()->password)) {
                    if (Users::currentUser()->update(array('password' => Hash::hashPassword(Input::get('password'))))) {
                        Notifications::addSuccess('Password changed!');
                    } else {
                        Notifications::addError('Could not change password.');
                    }
                } else {
                    Notifications::addValidationFail('Invalid current password.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'update_googleAuth') {
            $validation = new Validate();
            $validation->check($_POST, array('authcode' => array('name' => 'Authorisation Code', 'required' => true)));
            if ($validation->passed()) {
                if (Calendar::setCredentials(Input::get('authcode'))) {
                    Notifications::addSuccess('Google Calendar API authorized!');
                } else {
                    Notifications::addValidationFail('Could not authorize Google Calendar API.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'update_calendarAssignmentsId') {
            $validation = new Validate();
            $validation->check($_POST, array('calid-ass' => array('name' => 'Assignments Calendar ID', 'required' => false), 'calid-ex' => array('name' => 'Exams Calendar ID', 'required' => false)));
            if ($validation->passed()) {
                $data = array('calendar_assignments' => Input::get('calid-ass'), 'calendar_exams' => Input::get('calid-ex'));
                if (Users::currentUser()->update($data)) {
                    Notifications::addSuccess('Calendar ID\'s updated!');
                } else {
                    Notifications::addValidationFail('Could not update calendar ID\'s.');
                }
            } else {
                Notifications::addValidationFail($validation->getErrors());
            }
        }
        if (Input::get('action') === 'delete_googleAuth') {
            Calendar::deleteCredentials();
        }
        if (Input::get('action') === 'update_calendarAssignments' && Users::isEditor()) {
            $assignments = DB::instance()->get(Users::safeSid() . "_assignments")->results();
            foreach ($assignments as $assignment) {
                Calendar::updateAssignment($assignment->id);
            }
        }
        if (Input::get('action') === 'create_database') {
            if (!UserTables::hasTables()) {
                UserTables::createTables();
                if (Users::isGuest()) {
                    Users::currentUser()->update(array('permission_group' => '2'));
                }
            }
        }
    }
    if (!Calendar::isReady()) {
        $smarty->assign('authUrl', Calendar::getAuthUrl());
    }
    $smarty->assign('authCode', Input::get('authcode'));
    $smarty->assign('calid_ass', Users::currentData()->calendar_assignments);
    $smarty->assign('calid_ex', Users::currentData()->calendar_exams);
    $smarty->assign('name', Users::currentData()->name);
    $smarty->assign('sid', Users::currentData()->student_id);
    $smarty->assign('email', Users::currentData()->email);
    $smarty->assign('phone', Users::currentData()->phone);
    return $smarty;
//.........这里部分代码省略.........
开发者ID:Wicloz,项目名称:UniversityWebsite,代码行数:101,代码来源:profile.php

示例9: header

        header('Location: /TCP/' . Input::get('page'));
        exit;
    } else {
        $_SESSION["errors"][] = array('message' => 'Deletion failed', 'type' => 'danger');
    }
    //}
} else {
    if (Input::exist()) {
        //check if token is from this session
        if (Token::check(Input::get('token'))) {
            $validate = new Validate();
            $salt = Hash::salt(32);
            //validate input
            $validation = $validate->check($_POST, array('Email' => array('required' => true, 'min' => 2, 'unique' => 'user'), 'Password' => array('min' => 6, 'max' => 16), 'Repeat-password' => array('min' => 6, 'max' => 16, 'matches' => 'Password'), 'fName' => array('regex' => true), 'lName' => array('regex' => true)));
            //update user
            if (Input::get('view') && $validate->passed()) {
                $account = array('fName' => Input::get('fName'), 'lName' => Input::get('lName'), 'nationality' => Input::get('nationality'), 'email' => Input::get('Email'), 'password' => Hash::make(Input::get('Password'), $salt), 'salt' => $salt);
                if (strlen(Input::get('intake')) > 0) {
                    $account['intakeID'] = Input::get('intake');
                }
                try {
                    $user->update(Input::get('view'), $account);
                } catch (Exception $e) {
                    die($e->getMessage());
                }
                //force refresh
                header('Location: /TCP/' . Input::get('page'));
            } else {
                if ($validate->passed()) {
                    $account = array('role' => Input::get('role'), 'fName' => Input::get('fName'), 'lName' => Input::get('lName'), 'gender' => Input::get('gender'), 'nationality' => Input::get('nationality'), 'email' => Input::get('Email'), 'password' => Hash::make(Input::get('Password'), $salt), 'salt' => $salt);
                    if (strlen(Input::get('intake')) > 0) {
开发者ID:NoOneLiv3,项目名称:TCS-Webstore,代码行数:31,代码来源:user.php

示例10: adminDeleteItem

 public static function adminDeleteItem()
 {
     if (Users::isAdmin()) {
         $validation = new Validate();
         $validation->check($_POST, array('action' => array('name' => 'Action', 'required' => true, 'wildcard' => 'admin_item_delete'), 'table' => array('name' => 'Table Name', 'required' => true), 'id' => array('name' => 'Entry ID', 'required' => true)));
         if ($validation->passed()) {
             DB::instance()->delete(Input::get('table'), array("", "id", "=", Input::get('id')));
             if (Input::get('table') === Users::safeSid() . '_assignments') {
                 Calendar::deleteAssignment(Input::get('id'));
             }
             Notifications::addSuccess('Entry deleted!');
             Redirect::to('?page=home');
         } else {
             Notifications::addValidationFail($validation->getErrors());
         }
     } else {
         Redirect::error(403);
     }
 }
开发者ID:Wicloz,项目名称:UniversityWebsite,代码行数:19,代码来源:Update.php

示例11: Validate

<?php

require_once '/../modal/core/setup.php';
if (Input::exist() && $user->isLoggedIn()) {
    $validate = new Validate();
    $salt = Hash::salt(32);
    $upload = new Upload();
    //validate input
    $validation = $validate->check($_POST, array('email' => array('required' => true, 'min' => 2), 'fullName' => array('regex' => true)));
    $userArr = array('type' => Input::get('type'), 'fullName' => Input::get('fullName'), 'gender' => Input::get('gender'), 'email' => Input::get('email'));
    //update user
    if (is_numeric(Input::get('userID')) && $validate->passed()) {
        try {
            if ($user->find(Input::get('userID'))) {
                if (!empty($filename = $upload->imgUpload($_FILES['image'], 'profile'))) {
                    unlink('../upload/profile/' . $user->data()->imageURL);
                    $userArr['imageURL'] = $filename;
                }
                if (Input::get('password')) {
                    $validation = $validate->check($_POST, array('password' => array('min' => 6, 'max' => 16), 'repeat-password' => array('min' => 6, 'max' => 16, 'matches' => 'password')));
                    if ($validate->passed()) {
                        $userArr['password'] = Hash::make(Input::get('password'), $salt);
                        $userArr['salt'] = $salt;
                    }
                }
                $user->update(Input::get('userID'), $userArr);
            }
        } catch (Exception $e) {
            die($e->getMessage());
        }
        //force refresh
开发者ID:NoOneLiv3,项目名称:TCS-Webstore,代码行数:31,代码来源:user-process.php

示例12: Validate

 $validation = new Validate();
 if (Input::exists()) {
     //regeln für alle felder, analog zum erstellen eines events
     $validation->check($_POST, array('eventName' => array('name' => 'Event Name', 'required' => true, 'max' => 100), 'eventCast' => array('name' => 'Cast', 'max' => 255), 'eventDescription' => array('name' => 'Event Description', 'required' => true), 'eventDate' => array('name' => 'Event Date', 'required' => true, 'date' => true), 'eventTimeHour' => array('name' => 'Time of the Event ( Hours )', 'required' => true, 'minValue' => 0, 'maxValue' => 23), 'eventTimeMinute' => array('name' => 'Time of the Event ( Minutes )', 'required' => true, 'maxValue' => 59, 'minValue' => 0), 'eventDuration' => array('name' => 'Duration of the Event', 'required' => true, 'minValue' => 1), 'eventLink' => array('name' => 'Event Link', 'max' => 100), 'eventLinkDescription' => array('name' => 'Description of the EventLink', 'max' => 255), 'pricegroup' => array('name' => 'Price Group', 'required' => true)));
     //date-time stempel wird gebaut
     $rawdate = new DateTime(Input::get('eventDate') . ' ' . Input::get('eventTimeHour') . ':' . Input::get('eventTimeMinute') . ':00');
     $date = $rawdate->format('Y-m-d H:i:s');
     $duration = Input::get('eventDuration');
     $endTime = strtotime("+{$duration} minutes", strtotime($date));
     //hier wird überprüft ob ein event in einem zeitkonflikt mit einem anderen event steht
     $conflicts = DB::getInstance()->getInterferingEvents('event', 'date', $date, date('Y-m-d h:i:s', $endTime))->results();
     if (count($conflicts)) {
         $validation->addError('Dieses Event steht in einem Zeitkonflikt mit einem bereits bestehendem Event');
         $validation->setPassed(false);
     }
     if (!$validation->passed()) {
         foreach ($validation->errors() as $error) {
             echo $error . '<br>';
         }
     }
     //wenn alles validiert werden konnte wird hier der event aktualisiert
     if ($validation->passed()) {
         //2015-11-12 15:26:53 das wollen wir
         $rawdate = new DateTime(Input::get('eventDate') . ' ' . Input::get('eventTimeHour') . ':' . Input::get('eventTimeMinute') . ':00');
         $date = $rawdate->format('Y-m-d H:i:s');
         $eventName = Input::get('eventName');
         try {
             //neue daten werden in der db gespeichert
             $db->update('event', Input::get('id'), array('name' => $eventName, 'starring' => Input::get('eventCast'), 'description' => Input::get('eventDescription'), 'date' => $date, 'duration' => Input::get('eventDuration'), 'link' => Input::get('eventLink'), 'linkDescription' => Input::get('eventLinkDescription'), 'fk_genre_id' => Input::get('genre')));
             $eventID = $db->get('event', array('name', '=', $eventName))->first()->id;
             $rowCount = $db->get('event_has_price', array('fk_event_id', '=', $_POST['delete']))->count();
开发者ID:Geryones,项目名称:eventCal,代码行数:31,代码来源:updateEvent.php

示例13: post

 public function post($post_id)
 {
     $this->model('User');
     $this->model('Article');
     $user = new User();
     $article = new Article();
     $this->loginRequired($user);
     // If new post is to be created
     if (empty($post_id) || $post_id == 'new') {
         if (Input::exists()) {
             $validate = new Validate();
             // Validation for Inputs
             $validation = $validate->check($_POST, array('title' => array('name' => 'Post title', 'required' => true, 'min' => 5), 'description' => array('name' => 'description', 'required' => true, 'min' => 50), 'featuredimage' => array('name' => 'Featured Image', 'required' => true), 'link' => array('name' => 'Article Link', 'required' => true, 'unique' => ARTICLE_TABLE)));
             if (empty(Input::get('type'))) {
                 $type = 0;
             } else {
                 $type = 1;
             }
             if ($validate->passed()) {
                 $template = Strings::get('catagory');
                 try {
                     $article->create(array('TITLE' => Input::get('title'), 'SECURL' => Input::get('catagory'), 'SUBSEC' => Input::get('subsec'), 'CREATED_DATE' => date("Y-m-d  H:i:s", time()), 'IMG' => Input::get('featuredimage'), 'DES' => Input::get('description'), 'LINK' => Input::get('link'), 'TYPE' => $type, 'TEMPLATE' => Input::get('template')));
                     // Get the created article details from LINK to redirect the user to edit it.
                     $newarticle = new Article(Input::get('link'));
                     Redirect::to(ADMINPATH . 'post/' . $newarticle->data()->SL_NO);
                 } catch (Exception $e) {
                     die($e->getMessage());
                 }
                 if (isset($data)) {
                     $submissionData = Input::values($_POST);
                     $data = array_merge($data, $submissionData);
                 } else {
                     $data = Input::values($_POST);
                 }
             } else {
                 $data = $validate->errors();
             }
         }
         if (isset($data)) {
             $submissionData = Input::values($_POST);
             $data = array_merge($data, $submissionData);
         } else {
             $data = Input::values($_POST);
         }
         $data['CATAGORY'] = Strings::get('catagory');
         $data['SUBCATAGORY'] = Strings::get('subcatagory');
         $data['TEMPLATES'] = Strings::get('templates');
         $data['token'] = Token::generate();
         $data['TITLE'] = "Create New Post";
         $this->view('admin/post.new.html', $data);
     } else {
         /** 
          * Edit Post section
          * 
          * The edit and after creation events happen here
          */
         $article = new Article($post_id);
         if (Input::exists()) {
             $validate = new Validate();
             // Validation for Inputs
             $validation = $validate->check($_POST, array('title' => array('name' => 'Post title', 'required' => true, 'min' => 5), 'description' => array('name' => 'description', 'required' => true, 'min' => 50), 'featuredimage' => array('name' => 'Featured Image', 'required' => true)));
             // If Article URL is changed check if it already exist
             if ($validate->passed() && $article->data()->LINK != Input::get('link')) {
                 $validation = $validate->check($_POST, array('link' => array('name' => 'Article Link', 'required' => true, 'unique' => ARTICLE_TABLE)));
             }
             if (empty(Input::get('type'))) {
                 $type = 0;
             } else {
                 $type = 1;
             }
             if (empty(Input::get('featured'))) {
                 $featured = 0;
             } else {
                 $featured = 1;
             }
             if (Input::get('publish') == 1) {
                 $publish = $article->data()->STATUS ? 0 : 1;
             } else {
                 $publish = $article->data()->STATUS;
             }
             if ($validation) {
                 $template = Strings::get('catagory');
                 try {
                     $article->update(array('TITLE' => Input::get('title'), 'SECURL' => Input::get('catagory'), 'SUBSEC' => Input::get('subsec'), 'CONTENT' => Input::get('content'), 'DATE' => Input::get('date'), 'IMG' => Input::get('featuredimage'), 'DES' => Input::get('description'), 'LINK' => Input::get('link'), 'TYPE' => $type, 'TEMPLATE' => Input::get('template'), 'FEATURED' => $featured, 'STATUS' => $publish), $post_id);
                     Redirect::to(ADMINPATH . 'post/' . $post_id);
                 } catch (Exception $e) {
                     die($e->getMessage());
                 }
                 if (isset($data)) {
                     $submissionData = Input::values($_POST);
                     $data = array_merge($data, $submissionData);
                 } else {
                     $data = Input::values($_POST);
                 }
             } else {
                 $data = $validate->errors();
             }
         }
         if ($article->count()) {
             if (isset($data)) {
//.........这里部分代码省略.........
开发者ID:mdb-webdev,项目名称:techstream-v3,代码行数:101,代码来源:admin.php

示例14: array

if ($user->isLoggedIn()) {
    echo '<br><br>';
    if (!is_null($_POST['id'])) {
        $updateId = $_POST['id'];
        $_POST = array();
    }
    $db = DB::getInstance();
    $event = $db->get('event', array('id', '=', $updateId))->first();
    $fileSaver = new SaveFile();
    $validation = new Validate();
    if (Input::exists()) {
        //regeln für das bild
        $validation->checkFile($_FILES, array('eventPicture' => array('name' => 'Picture', 'type' => 'picture', 'required' => true, 'maxFileSize' => 512 * 1000, 'maxWidth' => 1000, 'maxHeight' => 1000)));
        //regeln für die picture-description
        $validation->check($_POST, array('eventPictureDescription' => array('name' => 'Description of the EventPicture', 'required' => true, 'max' => 255)));
        if (!$validation->passed()) {
            foreach ($validation->errors() as $error) {
                echo $error . '<br>';
            }
        }
        if (!$validation->filePassed()) {
            foreach ($validation->fileErrors() as $error) {
                echo $error . '<br>';
            }
        }
        //wenn beides validiert werden konnte wird das bild gespeichert
        if ($validation->passed() && $validation->filePassed()) {
            $eventFileName = $fileSaver->savePicture($_FILES, 'eventPicture');
            try {
                //name des alten bildes wird abgerufen um es später löschen zu können
                $old = $db->get('event', array('id', '=', Input::get('eventId')))->first()->picture;
开发者ID:Geryones,项目名称:eventCal,代码行数:31,代码来源:changePicture.php

示例15: User

 *
 */
?>

    <h1>This is upload</h1>
<?php 
$user = new User();
//Wenn ein Bild / datei ausgesucht wurde
if (Input::exists()) {
    // echo 'check.. input exists <br>';
    $validate = new Validate();
    //bild wird validiert
    $validate->checkFile($_FILES, array('fileUpload' => array('name' => 'Picture', 'type' => 'picture', 'required' => true, 'maxFileSize' => 3072 * 1000, 'maxWidth' => 4000, 'maxHeight' => 4000, 'minWidth' => 400, 'minHeight' => 400)));
    $validate->check($_POST, array('description' => array('name' => 'Picture Description', 'required' => true, 'min' => 5, 'max' => 1000)));
    //falls validierung erfolgreich war
    if ($validate->passed() && $validate->filePassed()) {
        $saver = new SaveFile();
        //echo 'file upload validation passed<br>';
        //echo ' dir erstellt <br>';
        //wem gehört das bild?
        $owner = $user->data()->id;
        // echo 'owner ermittelt '.$owner.'<br>';
        //bild wird gespeichert
        if ($saver->savePicture($_FILES, 'fileUpload', $owner, Input::get('description'))) {
            //Session::flash('picUpload','Your picture was successfully saved');
            //Redirect::to('index.php');
            echo 'upload successful<br>';
        } else {
            echo ' there was an error.. we are sorry <br>';
        }
    } else {
开发者ID:Geryones,项目名称:PHPLogingAndRegister,代码行数:31,代码来源:upload.php


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