Exemple #1
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;
 }
Exemple #2
0
 /**
  * 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;
 }
Exemple #3
0
 /**
  * Test uri xss preventing
  */
 public function testUriXssPreventing()
 {
     $uriItems = array(array('xss' => '/oxwall_repo/groups/invitation', 'cleaned' => '/oxwall_repo/groups/invitation'), array('xss' => '/oxwall_repo/groups/invitation/"><script>alert(\'s\')</script>', 'cleaned' => '/oxwall_repo/groups/invitation/%22%3E%3Cscript%3Ealert%28%27s%27%29%3C/script%3E'), array('xss' => '/oxwall_repo/groups/invitation?test=aa&h=/"><script>alert(10)</script>', 'cleaned' => '/oxwall_repo/groups/invitation?test=aa&h=%2F%22%3E%3Cscript%3Ealert%2810%29%3C%2Fscript%3E'), array('xss' => '/oxwall_repo/groups/invitation?g/"><script>alert(10)</script>', 'cleaned' => '/oxwall_repo/groups/invitation?g%2F%22%3E%3Cscript%3Ealert%2810%29%3C%2Fscript%3E='));
     foreach ($uriItems as $uri) {
         $this->assertEquals($uri['cleaned'], UTIL_Url::secureUri($uri['xss']));
     }
 }
 public function __construct(BASE_CLASS_WidgetParameter $params)
 {
     parent::__construct();
     $groupId = $params->additionalParamList['entityId'];
     $userId = OW::getUser()->getId();
     $service = GROUPS_BOL_Service::getInstance();
     $feedService = GROUPRSS_BOL_FeedService::getInstance();
     $whoCanAdd = OW::getConfig()->getValue('grouprss', 'actionMember');
     if ($whoCanAdd == 'admin' && !OW::getUser()->isAdmin()) {
         $this->setVisible(false);
         return;
     }
     $mypaths = explode("/", UTIL_Url::selfUrl());
     $groupId = strtolower(end($mypaths));
     if ($groupId == 'customize') {
         $groupId = strtolower(prev($mypaths));
     }
     if ($whoCanAdd == 'creator' && $feedService->getGroupCreater($groupId) !== $userId) {
         $this->setVisible(false);
         return;
     }
     if ($whoCanAdd == 'both') {
         if (!OW::getUser()->isAdmin() && $feedService->getGroupCreater($groupId) !== $userId) {
             $this->setVisible(false);
             return;
         }
     }
     $this->assign('groupId', (int) $groupId);
 }
Exemple #5
0
 /**
  * Makes permanent redirect to provided URL or URI.
  *
  * @param string $redirectTo
  */
 public function redirect($redirectTo = null)
 {
     // if empty redirect location -> current URI is used
     if ($redirectTo === null) {
         $redirectTo = OW::getRequest()->getRequestUri();
     }
     // if URI is provided need to add site home URL
     if (!strstr($redirectTo, 'http://') && !strstr($redirectTo, 'https://')) {
         $redirectTo = OW::getRouter()->getBaseUrl() . UTIL_String::removeFirstAndLastSlashes($redirectTo);
     }
     UTIL_Url::redirect($redirectTo);
 }
Exemple #6
0
 public function redirect()
 {
     if (OW::getRequest()->isAjax()) {
         $handler = OW::getRequestHandler()->getHandlerAttributes();
         if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BASE_CTRL_User' && $handler[OW_RequestHandler::ATTRS_KEY_ACTION] == 'ajaxSignIn') {
             OW::getSession()->delete(ANTIBRUTEFORCE_BOL_Service::SESSION_NAME);
             exit(json_encode(array('result' => TRUE, 'message' => '')));
         } else {
             if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'BASE_CTRL_Captcha' && $handler[OW_RequestHandler::ATTRS_KEY_ACTION] == 'ajaxResponder') {
                 OW::getSession()->delete(ANTIBRUTEFORCE_BOL_Service::SESSION_NAME);
                 exit(json_encode(array('result' => FALSE, 'reload' => OW::getRouter()->urlForRoute('antibruteforce.authenticate_fail'))));
             } else {
                 if ($handler[OW_RequestHandler::ATTRS_KEY_CTRL] == 'SMARTCAPTCHA_CTRL_SmartCaptcha' && $handler[OW_RequestHandler::ATTRS_KEY_ACTION] == 'ajaxResponder') {
                     OW::getSession()->delete(ANTIBRUTEFORCE_BOL_Service::SESSION_NAME);
                     exit(json_encode(array('result' => FALSE, 'reload' => OW::getRouter()->urlForRoute('antibruteforce.authenticate_fail'))));
                 }
             }
         }
     } else {
         OW::getSession()->delete(ANTIBRUTEFORCE_BOL_Service::SESSION_NAME);
         UTIL_Url::redirect(OW::getRouter()->urlForRoute('antibruteforce.authenticate_fail'));
     }
 }
Exemple #7
0
$installComplete = false;
$dbReady = false;
if (defined('OW_URL_HOME')) {
    try {
        $installedValue = (bool) OW::getConfig()->getValue('base', 'site_installed');
        $installComplete = (bool) OW::getConfig()->getValue('base', 'install_complete');
    } catch (Exception $e) {
        $installedValue = false;
        $installComplete = false;
    }
    $dbReady = $installedValue;
}
if (!$installComplete || defined('OW_INSTALL_DEV') && OW_INSTALL_DEV) {
    if (!defined('OW_URL_HOME')) {
        $selfUrl = UTIL_Url::selfUrl();
        if (substr($selfUrl, -1) != '/') {
            $selfUrl .= '/';
        }
        $installPos = strpos($selfUrl, '/install');
        if (!$installPos) {
            $installPos = strpos($selfUrl, '/ow_install');
        }
        if ($installPos) {
            $selfUrl = substr($selfUrl, 0, $installPos) . '/';
        }
        define('OW_URL_HOME', $selfUrl);
    }
    define('INSTALL_DIR_ROOT', dirname(__FILE__) . DS);
    define('INSTALL_URL_ROOT', OW_URL_HOME . 'ow_install/');
    define('INSTALL_URL_VIEW', INSTALL_URL_ROOT . 'view/');
Exemple #8
0
 public function isAndroidRequest()
 {
     return in_array("android", explode("/", UTIL_Url::getRealRequestUri(OW_URL_HOME, $_SERVER['REQUEST_URI'])));
 }
Exemple #9
0
 /**
  * Makes header redirect to provided URL or URI.
  *
  * @param string $redirectTo
  */
 public function redirect($redirectTo = null, $switchContextTo = false)
 {
     if ($switchContextTo !== false && in_array($switchContextTo, array(self::CONTEXT_DESKTOP, self::CONTEXT_MOBILE))) {
         OW::getSession()->set(self::CONTEXT_NAME, $switchContextTo);
     }
     // if empty redirect location -> current URI is used
     if ($redirectTo === null) {
         $redirectTo = OW::getRequest()->getRequestUri();
     }
     // if URI is provided need to add site home URL
     if (!strstr($redirectTo, 'http://') && !strstr($redirectTo, 'https://')) {
         $redirectTo = OW::getRouter()->getBaseUrl() . UTIL_String::removeFirstAndLastSlashes($redirectTo);
     }
     UTIL_Url::redirect($redirectTo);
 }
 /**
  * Returns processed catch all requests attributes.
  *
  * @return string
  */
 protected function processCatchAllRequestsAttrs()
 {
     if (empty($this->catchAllRequestsAttributes)) {
         return null;
     }
     $catchRequest = true;
     $lastKey = array_search(end($this->catchAllRequestsAttributes), $this->catchAllRequestsAttributes);
     foreach ($this->catchAllRequestsExcludes[$lastKey] as $exclude) {
         if ($exclude[self::CATCH_ALL_REQUEST_KEY_CTRL] == $this->handlerAttributes[self::ATTRS_KEY_CTRL]) {
             if ($exclude[self::CATCH_ALL_REQUEST_KEY_ACTION] === null || $exclude[self::CATCH_ALL_REQUEST_KEY_ACTION] == $this->handlerAttributes[self::ATTRS_KEY_ACTION]) {
                 if ($exclude[self::CATCH_ALL_REQUEST_KEY_PARAMS] === null || $exclude[self::CATCH_ALL_REQUEST_KEY_PARAMS] == $this->handlerAttributes[self::ATTRS_KEY_VARLIST]) {
                     $catchRequest = false;
                     break;
                 }
             }
         }
     }
     if ($catchRequest) {
         if (isset($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_REDIRECT]) && (bool) $this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_REDIRECT]) {
             $route = isset($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_ROUTE]) ? trim($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_ROUTE]) : null;
             $params = isset($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_PARAMS]) ? $this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_PARAMS] : array();
             $redirectUrl = $route !== null ? OW::getRouter()->urlForRoute($route, $params) : OW::getRouter()->urlFor($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_CTRL], $this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_ACTION], $params);
             $redirectUrl = OW::getRequest()->buildUrlQueryString($redirectUrl, array('back_uri' => OW::getRequest()->getRequestUri()));
             if (isset($this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_JS]) && (bool) $this->catchAllRequestsAttributes[$lastKey][self::CATCH_ALL_REQUEST_KEY_JS]) {
                 // TODO resolve hotfix
                 // hotfix for splash screen + members only case
                 if (array_key_exists('base.members_only', $this->catchAllRequestsAttributes)) {
                     if (in_array($this->handlerAttributes[self::CATCH_ALL_REQUEST_KEY_CTRL], array('BASE_CTRL_User', 'BASE_MCTRL_User')) && $this->handlerAttributes[self::CATCH_ALL_REQUEST_KEY_ACTION] === 'standardSignIn') {
                         $backUri = isset($_GET['back_uri']) ? $_GET['back_uri'] : OW::getRequest()->getRequestUri();
                         OW::getDocument()->addOnloadScript("window.location = '" . OW::getRequest()->buildUrlQueryString($redirectUrl, array('back_uri' => $backUri)) . "'");
                         return null;
                     } else {
                         $ru = OW::getRequest()->buildUrlQueryString(OW::getRouter()->urlForRoute('static_sign_in'), array('back_uri' => OW::getRequest()->getRequestUri()));
                         OW::getApplication()->redirect($ru);
                     }
                 }
                 OW::getDocument()->addOnloadScript("window.location = '" . $redirectUrl . "'");
                 return null;
             }
             UTIL_Url::redirect($redirectUrl);
         }
         return $this->getCatchAllRequestsAttributes($lastKey);
     }
     return null;
 }
Exemple #11
0
 public function checkSession()
 {
     $stamp = BOL_QuestionService::getInstance()->getQuestionsEditStamp();
     $sessionStamp = OW::getSession()->get(self::SESSION_START_STAMP);
     if (!empty($sessionStamp) && $stamp > $sessionStamp) {
         OW::getSession()->delete(self::SESSION_ALL_QUESTION_LIST);
         OW::getSession()->delete(self::SESSION_JOIN_DATA);
         OW::getSession()->delete(self::SESSION_JOIN_STEP);
         OW::getSession()->delete(self::SESSION_REAL_QUESTION_LIST);
         OW::getSession()->delete(self::SESSION_START_STAMP);
         if (OW::getRequest()->isPost()) {
             UTIL_Url::redirect(OW::getRouter()->urlForRoute('base_join'));
         }
     }
 }
Exemple #12
0
 public function ajaxCropPhoto($params)
 {
     if (!isset($params['coords']) || !isset($params['view_size'])) {
         return array('result' => false, 'case' => 0);
     }
     $coords = $params['coords'];
     $viewSize = $params['view_size'];
     $path = null;
     $localFile = false;
     $avatarService = BOL_AvatarService::getInstance();
     if (!empty($params['entityType']) && !empty($params['id'])) {
         $item = $avatarService->getAvatarChangeGalleryItem($params['entityType'], $params['entityId'], $params['id']);
         if (!$item || empty($item['path']) || !OW::getStorage()->fileExists($item['path'])) {
             return array('result' => false, 'case' => 1);
         }
         $path = $item['path'];
     } else {
         if (isset($params['url'])) {
             $path = UTIL_Url::getLocalPath($params['url']);
             if (!OW::getStorage()->fileExists($path)) {
                 if (!file_exists($path)) {
                     return array('result' => false, 'case' => 2);
                 }
                 $localFile = true;
             }
         }
     }
     $userId = OW_Auth::getInstance()->getUserId();
     if ($userId) {
         $avatar = $avatarService->findByUserId($userId);
         try {
             $event = new OW_Event('base.before_avatar_change', array('userId' => $userId, 'avatarId' => $avatar ? $avatar->id : null, 'upload' => false, 'crop' => true));
             OW::getEventManager()->trigger($event);
             if (!$avatarService->cropAvatar($userId, $path, $coords, $viewSize, array('isLocalFile' => $localFile))) {
                 return array('result' => false, 'case' => 6);
             }
             $avatar = $avatarService->findByUserId($userId, false);
             $event = new OW_Event('base.after_avatar_change', array('userId' => $userId, 'avatarId' => $avatar ? $avatar->id : null, 'upload' => false, 'crop' => true));
             OW::getEventManager()->trigger($event);
             return array('result' => true, 'modearationStatus' => $avatar->status, 'url' => $avatarService->getAvatarUrl($userId, 1, null, false, false), 'bigUrl' => $avatarService->getAvatarUrl($userId, 2, null, false, false));
         } catch (Exception $e) {
             return array('result' => false, 'case' => 4);
         }
     } else {
         $key = $avatarService->getAvatarChangeSessionKey();
         $path = $avatarService->getTempAvatarPath($key, 3);
         if (!file_exists($path)) {
             return array('result' => false, 'case' => 5);
         }
         $avatarService->cropTempAvatar($key, $coords, $viewSize);
         return array('result' => true, 'url' => $avatarService->getTempAvatarUrl($key, 1), 'bigUrl' => $avatarService->getTempAvatarUrl($key, 2));
     }
 }
Exemple #13
0
 public function isIOSRequest()
 {
     $uri = UTIL_Url::getRealRequestUri(OW_URL_HOME, $_SERVER['REQUEST_URI']);
     $uriParts = explode('/', $uri);
     return !in_array("android", $uriParts);
 }
Exemple #14
0
    public function popup()
    {
        $document = OW::getDocument();
        $document->getMasterPage()->setTemplate(OW::getThemeManager()->getMasterPageTemplate(OW_MasterPage::TEMPLATE_BLANK));
        if (isset($_GET['error'])) {
            $document->addOnloadScript('window.close();');
            $this->assign('close', true);
            return;
        }
        //setting parameters
        $authcode = $_GET["code"];
        $clientId = OW::getConfig()->getValue('contactimporter', 'google_client_id');
        $clientSecret = OW::getConfig()->getValue('contactimporter', 'google_client_secret');
        $redirectUri = OW::getRouter()->urlForRoute('contact-importer-google-oauth');
        $fields = array('code' => urlencode($authcode), 'client_id' => urlencode($clientId), 'client_secret' => urlencode($clientSecret), 'redirect_uri' => urlencode($redirectUri), 'grant_type' => urlencode('authorization_code'));
        //url-ify the data for the POST
        $fieldsString = '';
        foreach ($fields as $key => $value) {
            $fieldsString .= $key . '=' . $value . '&';
        }
        $fieldsString = rtrim($fieldsString, '&');
        //open connection
        $ch = curl_init();
        //set the url, number of POST vars, POST data
        curl_setopt($ch, CURLOPT_URL, 'https://accounts.google.com/o/oauth2/token');
        curl_setopt($ch, CURLOPT_POST, 5);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fieldsString);
        // Set so curl_exec returns the result instead of outputting it.
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        //to trust any ssl certificates
        curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
        //execute post
        $result = curl_exec($ch);
        //close connection
        curl_close($ch);
        //extracting access_token from response string
        $response = json_decode($result);
        if (empty($response->access_token)) {
            $authUrl = OW::getRequest()->buildUrlQueryString('https://accounts.google.com/o/oauth2/auth', array('response_type' => 'code', 'client_id' => $clientId, 'redirect_uri' => $redirectUri, 'state' => 'contacts', 'scope' => 'https://www.google.com/m8/feeds/'));
            UTIL_Url::redirect($authUrl);
        }
        $accessToken = $response->access_token;
        //passing accesstoken to obtain contact details
        $resultCount = 100;
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, 'https://www.google.com/m8/feeds/contacts/default/full?max-results=' . $resultCount . '&oauth_token=' . $accessToken . '&alt=json');
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('GData-Version: 2.0'));
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
        curl_setopt($ch, CURLOPT_HTTPGET, true);
        curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.1.4322)');
        curl_setopt($ch, CURLOPT_TIMEOUT, 10);
        $jsonResponse = curl_exec($ch);
        curl_close($ch);
        //$jsonResponse =  file_get_contents('https://www.google.com/m8/feeds/contacts/default/full?max-results=' . $resultCount . '&oauth_token=' . $accessToken . '&alt=json');
        $response = json_decode($jsonResponse, true);
        if (!empty($response["error"]["message"])) {
            echo $response["error"]["message"];
            exit;
        }
        $out = array();
        $list = $response['feed']['entry'];
        $defaultImage = BOL_AvatarService::getInstance()->getDefaultAvatarUrl();
        $contexId = uniqid('ci');
        $jsArray = array();
        foreach ($list as $item) {
            if (empty($item['gd$email'][0]['address'])) {
                continue;
            }
            $address = $item['gd$email'][0]['address'];
            $image = $item['link'][1]['type'] != 'image/*' ? $defaultImage : $item['link'][1]['href'] . '?oauth_token=' . $accessToken;
            $title = empty($item['title']['$t']) ? $address : $item['title']['$t'];
            $uniqId = uniqid('cii');
            $out[] = array('title' => $title, 'image' => $image, 'address' => $address, 'uniqId' => $uniqId, 'fields' => empty($item['title']['$t']) ? '' : $address, 'avatar' => array('title' => $title, 'src' => $image));
            $jsArray[$address] = array('linkId' => $uniqId, 'userId' => $address);
        }
        OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('base')->getStaticJsUrl() . 'avatar_user_select.js');
        OW::getDocument()->addOnloadScript("\n            var cmp = new AvatarUserSelect(" . json_encode($jsArray) . ", '" . $contexId . "');\n            cmp.init();\n            OW.registerLanguageKey('base', 'avatar_user_select_empty_list_message', '" . OW::getLanguage()->text('base', 'avatar_user_select_empty_list_message') . "');\n         ");
        $this->assign('users', $out);
        $this->assign('contexId', $contexId);
        $countLabel = OW::getLanguage()->text('base', 'avatar_user_list_select_count_label');
        $buttonLabel = OW::getLanguage()->text('base', 'avatar_user_list_select_button_label');
        $langs = array('countLabel' => $countLabel, 'startCountLabel' => !empty($countLabel) ? str_replace('#count#', '0', $countLabel) : null, 'buttonLabel' => $buttonLabel, 'startButtonLabel' => str_replace('#count#', '0', $buttonLabel));
        $this->assign('langs', $langs);
        $rsp = json_encode(OW::getRouter()->urlFor('CONTACTIMPORTER_CTRL_Google', 'send'));
        OW::getDocument()->addOnloadScript('OW.bind("base.avatar_user_list_select", function( data ){
            var msg = $("#ci-message").val();
	    var inv = $("#ci-message").attr("inv");

	    msg = inv == msg ? "" : msg;
            window.opener.CONTACTIMPORTER_Google.send(' . $rsp . ', data, msg);
            window.close();
        });');
    }
Exemple #15
0
 public function manage($params)
 {
     $groupId = (int) $params['groupId'];
     if (empty($groupId)) {
         throw new Redirect404Exception();
     }
     $service = GROUPS_BOL_Service::getInstance();
     $feedService = GROUPRSS_BOL_FeedService::getInstance();
     $language = OW::getLanguage();
     $config = OW::getConfig();
     $userId = OW::getUser()->getId();
     $groupDto = $service->findGroupById($groupId);
     if ($groupDto === null) {
         throw new Redirect404Exception();
     }
     $whoCanAdd = $config->getValue('grouprss', 'actionMember');
     if ($whoCanAdd == 'admin' && !OW::getUser()->isAdmin()) {
         throw new Redirect404Exception();
     }
     $mypaths = explode("/", UTIL_Url::selfUrl());
     $groupId = strtolower(end($mypaths));
     if ($groupId == 'customize') {
         $groupId = strtolower(prev($mypaths));
     }
     if ($whoCanAdd == 'creator' && $feedService->getGroupCreater($groupId) !== $userId) {
         throw new Redirect404Exception();
     }
     if ($whoCanAdd == 'both') {
         if (!OW::getUser()->isAdmin() && $feedService->getGroupCreater($groupId) !== $userId) {
             throw new Redirect404Exception();
         }
     }
     $userList = $service->findGroupUserIdList($groupId);
     $userService = BOL_UserService::getInstance();
     $feedService = GROUPRSS_BOL_FeedService::getInstance();
     $newForm = new Form('newForm');
     $element = new Selectbox('feedUser');
     $element->setLabel($language->text('grouprss', 'newsfeed_user'));
     $element->setRequired();
     foreach ($userList as $key => $user) {
         $element->addOption($user, $userService->getDisplayName($user));
     }
     $newForm->addElement($element);
     $element = new TextField('feedUrl');
     $element->setRequired(true);
     $validator = new UrlValidator();
     $validator->setErrorMessage($language->text('grouprss', 'invalid_feed_url'));
     $element->addValidator($validator);
     $element->setLabel($language->text('grouprss', 'new_feed_url'));
     $newForm->addElement($element);
     $element = new TextField('feedCount');
     $element->setValue("2");
     $element->setRequired();
     $element->setLabel(OW::getLanguage()->text('grouprss', 'user_feed_count'));
     $validator = new IntValidator(1, 50);
     $validator->setErrorMessage(OW::getLanguage()->text('grouprss', 'invalid_feed_count_error'));
     $element->addValidator($validator);
     $newForm->addElement($element);
     $element = new Submit('addFeed');
     $element->setValue(OW::getLanguage()->text('grouprss', 'add_new_feed'));
     $newForm->addElement($element);
     if (OW::getRequest()->isPost()) {
         if ($newForm->isValid($_POST)) {
             $values = $newForm->getValues();
             $userId = $values['feedUser'];
             $feedUrl = $values['feedUrl'];
             $feedCount = $values['feedCount'];
             if ($feedService->isDuplicate($groupId, $feedUrl)) {
                 OW::getFeedback()->error($language->text('grouprss', 'add_feed_duplicate_error'));
             } else {
                 $feedService->addFeed($groupId, $userId, $feedUrl, $feedCount);
                 OW::getFeedback()->info($language->text('grouprss', 'add_feed_success'));
                 GROUPRSS_BOL_FeedService::getInstance()->addAllGroupFeed();
             }
         }
     }
     $this->addForm($newForm);
     $allFeeds = $feedService->findByGroup($groupId);
     $feedDetails = array();
     $deleteFeeds = array();
     foreach ($allFeeds as $feed) {
         $feedDetails[$feed->id]['feedID'] = $feed->id;
         $feedDetails[$feed->id]['groupID'] = $feed->groupId;
         $feedDetails[$feed->id]['userID'] = $feed->userId;
         $feedDetails[$feed->id]['userName'] = $userService->getDisplayName($feed->userId);
         $feedDetails[$feed->id]['userURL'] = $userService->getUserUrl($feed->userId);
         $feedDetails[$feed->id]['feedURL'] = $feed->feedUrl;
         $feedDetails[$feed->id]['feedCount'] = $feed->feedCount;
         $feedDetails[$feed->id]['timestamp'] = $feed->timestamp;
         $deleteFeeds[$feed->id] = OW::getRouter()->urlFor(__CLASS__, 'delete', array('id' => $feed->id, 'groupId' => $groupId));
     }
     $this->assign('feedDetails', $feedDetails);
     $this->assign('deleteFeeds', $deleteFeeds);
     OW::getDocument()->addStyleSheet(OW::getPluginManager()->getPlugin('grouprss')->getStaticCssUrl() . 'style.css');
     OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('grouprss')->getStaticJsUrl() . 'jquery.tablesorter.min.js');
     $this->setPageHeading(OW::getLanguage()->text('grouprss', 'manage_settings_title'));
     $this->setPageTitle(OW::getLanguage()->text('grouprss', 'manage_settings_title'));
     $this->setPageHeadingIconClass('ow_ic_gear_wheel');
 }