本文整理汇总了PHP中OW::getRequest方法的典型用法代码示例。如果您正苦于以下问题:PHP OW::getRequest方法的具体用法?PHP OW::getRequest怎么用?PHP OW::getRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OW
的用法示例。
在下文中一共展示了OW::getRequest方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
/**
* Default action
*/
public function index()
{
$lang = OW::getLanguage();
OW::getDocument()->setHeading($lang->text('ocssitestats', 'admin_page_heading'));
OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
$pluginManager = OW::getPluginManager();
$pluginsActivated = array('total_users' => true, 'online_users' => true, 'new_users_today' => true, 'new_users_this_month' => true, 'photos' => $pluginManager->isPluginActive('photo'), 'videos' => $pluginManager->isPluginActive('video'), 'blogs' => $pluginManager->isPluginActive('blogs'), 'groups' => $pluginManager->isPluginActive('groups'), 'events' => $pluginManager->isPluginActive('event'), 'discussions' => $pluginManager->isPluginActive('forum'), 'links' => $pluginManager->isPluginActive('links'));
$config = OW::getConfig();
if (OW::getRequest()->isPost() && !empty($_POST['action'])) {
switch ($_POST['action']) {
case 'update_metrics':
$conf = array();
foreach ($pluginsActivated as $key => $m) {
$conf[$key] = $pluginsActivated[$key] && !empty($_POST['metrics'][$key]) && $_POST['metrics'][$key];
}
$config->saveConfig('ocssitestats', 'metrics', json_encode($conf));
OW::getFeedback()->info($lang->text('ocssitestats', 'settings_updated'));
$this->redirect();
break;
case 'update_settings':
$config->saveConfig('ocssitestats', 'zero_values', !empty($_POST['zero_values']));
OW::getFeedback()->info($lang->text('ocssitestats', 'settings_updated'));
$this->redirect();
break;
}
}
$metricsConf = json_decode($config->getValue('ocssitestats', 'metrics'), true);
$this->assign('metrics', $metricsConf);
$zeroValues = $config->getValue('ocssitestats', 'zero_values');
$this->assign('zeroValues', $zeroValues);
$this->assign('pluginsActivated', $pluginsActivated);
$logo = OW::getPluginManager()->getPlugin('ocssitestats')->getStaticUrl() . 'img/oxwallcandystore-logo.jpg';
$this->assign('logo', $logo);
}
示例2: editSlide
public function editSlide()
{
if (!OW::getRequest()->isAjax()) {
exit(json_encode(array('result' => false)));
}
if (!OW::getUser()->isAdmin()) {
throw new AuthenticationException();
exit;
}
if (!empty($_POST['slideId'])) {
$title = !empty($_POST['title']) ? htmlspecialchars($_POST['title']) : null;
$url = !empty($_POST['url']) ? htmlspecialchars($_POST['url']) : null;
$service = SLIDESHOW_BOL_Service::getInstance();
$slideId = (int) $_POST['slideId'];
$slide = $service->findSlideById($slideId);
if (!$slide) {
exit(json_encode(array('result' => false)));
}
$slide->label = $title;
$slide->url = $url;
$service->updateSlide($slide);
exit(json_encode(array('result' => true, 'slideId' => $slideId)));
}
exit;
}
示例3: grantCredits
public function grantCredits()
{
if (!OW::getRequest()->isAjax()) {
throw new Redirect404Exception();
}
if (!OW::getUser()->isAuthenticated()) {
throw new AuthenticateException();
}
$form = new USERCREDITS_CLASS_GrantCreditsForm();
if ($form->isValid($_POST)) {
$lang = OW::getLanguage();
$creditService = USERCREDITS_BOL_CreditsService::getInstance();
$grantorId = OW::getUser()->getId();
$values = $form->getValues();
$userId = (int) $values['userId'];
$amount = abs((int) $values['amount']);
$granted = $creditService->grantCredits($grantorId, $userId, $amount);
$credits = $creditService->getCreditsBalance($grantorId);
if ($granted) {
$data = array('amount' => $amount, 'grantorId' => $grantorId, 'userId' => $userId);
$event = new OW_Event('usercredits.grant', $data);
OW::getEventManager()->trigger($event);
$data = array('message' => $lang->text('usercredits', 'credits_granted', array('amount' => $amount)), 'credits' => $credits);
} else {
$data = array('error' => $lang->text('usercredits', 'credits_grant_error'));
}
exit(json_encode($data));
}
}
示例4: index
public function index($params)
{
$id = (int) $params['id'];
$menu = BOL_NavigationService::getInstance()->findMenuItemById($id);
$form = new EditPluginPageForm('edit-form', $menu);
$service = BOL_NavigationService::getInstance();
if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
$data = $form->getValues();
$visibleFor = 0;
$arr = !empty($data['visible-for']) ? $data['visible-for'] : array();
foreach ($arr as $val) {
$visibleFor += $val;
}
$service->saveMenuItem($menu->setVisibleFor($visibleFor));
$languageService = BOL_LanguageService::getInstance();
$langKey = $languageService->findKey($menu->getPrefix(), $menu->getKey());
$langValue = $languageService->findValue($languageService->getCurrent()->getId(), $langKey->getId());
$languageService->saveValue($langValue->setValue($data['name']));
$adminPlugin = OW::getPluginManager()->getPlugin('admin');
OW::getFeedback()->info(OW::getLanguage()->text($adminPlugin->getKey(), 'updated_msg'));
$this->redirect();
}
//--
$this->addForm($form);
}
示例5: index
public function index()
{
$language = OW::getLanguage();
OW::getDocument()->setHeading($language->text('mcompose', 'heading_configuration'));
OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
$this->assign('pluginUrl', 'http://www.oxwall.org/store/item/10');
if (!$this->plugin->isAvaliable()) {
$this->assign('avaliable', false);
return;
}
$this->assign('avaliable', true);
$settingUrl = OW::getRouter()->urlForRoute('mailbox_admin_config');
$this->assign('settingsUrl', $settingUrl);
$configs = OW::getConfig()->getValues('mcompose');
$features = array();
$features["friends"] = MCOMPOSE_CLASS_FriendsBridge::getInstance()->isActive();
$features["groups"] = MCOMPOSE_CLASS_GroupsBridge::getInstance()->isActive();
$features["events"] = MCOMPOSE_CLASS_EventsBridge::getInstance()->isActive();
$form = new MCOMPOSE_ConfigForm($configs, $features);
$this->addForm($form);
$this->assign("configs", $configs);
$this->assign("features", $features);
$this->assign("activeFeatures", array_filter($features));
if (OW::getRequest()->isPost() && $form->isValid($_POST)) {
if ($form->process($_POST)) {
OW::getFeedback()->info($language->text('mcompose', 'admin_settings_updated'));
$this->redirect(OW::getRouter()->urlForRoute('mcompose-admin'));
}
}
}
示例6: __construct
public function __construct($conversationId, $opponentId)
{
parent::__construct('newMailMessageForm');
$this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
$field = new TextField('newMessageText');
$field->setValue(OW::getLanguage()->text('mailbox', 'text_message_invitation'));
$field->setId('newMessageText');
$this->addElement($field);
$field = new HiddenField('attachment');
$this->addElement($field);
$field = new HiddenField('conversationId');
$field->setValue($conversationId);
$this->addElement($field);
$field = new HiddenField('opponentId');
$field->setValue($opponentId);
$this->addElement($field);
$field = new HiddenField('uid');
$field->setValue(UTIL_HtmlTag::generateAutoId('mailbox_conversation_' . $conversationId . '_' . $opponentId));
$this->addElement($field);
$submit = new Submit('newMessageSendBtn');
$submit->setId('newMessageSendBtn');
$submit->setName('newMessageSendBtn');
$submit->setValue(OW::getLanguage()->text('mailbox', 'add_button'));
$this->addElement($submit);
if (!OW::getRequest()->isAjax()) {
$js = UTIL_JsGenerator::composeJsString('
owForms["newMailMessageForm"].bind( "submit", function( r )
{
$("#newmessage-mail-send-btn").addClass("owm_preloader_circle");
});');
OW::getDocument()->addOnloadScript($js);
}
$this->setAction(OW::getRouter()->urlFor('MAILBOX_MCTRL_Messages', 'newmessage'));
}
示例7: index
/**
* Default action
*/
public function index()
{
$language = OW::getLanguage();
$clipService = VIDEO_BOL_ClipService::getInstance();
$userId = OW::getUser()->getId();
if (!OW::getUser()->isAuthorized('video', 'add')) {
$status = BOL_AuthorizationService::getInstance()->getActionStatus('video', 'add');
throw new AuthorizationException($status['msg']);
}
if (!($clipService->findUserClipsCount($userId) <= $clipService->getUserQuotaConfig())) {
$this->assign('auth_msg', $language->text('video', 'quota_exceeded', array('limit' => $clipService->getUserQuotaConfig())));
} else {
$this->assign('auth_msg', null);
$videoAddForm = new videoAddForm();
$this->addForm($videoAddForm);
if (OW::getRequest()->isPost() && $videoAddForm->isValid($_POST)) {
$values = $videoAddForm->getValues();
$code = $clipService->validateClipCode($values['code']);
if (!mb_strlen($code)) {
OW::getFeedback()->warning($language->text('video', 'resource_not_allowed'));
$this->redirect();
}
$res = $videoAddForm->process();
OW::getFeedback()->info($language->text('video', 'clip_added'));
$this->redirect(OW::getRouter()->urlForRoute('view_clip', array('id' => $res['id'])));
}
}
if (!OW::getRequest()->isAjax()) {
OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'video', 'video');
}
OW::getDocument()->setHeading($language->text('video', 'page_title_add_video'));
OW::getDocument()->setHeadingIconClass('ow_ic_video');
OW::getDocument()->setTitle($language->text('video', 'meta_title_video_add'));
OW::getDocument()->setDescription($language->text('video', 'meta_description_video_add'));
}
示例8: index
public function index()
{
$groups = MODERATION_BOL_Service::getInstance()->getContentGroups();
if (OW::getRequest()->isPost()) {
$selectedGroups = empty($_POST["groups"]) ? array() : $_POST["groups"];
$types = array();
foreach ($groups as $group) {
$selected = in_array($group["name"], $selectedGroups);
foreach ($group["entityTypes"] as $type) {
$types[$type] = $selected;
}
}
OW::getConfig()->saveConfig("moderation", "content_types", json_encode($types));
OW::getFeedback()->info(OW::getLanguage()->text("moderation", "content_types_saved_message"));
$this->redirect(OW::getRouter()->urlForRoute("moderation.admin"));
}
$this->setPageHeading(OW::getLanguage()->text("moderation", "admin_heading"));
$this->setPageTitle(OW::getLanguage()->text("moderation", "admin_title"));
$form = new Form("contentTypes");
$submit = new Submit("save");
$submit->setLabel(OW::getLanguage()->text("admin", "save_btn_label"));
$form->addElement($submit);
$this->addForm($form);
$this->assign("groups", $groups);
}
示例9: index
/**
* Default action
*/
public function index()
{
$language = OW::getLanguage();
$item = new BASE_MenuItem();
$item->setLabel($language->text('gphotoviewer', 'admin_menu_general'));
$item->setUrl(OW::getRouter()->urlForRoute('gphotoviewer.admin_config'));
$item->setKey('general');
$item->setIconClass('ow_ic_gear_wheel');
$item->setOrder(0);
$menu = new BASE_CMP_ContentMenu(array($item));
$this->addComponent('menu', $menu);
$configs = OW::getConfig()->getValues('gphotoviewer');
$configSaveForm = new ConfigSaveForm();
$this->addForm($configSaveForm);
if (OW::getRequest()->isPost() && $configSaveForm->isValid($_POST)) {
$res = $configSaveForm->process();
OW::getFeedback()->info($language->text('gphotoviewer', 'settings_updated'));
$this->redirect(OW::getRouter()->urlForRoute('gphotoviewer.admin_config'));
}
if (!OW::getRequest()->isAjax()) {
$this->setPageHeading(OW::getLanguage()->text('gphotoviewer', 'admin_config'));
$this->setPageHeadingIconClass('ow_ic_picture');
$elem = $menu->getElement('general');
if ($elem) {
$elem->setActive(true);
}
}
$configSaveForm->getElement('enablePhotoviewer')->setValue($configs['enable_photo_viewer']);
$configSaveForm->getElement('downloadable')->setValue($configs['can_users_to_download_photos']);
$configSaveForm->getElement('slideshowTime')->setValue($configs['slideshow_time_per_a_photo']);
}
示例10: settings
public function settings()
{
$adminForm = new Form('adminForm');
$language = OW::getLanguage();
$config = OW::getConfig();
$element = new TextField('autoclick');
$element->setRequired(true);
$validator = new IntValidator(1);
$validator->setErrorMessage($language->text('autoviewmore', 'admin_invalid_number_error'));
$element->addValidator($validator);
$element->setLabel($language->text('autoviewmore', 'admin_auto_click'));
$element->setValue($config->getValue('autoviewmore', 'autoclick'));
$adminForm->addElement($element);
$element = new Submit('saveSettings');
$element->setValue($language->text('autoviewmore', 'admin_save_settings'));
$adminForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($adminForm->isValid($_POST)) {
$values = $adminForm->getValues();
$config = OW::getConfig();
$config->saveConfig('autoviewmore', 'autoclick', $values['autoclick']);
OW::getFeedback()->info($language->text('autoviewmore', 'user_save_success'));
}
}
$this->addForm($adminForm);
}
示例11: index
public function index()
{
$language = OW::getLanguage();
$billingService = BOL_BillingService::getInstance();
$adminForm = new Form('adminForm');
$element = new TextField('creditValue');
$element->setRequired(true);
$element->setLabel($language->text('billingcredits', 'admin_usd_credit_value'));
$element->setDescription($language->text('billingcredits', 'admin_usd_credit_value_desc'));
$element->setValue($billingService->getGatewayConfigValue('billingcredits', 'creditValue'));
$validator = new FloatValidator(0.1);
$validator->setErrorMessage($language->text('billingcredits', 'invalid_numeric_format'));
$element->addValidator($validator);
$adminForm->addElement($element);
$element = new Submit('saveSettings');
$element->setValue($language->text('billingcredits', 'admin_save_settings'));
$adminForm->addElement($element);
if (OW::getRequest()->isPost()) {
if ($adminForm->isValid($_POST)) {
$values = $adminForm->getValues();
$billingService->setGatewayConfigValue('billingcredits', 'creditValue', $values['creditValue']);
OW::getFeedback()->info($language->text('billingcredits', 'user_save_success'));
}
}
$this->addForm($adminForm);
$this->setPageHeading(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
$this->setPageTitle(OW::getLanguage()->text('billingcredits', 'config_page_heading'));
$this->setPageHeadingIconClass('ow_ic_app');
}
示例12: gallery
public function gallery($params)
{
if (OW::getRequest()->isPost()) {
$userId = OW::getUser()->getId();
if (empty($userId)) {
throw new Exception('Guests can\'t view this page');
}
$imgId = intval($_POST['img-id']);
if ($imgId <= 0) {
throw new Redirect404Exception();
}
BOL_MediaPanelService::getInstance()->deleteById($imgId);
OW::getFeedback()->info(OW::getLanguage()->text('base', 'media_panel_file_deleted'));
$this->redirect();
}
$pluginKey = $params['pluginKey'];
$this->initMenu($params);
$this->addComponent('menu', $this->menu);
$this->menu->getElement('gallery');
$service = BOL_MediaPanelService::getInstance();
$list = $service->findGalleryImages($pluginKey, OW::getUser()->getId(), 0, 500);
$list = array_reverse($list);
$images = array();
foreach ($list as $img) {
$images[] = array('dto' => $img, 'data' => $img->getData(), 'url' => OW::getStorage()->getFileUrl(OW::getPluginManager()->getPlugin('base')->getUserFilesDir() . $img->id . '-' . $img->getData()->name), 'sel' => !empty($params['pid']) && $img->getId() == $params['pid']);
}
$this->assign('images', $images);
$this->assign('id', $params['id']);
}
示例13: index
/**
* Default action
*/
public function index()
{
$language = OW::getLanguage();
$configSaveForm = new ConfigSaveForm();
$this->addForm($configSaveForm);
$activeModes = MAILBOX_BOL_ConversationService::getInstance()->getActiveModeList();
if (count($activeModes) > 1) {
$selectedMode = 'mailchat';
} else {
$selectedMode = $activeModes[0];
}
$this->assign('selectedMode', $selectedMode);
$mailModeEnabled = in_array('mail', $activeModes);
$this->assign('mailModeEnabled', $mailModeEnabled);
if (OW::getRequest()->isPost() && $configSaveForm->isValid($_POST)) {
$configSaveForm->process();
// clear cache
MAILBOX_BOL_ConversationService::getInstance()->resetAllUsersLastData();
OW::getFeedback()->info($language->text('mailbox', 'settings_updated'));
$this->redirect();
}
if (!OW::getRequest()->isAjax()) {
$this->setPageHeading(OW::getLanguage()->text('mailbox', 'admin_config'));
$this->setPageHeadingIconClass('ow_ic_mail');
}
}
示例14: customization
public function customization()
{
$language = OW::getLanguage();
$this->setPageHeading($language->text('newsfeed', 'admin_page_heading'));
$this->setPageTitle($language->text('newsfeed', 'admin_page_title'));
$this->setPageHeadingIconClass('ow_ic_comment');
$types = NEWSFEED_BOL_CustomizationService::getInstance()->getActionTypes();
$form = new NEWSFEED_CustomizationForm();
$this->addForm($form);
$processTypes = array();
foreach ($types as $type) {
$field = new CheckboxField($type['activity']);
$field->setValue($type['active']);
$form->addElement($field);
$processTypes[] = $type['activity'];
}
if (OW::getRequest()->isPost()) {
$result = $form->process($_POST, $processTypes);
if ($result) {
OW::getFeedback()->info($language->text('newsfeed', 'customization_changed'));
} else {
OW::getFeedback()->warning($language->text('newsfeed', 'customization_not_changed'));
}
$this->redirect();
}
$this->assign('types', $types);
$this->addComponent('menu', $this->getMenu());
}
示例15: index
public function index()
{
$language = OW::getLanguage();
$this->setPageHeading($language->text('ynsocialpublisher', 'admin_config'));
$this->setPageHeadingIconClass('ow_ic_picture');
$item = new BASE_MenuItem();
$item->setLabel($language->text('ynsocialpublisher', 'admin_menu_general'));
$item->setUrl(OW::getRouter()->urlForRoute('ynsocialpublisher.admin'));
$item->setKey('general');
$item->setIconClass('ow_ic_gear_wheel');
$item->setOrder(0);
$item->setActive(true);
$menu = new BASE_CMP_ContentMenu(array($item));
$this->addComponent('menu', $menu);
$service = YNSOCIALPUBLISHER_BOL_Service::getInstance();
$plugins = $service->getEnabledPlugins();
$this->assign('plugins', $plugins);
$form_url = OW::getRouter()->urlForRoute('ynsocialpublisher.admin');
$this->assign('form_url', $form_url);
if (OW::getRequest()->isPost()) {
// get plugins data from post
$params = $_POST['params'];
foreach ($params as $key => $settings) {
if (!isset($settings['providers'])) {
$settings['providers'] = array();
}
OW::getConfig()->saveConfig('ynsocialpublisher', $key, json_encode($settings));
}
OW::getFeedback()->info($language->text('ynsocialpublisher', 'settings_updated'));
$this->redirect($form_url);
}
}