function execute() { $video = new ConnectionVideo(); if (!Request::files('Filedata')) { return array('status' => 'error'); } $result = $video->download('Filedata'); if (!$result) { return array('status' => 'error'); } $file = Request::files('Filedata'); $model = new connectionUserVideoModel(); $user = ConnectionHelper::userLogin(); $userModel = new connectionUserModel(); $videoID = $model->insert(array('file' => $result, 'status' => 'upload', 'user' => (int) $user['id'], 'date' => strtotime('now'), 'title' => htmlspecialchars($file[0]['name']))); $userModel->addHistory($user['id'], connectionUserModel::HISTORY_ADD_VIDEO, '', array('video' => (int) $videoID)); Route::exec('php ' . MAIN_DIR . DS . 'cli.php connection ConvertVideo cli ' . $videoID); return array('status' => 'success'); }
/** * Extrai os argumentos a partir de URL * @param string $url url acessada pelo usuário * @return array retorna um array com os argumentos */ private function args($url) { $args = Route::exec($url); if (empty($args['controller'])) { $args['controller'] = Config::get('default_controller'); } if (empty($args['action'])) { $args['action'] = Config::get('default_action'); } if (empty($args['lang'])) { $args['lang'] = Config::get('default_lang'); } return $args; }