Example #1
0
 /**
  * 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);
 }
Example #2
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();
 }
Example #3
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);
 }
Example #4
0
 public function __construct($name)
 {
     parent::__construct($name);
     $this->setAction(OW::getRouter()->urlForRoute('ocsaffiliates.action_signup'));
     $this->setAjax();
     $lang = OW::getLanguage();
     $affName = new TextField('name');
     $affName->setRequired(true);
     $affName->setLabel($lang->text('ocsaffiliates', 'affiliate_name'));
     $this->addElement($affName);
     $email = new TextField('email');
     $email->setRequired(true);
     $email->setLabel($lang->text('ocsaffiliates', 'email'));
     $email->addValidator(new EmailValidator());
     $this->addElement($email);
     $password = new PasswordField('password');
     $password->setRequired(true);
     $password->setLabel($lang->text('ocsaffiliates', 'password'));
     $this->addElement($password);
     $payment = new Textarea('payment');
     $payment->setRequired(true);
     $payment->setLabel($lang->text('ocsaffiliates', 'payment_details'));
     $this->addElement($payment);
     if (OW::getConfig()->getValue('ocsaffiliates', 'terms_agreement')) {
         $terms = new CheckboxField('terms');
         $validator = new RequiredValidator();
         $validator->setErrorMessage($lang->text('ocsaffiliates', 'terms_required_msg'));
         $terms->addValidator($validator);
         $this->addElement($terms);
     }
     $submit = new Submit('signup');
     $submit->setValue($lang->text('ocsaffiliates', 'signup_btn'));
     $this->addElement($submit);
     $this->bindJsFunction(Form::BIND_SUCCESS, "function(data){\n            if ( !data.result ) {\n                OW.error(data.error);\n            }\n            else {\n                document.location.reload();\n            }\n        }");
 }
Example #5
0
 private static function detectContext()
 {
     if (self::$context !== null) {
         return;
     }
     if (defined('OW_USE_CONTEXT')) {
         switch (true) {
             case OW_USE_CONTEXT == 1:
                 self::$context = self::CONTEXT_DESKTOP;
                 return;
             case OW_USE_CONTEXT == 1 << 1:
                 self::$context = self::CONTEXT_MOBILE;
                 return;
             case OW_USE_CONTEXT == 1 << 2:
                 self::$context = self::CONTEXT_API;
                 return;
         }
     }
     $context = self::CONTEXT_DESKTOP;
     try {
         $isSmart = UTIL_Browser::isSmartphone();
     } catch (Exception $e) {
         return;
     }
     if (defined('OW_CRON')) {
         $context = self::CONTEXT_DESKTOP;
     } else {
         if (self::getSession()->isKeySet(OW_Application::CONTEXT_NAME)) {
             $context = self::getSession()->get(OW_Application::CONTEXT_NAME);
         } else {
             if ($isSmart) {
                 $context = self::CONTEXT_MOBILE;
             }
         }
     }
     if (defined('OW_USE_CONTEXT')) {
         if ((OW_USE_CONTEXT & 1 << 1) == 0 && $context == self::CONTEXT_MOBILE) {
             $context = self::CONTEXT_DESKTOP;
         }
         if ((OW_USE_CONTEXT & 1 << 2) == 0 && $context == self::CONTEXT_API) {
             $context = self::CONTEXT_DESKTOP;
         }
     }
     if ((bool) OW::getConfig()->getValue('base', 'disable_mobile_context') && $context == self::CONTEXT_MOBILE) {
         $context = self::CONTEXT_DESKTOP;
     }
     //temp API context detection
     //TODO remake
     $uri = UTIL_Url::getRealRequestUri(OW::getRouter()->getBaseUrl(), $_SERVER['REQUEST_URI']);
     if (mb_strstr($uri, '/')) {
         if (trim(mb_substr($uri, 0, mb_strpos($uri, '/'))) == 'api') {
             $context = self::CONTEXT_API;
         }
     } else {
         if (trim($uri) == 'api') {
             $context = self::CONTEXT_API;
         }
     }
     self::$context = $context;
 }
Example #6
0
 public function processCleanUp()
 {
     $configs = OW::getConfig()->getValues('cacheextreme');
     //clean template cache
     if ($configs['template_cache']) {
         OW_ViewRenderer::getInstance()->clearCompiledTpl();
     }
     //clean db backend cache
     if ($configs['backend_cache']) {
         OW::getCacheManager()->clean(array(), OW_CacheManager::CLEAN_ALL);
     }
     //clean themes static contents cache
     if ($configs['theme_static']) {
         OW::getThemeManager()->getThemeService()->processAllThemes();
     }
     //clean plugins static contents cache
     if ($configs['plugin_static']) {
         $pluginService = BOL_PluginService::getInstance();
         $activePlugins = $pluginService->findActivePlugins();
         /* @var $pluginDto BOL_Plugin */
         foreach ($activePlugins as $pluginDto) {
             $pluginStaticDir = OW_DIR_PLUGIN . $pluginDto->getModule() . DS . 'static' . DS;
             if (file_exists($pluginStaticDir)) {
                 $staticDir = OW_DIR_STATIC_PLUGIN . $pluginDto->getModule() . DS;
                 if (file_exists($staticDir)) {
                     UTIL_File::removeDir($staticDir);
                 }
                 mkdir($staticDir);
                 chmod($staticDir, 0777);
                 UTIL_File::copyDir($pluginStaticDir, $staticDir);
             }
         }
     }
 }
Example #7
0
 public function index()
 {
     $language = OW::getLanguage();
     $config = OW::getConfig();
     OW::getDocument()->setHeading(OW::getLanguage()->text('admin', 'heading_mobile_settings'));
     OW::getDocument()->setHeadingIconClass('ow_ic_gear_wheel');
     $settingsForm = new Form('mobile_settings');
     $disableMobile = new CheckboxField('disable_mobile');
     $disableMobile->setLabel($language->text('admin', 'mobile_settings_mobile_context_disable_label'));
     $disableMobile->setDescription($language->text('admin', 'mobile_settings_mobile_context_disable_desc'));
     $settingsForm->addElement($disableMobile);
     $submit = new Submit('save');
     $submit->setValue($language->text('admin', 'save_btn_label'));
     $settingsForm->addElement($submit);
     $this->addForm($settingsForm);
     if (OW::getRequest()->isPost()) {
         if ($settingsForm->isValid($_POST)) {
             $data = $settingsForm->getValues();
             $config->saveConfig('base', 'disable_mobile_context', (bool) $data['disable_mobile']);
             OW::getFeedback()->info($language->text('admin', 'settings_submit_success_message'));
         } else {
             OW::getFeedback()->error('Error');
         }
         $this->redirect();
     }
     $disableMobile->setValue($config->getValue('base', 'disable_mobile_context'));
 }
Example #8
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $uniqId = uniqid('questionAdd');
     $this->assign('uniqId', $uniqId);
     $config = OW::getConfig()->getValues(EQUESTIONS_Plugin::PLUGIN_KEY);
     $this->assign('configs', $config);
     $form = $this->initForm();
     $this->addForm($form);
     EQUESTIONS_Plugin::getInstance()->addStatic();
     $attachmentsId = null;
     if ($config['attachments']) {
         $types = array();
         if ($config['attachments_image']) {
             $types[] = 'image';
         }
         if ($config['attachments_video']) {
             $types[] = 'video';
         }
         if ($config['attachments_link']) {
             $types[] = 'link';
         }
         $attachments = new EQUESTIONS_CMP_Attachments($types);
         $attachments->initJs();
         $this->addComponent('attachments', $attachments);
         $attachmentsId = $attachments->getUniqId();
     }
     $js = UTIL_JsGenerator::newInstance()->newObject('questionsAdd', 'QUESTIONS_QuestionAdd', array($uniqId, $form->getName(), array('maxQuestionLength' => 500, 'minQuestionLength' => 3, 'maxAnswerLength' => 150), $attachmentsId));
     OW::getDocument()->addOnloadScript($js);
 }
Example #9
0
 protected function getTabs()
 {
     $language = OW::getLanguage();
     $service = UHEADER_BOL_Service::getInstance();
     $photoBridge = UHEADER_CLASS_PhotoBridge::getInstance();
     $templatesCount = $service->findTemplatesCountForUser($this->userId);
     if ($templatesCount > 0 || !$photoBridge->isActive()) {
         $activeTab = "gallery";
     } else {
         $activeTab = "photos";
     }
     $tabs = array();
     if ($templatesCount > 0) {
         $tabKey = "gallery";
         $dimensions = $this->getDimensions();
         //$dimensions["height"] -= 45;
         if (OW::getConfig()->getValue('uheader', 'tpl_view_mode') == "list") {
             $coverGallery = new UHEADER_CMP_CoverGallery($this->userId, $tabKey, $dimensions);
         } else {
             $coverGallery = new UHEADER_CMP_CoverPreviewGallery($this->userId, $tabKey, $dimensions);
         }
         $coverGallery->assign("dimensions", $this->getDimensions());
         $tabs[] = array("label" => $language->text("uheader", "gallery_tab_gallery"), "key" => $tabKey, "active" => $tabKey == $activeTab, "content" => $coverGallery->render());
     }
     $tabKey = "photos";
     $photoList = new UHEADER_CMP_MyPhotos($this->userId, $tabKey);
     $tabs[] = array("label" => $language->text("uheader", "gallery_tab_photos"), "key" => $tabKey, "active" => $tabKey == $activeTab, "content" => $photoList->render());
     return $tabs;
 }
Example #10
0
 public function __construct($layout)
 {
     parent::__construct();
     $status = BOL_AuthorizationService::getInstance()->getActionStatus('photo', 'view');
     if ($status['status'] == BOL_AuthorizationService::STATUS_DISABLED) {
         $this->assign('authError', $status['msg']);
         return;
     }
     $class = "";
     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);
     $document = OW::getDocument();
     $js = "\$('#btn-save-as-avatar').off().on('click', function() {\n        console.log('photo floatbox call js');\n        var photoId = \$('#btn-photo-edit') . attr('rel');\n\n        document.avatarFloatBox = OW.ajaxFloatBox(\n        'BASE_CMP_AvatarChange', {\n            params: {\n                step: 2, entityType: 'photo_album', entityId: '', id: photoId\n            }}, {\n                width: 749, title: OW.getLanguageText('base', 'avatar_change')}\n                );\n            })";
     $document->addOnloadScript($js);
 }
Example #11
0
 public function index()
 {
     $this->setPageHeading(OW::getLanguage()->text('admin', 'admin_dashboard'));
     $this->setPageHeadingIconClass('ow_ic_dashboard');
     $this->assign('version', OW::getConfig()->getValue('base', 'soft_version'));
     $this->assign('build', OW::getConfig()->getValue('base', 'soft_build'));
 }
Example #12
0
 public function run()
 {
     $config = OW::getConfig();
     // check if uninstall is in progress
     if (!$config->getValue('groups', 'uninstall_inprogress')) {
         return;
     }
     if (!$config->configExists('groups', 'uninstall_cron_busy')) {
         $config->addConfig('groups', 'uninstall_cron_busy', 0);
     }
     // check if cron queue is not busy
     if ($config->getValue('groups', 'uninstall_cron_busy')) {
         return;
     }
     $config->saveConfig('groups', 'uninstall_cron_busy', 1);
     $service = GROUPS_BOL_Service::getInstance();
     try {
         $groups = $service->findLimitedList(self::GROUPS_DELETE_LIMIT);
         if (empty($groups)) {
             BOL_PluginService::getInstance()->uninstall('groups');
             OW::getApplication()->setMaintenanceMode(false);
             return;
         }
         foreach ($groups as $group) {
             $service->deleteGroup($group->id);
         }
         $config->saveConfig('groups', 'uninstall_cron_busy', 0);
     } catch (Exception $e) {
         $config->saveConfig('groups', 'uninstall_cron_busy', 0);
         throw $e;
     }
 }
Example #13
0
 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);
 }
Example #14
0
 public function getList(array $params)
 {
     OW::getDocument()->setHeading(OW::getLanguage()->text('bookmarks', 'list_headint_title'));
     $this->setTemplate(OW::getPluginManager()->getPlugin('bookmarks')->getCtrlViewDir() . 'list.html');
     $userId = OW::getUser()->getId();
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $userOnPage = (int) OW::getConfig()->getValue('base', 'users_on_page');
     $first = ($page - 1) * $userOnPage;
     $list = $this->service->findBookmarksUserIdList($userId, $first, $userOnPage, $params['category']);
     $count = $this->service->findBookmarksCount($userId, $params['category']);
     $sexValue = array();
     $userDataList = array();
     $questionService = BOL_QuestionService::getInstance();
     $data = $questionService->getQuestionData($list, array('sex', 'googlemap_location', 'birthdate'));
     foreach (BOL_QuestionValueDao::getInstance()->findQuestionValues('sex') as $sexDto) {
         $sexValue[$sexDto->value] = $questionService->getQuestionValueLang('sex', $sexDto->value);
     }
     foreach ($data as $userId => $user) {
         if (isset($user['birthdate'])) {
             $date = UTIL_DateTime::parseDate($user['birthdate'], UTIL_DateTime::MYSQL_DATETIME_DATE_FORMAT);
             $age = UTIL_DateTime::getAge($date['year'], $date['month'], $date['day']);
         } else {
             $age = '';
         }
         $userDataList[$userId] = array('info_gender' => !empty($user['sex']) && !empty($sexValue[$user['sex']]) ? $sexValue[$user['sex']] : '' . ' ' . $age, 'location' => !empty($user['googlemap_location']) ? $user['googlemap_location']['address'] : '');
     }
     $this->addComponent('list', OW::getClassInstance('BASE_CMP_Users', $userDataList, array(), $count));
 }
Example #15
0
function ganalytics_admin_notification(BASE_CLASS_EventCollector $event)
{
    $wpid = OW::getConfig()->getValue('ganalytics', 'web_property_id');
    if (empty($wpid)) {
        $event->add(OW::getLanguage()->text('ganalytics', 'admin_notification_text', array('link' => OW::getRouter()->urlForRoute('ganalytics_admin'))));
    }
}
Example #16
0
 public function rated()
 {
     if (!OW::getUser()->isAuthenticated()) {
         throw new AuthenticateException();
     }
     $lang = OW::getLanguage();
     $page = !empty($_GET['page']) && intval($_GET['page']) > 0 ? $_GET['page'] : 1;
     $perPage = (int) OW::getConfig()->getValue('base', 'users_count_on_page');
     $service = OCSTOPUSERS_BOL_Service::getInstance();
     $userId = OW::getUser()->getId();
     $users = $service->findRateUserList($userId, $page, $perPage);
     if ($users) {
         $count = $service->countRateUsers($userId);
         $list = array();
         $fields = array();
         foreach ($users as $user) {
             $list[] = $user['dto'];
             $fields[$user['dto']->id] = array('score' => $user['score'], 'timeStamp' => $user['timeStamp']);
         }
         $cmp = new OCSTOPUSERS_CMP_RatedList($list, $count, $perPage, false, $fields);
         $this->addComponent('users', $cmp);
     } else {
         $this->assign($users, null);
     }
     OW::getDocument()->setHeading($lang->text('ocstopusers', 'rated_me'));
     OW::getDocument()->setHeadingIconClass('ow_ic_star');
     OW::getNavigation()->activateMenuItem(BOL_NavigationService::MENU_TYPE_MAIN, 'base', 'users_main_menu_item');
     $this->setTemplate(OW::getPluginManager()->getPlugin('ocstopusers')->getCtrlViewDir() . 'list_index.html');
 }
Example #17
0
 public function index($params = array())
 {
     $userService = BOL_UserService::getInstance();
     $language = OW::getLanguage();
     $this->setPageHeading($language->text('hotlist', 'admin_heading_settings'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
     $settingsForm = new Form('settingsForm');
     $settingsForm->setId('settingsForm');
     $expiration_time = new TextField('expiration_time');
     $expiration_time->setRequired();
     $expiration_time->setLabel($language->text('hotlist', 'label_expiration_time'));
     $expiration_time_value = (int) OW::getConfig()->getValue('hotlist', 'expiration_time') / 86400;
     $expiration_time->setValue($expiration_time_value);
     $settingsForm->addElement($expiration_time);
     $submit = new Submit('save');
     $submit->addAttribute('class', 'ow_ic_save');
     $submit->setValue($language->text('hotlist', 'label_save_btn_label'));
     $settingsForm->addElement($submit);
     $this->addForm($settingsForm);
     if (OW::getRequest()->isPost()) {
         if ($settingsForm->isValid($_POST)) {
             $data = $settingsForm->getValues();
             OW::getConfig()->saveConfig('hotlist', 'expiration_time', $data['expiration_time'] * 86400);
             OW::getFeedback()->info($language->text('hotlist', 'settings_saved'));
             $this->redirect();
         }
     }
 }
Example #18
0
 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);
 }
Example #19
0
 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);
     }
 }
Example #20
0
 public function templatesDeleteProcess()
 {
     $config = OW::getConfig();
     // check if uninstall is in progress
     if (!$config->getValue('virtualgifts', 'uninstall_inprogress')) {
         return;
     }
     // check if cron queue is not busy
     if ($config->getValue('virtualgifts', 'uninstall_cron_busy')) {
         return;
     }
     $config->saveConfig('virtualgifts', 'uninstall_cron_busy', 1);
     $giftService = VIRTUALGIFTS_BOL_VirtualGiftsService::getInstance();
     $templates = $giftService->findAllTemplates();
     for ($i = 0; $i < self::TEMPLATE_DELETE_LIMIT; $i++) {
         if (!isset($templates[$i])) {
             break;
         }
         $giftService->deleteTemplate($templates[$i]->id);
     }
     $config->saveConfig('virtualgifts', 'uninstall_cron_busy', 0);
     $templates = $giftService->findAllTemplates();
     if (!$templates) {
         $config->saveConfig('virtualgifts', 'uninstall_inprogress', 0);
         BOL_PluginService::getInstance()->uninstall('virtualgifts');
         $giftService->setMaintenanceMode(false);
     }
 }
Example #21
0
function antibruteforce_core_after_route(OW_Event $event)
{
    if (OW::getUser()->isAuthenticated()) {
        return;
    }
    $classDir = OW::getPluginManager()->getPlugin('antibruteforce')->getClassesDir();
    $handler = OW::getRequestHandler()->getHandlerAttributes();
    if (OW::getConfig()->getValue('antibruteforce', 'authentication')) {
        include_once $classDir . 'sign_in.php';
        include_once $classDir . 'auth_result.php';
    }
    if (OW::getConfig()->getValue('antibruteforce', 'registration')) {
        if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BASE_CTRL_Join' && $handler[OW_RequestHandler::ATTRS_KEY_ACTION] == 'index') {
            OW::getEventManager()->bind(OW_EventManager::ON_FINALIZE, 'antibruteforce_core_finalize');
        } else {
            if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BASE_CTRL_Captcha' && $handler[OW_RequestHandler::ATTRS_KEY_ACTION] == 'ajaxResponder') {
                include_once $classDir . 'captcha.php';
            }
        }
    }
    if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] != 'ANTIBRUTEFORCE_CTRL_Antibruteforce') {
        if (ANTIBRUTEFORCE_BOL_Service::getInstance()->isLocked()) {
            ANTIBRUTEFORCE_BOL_Service::getInstance()->redirect();
        }
    }
}
Example #22
0
 public function getUsersetting($userId, $key)
 {
     // user setting
     $userSetting = $this->findByUserIdOrKey($userId, $key);
     // admin setting
     $adminConfigs = json_decode(OW::getConfig()->getValue('ynsocialpublisher', $key), true);
     // return setting
     $setting = array();
     // if do not find this setting in user, use setting in admin
     if (!empty($adminConfigs['active']) && OW::getPluginManager()->isPluginActive($key)) {
         $setting['userId'] = $userId;
         $setting['key'] = $key;
         $setting['providers'] = array();
         $setting['adminProviders'] = $adminConfigs['providers'];
         if (!$userSetting) {
             //$setting['option'] = YNSOCIALPUBLISHER_BOL_UsersettingDao::OPTIONS_NOT_ASK;
             $setting['option'] = YNSOCIALPUBLISHER_BOL_UsersettingDao::OPTIONS_ASK;
             // providers
             $setting['providers'] = $adminConfigs['providers'];
         } else {
             $setting['option'] = $userSetting->option;
             // providers
             $setting['providers'] = array_intersect(json_decode($userSetting->providers, true), $adminConfigs['providers']);
         }
     }
     return $setting;
 }
Example #23
0
 public function searchResultMenu($order)
 {
     $lang = OW::getLanguage();
     $router = OW::getRouter();
     $config = OW::getConfig()->getValues('usearch');
     $items = array();
     if ($config['order_latest_activity']) {
         $item = array('label' => $lang->text('usearch', 'latest'), 'url' => $router->urlForRoute('users-search-result', array('orderType' => USEARCH_BOL_Service::LIST_ORDER_LATEST_ACTIVITY)), 'isActive' => $order == USEARCH_BOL_Service::LIST_ORDER_LATEST_ACTIVITY);
         array_push($items, $item);
     }
     if ($config['order_recently_joined']) {
         $item = array('label' => $lang->text('usearch', 'recently_joined'), 'url' => $router->urlForRoute('users-search-result', array('orderType' => USEARCH_BOL_Service::LIST_ORDER_NEW)), 'isActive' => $order == USEARCH_BOL_Service::LIST_ORDER_NEW);
         array_push($items, $item);
     }
     if (OW::getPluginManager()->isPluginActive('matchmaking') && $config['order_match_compatibitity'] && OW::getUser()->isAuthenticated()) {
         $item = array('label' => $lang->text('usearch', 'match_compatibitity'), 'url' => $router->urlForRoute('users-search-result', array('orderType' => USEARCH_BOL_Service::LIST_ORDER_MATCH_COMPATIBILITY)), 'isActive' => $order == USEARCH_BOL_Service::LIST_ORDER_MATCH_COMPATIBILITY);
         array_push($items, $item);
     }
     if (OW::getPluginManager()->isPluginActive('googlelocation') && $config['order_distance']) {
         $item = array('label' => $lang->text('usearch', 'distance'), 'url' => $router->urlForRoute('users-search-result', array('orderType' => USEARCH_BOL_Service::LIST_ORDER_DISTANCE)), 'isActive' => $order == USEARCH_BOL_Service::LIST_ORDER_DISTANCE);
         array_push($items, $item);
     }
     $event = new OW_Event('usearch.get_list_order_menu', array('order' => $order), $items);
     OW::getEventManager()->trigger($event);
     $items = $event->getData();
     if (!empty($items)) {
         return new BASE_CMP_SortControl($items);
     }
     return null;
 }
Example #24
0
 public function getData(BASE_CLASS_WidgetParameter $params)
 {
     $count = (int) $params->customParamList['count'];
     $userId = OW::getUser()->getId();
     $service = OCSFAVORITES_BOL_Service::getInstance();
     $lang = OW::getLanguage();
     $router = OW::getRouter();
     $multiple = OW::getConfig()->getValue('ocsfavorites', 'can_view') && OW::getUser()->isAuthorized('ocsfavorites', 'view_users');
     $toolbar = array();
     $lists = array();
     $resultList = array();
     $toolbar['my'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.list'));
     $lists['my'] = $service->findFavoritesForUser($userId, 1, $count);
     if ($multiple) {
         $toolbar['me'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.added_list'));
         $lists['me'] = $service->findUsersWhoAddedUserAsFavorite($userId, 1, $count);
         $toolbar['mutual'] = array('label' => $lang->text('base', 'view_all'), 'href' => $router->urlForRoute('ocsfavorites.mutual_list'));
         $lists['mutual'] = $service->findMutualFavorites($userId, 1, $count);
     }
     $this->setSettingValue(self::SETTING_TOOLBAR, array($toolbar['my']));
     $resultList['my'] = array('menu-label' => $lang->text('ocsfavorites', 'my'), 'menu_active' => true, 'userIds' => $this->getIds($lists['my'], 'favoriteId'), 'toolbar' => array($toolbar['my']));
     if ($multiple) {
         if ($lists['me']) {
             $resultList['me'] = array('menu-label' => $lang->text('ocsfavorites', 'who_added_me'), 'userIds' => $this->getIds($lists['me'], 'userId'), 'toolbar' => array($toolbar['me']));
         }
         if ($lists['mutual']) {
             $resultList['mutual'] = array('menu-label' => $lang->text('ocsfavorites', 'mutual'), 'userIds' => $this->getIds($lists['mutual'], 'userId'), 'toolbar' => array($toolbar['mutual']));
         }
     }
     return $resultList;
 }
Example #25
0
 public function index($params)
 {
     if (OW::getUser()->isAuthenticated()) {
         $this->redirect(OW::getRouter()->urlForRoute('base_index'));
     }
     parent::index($params);
     $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getMobileCtrlViewDir() . 'join_index.html');
     $urlParams = $_GET;
     if (is_array($params) && !empty($params)) {
         $urlParams = array_merge($_GET, $params);
     }
     /* @var $form JoinForm */
     $form = $this->joinForm;
     if (!empty($form)) {
         $this->joinForm->setAction(OW::getRouter()->urlFor('BASE_MCTRL_Join', 'joinFormSubmit', $urlParams));
         BASE_MCLASS_JoinFormUtlis::setLabels($form, $form->getSortedQuestionsList());
         BASE_MCLASS_JoinFormUtlis::setInvitations($form, $form->getSortedQuestionsList());
         BASE_MCLASS_JoinFormUtlis::setColumnCount($form);
         $displayPhotoUpload = OW::getConfig()->getValue('base', 'join_display_photo_upload');
         $this->assign('requiredPhotoUpload', $displayPhotoUpload == BOL_UserService::CONFIG_JOIN_DISPLAY_AND_SET_REQUIRED_PHOTO_UPLOAD);
         $this->assign('presentationToClass', $this->presentationToCssClass());
         $element = $this->joinForm->getElement('userPhoto');
         $this->assign('photoUploadId', 'userPhoto');
         if ($element) {
             $this->assign('photoUploadId', $element->getId());
         }
         BASE_MCLASS_JoinFormUtlis::addOnloadJs($form->getName());
     }
 }
Example #26
0
 public function onCollectTypes(BASE_CLASS_EventCollector $event)
 {
     $mandatoryApprove = OW::getConfig()->getValue('base', 'mandatory_user_approve');
     $event->add(array("pluginKey" => "base", "authorizationGroup" => "base", "group" => "profiles", "entityType" => self::ENTITY_TYPE_PROFILE, "groupLabel" => OW::getLanguage()->text("base", "content_profiles_label"), "entityLabel" => OW::getLanguage()->text("base", "content_profile_label"), "displayFormat" => "empty", "moderation" => $mandatoryApprove ? array(BOL_ContentService::MODERATION_TOOL_FLAG, BOL_ContentService::MODERATION_TOOL_APPROVE) : array(BOL_ContentService::MODERATION_TOOL_FLAG)));
     $event->add(array("pluginKey" => "base", "authorizationGroup" => "base", "group" => "comments", "entityType" => self::ENTITY_TYPE_COMMENT, "groupLabel" => OW::getLanguage()->text("base", "content_comments_label"), "entityLabel" => OW::getLanguage()->text("base", "content_comment_label"), "moderation" => array(BOL_ContentService::MODERATION_TOOL_FLAG)));
     $event->add(array("pluginKey" => "base", "authorizationGroup" => "base", "group" => "avatars", "entityType" => self::ENTITY_TYPE_AVATAR, "groupLabel" => OW::getLanguage()->text("base", "content_avatars_label"), "entityLabel" => OW::getLanguage()->text("base", "content_avatar_label")));
 }
Example #27
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);
 }
Example #28
0
 public function deleteBlockIp()
 {
     $expareTime = (int) OW::getConfig()->getValue('antibruteforce', ANTIBRUTEFORCE_BOL_Service::EXPIRE_TIME) * 60;
     $query = 'DELETE FROM `' . $this->getTableName() . '`
         WHERE `time` <= :time';
     $this->dbo->query($query, array('time' => time() - $expareTime));
 }
Example #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);
 }
Example #30
0
 public function index(array $params)
 {
     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 = OCSGUESTS_BOL_Service::getInstance()->findGuestsForUser($userId, $page, $perPage);
     $guestList = array();
     if ($guests) {
         foreach ($guests as $guest) {
             $guestList[$guest->guestId] = array('last_visit' => $lang->text('ocsguests', 'visited') . ' ' . '<span class="ow_remark">' . $guest->visitTimestamp . '</span>');
         }
         $itemCount = OCSGUESTS_BOL_Service::getInstance()->countGuestsForUser($userId);
         if (OW::getPluginManager()->isPluginActive('skadate')) {
             $cmp = OW::getClassInstance('BASE_CMP_Users', $guestList, array(), $itemCount);
         } else {
             $guestsUsers = OCSGUESTS_BOL_Service::getInstance()->findGuestUsers($userId, $page, $perPage);
             $cmp = new OCSGUESTS_CMP_Users($guestsUsers, $itemCount, $perPage, true, $guestList);
         }
         $this->addComponent('guests', $cmp);
     } else {
         $this->assign('guests', null);
     }
     $this->setPageHeading($lang->text('ocsguests', 'viewed_profile'));
     $this->setPageTitle($lang->text('ocsguests', 'viewed_profile'));
     OW::getNavigation()->activateMenuItem(OW_Navigation::MAIN, 'base', 'dashboard');
 }