本文整理汇总了PHP中OW::getuser方法的典型用法代码示例。如果您正苦于以下问题:PHP OW::getuser方法的具体用法?PHP OW::getuser怎么用?PHP OW::getuser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OW
的用法示例。
在下文中一共展示了OW::getuser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload
public function upload()
{
if (!OW::getUser()->isAuthorized('ivideo', 'add')) {
$this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCtrlViewDir() . 'authorization_failed.html');
return;
}
$eventParams = array('pluginKey' => 'ivideo', 'action' => 'upload_video');
$credits = OW::getEventManager()->call('usercredits.check_balance', $eventParams);
if ($credits === false) {
$this->assign('authMsg', OW::getEventManager()->call('usercredits.error_message', $eventParams));
return;
} else {
$this->assign('authMsg', null);
}
$language = OW::getLanguage();
$config = OW::getConfig();
$uploadForm = new Form('uploadForm');
$uploadForm->setId('THEFORM');
$uploadForm->setEnctype('multipart/form-data');
$element = new TextField('videoName');
$element->setRequired(true);
$element->addValidator(new uploadValidator());
$element->setLabel($language->text('ivideo', 'upload_video_name'));
$uploadForm->addElement($element);
$element = new WysiwygTextarea('videoDescription');
$element->setRequired(true);
$element->setLabel($language->text('ivideo', 'upload_video_desc'));
$uploadForm->addElement($element);
$element = new Selectbox('videoCategory');
$element->setRequired(true);
$element->setLabel($language->text('ivideo', 'admin_video_category'));
foreach (IVIDEO_BOL_CategoryDao::getInstance()->findAll() as $category) {
$element->addOption($category->id, $category->name);
}
$uploadForm->addElement($element);
$tagService = BOL_TagService::getInstance();
$tf = new TagsField('tf');
$tf->setLabel($language->text('ivideo', 'tags_field_label'));
$uploadForm->addElement($tf);
$element = new Submit('uploadVideo');
$element->setValue($language->text('ivideo', 'user_upload_video'));
$uploadForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($uploadForm->isValid($_POST) && isset($_POST['ax-uploaded-files'])) {
$values = $uploadForm->getValues();
$fileName = OW::getSession()->get('ivideo.filename');
if (is_null($fileName)) {
OW::getFeedback()->error($language->text('ivideo', 'admin_video_not_uploaded_error'));
} else {
$video = new IVIDEO_BOL_Video();
$video->name = ucwords(UTIL_HtmlTag::stripTags($values['videoName']));
$description = UTIL_HtmlTag::stripJs($values['videoDescription']);
$description = UTIL_HtmlTag::stripTags($description, array('frame', 'style'), array(), true);
$video->description = $description;
$video->owner = OW::getuser()->getId();
$video->timestamp = time();
$video->status = $config->getValue('ivideo', 'videoApproval') == 'auto' ? 'approved' : 'pending';
$video->filename = $fileName;
$videoId = IVIDEO_BOL_Service::getInstance()->addVideo($video);
if ($videoId) {
$fullFileName = OW::getPluginManager()->getPlugin('ivideo')->getUserFilesDir() . $fileName;
$imageFileName = OW::getPluginManager()->getPlugin('ivideo')->getUserFilesDir() . $fileName . ".png";
$ffmpegPath = $config->getValue('ivideo', 'ffmpegPath');
if (!empty($ffmpegPath) && file_exists($ffmpegPath)) {
exec("{$ffmpegPath} -y -itsoffset -4 -i '{$fullFileName}' -r 1 -f image2 '{$imageFileName}'");
}
IVIDEO_BOL_VideoCategoryService::getInstance()->setVideoCategories($videoId, $values['videoCategory']);
BOL_TagService::getInstance()->updateEntityTags($video->id, 'ivideo-video', TagsField::getTags($values['tf']));
$event = new OW_Event('feed.action', array('pluginKey' => 'ivideo', 'entityType' => 'ivideo-comments', 'entityId' => $video->id, 'userId' => $video->owner));
OW::getEventManager()->trigger($event);
$this->redirect(OW::getRouter()->urlForRoute('ivideo_view_list', array('type' => 'latest')));
OW::getFeedback()->info($language->text('ivideo', 'admin_upload_video_ok'));
} else {
OW::getFeedback()->error($language->text('ivideo', 'admin_upload_video_fail'));
}
}
}
}
$this->addForm($uploadForm);
if (OW::getSession()->isKeySet('ivideo.filename')) {
OW::getSession()->delete('ivideo.filename');
}
$jsURL = OW::getPluginManager()->getPlugin('ivideo')->getStaticUrl() . 'ajaxupload' . '/';
$this->assign('filesDir', json_encode(OW::getPluginManager()->getPlugin('ivideo')->getUserFilesDir()));
$this->assign('uploadAction', json_encode(OW::getRouter()->urlFor('IVIDEO_CTRL_Upload', 'action')));
$this->assign('maxSize', $config->getValue('ivideo', 'allowedFileSize'));
$this->assign('allowedExtn', UTIL_String::arrayToDelimitedString(explode(",", $config->getValue('ivideo', 'allowedExtensions')), ",", "'", "'"));
$this->assign('allowedExtnText', UTIL_String::arrayToDelimitedString(explode(",", $config->getValue('ivideo', 'allowedExtensions')), ","));
$this->assign('flashURL', $jsURL);
$this->assign('videoApproval', $config->getValue('ivideo', 'videoApproval'));
$theme = $config->getValue('ivideo', 'theme');
OW::getDocument()->addStyleSheet($jsURL . 'css/' . $theme . '/style.css');
OW::getDocument()->addScript($jsURL . "js/ajaxupload-min.js");
$this->setPageHeading(OW::getLanguage()->text('ivideo', 'video_user_upload'));
$this->setPageTitle(OW::getLanguage()->text('ivideo', 'video_user_upload'));
$this->setPageHeadingIconClass('ow_ic_video');
}