예제 #1
0
 public function __construct()
 {
     parent::__construct('FindWhiteIp');
     $submit = new Submit('search');
     $submit->setValue(OW::getLanguage()->text('watchdog', 'search'));
     $this->addElement($submit);
 }
예제 #2
0
 public function getList($params)
 {
     $data = OW::getEventManager()->call("guests.get_guests_list", array("userId" => OW::getUser()->getId()));
     if (empty($data)) {
         $this->assign("list", array());
         return;
     }
     $idList = array();
     $viewedMap = array();
     $timeMap = array();
     foreach ($data as $item) {
         $idList[] = $item["userId"];
         $viewedMap[$item["userId"]] = $item["viewed"];
         $timeMap[$item["userId"]] = UTIL_DateTime::formatDate($item["timeStamp"]);
     }
     OW::getEventManager()->call("guests.mark_guests_viewed", array("userId" => OW::getUser()->getId(), "guestIds" => $idList));
     $bookmarkList = OW::getEventManager()->call("bookmarks.get_mark_list", array("userId" => OW::getUser()->getId(), "idList" => $idList));
     $bookmarkList = empty($bookmarkList) ? array() : $bookmarkList;
     $avatarList = BOL_AvatarService::getInstance()->getDataForUserAvatars($idList, true, false);
     $onlineMap = BOL_UserService::getInstance()->findOnlineStatusForUserList($idList);
     foreach ($avatarList as $userId => $user) {
         $color = array('r' => '100', 'g' => '100', 'b' => '100');
         if (!empty($user['labelColor'])) {
             $_color = explode(', ', trim($user['labelColor'], 'rgba()'));
             $color = array('r' => $_color[0], 'g' => $_color[1], 'b' => $_color[2]);
         }
         $list[] = array("userId" => $userId, "displayName" => $user["title"], "avatarUrl" => $user["src"], "label" => $user["label"], "labelColor" => $color, "viewed" => $viewedMap[$userId], "online" => $onlineMap[$userId], "bookmarked" => !empty($bookmarkList[$userId]), "time" => $timeMap[$userId]);
     }
     $this->assign("list", $list);
 }
예제 #3
0
 public function __construct()
 {
     parent::__construct();
     $plugin = OW::getPluginManager()->getPlugin('BASE');
     $this->setTemplate($plugin->getCmpViewDir() . 'console_list_ipc_item.html');
     $this->addClass('ow_invitation_item ow_cursor_default');
 }
예제 #4
0
 public function __construct($ctrl)
 {
     parent::__construct('settings-form');
     $configs = OW::getConfig()->getValues('yncontactimporter');
     $ctrl->assign('configs', $configs);
     $l = OW::getLanguage();
     $miValidator = new IntValidator(1, 999);
     $miValidator->setErrorMessage($l->text('yncontactimporter', 'max_validation_error', array('min' => 1, 'max' => 999)));
     //Contacts per page
     $textField['contact_per_page'] = new TextField('contact_per_page');
     $textField['contact_per_page']->setLabel($l->text('yncontactimporter', 'settings_contact_per_page'))->setValue($configs['contact_per_page'])->addValidator($miValidator)->setRequired(true);
     $this->addElement($textField['contact_per_page']);
     //Maximum invite per times
     $textField['max_invite_per_times'] = new TextField('max_invite_per_times');
     $textField['max_invite_per_times']->setLabel($l->text('yncontactimporter', 'settings_max_invite_per_times'))->setValue($configs['max_invite_per_times'])->addValidator($miValidator)->setRequired(true);
     $this->addElement($textField['max_invite_per_times']);
     //Default invite message
     $textField['default_invite_message'] = new Textarea('default_invite_message');
     $textField['default_invite_message']->setLabel($l->text('yncontactimporter', 'settings_default_invite_message'))->setValue($configs['default_invite_message']);
     $this->addElement($textField['default_invite_message']);
     // Logo width
     $textField['logo_width'] = new TextField('logo_width');
     $textField['logo_width']->setLabel($l->text('yncontactimporter', 'settings_logo_width'))->setValue($configs['logo_width'])->addValidator($miValidator)->setRequired(true);
     $this->addElement($textField['logo_width']);
     // Logo Height
     $textField['logo_height'] = new TextField('logo_height');
     $textField['logo_height']->setLabel($l->text('yncontactimporter', 'settings_logo_height'))->setValue($configs['logo_height'])->addValidator($miValidator)->setRequired(true);
     $this->addElement($textField['logo_height']);
     $submit = new Submit('submit');
     $submit->setValue($l->text('yncontactimporter', 'save_btn_label'));
     $submit->addAttribute('class', 'ow_ic_save ow_positive');
     $this->addElement($submit);
 }
예제 #5
0
 public function __construct($layout, $params)
 {
     parent::__construct();
     if (empty($params['available'])) {
         if (!empty($params['msg'])) {
             $msg = $params['msg'];
         } else {
             $msg = OW::getLanguage()->text('base', 'authorization_failed_feedback');
         }
         $this->assign('authError', $msg);
         return;
     }
     switch ($layout) {
         case 'page':
             $class = ' ow_photoview_info_onpage';
             break;
         default:
             if ((bool) OW::getConfig()->getValue('photo', 'photo_view_classic')) {
                 $class = ' ow_photoview_pint_mode';
             } else {
                 $class = '';
             }
             break;
     }
     $this->assign('class', $class);
     $this->assign('layout', $layout);
 }
예제 #6
0
 public function setCustomMetaInfo()
 {
     OW::getDocument()->setDescription(null);
     if (OW::getLanguage()->valueExist('base', "local_page_meta_tags_{$this->getDocumentKey()}")) {
         OW::getDocument()->addCustomHeadInfo(OW::getLanguage()->text('base', "local_page_meta_tags_{$this->getDocumentKey()}"));
     }
 }
예제 #7
0
 public function __construct()
 {
     parent::__construct('delete-membership-form');
     $this->setAjaxResetOnSuccess(false);
     $this->setAjax(true);
     $this->setAction(OW::getRouter()->urlForRoute('membership_delete_type'));
     $lang = OW::getLanguage();
     $typeId = new HiddenField('typeId');
     $typeId->setRequired(true);
     $this->addElement($typeId);
     $newTypeId = new Selectbox('newTypeId');
     $newTypeId->setHasInvitation(false);
     $this->addElement($newTypeId);
     $types = new RadioGroupItemField('type');
     $types->setRequired(true);
     $types->setLabel($lang->text('membership', 'set_membership'));
     $this->addElement($types);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function( data ) {\n                if ( data.result ) {\n                    document.location.reload();\n                }\n            }");
     $script = '$("#btn-confirm-type-delete").click(function(){
         if ( confirm(' . json_encode($lang->text('membership', 'type_delete_confirm')) . ') ) {
              $(this).parents("form:eq(0)").submit();
         }
     });
     ';
     OW::getDocument()->addOnloadScript($script);
 }
예제 #8
0
 public function __construct(BASE_CommentsParams $params, $id, $formName)
 {
     parent::__construct();
     $language = OW::getLanguage();
     $form = new Form($formName);
     $textArea = new Textarea('commentText');
     $textArea->setHasInvitation(true);
     $textArea->setInvitation($language->text('base', 'comment_form_element_invitation_text'));
     $form->addElement($textArea);
     $hiddenEls = array('entityType' => $params->getEntityType(), 'entityId' => $params->getEntityId(), 'displayType' => $params->getDisplayType(), 'pluginKey' => $params->getPluginKey(), 'ownerId' => $params->getOwnerId(), 'cid' => $id, 'commentCountOnPage' => $params->getCommentCountOnPage(), 'isMobile' => 1);
     foreach ($hiddenEls as $name => $value) {
         $el = new HiddenField($name);
         $el->setValue($value);
         $form->addElement($el);
     }
     $submit = new Submit('comment-submit');
     $submit->setValue($language->text('base', 'comment_add_submit_label'));
     $form->addElement($submit);
     $form->setAjax(true);
     $form->setAction(OW::getRouter()->urlFor('BASE_CTRL_Comments', 'addComment'));
     //        $form->bindJsFunction(Form::BIND_SUBMIT, "function(){ $('#comments-" . $id . " .comments-preloader').show();}");
     //        $form->bindJsFunction(Form::BIND_SUCCESS, "function(){ $('#comments-" . $id . " .comments-preloader').hide();}");
     $this->addForm($form);
     OW::getDocument()->addOnloadScript("window.owCommentCmps['{$id}'].initForm('" . $textArea->getId() . "', '" . $submit->getId() . "');");
     $this->assign('form', true);
     $this->assign('id', $id);
 }
예제 #9
0
 public function index(array $params)
 {
     echo "post_call->" . $_POST['post_id'];
     echo "call->" . $params['id'];
     echo "user_id->" . OW::getUser()->getId();
     echo "call";
     die;
     //        if (!$userId = OW::getUser()->getId()) {
     //            throw new AuthenticateException();
     //        }
     //        $page = (!empty($_GET['page']) && intval($_GET['page']) > 0 ) ? $_GET['page'] : 1;
     //        $lang = OW::getLanguage();
     //        $perPage = (int) OW::getConfig()->getValue('base', OW::getPluginManager()->isPluginActive('skadate') ? 'users_on_page' : 'users_count_on_page');
     //        $guests = OCSGUESTS2_BOL_Service::getInstance()->findGuestsForUser($userId, $page, $perPage);
     //        $guestList = array();
     //        if ($guests) {
     //            foreach ($guests as $guest) {
     //                $guestList[$guest->guestId] = array('last_visit' => $lang->text('skapi', 'visited') . ' ' . '<span class="ow_remark">' . $guest->visitTimestamp . '</span>');
     //            }
     //            $itemCount = OCSGUESTS2_BOL_Service::getInstance()->countGuestsForUser($userId);
     //
     //            if (OW::getPluginManager()->isPluginActive('skadate')) {
     //                $cmp = OW::getClassInstance('BASE_CMP_Users', $guestList, array(), $itemCount);
     //            } else {
     //                $guestsUsers = OCSGUESTS2_BOL_Service::getInstance()->findGuestUsers($userId, $page, $perPage);
     //                $cmp = new OCSGUESTS2_CMP_Users($guestsUsers, $itemCount, $perPage, true, $guestList);
     //            }
     //            $this->addComponent('guests', $cmp);
     //        } else {
     //            $this->assign('guests', null);
     //        }
     //        $this->setPageHeading($lang->text('skapi', 'viewed_profile'));
     //        $this->setPageTitle($lang->text('skapi', 'viewed_profile'));
     //  OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'base', 'dashboard');
 }
예제 #10
0
function smarty_function_text_edit($params, $smarty)
{
    $key = $params['key'];
    unset($params['key']);
    $key = explode('+', $key);
    if (empty($key[0]) || empty($key[1])) {
        return '_INVALID_KEY_';
    }
    $prefix = $key[0];
    $key = $key[1];
    $text = OW::getLanguage()->text($prefix, $key, $params);
    $keyDto = BOL_LanguageService::getInstance()->findKey($prefix, $key);
    if (!$keyDto) {
        return '<span class="ow_red">' . $text . '</span>';
    }
    $script = '$("a.ow_text_edit").click(function(){
        var self=$(this), lang = this.rel.split("+");
        OW.editLanguageKey(lang[0],lang[1], function(e){
            self.text(e.value);     
        });
    });';
    OW::getDocument()->addOnloadScript($script);
    $rel = json_encode($prefix . '+' . $key);
    return '<a href="javascript://" rel=' . $rel . ' class="ow_text_edit">' . $text . '</a>';
}
예제 #11
0
 /**
  * @return Constructor.
  */
 public function __construct($groupId)
 {
     parent::__construct();
     $service = GROUPS_BOL_Service::getInstance();
     $groupDto = $service->findGroupById($groupId);
     $group = array('title' => htmlspecialchars($groupDto->title), 'description' => $groupDto->description, 'time' => $groupDto->timeStamp, 'imgUrl' => empty($groupDto->imageHash) ? false : $service->getGroupImageUrl($groupDto), 'url' => OW::getRouter()->urlForRoute('groups-view', array('groupId' => $groupDto->id)), "id" => $groupDto->id);
     $imageUrl = empty($groupDto->imageHash) ? '' : $service->getGroupImageUrl($groupDto);
     OW::getDocument()->addMetaInfo('image', $imageUrl, 'itemprop');
     OW::getDocument()->addMetaInfo('og:image', $imageUrl, 'property');
     $createDate = UTIL_DateTime::formatDate($groupDto->timeStamp);
     $adminName = BOL_UserService::getInstance()->getDisplayName($groupDto->userId);
     $adminUrl = BOL_UserService::getInstance()->getUserUrl($groupDto->userId);
     $js = UTIL_JsGenerator::newInstance()->jQueryEvent('#groups_toolbar_flag', 'click', UTIL_JsGenerator::composeJsString('OW.flagContent({$entity}, {$id}, {$title}, {$href}, "groups+flags", {$ownerId});', array('entity' => GROUPS_BOL_Service::WIDGET_PANEL_NAME, 'id' => $groupDto->id, 'title' => $group['title'], 'href' => $group['url'], 'ownerId' => $groupDto->userId)));
     OW::getDocument()->addOnloadScript($js, 1001);
     $toolbar = array(array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_create_date', array('date' => $createDate))), array('label' => OW::getLanguage()->text('groups', 'widget_brief_info_admin', array('name' => $adminName, 'url' => $adminUrl))));
     if ($service->isCurrentUserCanEdit($groupDto)) {
         $toolbar[] = array('label' => OW::getLanguage()->text('groups', 'edit_btn_label'), 'href' => OW::getRouter()->urlForRoute('groups-edit', array('groupId' => $groupId)));
     }
     if (OW::getUser()->isAuthenticated() && OW::getUser()->getId() != $groupDto->userId) {
         $toolbar[] = array('label' => OW::getLanguage()->text('base', 'flag'), 'href' => 'javascript://', 'id' => 'groups_toolbar_flag');
     }
     $event = new BASE_CLASS_EventCollector('groups.on_toolbar_collect', array('groupId' => $groupId));
     OW::getEventManager()->trigger($event);
     foreach ($event->getData() as $item) {
         $toolbar[] = $item;
     }
     $this->assign('toolbar', $toolbar);
     $this->assign('group', $group);
 }
예제 #12
0
파일: import.php 프로젝트: vazahat/dudex
 public function import($params)
 {
     $importDir = $params['importDir'];
     $txtFile = $importDir . 'configs.txt';
     // import configs
     if (file_exists($txtFile)) {
         $string = file_get_contents($txtFile);
         $configs = json_decode($string, true);
     }
     if (!$configs) {
         return;
     }
     $giftService = VIRTUALGIFTS_BOL_VirtualGiftsService::getInstance();
     $giftsDir = $giftService->getGiftUploadDir();
     $tpls = $giftService->getTemplateList();
     if (empty($tpls)) {
         return;
     }
     foreach ($tpls as $tpl) {
         $dto = $tpl['dto'];
         $path = $giftService->getGiftFilePath($dto->id, $dto->uploadTimestamp, $dto->extension);
         $name = str_replace($giftsDir, '', $path);
         $content = file_get_contents($configs['url'] . '/' . $name);
         if (mb_strlen($content)) {
             OW::getStorage()->fileSetContent($path, $content);
         }
     }
 }
예제 #13
0
파일: import.php 프로젝트: vazahat/dudex
 public function import($params)
 {
     $importDir = $params['importDir'];
     $txtFile = $importDir . 'configs.txt';
     // import configs
     if (file_exists($txtFile)) {
         $string = file_get_contents($txtFile);
         $configs = json_decode($string, true);
     }
     if (!$configs) {
         return;
     }
     $photoService = PHOTO_BOL_PhotoService::getInstance();
     $types = array('main', 'preview', 'original');
     $photoDir = $photoService->getPhotoUploadDir();
     $page = 1;
     while (true) {
         $photos = $photoService->findPhotoList('latest', $page, 10);
         $page++;
         if (empty($photos)) {
             break;
         }
         foreach ($photos as $photo) {
             foreach ($types as $type) {
                 $path = $photoService->getPhotoPath($photo['id'], $photo['hash'], $type);
                 $photoName = str_replace($photoDir, '', $path);
                 $content = file_get_contents($configs['url'] . '/' . $photoName);
                 if (mb_strlen($content)) {
                     OW::getStorage()->fileSetContent($path, $content);
                 }
             }
         }
     }
 }
예제 #14
0
 public function __construct(array $aParams)
 {
     parent::__construct();
     //print_r($aParams); exit;
     foreach ($aParams['items'] as $k => $v) {
         $aParams['items'][$k]['media_parent'] = isset($aParams['items'][$k]['media_parent']) ? $aParams['items'][$k]['media_parent'] : '';
         $aParams['items'][$k]['title_decode'] = urldecode($aParams['items'][$k]['title']);
         $aParams['items'][$k]['update_page_param'] = http_build_query(array('service' => $aParams['items'][$k]['provider'], 'media' => 'photo', 'media_parent' => $aParams['items'][$k]['media_parent'], 'extra' => 'aid', 'aid' => $aParams['items'][$k]['aid']));
         //$aParams['items'][$k]['brief_title'] = substr($aParams['items'][$k]['title_decode'], 0, 20);
         $aParams['items'][$k]['status_text'] = OW::getLanguage()->text("ynmediaimporter", 'import_status_' . $aParams['items'][$k]['status']);
         $aParams['items'][$k]['json'] = json_encode($aParams['items'][$k]);
     }
     //print_r($aParams); exit;
     if (isset($aParams['items'])) {
         $this->assign('items', $aParams['items']);
     }
     if (isset($aParams['params'])) {
         $this->assign('params', $aParams['params']);
         $this->assign('params_json', json_encode($aParams['params']));
     }
     if (isset($aParams['item_count'])) {
         $this->assign('item_count', $aParams['item_count']);
     }
     if (isset($aParams['userId'])) {
         $this->assign('userId', $aParams['userId']);
     }
 }
예제 #15
0
파일: faq_edit.php 프로젝트: vazahat/dudex
 /**
  * Class constructor
  */
 public function __construct()
 {
     parent::__construct('update-question-form');
     $this->setAction(OW::getRouter()->urlFor('OCSFAQ_CTRL_Admin', 'editQuestion'));
     $lang = OW::getLanguage();
     $questionId = new HiddenField('questionId');
     $questionId->setRequired(true);
     $this->addElement($questionId);
     $question = new TextField('question');
     $question->setRequired(true);
     $question->setLabel($lang->text('ocsfaq', 'question'));
     $this->addElement($question);
     $btnSet = array(BOL_TextFormatService::WS_BTN_IMAGE, BOL_TextFormatService::WS_BTN_VIDEO, BOL_TextFormatService::WS_BTN_HTML);
     $answer = new WysiwygTextarea('answer', $btnSet);
     $answer->setRequired(true);
     $answer->setLabel($lang->text('ocsfaq', 'answer'));
     $this->addElement($answer);
     $isFeatured = new CheckboxField('isFeatured');
     $isFeatured->setLabel($lang->text('ocsfaq', 'is_featured'));
     $this->addElement($isFeatured);
     $categories = OCSFAQ_BOL_FaqService::getInstance()->getCategories();
     if ($categories) {
         $category = new Selectbox('category');
         foreach ($categories as $cat) {
             $category->addOption($cat->id, $cat->name);
         }
         $category->setLabel($lang->text('ocsfaq', 'category'));
         $this->addElement($category);
     }
     // submit
     $submit = new Submit('update');
     $submit->setValue($lang->text('ocsfaq', 'btn_save'));
     $this->addElement($submit);
 }
예제 #16
0
 public function index($params)
 {
     if (OW::getRequest()->isAjax()) {
         exit;
     }
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('base', 'massmailing_unsubscribe'));
     $code = null;
     $userId = null;
     $result = false;
     if (isset($params['code']) && isset($params['id'])) {
         $result = 'confirm';
         if (!empty($_POST['cancel'])) {
             $this->redirect(OW_URL_HOME);
         }
         $code = trim($params['code']);
         $userId = $params['id'];
         $user = $this->userServise->findUserById($userId);
         if ($user !== null) {
             if (md5($user->username . $user->password) === $code) {
                 $result = 'confirm';
                 if (!empty($_POST['confirm'])) {
                     BOL_PreferenceService::getInstance()->savePreferenceValue('mass_mailing_subscribe', false, $user->id);
                     $result = true;
                     OW::getFeedback()->info($language->text('base', 'massmailing_unsubscribe_successful'));
                     $this->redirect(OW_URL_HOME);
                 }
             }
         }
     }
     $this->assign('result', $result);
 }
예제 #17
0
파일: request.php 프로젝트: ZyXelP/oxwall
 /**
  * Returns real request uri.
  *
  * @return string
  */
 public function getRequestUri()
 {
     if ($this->uri === null) {
         $this->uri = UTIL_Url::getRealRequestUri(OW::getRouter()->getBaseUrl(), $_SERVER['REQUEST_URI']);
     }
     return $this->uri;
 }
예제 #18
0
파일: init.php 프로젝트: vazahat/dudex
function contactus_handler_after_install(BASE_CLASS_EventCollector $event)
{
    if (count(CONTACTUS_BOL_Service::getInstance()->getDepartmentList()) < 1) {
        $url = OW::getRouter()->urlForRoute('contactus.admin');
        $event->add(OW::getLanguage()->text('contactus', 'after_install_notification', array('url' => $url)));
    }
}
예제 #19
0
파일: log.php 프로젝트: ZyXelP/oxwall
 /**
  * Constructor.
  *
  * @param string $type
  * @param OW_LogWriter $logWriter
  */
 private function __construct($type)
 {
     $this->type = $type;
     $this->logWriter = new BASE_CLASS_DbLogWriter();
     OW::getEventManager()->bind('core.exit', array($this, 'writeLog'));
     OW::getEventManager()->bind('core.emergency_exit', array($this, 'writeLog'));
 }
예제 #20
0
 protected function initJs()
 {
     $js = UTIL_JsGenerator::newInstance();
     $js->addScript('OW.Console.addItem(new OW_ConsoleDropdownClick({$uniqId}, {$contentIniqId}), {$key});', array('uniqId' => $this->consoleItem->getUniqId(), 'key' => $this->getKey(), 'contentIniqId' => $this->consoleItem->getContentUniqId()));
     OW::getDocument()->addOnloadScript($js);
     return $this->consoleItem->getUniqId();
 }
예제 #21
0
 public function initJs($delegate)
 {
     $js = UTIL_JsGenerator::newInstance();
     $js->newObject(array('CORE.ObjectRegistry', $this->uniqId), 'ATTACHMENTS.Attachment', array($this->uniqId, $delegate));
     OW::getDocument()->addOnloadScript($js);
     return $this->uniqId;
 }
예제 #22
0
 /**
  * @return Constructor.
  */
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'users_widget.html');
     $randId = UTIL_HtmlTag::generateAutoId('base_users_widget');
     $this->assign('widgetId', $randId);
     $data = $this->getData($params);
     $menuItems = array();
     $dataToAssign = array();
     if (!empty($data)) {
         foreach ($data as $key => $item) {
             $contId = "{$randId}_users_widget_{$key}";
             $toolbarId = !empty($item['toolbar']) ? "{$randId}_toolbar_{$key}" : false;
             $menuItems[$key] = array('label' => $item['menu-label'], 'id' => "{$randId}_users_widget_menu_{$key}", 'contId' => $contId, 'active' => !empty($item['menu_active']), 'toolbarId' => $toolbarId);
             $usersCmp = $this->getUsersCmp($item['userIds']);
             $dataToAssign[$key] = array('users' => $usersCmp->render(), 'active' => !empty($item['menu_active']), 'toolbar' => !empty($item['toolbar']) ? $item['toolbar'] : array(), 'toolbarId' => $toolbarId, 'contId' => $contId);
         }
     }
     $this->assign('data', $dataToAssign);
     $displayMenu = true;
     if (count($data) == 1 && !$this->forceDisplayMenu) {
         $displayMenu = false;
     }
     if (!$params->customizeMode && (count($data) != 1 || $this->forceDisplayMenu)) {
         $menu = $this->getMenuCmp($menuItems);
         if (!empty($menu)) {
             $this->addComponent('menu', $menu);
         }
     }
 }
예제 #23
0
 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));
     }
 }
예제 #24
0
 public function __construct($params = array())
 {
     parent::__construct();
     $service = BOL_BillingService::getInstance();
     $gateway = $service->findGatewayByKey($params['gateway']);
     if (!$gateway || $gateway->dynamic) {
         $this->setVisible(false);
         return;
     }
     $event = new BASE_CLASS_EventCollector('base.billing_add_gateway_product');
     OW::getEventManager()->trigger($event);
     $data = $event->getData();
     $eventProducts = array();
     if ($data) {
         foreach ($data as $plugin) {
             foreach ($plugin as $product) {
                 $id = $service->addGatewayProduct($gateway->id, $product['pluginKey'], $product['entityType'], $product['entityId']);
                 $product['id'] = $id;
                 $eventProducts[] = $product;
             }
         }
     }
     $products = $service->findGatewayProductList($gateway->id);
     foreach ($eventProducts as &$prod) {
         $prod['productId'] = !empty($products[$prod['id']]) ? $products[$prod['id']]['dto']->productId : null;
         $prod['plugin'] = !empty($products[$prod['id']]) ? $products[$prod['id']]['plugin'] : null;
     }
     $this->assign('products', $eventProducts);
     $this->assign('actionUrl', OW::getRouter()->urlFor('BASE_CTRL_Billing', 'saveGatewayProduct'));
     $this->assign('backUrl', urlencode(OW::getRouter()->getBaseUrl() . OW::getRouter()->getUri()));
 }
예제 #25
0
 public function onUserRegister(OW_Event $event)
 {
     $params = $event->getParams();
     if (empty($params['params']['code'])) {
         return;
     }
     $userIds = array();
     foreach ($this->providers as $provider) {
         $inviters = $provider->getInviters($params['params']['code']);
         if ($inviters && is_array($inviters)) {
             $userIds = array_merge($userIds, $inviters);
         }
     }
     $newId = $params['userId'];
     foreach ($userIds as $uid) {
         $event = new OW_Event('friends.add_friend', array('requesterId' => $uid, 'userId' => $newId));
         OW::getEventManager()->trigger($event);
         /*$eventParams = array('pluginKey' => 'contactimporter', 'action' => 'import_friend', 'userId' => $userId);
         
         	    if ( OW::getEventManager()->call('usercredits.check_balance', $eventParams) === true )
         	    {
         		OW::getEventManager()->call('usercredits.track_action', $eventParams);
         	    }*/
     }
 }
예제 #26
0
 public function __construct()
 {
     parent::__construct('upload-form');
     $language = OW::getLanguage();
     $this->setEnctype(Form::ENCTYPE_MULTYPART_FORMDATA);
     $fileField = new FileField('photo');
     //$fileField->setRequired(true);
     $this->addElement($fileField);
     // album Field
     $albumField = new TextField('album');
     $albumField->setRequired(true);
     $albumField->setHasInvitation(true);
     $albumField->setId('album_input');
     $albumField->setInvitation($language->text('photo', 'create_album'));
     $this->addElement($albumField);
     // description Field
     $descField = new Textarea('description');
     $descField->setHasInvitation(true);
     $descField->setInvitation($language->text('photo', 'describe_photo'));
     $this->addElement($descField);
     $cancel = new Submit('cancel', false);
     $cancel->setValue($language->text('base', 'cancel_button'));
     $this->addElement($cancel);
     $submit = new Submit('submit', false);
     $this->addElement($submit);
 }
예제 #27
0
 public function render()
 {
     $cssUrl = OW::getPluginManager()->getPlugin('FBCONNECT')->getStaticCssUrl() . 'fbconnect.css';
     OW::getDocument()->addStyleSheet($cssUrl);
     FBCONNECT_BOL_Service::getInstance()->initializeJs(array('email', 'user_about_me', 'user_birthday'), $_GET);
     return parent::render();
 }
예제 #28
0
 public function render()
 {
     $defaultAvatarUrl = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
     $this->assign('defaultAvatarUrl', $defaultAvatarUrl);
     $js = "OW.Mailbox.conversationController = new MAILBOX_ConversationView();";
     OW::getDocument()->addOnloadScript($js, 3006);
     //TODO check this config
     $enableAttachments = OW::getConfig()->getValue('mailbox', 'enable_attachments');
     $this->assign('enableAttachments', $enableAttachments);
     $replyToMessageActionPromotedText = '';
     $isAuthorizedReplyToMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_message');
     $isAuthorizedReplyToMessage = $isAuthorizedReplyToMessage || OW::getUser()->isAuthorized('mailbox', 'send_chat_message');
     if (!$isAuthorizedReplyToMessage) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_message');
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $replyToMessageActionPromotedText = $status['msg'];
         }
     }
     $this->assign('isAuthorizedReplyToMessage', $isAuthorizedReplyToMessage);
     $isAuthorizedReplyToChatMessage = OW::getUser()->isAuthorized('mailbox', 'reply_to_chat_message');
     if (!$isAuthorizedReplyToChatMessage) {
         $status = BOL_AuthorizationService::getInstance()->getActionStatus('mailbox', 'reply_to_chat_message');
         if ($status['status'] == BOL_AuthorizationService::STATUS_PROMOTED) {
             $replyToMessageActionPromotedText = $status['msg'];
         }
     }
     $this->assign('isAuthorizedReplyToChatMessage', $isAuthorizedReplyToChatMessage);
     $this->assign('replyToMessageActionPromotedText', $replyToMessageActionPromotedText);
     if ($isAuthorizedReplyToMessage) {
         $text = new WysiwygTextarea('mailbox_message');
         $text->setId('conversationTextarea');
         $this->assign('mailbox_message', $text->renderInput());
     }
     return parent::render();
 }
예제 #29
0
 public function uploadTmpAvatar($file)
 {
     if (isset($file)) {
         $lang = OW::getLanguage();
         if (!UTIL_File::validateImage($file['name'])) {
             return array('result' => false, 'error' => $lang->text('base', 'not_valid_image'));
         }
         if (!empty($file['error'])) {
             $message = BOL_FileService::getInstance()->getUploadErrorMessage($file['error']);
         }
         if (!empty($message)) {
             return array('result' => false, 'error' => $message);
         }
         $filesize = OW::getConfig()->getValue('base', 'avatar_max_upload_size');
         if (empty($file['size']) || $filesize * 1024 * 1024 < $file['size']) {
             $message = OW::getLanguage()->text('base', 'upload_file_max_upload_filesize_error');
             return array('result' => false, 'error' => $message);
         }
         $avatarService = BOL_AvatarService::getInstance();
         $key = $avatarService->getAvatarChangeSessionKey();
         $uploaded = $avatarService->uploadUserTempAvatar($key, $file['tmp_name']);
         if (!$uploaded) {
             return array('result' => false, 'error' => $lang->text('base', 'upload_avatar_faild'));
         }
         $url = $avatarService->getTempAvatarUrl($key, 3);
         return array('result' => true, 'url' => $url);
     }
     return array('result' => false);
 }
예제 #30
0
/**
 * Smarty form block function.
 *
 * @author Sardar Madumarov <*****@*****.**>
 * @package ow.ow_smarty.plugin
 * @since 1.0
 */
function smarty_block_form($params, $content)
{
    if (!isset($params['name'])) {
        throw new InvalidArgumentException('Empty form name!');
    }
    $vr = OW_ViewRenderer::getInstance();
    $assignedForms = $vr->getAssignedVar('_owForms_');
    if (!isset($assignedForms[$params['name']])) {
        throw new InvalidArgumentException('There is no form with name `' . $params['name'] . '` !');
    }
    // mark active form
    if ($content === null) {
        $vr->assignVar('_owActiveForm_', $assignedForms[$params['name']]);
        return;
    }
    /* @var $form OW_Form */
    $form = $vr->getAssignedVar('_owActiveForm_');
    if (isset($params['decorator'])) {
        $viewRenderer = OW_ViewRenderer::getInstance();
        $viewRenderer->assignVar('formInfo', $form->getElementsInfo());
        $content = $viewRenderer->renderTemplate(OW::getThemeManager()->getDecorator($params['decorator']));
    }
    unset($params['decorator']);
    unset($params['name']);
    return $form->render($content, $params);
}