示例#1
0
 /**
  * Process the form on POST submission.  If you return false from getFormFields(),
  * this will obviously never be reached.  If you don't want to do anything with the
  * form, just return false here
  * @param  $data Array
  * @return Bool|Array true for success, false for didn't-try, array of errors on failure
  */
 public function onSubmit($data)
 {
     // Record upload and update metadata cache
     $this->video = Video::newFromName($this->oldvideo->ov_name, $this->getContext());
     $this->video->addVideo($this->oldvideo->ov_url, $this->oldvideo->ov_type, '');
     return true;
 }
示例#2
0
 /**
  * Actually inserts the Video into the DB if validation passes
  *
  * @param $data Array
  * @return bool
  */
 public function submit(array $data)
 {
     list($url, $provider) = $this->getUrlAndProvider($data['Video']);
     $this->video->addVideo($url, $provider, false, $data['Watch']);
     $this->getOutput()->redirect($this->video->getTitle()->getFullURL());
     return true;
 }
示例#3
0
 /**
  * Создает новое видео 
  */
 public function actionCreate()
 {
     self::checkAdmin();
     if (isset($_POST['submit'])) {
         $title = Validate::cleanStr($_POST['title']);
         $descr = Validate::cleanStr($_POST['descr']);
         if (!empty($title) && !empty($descr)) {
             //выбираем код видео из ссылки ютуб
             $video = Validate::cleanLinkYoutube($descr);
             $result = Video::addVideo(['title', 'descr', 'pubTime'], [$title, $video, time()]);
         }
         $res = isset($result) ? 'suc_video_create' : 'fail_video_create';
     } else {
         $res = 'fail_video_create';
     }
     header('Location:' . Config::ADDRESS . 'admin/video/?res=' . $res);
 }