Beispiel #1
0
 public static function login($username, $password, $keep_signed, &$errors, $login_as_user = false, $autoriseByUsername = false)
 {
     $login = SJB_UserManager::login($username, $password, $errors, $autoriseByUsername, $login_as_user);
     if ($login) {
         if (SJB_UserManager::checkBan($errors)) {
             return false;
         }
         $userInfo = SJB_UserManager::getUserInfoByUserName($username);
         if (!$userInfo['active']) {
             $errors['USER_NOT_ACTIVE'] = 1;
             return false;
         }
         // if "Approve Users by Admin" option is turned on
         $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($userInfo['user_group_sid']);
         if (!empty($userGroupInfo['approve_user_by_admin']) && 'Approved' != $userInfo['approval']) {
             $errors['USER_NOT_APPROVED'] = 1;
             return false;
         }
         $loginParams = array('username' => $username, 'password' => $password);
         SJB_Event::dispatch('Login', $loginParams);
         if ($keep_signed) {
             SJB_Authorization::keepUserSignedIn($userInfo);
         }
         SJB_DB::query('update `users` set `ip` = ?s where `sid` = ?n', $_SERVER['REMOTE_ADDR'], $userInfo['sid']);
         if (!empty($userInfo['parent_sid'])) {
             $subuserInfo = $userInfo;
             $userInfo = SJB_UserManager::getUserInfoBySID($userInfo['parent_sid']);
             $userInfo['subuser'] = $subuserInfo;
         }
         SJB_Authorization::setSessionForUser($userInfo);
         return true;
     }
     return false;
 }
Beispiel #2
0
 /**
  * @return array
  */
 public function getResources($type = 'all', $role = '')
 {
     $listingsTypes = SJB_ListingTypeDBManager::getAllListingTypesInfo();
     /* sort by resume, job then others */
     usort($listingsTypes, function ($listingType) {
         return $listingType['id'] == 'Job' || $listingType['id'] == 'Resume' ? true : false;
     });
     $listingsTypes = array_reverse($listingsTypes);
     $listingsTypesResources = array();
     foreach ($listingsTypes as $listingType) {
         $listingType['name'] = !in_array($listingType['name'], array('Resume', 'Job')) ? "'{$listingType['name']}' Listings" : $listingType['name'] . 's';
         $listingType['id'] = !in_array($listingType['id'], array('Resume', 'Job')) ? "{$listingType['id']}_listings" : $listingType['id'] . 's';
         $listingsTypesResources['manage_' . mb_strtolower($listingType['id'], 'UTF-8')] = array('title' => "Manage {$listingType['name']}", 'group' => 'listings', 'type' => 'subadmin');
         $listingsTypesResources['get_notifications_on_' . mb_strtolower($listingType['id'], 'UTF-8') . '_added'] = array('title' => 'Get Notifications on ' . $listingType['name'] . ' Added', 'group' => 'listings', 'type' => 'subadmin', 'parent' => 'manage_' . mb_strtolower($listingType['id'], 'UTF-8'), 'notification' => true);
         $listingsTypesResources['get_notifications_on_' . mb_strtolower($listingType['id'], 'UTF-8') . '_expiration'] = array('title' => 'Get Notifications on ' . $listingType['name'] . ' Expiration', 'group' => 'listings', 'type' => 'subadmin', 'parent' => 'manage_' . mb_strtolower($listingType['id'], 'UTF-8'), 'notification' => true);
     }
     $resources = array('manage_common_listing_fields' => array('title' => 'Manage Common Listing Fields', 'group' => 'listings', 'type' => 'subadmin'), 'manage_listing_types_and_specific_listing_fields' => array('title' => 'Manage Listing Types and Specific Listing Fields', 'group' => 'listings', 'type' => 'subadmin'), 'set_posting_pages' => array('title' => 'Set Posting Pages', 'group' => 'listings', 'type' => 'subadmin'), 'import_listings' => array('title' => 'Import Listings', 'group' => 'listings', 'type' => 'subadmin'), 'export_listings' => array('title' => 'Export Listings', 'group' => 'listings', 'type' => 'subadmin'), 'set_xml_feeds' => array('title' => 'Set XML Feeds', 'group' => 'listings', 'type' => 'subadmin'), 'set_xml_import' => array('title' => 'Set XML Import', 'group' => 'listings', 'type' => 'subadmin'), 'manage_flagged_listings' => array('title' => 'Manage Flagged Listings', 'group' => 'listings', 'type' => 'subadmin'), 'get_notifications_on_listing_flagged' => array('title' => 'Get Notifications on Listing Flagged', 'group' => 'listings', 'type' => 'subadmin', 'parent' => 'manage_flagged_listings', 'notification' => true), 'manage_user_groups' => array('title' => 'Manage User Groups', 'group' => 'users', 'type' => 'subadmin'), 'manage_user_groups_permissions' => array('title' => 'Manage User Groups Permissions', 'group' => 'users', 'type' => 'subadmin', 'parent' => 'manage_user_groups'), 'edit_user_groups_profile_fields' => array('title' => 'Edit User Groups Profile Fields', 'group' => 'users', 'type' => 'subadmin', 'parent' => 'manage_user_groups'), 'import_users' => array('title' => 'Import Users', 'group' => 'users', 'type' => 'subadmin'), 'export_users' => array('title' => 'Export Users', 'group' => 'users', 'type' => 'subadmin'), 'create_and_send_mass_mailings' => array('title' => 'Create and Send Mass Mailings', 'group' => 'users', 'type' => 'subadmin'), 'manage_guest_email_alerts' => array('title' => 'Manage Guest Email Alerts', 'group' => 'users', 'type' => 'subadmin'), 'manage_banned_ips' => array('title' => 'Manage Banned IPs', 'group' => 'users', 'type' => 'subadmin'), 'edit_form_builder' => array('title' => 'Use Form Bulider', 'group' => 'layout and content', 'type' => 'subadmin'), 'edit_templates_and_themes' => array('title' => 'Edit Templates and Themes', 'group' => 'layout and content', 'type' => 'subadmin'), 'manage_banners' => array('title' => 'Manage Banners', 'group' => 'layout and content', 'type' => 'subadmin'), 'manage_site_pages' => array('title' => 'Manage Site Pages', 'group' => 'layout and content', 'type' => 'subadmin'), 'manage_static_content' => array('title' => 'Manage Static Content', 'group' => 'layout and content', 'type' => 'subadmin'), 'manage_news' => array('title' => 'Manage News', 'group' => 'layout and content', 'type' => 'subadmin'), 'manage_polls' => array('title' => 'Manage Polls', 'group' => 'layout and content', 'type' => 'subadmin'), 'configure_system_settings' => array('title' => 'Configure System Settings', 'group' => 'system configuration', 'type' => 'subadmin'), 'social_media' => array('title' => 'Social Media', 'group' => 'system configuration', 'type' => 'subadmin'), 'social_media_bitly' => array('title' => 'Bitly Settings', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'social_media'), 'edit_zipcode_database' => array('title' => 'Edit ZipCode Database', 'group' => 'system configuration', 'type' => 'subadmin'), 'manage_countries' => array('title' => 'Manage Countries', 'group' => 'system configuration', 'type' => 'subadmin'), 'manage_states_or_regions' => array('title' => 'Manage States/Regions', 'group' => 'system configuration', 'type' => 'subadmin'), 'configure_breadcrumbs' => array('title' => 'Configure Breadcrumbs', 'group' => 'system configuration', 'type' => 'subadmin'), 'set_html_filters' => array('title' => 'Set HTML filters', 'group' => 'system configuration', 'type' => 'subadmin'), 'manage_currencies' => array('title' => 'Manage Currencies', 'group' => 'system configuration', 'type' => 'subadmin'), 'set_task_scheduler' => array('title' => 'Set Task Scheduler', 'group' => 'system configuration', 'type' => 'subadmin'), 'manage_plug-ins' => array('title' => 'Manage Plug-ins', 'group' => 'system configuration', 'type' => 'subadmin'), 'set_phpbb_plug-in' => array('title' => 'Set PhpBB Plug-in', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_facebook_plug-in' => array('title' => 'Set Facebook Plug-in', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_linkedin_plug-in' => array('title' => 'Set Linkedin Plug-in', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_wordpress_plug-in' => array('title' => 'Set WordPress Plug-in', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_twitter_plug-in' => array('title' => 'Set Twitter Plug-in', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_sharethisplugin' => array('title' => 'Set ShareThisPlugin', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_captchaplugin' => array('title' => 'Set CaptchaPlugin', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_indeedplugin' => array('title' => 'Set IndeedPlugin', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_jujuplugin' => array('title' => 'Set JujuPlugin', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_simplyhiredplugin' => array('title' => 'Set SimplyHiredPlugin', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_googleplugin' => array('title' => 'Set Google Social Plugin', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_googleanalyticsplugin' => array('title' => 'Set Google Analytics Plugin', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_beyondplugin' => array('title' => 'Set Beyond Plugin', 'group' => 'system configuration', 'type' => 'subadmin', 'parent' => 'manage_plug-ins'), 'set_refine_search_parameters' => array('title' => 'Set Refine Search Parameters', 'group' => 'system configuration', 'type' => 'subadmin'), 'create_and_restore_backups' => array('title' => 'Create and Restore Backups', 'group' => 'system configuration', 'type' => 'subadmin'), 'edit_flag_listing_settings' => array('title' => 'Edit Flag Listing Settings', 'group' => 'system configuration', 'type' => 'subadmin'), 'email_log' => array('title' => 'View Email Log', 'group' => 'system configuration', 'type' => 'subadmin'), 'manage_invoices' => array('title' => 'Manage Invoices', 'group' => 'billing', 'type' => 'subadmin'), 'manage_products' => array('title' => 'Manage Products', 'group' => 'billing', 'type' => 'subadmin'), 'manage_promotions' => array('title' => 'Manage Promotions', 'group' => 'billing', 'type' => 'subadmin'), 'manage_tax_rules' => array('title' => 'Manage Tax Rules', 'group' => 'billing', 'type' => 'subadmin'), 'manage_payment_gateways' => array('title' => 'Manage Payment Gateways', 'group' => 'billing', 'type' => 'subadmin'), 'transaction_history' => array('title' => 'View Transaction History', 'group' => 'billing', 'type' => 'subadmin'), 'payment_log' => array('title' => 'View Payment Log', 'group' => 'billing', 'type' => 'subadmin'), 'general_statistics' => array('title' => 'View General Statistics', 'group' => 'reports', 'type' => 'subadmin'), 'listings_reports' => array('title' => 'View Listings Reports', 'group' => 'reports', 'type' => 'subadmin'), 'applications_and_views_reports' => array('title' => 'View Applications and Views Reports', 'group' => 'reports', 'type' => 'subadmin'), 'sales_reports' => array('title' => 'View Sales Reports', 'group' => 'reports', 'type' => 'subadmin'), 'guest_alerts_reports' => array('title' => 'View Guest Alerts Reports', 'group' => 'reports', 'type' => 'subadmin'), 'manage_languages' => array('title' => 'Manage Languages', 'group' => 'languages', 'type' => 'subadmin'), 'translate_phrases' => array('title' => 'Translate Phrases', 'group' => 'languages', 'type' => 'subadmin'), 'import_languages' => array('title' => 'Import Languages', 'group' => 'languages', 'type' => 'subadmin'), 'export_languages' => array('title' => 'Export Languages', 'group' => 'languages', 'type' => 'subadmin'));
     $resources = array_merge($listingsTypesResources, $resources);
     $userGroups = SJB_UserGroupManager::getAllUserGroupsInfo();
     foreach ($userGroups as $userGroup) {
         $userGroupId = mb_strtolower($userGroup['id'], 'UTF-8');
         $userGroupName = $userGroup['name'];
         if ($userGroup['name'] == 'Job Seeker' || $userGroup['name'] == 'Employer') {
             $titleEdition = $userGroup['name'] . 's';
         } else {
             $titleEdition = '\'$permission.groupName\' users';
         }
         $resources['manage_' . $userGroupId] = array('title' => 'Manage ' . $titleEdition, 'groupName' => $userGroupName, 'group' => 'users', 'type' => 'subadmin');
         $resources['get_notifications_on_' . $userGroupId . '_registration'] = array('title' => 'Get Notifications on Registration of ' . $titleEdition, 'groupName' => $userGroupName, 'group' => 'users', 'type' => 'subadmin', 'parent' => 'manage_' . $userGroupId, 'notification' => true);
         $resources['get_notifications_on_' . $userGroupId . '_subscription_expiration'] = array('title' => 'Get Notifications on Products Expiration of ' . $titleEdition, 'groupName' => $userGroupName, 'group' => 'users', 'type' => 'subadmin', 'parent' => 'manage_' . $userGroupId, 'notification' => true);
         $resources['get_notifications_on_deleting_' . $userGroupId . '_profile'] = array('title' => 'Get Notifications on Profile Deletion of ' . $titleEdition, 'groupName' => $userGroupName, 'group' => 'users', 'type' => 'subadmin', 'parent' => 'manage_' . $userGroupId, 'notification' => true);
     }
     return $resources;
 }
Beispiel #3
0
 public function isAccessible()
 {
     $userName = SJB_Request::getVar('username', null);
     $userGroupID = SJB_UserGroupManager::getUserGroupIDByUserName($userName);
     $this->setPermissionLabel('manage_' . strtolower($userGroupID));
     return parent::isAccessible();
 }
Beispiel #4
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid', 0, SJB_Request::METHOD_GET));
     $user_id = $user['sid'];
     if (SJB_Request::getVar('pm_action', '', SJB_Request::METHOD_POST) == 'delete') {
         $checked = SJB_Request::getVar('pm_check', array(), SJB_Request::METHOD_POST);
         SJB_PrivateMessage::delete($checked);
     }
     $page = intval(SJB_Request::getVar('page', 1, SJB_Request::METHOD_GET));
     $per_page = 10;
     $total = SJB_PrivateMessage::getTotalOutbox($user_id);
     $max_pages = ceil($total / $per_page);
     if ($max_pages == 0) {
         $max_pages = 1;
     }
     if ($max_pages < $page) {
         SJB_HelperFunctions::redirect("?user_sid={$user_id}&page={$max_pages}");
     }
     $navigate = SJB_PrivateMessage::getNavigate($page, $total, $per_page);
     $list = SJB_PrivateMessage::getListOutbox($user_id, $page, $per_page);
     $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']);
     SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']);
     $tp->assign("user_group_info", $userGroupInfo);
     $tp->assign('username', $user['username']);
     $tp->assign('user_sid', $user_id);
     $tp->assign('message', $list);
     $tp->assign('navigate', $navigate);
     $tp->assign('page', $page);
     $tp->display('pm_outbox.tpl');
 }
Beispiel #5
0
 public function execute()
 {
     $template_processor = SJB_System::getTemplateProcessor();
     $errors = array();
     $UserProfileFieldListItemManager = new SJB_UserProfileFieldListItemManager();
     if (!isset($_REQUEST['field_sid'], $_REQUEST['item_sid'])) {
         echo 'The system cannot proceed as some key paramaters are missed';
     } else {
         if (is_null($list_item = $UserProfileFieldListItemManager->getListItemBySID($_REQUEST['item_sid']))) {
             echo 'Wrong parameters are specified';
         } else {
             $list_item_info['value'] = $list_item->getValue();
             $template_processor->assign("list_item_info", $list_item_info);
             if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'save') {
                 $list_item->setValue($_REQUEST['list_item_value']);
                 if (empty($_REQUEST['list_item_value'])) {
                     $errors = array('Value' => 'EMPTY_VALUE');
                 } else {
                     $UserProfileFieldListItemManager->saveListItem($list_item);
                     SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/edit-user-profile-field/edit-list/?field_sid=" . $_REQUEST['field_sid']);
                 }
             }
             $user_profile_field = SJB_UserProfileFieldManager::getFieldBySID($_REQUEST['field_sid']);
             $user_profile_field_info = SJB_UserProfileFieldManager::getFieldInfoBySID($_REQUEST['field_sid']);
             $template_processor->assign("user_profile_field_info", $user_profile_field_info);
             $template_processor->assign("user_group_sid", $user_profile_field->getUserGroupSID());
             $template_processor->assign("user_profile_field_sid", $_REQUEST['field_sid']);
             $template_processor->assign("item_sid", $_REQUEST['item_sid']);
             $template_processor->assign("list_item_value", htmlspecialchars($list_item->getValue()));
             $template_processor->assign("errors", $errors);
             $template_processor->assign("user_group_info", SJB_UserGroupManager::getUserGroupInfoBySID($user_profile_field->getUserGroupSID()));
             $template_processor->display("user_profile_list_item_editing.tpl");
         }
     }
 }
Beispiel #6
0
 public function execute()
 {
     ini_set('max_execution_time', 0);
     $tp = SJB_System::getTemplateProcessor();
     $userGroupID = SJB_Request::getVar('user_group_id', 0);
     $user = SJB_UsersExportController::createUser($userGroupID);
     $searchFormBuilder = new SJB_SearchFormBuilder($user);
     $criteria = $searchFormBuilder->extractCriteriaFromRequestData($_REQUEST, $user);
     $searchFormBuilder->registerTags($tp);
     $searchFormBuilder->setCriteria($criteria);
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $exportProperties = SJB_Request::getVar('export_properties', array());
         if (empty($exportProperties)) {
             SJB_FlashMessages::getInstance()->addWarning('EMPTY_EXPORT_PROPERTIES');
         } else {
             $innerJoin = false;
             if (isset($_REQUEST['product']['multi_like']) && $_REQUEST['product']['multi_like'] != '') {
                 $products = $_REQUEST['product']['multi_like'];
                 if (is_array($products)) {
                     $products = implode(',', $products);
                 }
                 $whereParam = implode(',', explode(',', SJB_DB::quote($products)));
                 $innerJoin = array('contracts' => array('join_field' => 'user_sid', 'join_field2' => 'sid', 'join' => 'INNER JOIN', 'where' => "AND FIND_IN_SET(`contracts`.`product_sid`, '{$whereParam}')"));
                 unset($criteria['system']['product']);
             }
             $searcher = new SJB_UserSearcher(false, 'parent_sid', 'ASC', $innerJoin);
             $searchAliases = SJB_UsersExportController::getSearchPropertyAliases();
             $foundUsersSid = $searcher->getObjectsSIDsByCriteria($criteria, $searchAliases);
             if (!empty($foundUsersSid)) {
                 $result = SJB_UsersExportController::createExportDirectories();
                 if ($result === true) {
                     $exportProperties['extUserID'] = 1;
                     $exportProperties['parent_sid'] = 1;
                     $exportAliases = SJB_UsersExportController::getExportPropertyAliases();
                     $exportData = SJB_UsersExportController::getExportData($foundUsersSid, $exportProperties, $exportAliases);
                     $fileName = 'users.xls';
                     SJB_UsersExportController::makeExportFile($exportData, $fileName);
                     if (!file_exists(SJB_System::getSystemSettings('EXPORT_FILES_DIRECTORY') . "/{$fileName}")) {
                         SJB_FlashMessages::getInstance()->addWarning('CANT_CREATE_EXPORT_FILES');
                     } else {
                         SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/users/archive-and-send-export-data/");
                     }
                 }
             } else {
                 SJB_FlashMessages::getInstance()->addWarning('EMPTY_EXPORT_DATA');
             }
         }
     }
     $userSystemProperties = SJB_UserManager::getAllUserSystemProperties();
     $userGroups = SJB_UserGroupManager::getAllUserGroupsInfo();
     $userCommonProperties = array();
     foreach ($userGroups as $userGroup) {
         $userGroupProperties = SJB_UserProfileFieldManager::getFieldsInfoByUserGroupSID($userGroup['sid']);
         $userCommonProperties[$userGroup['id']] = $userGroupProperties;
     }
     $tp->assign('userSystemProperties', $userSystemProperties);
     $tp->assign('userCommonProperties', $userCommonProperties);
     $tp->assign('selected_user_group_id', $userGroupID);
     $tp->display('export_users.tpl');
 }
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user_group_sid = SJB_Request::getVar('user_group_sid', null);
     $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
     $errors = null;
     if (!is_null($user_group_sid)) {
         if (isset($_REQUEST['action'], $_REQUEST['field_sid'])) {
             if ($_REQUEST['action'] == 'move_up') {
                 SJB_UserProfileFieldManager::moveUpFieldBySID($_REQUEST['field_sid']);
             } elseif ($_REQUEST['action'] == 'move_down') {
                 SJB_UserProfileFieldManager::moveDownFieldBySID($_REQUEST['field_sid']);
             }
         }
         $user_profile_fields = SJB_UserProfileFieldManager::getFieldsInfoByUserGroupSID($user_group_sid);
     } else {
         $errors['USER_GROUP_SID_NOT_SET'] = 1;
         $user_profile_fields = null;
     }
     $tp->assign("errors", $errors);
     $tp->assign("user_profile_fields", $user_profile_fields);
     $tp->assign("user_group_sid", $user_group_sid);
     $tp->assign("user_group_info", $user_group_info);
     $tp->display("edit_user_profile_fields.tpl");
 }
Beispiel #8
0
 public function execute()
 {
     $template_processor = SJB_System::getTemplateProcessor();
     $user_groups_structure = SJB_UserGroupManager::createTemplateStructureForUserGroups();
     $template_processor->assign("user_groups", $user_groups_structure);
     $template_processor->display("user_groups.tpl");
 }
Beispiel #9
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $userGroupsInfo = SJB_UserGroupManager::getAllUserGroupsInfo();
     $tp->assign('userGroupsInfo', $userGroupsInfo);
     $tp->display('choose_user_group.tpl');
 }
Beispiel #10
0
 public static function getDetails($user_group_sid, $referenceUid = false)
 {
     $details = array(array('id' => 'featured', 'caption' => 'Featured', 'type' => 'boolean', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => null), array('id' => 'active', 'caption' => 'Status', 'type' => 'list', 'list_values' => array(array('id' => '1', 'caption' => 'Active'), array('id' => '0', 'caption' => 'Not active')), 'length' => '10', 'is_required' => false, 'is_system' => true), array('id' => 'sendmail', 'caption' => "Don't send mailings", 'type' => 'boolean', 'length' => '1', 'is_required' => false, 'is_system' => true));
     $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
     $email_confirmation = false;
     if (isset($user_group_info['email_confirmation'])) {
         $email_confirmation = $user_group_info['email_confirmation'];
     }
     if (SJB_UserGroupManager::isUserEmailAsUsernameInUserGroup($user_group_sid) || class_exists('SJB_SocialPlugin') && $referenceUid) {
         $userFields = array(array('id' => 'username', 'caption' => 'User name', 'type' => 'string', 'table_name' => 'users', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 0), array('id' => 'password', 'caption' => 'Password', 'type' => 'password', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 2), array('id' => 'email', 'caption' => 'Email', 'type' => 'unique_email', 'table_name' => 'users', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 1, 'email_confirmation' => $email_confirmation));
     } else {
         $userFields = array(array('id' => 'username', 'caption' => 'User name', 'type' => 'unique_string', 'table_name' => 'users', 'length' => '20', 'validators' => array('SJB_IdValidator', 'SJB_UniqueSystemValidator'), 'is_required' => true, 'is_system' => true, 'order' => 0), array('id' => 'password', 'caption' => 'Password', 'type' => 'password', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 1), array('id' => 'email', 'caption' => 'Email', 'type' => 'unique_email', 'table_name' => 'users', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 2, 'email_confirmation' => $email_confirmation));
     }
     $details = array_merge($userFields, $details);
     $extra_details = SJB_UserProfileFieldManager::getFieldsInfoByUserGroupSID($user_group_sid);
     foreach ($extra_details as $key => $extra_detail) {
         if ($extra_detail['type'] == 'monetary' || $extra_detail['type'] == 'complex') {
             $extra_details[$key]['is_system'] = false;
         } else {
             $extra_details[$key]['is_system'] = true;
         }
     }
     $details = array_merge($details, $extra_details);
     if (SJB_PluginManager::isPluginActive('CaptchaPlugin') && SJB_System::getSettingByName('registrationCaptcha') == 1 && SJB_System::getURI() == '/registration/') {
         $details_captcha = array(array('id' => 'captcha', 'caption' => 'Enter code from image', 'type' => 'captcha', 'length' => '20', 'is_required' => true, 'is_system' => false));
         $details = array_merge($details, $details_captcha);
     }
     return $details;
 }
Beispiel #11
0
 public function execute()
 {
     $user_group = new SJB_UserGroup($_REQUEST);
     $add_user_group_form = new SJB_Form($user_group);
     $form_is_submitted = isset($_REQUEST['action']) && $_REQUEST['action'] == 'add';
     $errors = null;
     $tp = SJB_System::getTemplateProcessor();
     if ($form_is_submitted && $add_user_group_form->isDataValid($errors)) {
         SJB_UserGroupManager::saveUserGroup($user_group);
         $page = array('uri' => '/' . mb_strtolower($user_group->getPropertyValue('id'), 'UTF-8') . '-products/', 'module' => 'payment', 'function' => 'user_products', 'access_type' => 'user', 'parameters' => 'userGroupID=' . $user_group->getID());
         $userPage = new SJB_UserPage();
         $page_data = SJB_UserPage::extractPageData($page);
         $userPage->setPageData($page_data);
         $userPage->save();
         $this->addLocationField($user_group->getSID());
         SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/user-groups/");
     } else {
         $add_user_group_form->registerTags($tp);
         $tp->assign('notifications', $user_group->getNotifications());
         $tp->assign('notificationGroups', $user_group->getNotificationsGroups());
         $tp->assign('form_fields', $add_user_group_form->getFormFieldsInfo());
         $tp->assign('errors', $errors);
         $tp->display('add_user_group.tpl');
     }
 }
 public function execute()
 {
     $user_group_sid = isset($_REQUEST['user_group_sid']) ? $_REQUEST['user_group_sid'] : null;
     $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
     $user_profile_field = new SJB_UserProfileField($_REQUEST);
     $user_profile_field->setUserGroupSID($user_group_sid);
     //infill instructions field
     //$user_profile_field->addInfillInstructions(SJB_Request::getVar('instructions'));
     $add_user_profile_field_form = new SJB_Form($user_profile_field);
     $form_is_submitted = isset($_REQUEST['action']) && $_REQUEST['action'] == 'add';
     $errors = null;
     if ($form_is_submitted && $add_user_profile_field_form->isDataValid($errors)) {
         SJB_UserProfileFieldManager::saveUserProfileField($user_profile_field);
         if (SJB_Request::getVar('type', '') == 'youtube') {
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/instruction_user_profile_field/?user_group_sid=" . $user_group_sid . "&user_field_sid=" . $user_profile_field->sid);
         } else {
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . "/edit-user-profile/?user_group_sid=" . $user_group_sid);
         }
     } else {
         $template_processor = SJB_System::getTemplateProcessor();
         $add_user_profile_field_form->registerTags($template_processor);
         $template_processor->assign("form_fields", $add_user_profile_field_form->getFormFieldsInfo());
         $template_processor->assign("user_group_sid", $user_group_sid);
         $template_processor->assign("errors", $errors);
         $template_processor->assign("user_group_info", $user_group_info);
         $template_processor->display("add_user_profile_field.tpl");
     }
 }
Beispiel #13
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user_group_sid = SJB_Request::getVar('sid', null);
     $errors = array();
     if (!is_null($user_group_sid)) {
         $action = SJB_Request::getVar("action", false);
         $product_sid = SJB_Request::getVar("product_sid", false);
         if ($action && $product_sid !== false) {
             switch ($action) {
                 case 'move_up':
                     SJB_ProductsManager::moveUpProductBySID($product_sid, $user_group_sid);
                     break;
                 case 'move_down':
                     SJB_ProductsManager::moveDownProductBySID($product_sid, $user_group_sid);
                     break;
                 case 'set_default_product':
                     SJB_UserGroupManager::setDefaultProduct($user_group_sid, $product_sid);
                     break;
             }
         }
         $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_group_sid);
         $user_group_info = array_merge($user_group_info, $_REQUEST);
         $userGroup = new SJB_UserGroup($user_group_info);
         $userGroup->setSID($user_group_sid);
         $edit_user_group_form = new SJB_Form($userGroup);
         $form_is_submitted = SJB_Request::getVar('submit');
         if ($form_is_submitted && $edit_user_group_form->isDataValid($errors)) {
             SJB_UserGroupManager::saveUserGroup($userGroup);
             if ($form_is_submitted == 'save_info') {
                 SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/user-groups/');
             }
         }
         $productSIDs = SJB_ProductsManager::getProductsInfoByUserGroupSID($user_group_sid);
         $productsInfo = array();
         $user_sids_in_group = SJB_UserManager::getUserSIDsByUserGroupSID($user_group_sid);
         $user_group_product_user_number = array();
         foreach ($productSIDs as $product) {
             $productsInfo[] = $product;
             $user_sids_in_product = SJB_UserManager::getUserSIDsByProductSID($product['sid']);
             $user_number = count(array_intersect($user_sids_in_group, $user_sids_in_product));
             $user_group_product_user_number[$product['sid']] = $user_number;
         }
         $edit_user_group_form->registerTags($tp);
         $tp->assign('object_sid', $userGroup->getSID());
         $tp->assign('notifications', $userGroup->getNotifications());
         $tp->assign('notificationGroups', $userGroup->getNotificationsGroups());
         $tp->assign('user_group_sid', $user_group_sid);
         $tp->assign('user_group_products_info', $productsInfo);
         $tp->assign('user_group_product_user_number', $user_group_product_user_number);
         $tp->assign('form_fields', $edit_user_group_form->getFormFieldsInfo());
     } else {
         $errors['USER_GROUP_SID_NOT_SET'] = 1;
     }
     $tp->assign('user_group_info', isset($user_group_info) ? $user_group_info : null);
     $tp->assign('errors', $errors);
     $tp->assign('object_sid', $user_group_sid);
     $tp->display('edit_user_group.tpl');
 }
 public function isAccessible()
 {
     $userSidList = SJB_Request::getVar('userids', null);
     $userSid = array_shift($userSidList);
     $userGroupID = SJB_UserGroupManager::getUserGroupIDByUserSID($userSid);
     $this->setPermissionLabel('manage_' . strtolower($userGroupID));
     return parent::isAccessible();
 }
Beispiel #15
0
 public static function getDetails()
 {
     $listing_info = array();
     foreach (SJB_UserGroupManager::getAllUserGroupsInfo() as $key => $val) {
         array_push($listing_info, array('id' => $val['sid'], 'caption' => $val['name']));
     }
     $system_details = array(array('id' => 'fb_appID', 'caption' => 'Facebook App ID', 'type' => 'string', 'length' => '255', 'is_required' => true, 'is_system' => true, 'order' => -1, 'comment' => 'To get these credentials you need to create an application in <a href="https://developers.facebook.com/" target="_blank">Facebook Developers Console</a>.<br /><br />Follow the <a target="_blank" href="http://wiki.smartjobboard.com/display/sjb42/Facebook#Facebook-GettingFacebookCredentials">User Manual instructions</a> on how to do this.'), array('id' => 'fb_appSecret', 'caption' => 'Facebook App Secret', 'type' => 'string', 'length' => '255', 'is_required' => true, 'is_system' => true, 'order' => -0), array('id' => 'facebook_userGroup', 'caption' => 'User Group', 'type' => 'multilist', 'list_values' => $listing_info, 'is_required' => false, 'is_system' => true, 'order' => 1, 'comment' => 'Please select user groups which will use Facebook connect'), array('id' => 'facebook_resumeAutoFillSync', 'caption' => 'Allow Resume auto filling/synchronizing for Job Seekers', 'type' => 'boolean', 'is_required' => false, 'is_system' => true, 'order' => 1), array('id' => 'fb_likeJob', 'caption' => 'Display “Like” FaceBook icon for Jobs', 'type' => 'boolean', 'is_required' => false, 'is_system' => true, 'order' => 1), array('id' => 'fb_likeResume', 'caption' => 'Display “Like” FaceBook icon for Resumes', 'type' => 'boolean', 'is_required' => false, 'is_system' => true, 'order' => 1));
     return $system_details;
 }
Beispiel #16
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $productType = SJB_Request::getVar('product_type', false);
     $action = SJB_Request::getVar('action', false);
     $errors = array();
     $productErrors = array();
     if ($productType) {
         if ($productType == 'featured_user') {
             $_REQUEST['user_group_sid'] = SJB_UserGroupManager::getUserGroupSIDByID('Employer');
         }
         $product = new SJB_Product($_REQUEST, $productType);
         $pages = $product->getProductPages();
         $addProductForm = new SJB_Form($product);
         $addProductForm->registerTags($tp);
         $form_submitted = SJB_Request::getVar('action', '') == 'save';
         if ($form_submitted) {
             $productErrors = $product->isValid($product);
             if (in_array($productType, array('access_listings', 'featured_user', 'banners', 'custom_product'))) {
                 $periodName = $product->getPropertyValue('period_name');
                 if ($periodName == 'unlimited') {
                     $product->makePropertyNotRequired('period');
                 }
             }
         }
         if ($form_submitted && $addProductForm->isDataValid($errors) && !$productErrors) {
             $product->addProperty(array('id' => 'product_type', 'type' => 'string', 'value' => $productType, 'is_system' => true));
             $product->saveProduct($product, $_REQUEST);
             $product->savePermissions($_REQUEST);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings("SITE_URL") . '/products/');
         }
         $errors = array_merge($errors, $productErrors);
         $formFieldsInfo = $addProductForm->getFormFieldsInfo();
         $formFields = array();
         foreach ($pages as $pageID => $page) {
             foreach ($formFieldsInfo as $formFieldInfo) {
                 if (in_array($formFieldInfo['id'], $page['fields'])) {
                     $formFields[$pageID][] = $formFieldInfo;
                 }
             }
             if (!isset($formFields[$pageID])) {
                 $formFields[$pageID] = array();
             }
         }
         $tp->assign('form_fields', $formFields);
         $tp->assign('product_type', $productType);
         $tp->assign('request', $_REQUEST);
         $tp->assign('params', http_build_query($_REQUEST));
         $tp->assign('pages', $pages);
         $tp->assign('pageTab', SJB_Request::getVar('page', false));
         $tp->assign("errors", $errors);
         $tp->display('add_product.tpl');
     } else {
         $tp->display('select_product_type.tpl');
     }
 }
Beispiel #17
0
 public function addUserGroupProperty($groupID = null)
 {
     $user_groups_info = SJB_UserGroupManager::getAllUserGroupsInfo();
     $list_values = array();
     foreach ($user_groups_info as $user_group) {
         $list_values[] = array('id' => $user_group['id'], 'caption' => $user_group['name']);
     }
     $this->addProperty(array('id' => 'user_group', 'type' => 'list', 'value' => $groupID, 'is_system' => true, 'list_values' => $list_values));
     return array('id' => 'user_group', 'real_id' => 'user_group_sid', 'transform_function' => 'SJB_UserGroupManager::getUserGroupSIDByID');
 }
Beispiel #18
0
 public function execute()
 {
     $user_group_sid = SJB_Request::getVar('sid', null);
     if (!is_null($user_group_sid)) {
         SJB_UserGroupManager::deleteUserGroupBySID($user_group_sid);
         SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . "/user-groups/");
     } else {
         echo 'The system  cannot proceed as User Group SID is not set';
     }
 }
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user_field_sid = SJB_Request::getVar('user_field_sid', null);
     $errors = array();
     if (!is_null($user_field_sid)) {
         $profile_field = SJB_UserProfileFieldManager::getFieldInfoBySID($user_field_sid);
         $profile_field['user_group'] = SJB_UserGroupManager::getUserGroupIDBySID($profile_field['user_group_sid']);
         $tp->assign('fieldInfo', $profile_field);
     } else {
         $errors[] = 'The system cannot proceed as some required parameters are not set';
     }
     $tp->assign('errors', $errors);
     $tp->display('instruction_user_profile_field.tpl');
 }
Beispiel #20
0
 public function execute()
 {
     $GLOBALS['LEFT_ADMIN_MENU']['Listing Configuration'] = array(array('title' => 'Common Fields', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/listing-fields/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-listing-field/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/', SJB_System::getSystemsettings('SITE_URL') . '/delete-listing-field/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/edit-tree/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/edit-list/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/edit-list-item/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/edit-location-fields/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/edit-fields/'), 'perm_label' => 'manage_common_listing_fields'), array('title' => 'Listing Types', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/listing-types/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-listing-type/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-type/', SJB_System::getSystemsettings('SITE_URL') . '/delete-listing-type/', SJB_System::getSystemsettings('SITE_URL') . '/add-listing-type-field/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-type-field/', SJB_System::getSystemsettings('SITE_URL') . '/delete-listing-type-field/', SJB_System::getSystemsettings('SITE_URL') . '/posting-pages/', SJB_System::getSystemsettings('SITE_URL') . '/attention-listing-type-field/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/edit-tree/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/edit-list/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/edit-list-item/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/edit-location-fields/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing-field/edit-fields/'), 'perm_label' => array('manage_listing_types_and_specific_listing_fields', 'set_posting_pages')));
     $listingTypes = SJB_ListingTypeManager::getAllListingTypesInfo();
     usort($listingTypes, function ($listingType) {
         return $listingType['id'] == 'Job' || $listingType['id'] == 'Resume' ? true : false;
     });
     $listingTypes = array_reverse($listingTypes);
     foreach ($listingTypes as $listingType) {
         if (!in_array($listingType['id'], array('Resume', 'Job'))) {
             $title = "'{$listingType['name']}' Listings";
             $link = strtolower($listingType['id']) . '-listings/';
             $permLabel = strtolower($listingType['id']) . '_listings';
         } else {
             $title = "{$listingType['name']}s";
             $link = strtolower($listingType['id']) . 's/';
             $permLabel = strtolower($listingType['id']) . 's';
         }
         $manageListings[] = array('title' => 'Manage ' . $title, 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/manage-' . $link, 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-listing/', SJB_System::getSystemsettings('SITE_URL') . '/edit-listing/', SJB_System::getSystemsettings('SITE_URL') . '/display-listing/', SJB_System::getSystemsettings('SITE_URL') . '/manage-pictures/', SJB_System::getSystemsettings('SITE_URL') . '/edit-picture/'), 'perm_label' => 'manage_' . $permLabel);
     }
     $listingsManagement = array(array('title' => 'Import Listings', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/import-listings/', 'highlight' => array(), 'perm_label' => 'import_listings'), array('title' => 'Export Listings', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/export-listings/', 'highlight' => array(), 'perm_label' => 'export_listings'), array('title' => 'XML Feeds', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/listing-feeds/', 'highlight' => array(), 'perm_label' => 'set_xml_feeds'), array('title' => 'XML Import', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/show-import/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-import/', SJB_System::getSystemsettings('SITE_URL') . '/edit-import/', SJB_System::getSystemsettings('SITE_URL') . '/run-import/'), 'perm_label' => 'set_xml_import'), array('title' => 'Flagged Listings', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/flagged-listings/', 'highlight' => array(), 'perm_label' => 'manage_flagged_listings'));
     $GLOBALS['LEFT_ADMIN_MENU']['Listing Management'] = array_merge($manageListings, $listingsManagement);
     $userGroup = array(array('title' => 'User Groups', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/user-groups/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-user-group/', SJB_System::getSystemsettings('SITE_URL') . '/edit-user-group/', SJB_System::getSystemsettings('SITE_URL') . '/delete-user-group/', SJB_System::getSystemsettings('SITE_URL') . '/edit-user-profile/', SJB_System::getSystemsettings('SITE_URL') . '/add-user-profile-field/', SJB_System::getSystemsettings('SITE_URL') . '/edit-user-profile-field/', SJB_System::getSystemsettings('SITE_URL') . '/edit-user-profile-field/edit-location-fields/', SJB_System::getSystemsettings('SITE_URL') . '/edit-user-profile-field/edit-tree/', SJB_System::getSystemsettings('SITE_URL') . '/edit-user-profile-field/edit-list/', SJB_System::getSystemsettings('SITE_URL') . '/edit-user-profile-field/edit-list-item/', SJB_System::getSystemsettings('SITE_URL') . '/system/users/acl/'), 'perm_label' => array('manage_user_groups', 'manage_user_groups_permissions')));
     $userGroups = SJB_UserGroupManager::getAllUserGroupsInfo();
     $manageUsers = array();
     foreach ($userGroups as $userGroups) {
         $userGroupId = mb_strtolower($userGroups['id'], 'utf8');
         if (in_array($userGroups['id'], array('JobSeeker', 'Employer'))) {
             $name = "{$userGroups['name']}s";
         } else {
             $name = "'{$userGroups['name']}' Users";
         }
         $link = 'manage-users/' . $userGroupId . '/';
         $manageUsers[] = array('title' => "Manage {$name}", 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/' . $link, 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/edit-user/', SJB_System::getSystemsettings('SITE_URL') . '/add-user/', SJB_System::getSystemsettings('SITE_URL') . '/manage-users/', SJB_System::getSystemsettings('SITE_URL') . '/email-log/', SJB_System::getSystemsettings('SITE_URL') . '/user-products/', SJB_System::getSystemsettings('SITE_URL') . '/private-messages/pm-main/', SJB_System::getSystemsettings('SITE_URL') . '/private-messages/pm-inbox/', SJB_System::getSystemsettings('SITE_URL') . '/private-messages/pm-outbox/', SJB_System::getSystemsettings('SITE_URL') . '/system/applications/view/', SJB_System::getSystemsettings('SITE_URL') . '/system/users/acl/'), 'perm_label' => 'manage_' . $userGroupId);
     }
     $GLOBALS['LEFT_ADMIN_MENU']['Users'] = array_merge($userGroup, $manageUsers);
     $users = array(array('title' => 'Import Users', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/import-users/', 'highlight' => array(), 'perm_label' => 'import_users'), array('title' => 'Export Users', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/export-users/', 'highlight' => array(), 'perm_label' => 'export_users'), array('title' => 'Mass Mailing', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/mailing/', 'highlight' => array(), 'perm_label' => 'create_and_send_mass_mailings'), array('title' => 'Guest Email Alerts', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/guest-alerts/', 'highlight' => array(), 'perm_label' => 'manage_guest_email_alerts'), array('title' => 'Banned IPs', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/banned-ips/', 'perm_label' => 'manage_banned_ips'));
     $GLOBALS['LEFT_ADMIN_MENU']['Users'] = array_merge($GLOBALS['LEFT_ADMIN_MENU']['Users'], $users);
     $GLOBALS['LEFT_ADMIN_MENU']['Layout and Content'] = array(array('title' => 'Form Builder', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/form-builders/', 'perm_label' => 'edit_form_builder'), array('title' => 'System Templates', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/edit-templates/', 'perm_label' => 'edit_templates_and_themes'), array('title' => 'Email Templates', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/edit-email-templates/', 'perm_label' => 'edit_templates_and_themes'), array('title' => 'Themes', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/edit-themes/', 'perm_label' => 'edit_templates_and_themes'), array('title' => 'Site Pages', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/user-pages/', 'perm_label' => 'manage_site_pages'), array('title' => 'Static Content', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/stat-pages/', 'perm_label' => 'manage_static_content'), array('title' => 'Banners', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/manage-banner-groups/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-banner-group/', SJB_System::getSystemsettings('SITE_URL') . '/edit-banner-group/', SJB_System::getSystemsettings('SITE_URL') . '/edit-banner/', SJB_System::getSystemsettings('SITE_URL') . '/add-banner/'), 'perm_label' => 'manage_banners'), array('title' => 'News', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/news-categories/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/manage-news/'), 'perm_label' => 'manage_news'), array('title' => 'Polls', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/manage-polls/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/poll-answers/', SJB_System::getSystemsettings('SITE_URL') . '/poll-results/'), 'perm_label' => 'manage_polls'));
     $GLOBALS['LEFT_ADMIN_MENU']['Billing'] = array(array('title' => 'Invoices', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/manage-invoices/', 'perm_label' => 'manage_invoices', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-invoice/', SJB_System::getSystemsettings('SITE_URL') . '/edit-invoice/')), array('title' => 'Products', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/products/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/edit-product/', SJB_System::getSystemsettings('SITE_URL') . '/add-product/'), 'perm_label' => 'manage_products'), array('title' => 'Promotions', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/promotions/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-promotion-code/', SJB_System::getSystemsettings('SITE_URL') . '/edit-promotion-code/', SJB_System::getSystemsettings('SITE_URL') . '/promotions/log/'), 'perm_label' => 'manage_promotions'), array('title' => 'Tax Rules', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/manage-taxes/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-tax/', SJB_System::getSystemsettings('SITE_URL') . '/edit-tax/'), 'perm_label' => 'manage_tax_rules'), array('title' => 'Payment Gateways', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/system/payment/gateways/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/configure-gateway/'), 'perm_label' => 'manage_payment_gateways'), array('title' => 'Transaction History', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/payments/', 'perm_label' => 'transaction_history'), array('title' => 'Payment Log', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/payment-log/', 'perm_label' => 'payment_log'));
     $GLOBALS['LEFT_ADMIN_MENU']['Reports'] = array(array('title' => 'General Statistics', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/general-statistics/', 'perm_label' => 'general_statistics'), array('title' => 'Listings', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/listings-statistics/', 'perm_label' => 'listings_reports'), array('title' => 'Applications and Views', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/applications-and-views/', 'perm_label' => 'applications_and_views_reports'), array('title' => 'Sales', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/sales/', 'perm_label' => 'sales_reports'), array('title' => 'Guest Alerts', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/statistics/guest-alerts/', 'perm_label' => 'guest_alerts_reports'), array('title' => 'Promotions Usage', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/statistics/promotions/', 'perm_label' => 'promotions_statistics'));
     $GLOBALS['LEFT_ADMIN_MENU']['System Configuration'] = array(array('title' => 'System Settings', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/settings/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/alphabet-letters/', SJB_System::getSystemsettings('SITE_URL') . '/view-error-log/'), 'perm_label' => 'configure_system_settings'), array('title' => 'Social Media', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/social-media/', 'perm_label' => 'social_media', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/social-media/bitly/', SJB_System::getSystemsettings('SITE_URL') . '/social-media/facebook', SJB_System::getSystemsettings('SITE_URL') . '/social-media/linkedin', SJB_System::getSystemsettings('SITE_URL') . '/social-media/twitter', SJB_System::getSystemsettings('SITE_URL') . '/social-media/googleplus')), array('title' => 'Admin Password', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/adminpswd/'), array('title' => 'Admin Sub Accounts', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/manage-subadmins/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-subadmin/', SJB_System::getSystemsettings('SITE_URL') . '/edit-subadmin/')), array('title' => 'ZipCode Database', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/geographic-data/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/geographic-data/import-data/', SJB_System::getSystemsettings('SITE_URL') . '/geographic-data/edit-location/'), 'perm_label' => 'edit_zipcode_database'), array('title' => 'Countries', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/countries/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-country/', SJB_System::getSystemsettings('SITE_URL') . '/import-countries/', SJB_System::getSystemsettings('SITE_URL') . '/edit-country/'), 'perm_label' => 'manage_countries'), array('title' => 'States/Regions', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/states/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-state/', SJB_System::getSystemsettings('SITE_URL') . '/edit-state/', SJB_System::getSystemsettings('SITE_URL') . '/import-states/'), 'perm_label' => 'manage_states_or_regions'), array('title' => 'Manage Currencies', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/currency-list/', 'perm_label' => 'manage_currencies'), array('title' => 'Refine Search Settings', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/refine-search-settings/', 'perm_label' => 'set_refine_search_parameters'), array('title' => 'Flag Listing Settings', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/flag-listing-settings/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/flag/', SJB_System::getSystemsettings('SITE_URL') . '/flag/'), 'perm_label' => 'edit_flag_listing_settings'), array('title' => 'Breadcrumbs Config', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/manage-breadcrumbs/', 'perm_label' => 'configure_breadcrumbs'), array('title' => 'HTML filters', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/filters/', 'perm_label' => 'set_html_filters'), array('title' => 'Task Scheduler', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/task-scheduler-settings/', 'perm_label' => 'set_task_scheduler'), array('title' => 'Plugins', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/system/miscellaneous/plugins/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/system/miscellaneous/fb_app_settings/'), 'perm_label' => array('manage_plug-ins', 'set_phpbb_plug-in', 'set_facebook_plug-in', 'set_linkedin_plug-in', 'set_twitter_plug-in', 'set_wordpress_plug-in', 'set_sharethisplugin', 'set_captchaplugin', 'set_indeedplugin', 'set_jujuplugin', 'set_simplyhiredplugin', 'set_googleplugin', 'set_googleplusplugin', 'set_googleanalyticsplugin', 'set_beyondplugin')), array('title' => 'Backup/Restore', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/backup/', 'perm_label' => 'create_and_restore_backups'), array('title' => 'Email Log', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/email-log/', 'perm_label' => 'email_log'));
     $GLOBALS['LEFT_ADMIN_MENU']['Language Management'] = array(array('title' => 'Manage Languages', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/manage-languages/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-language/', SJB_System::getSystemsettings('SITE_URL') . '/edit-language/'), 'perm_label' => 'manage_languages'), array('title' => 'Translate Phrases', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/manage-phrases/', 'highlight' => array(SJB_System::getSystemsettings('SITE_URL') . '/add-phrase/'), 'perm_label' => 'translate_phrases'), array('title' => 'Import Language', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/import-language/', 'perm_label' => 'import_languages'), array('title' => 'Export Language', 'reference' => SJB_System::getSystemsettings('SITE_URL') . '/export-language/', 'perm_label' => 'export_languages'));
     // set subadmin mode
     if (SJB_SubAdmin::getSubAdminSID()) {
         $GLOBALS['subadmin_id'] = SJB_SubAdmin::getSubAdminSID();
     }
 }
Beispiel #21
0
 public function execute()
 {
     $ou = SJB_UserManager::getOnlineUsers();
     $onlineUsers = array();
     $totalOnlineUsers = 0;
     $userGroups = SJB_UserGroupManager::createTemplateStructureForUserGroups();
     foreach ($userGroups as $userGroup) {
         $onlineUsers[$userGroup["id"]]["count"] = 0;
         $onlineUsers[$userGroup["id"]]["caption"] = $userGroup["caption"];
     }
     foreach ($ou as $value) {
         $onlineUsers[$value["type"]]["count"]++;
         $totalOnlineUsers++;
     }
     $theme = SJB_Settings::getValue('TEMPLATE_USER_THEME', 'default');
     $themePath = SJB_TemplatePathManager::getAbsoluteThemePath($theme);
     // FLAGGED LISTINGS
     $allListingTypes = SJB_ListingTypeManager::getAllListingTypesInfo();
     $totalFlagsNum = array();
     foreach ($allListingTypes as $type) {
         $totalFlagsNum[$type['id']] = SJB_ListingManager::getFlagsNumberByListingTypeSID($type['sid'], $filter = null, $groupByListingSID = true);
     }
     $files = $this->getCssFiles($themePath);
     $tp = SJB_System::getTemplateProcessor();
     $tp->assign('totalFlagsNum', $totalFlagsNum);
     $tp->assign('usersInfo', SJB_UserManager::getUsersInfo());
     $tp->assign('groupsInfo', SJB_UserManager::getGroupsInfo());
     $tp->assign('listingsInfo', SJB_ListingManager::getListingsInfo());
     $tp->assign('listingTypesInfo', SJB_ListingTypeManager::getAllListingTypesInfo());
     $tp->assign('invoicesInfo', SJB_InvoiceManager::getInvoicesInfo());
     $tp->assign('unpaidInvoices', SJB_InvoiceManager::getTotalUnpaidInvoices());
     $tp->assign('totalInvoices', SJB_InvoiceManager::getTotalInvoices());
     $i18n = SJB_I18N::getInstance();
     $lang = $i18n->getLanguageData($i18n->getCurrentLanguage());
     $tp->assign("today", strftime($lang['date_format'], time()));
     // ранее были данные за период: месяц (последние 30 дней), неделя (последние 7 дней)
     // теперь - текущий месяц и текущая неделя
     $currMonth = strftime($lang['date_format'], mktime(0, 0, 0, date("m"), 1, date("Y")));
     $currWeek = strftime($lang['date_format'], mktime(0, 0, 0, date("m"), date("d") - date("N") + 1, date("Y")));
     $tp->assign("weekAgo", $currWeek);
     $tp->assign("monthAgo", $currMonth);
     $tp->assign('onlineUsers', $onlineUsers);
     $tp->assign('totalOnlineUsers', $totalOnlineUsers);
     if (count($files) > 0) {
         $tp->assign("file", $files[0]);
     }
     $tp->display("index.tpl");
 }
Beispiel #22
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $activated = SJB_Request::getVar('account_activated', '') == 'yes';
     if (SJB_Request::getVar('returnToShoppingCart', false)) {
         SJB_Session::setValue('fromAnonymousShoppingCart', 1);
     }
     if (!$activated) {
         if (!isset($_REQUEST['username'], $_REQUEST['activation_key'])) {
             $errors['PARAMETERS_MISSED'] = 1;
         } elseif (!($userInfo = SJB_UserManager::getUserInfoByUserName($_REQUEST['username']))) {
             $errors['USER_NOT_FOUND'] = 1;
         } elseif ($userInfo['activation_key'] != $_REQUEST['activation_key']) {
             $errors['INVALID_ACTIVATION_KEY'] = true;
         } elseif ($userInfo['approval'] == 'Rejected') {
             SJB_UserDBManager::deleteActivationKeyByUsername($_REQUEST['username']);
             SJB_HelperFunctions::redirect(SJB_System::getSystemSettings('SITE_URL') . '/system/users/activate_account/?account_activated=no&approval_status=Rejected');
         } else {
             if (SJB_UserManager::activateUserByUserName($_REQUEST['username'])) {
                 SJB_UserDBManager::deleteActivationKeyByUsername($_REQUEST['username']);
                 if (!SJB_Authorization::isUserLoggedIn()) {
                     SJB_Authorization::login($_REQUEST['username'], false, false, $errors, true, true);
                     if (!SJB_SocialPlugin::getProfileSocialID($userInfo['sid'])) {
                         SJB_Notifications::sendUserWelcomeLetter($userInfo['sid']);
                     }
                     $requireApprove = SJB_UserGroupManager::isApproveByAdmin($userInfo['user_group_sid']);
                     if ($requireApprove && !empty($userInfo['approval'])) {
                         $approvalStatus = $userInfo['approval'];
                     } else {
                         $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($userInfo['user_group_sid']);
                         $pageId = !empty($userGroupInfo['after_registration_redirect_to']) ? $userGroupInfo['after_registration_redirect_to'] : '';
                         $redirectUrl = SJB_UserGroupManager::getRedirectUrlByPageID($pageId);
                         SJB_HelperFunctions::redirect($redirectUrl . 'account_activated=yes');
                     }
                 }
                 $activated = 1;
             } else {
                 $errors['CANNOT_ACTIVATE'] = TRUE;
             }
         }
     }
     $tp->assign('activated', $activated);
     $tp->assign('errors', $errors);
     $tp->assign('approvalStatus', !empty($approvalStatus) ? $approvalStatus : SJB_Request::getVar('approval_status', ''));
     $tp->assign('isLoggedIn', SJB_Authorization::isUserLoggedIn());
     $tp->display('activate_account.tpl');
 }
 public function execute()
 {
     $current_user_info = array('logged_in' => false);
     if (SJB_UserManager::isUserLoggedIn()) {
         SJB_Authorization::updateCurrentUserSession();
         $current_user_info = SJB_UserManager::createTemplateStructureForCurrentUser();
         $current_user_info['logged_in'] = true;
         $current_user_info['new_messages'] = SJB_PrivateMessage::getCountUnreadMessages($current_user_info['id']);
     } else {
         // social plugin
         $userGroups = SJB_UserGroupManager::getAllUserGroupsInfo();
         SJB_System::setCurrentUserGroupsInfo($userGroups);
         SJB_Event::dispatch('Login_Plugin');
     }
     SJB_System::setCurrentUserInfo($current_user_info);
 }
Beispiel #24
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid'));
     $user_id = $user['sid'];
     $total_in = SJB_PrivateMessage::getTotalInbox($user_id);
     $total_out = SJB_PrivateMessage::getTotalOutbox($user_id);
     $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']);
     SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']);
     $tp->assign('username', $user['username']);
     $tp->assign("user_group_info", $userGroupInfo);
     $tp->assign('user_sid', $user_id);
     $tp->assign('total_in', $total_in);
     $tp->assign('total_out', $total_out);
     $tp->display('main.tpl');
 }
Beispiel #25
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $user_menu_template = 'user_menu.tpl';
     if (SJB_UserManager::isUserLoggedIn()) {
         $user_info = SJB_Authorization::getCurrentUserInfo();
         if (!empty($user_info)) {
             $user_group_info = SJB_UserGroupManager::getUserGroupInfoBySID($user_info['user_group_sid']);
             if (!empty($user_group_info['user_menu_template']) && $tp->templateExists($user_group_info['user_menu_template'])) {
                 $user_menu_template = $user_group_info['user_menu_template'];
             }
             $tp->assign("user_group_info", $user_group_info);
             $tp->assign('listingTypesInfo', SJB_ListingTypeManager::getAllListingTypesInfo());
         }
     }
     $tp->assign("account_activated", SJB_Request::getVar('account_activated', ''));
     $tp->display($user_menu_template);
 }
Beispiel #26
0
 public function execute()
 {
     if (SJB_Authorization::isUserLoggedIn() && class_exists('SJB_SocialPlugin') && !SJB_SocialPlugin::getProfileObject() && ($socPlugins = SJB_SocialPlugin::getAvailablePlugins())) {
         $tp = SJB_System::getTemplateProcessor();
         $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID(SJB_UserManager::getCurrentUser()->user_group_sid);
         /**
          * delete from plugins array plugins that are not allowed
          * for this userGroup registration
          */
         SJB_SocialPlugin::preparePluginsThatAreAvailableForRegistration($socPlugins, $userGroupInfo['id']);
         if (empty($socPlugins)) {
             return null;
         }
         $socialNetworks = SJB_SocialPlugin::getSocialNetworks($socPlugins);
         $tp->assign('label', 'link');
         $tp->assign('social_plugins', $socialNetworks);
         $tp->display('social_plugins.tpl');
     }
 }
Beispiel #27
0
 public function execute()
 {
     $template = SJB_Request::getVar('display_template', 'my_reports.tpl');
     $action = SJB_Request::getVar('action', 'quickStat');
     $tp = SJB_System::getTemplateProcessor();
     $errors = array();
     $currentUser = SJB_UserManager::getCurrentUser();
     if (empty($currentUser)) {
         $tp->assign('ERROR', 'NOT_LOGIN');
         $tp->display('../miscellaneous/error.tpl');
         return;
     } else {
         if (SJB_UserGroupManager::getUserGroupIDBySID($currentUser->getUserGroupSID()) == 'Employer') {
             switch ($action) {
                 case 'generalStat':
                     $generalStat = SJB_Statistics::getEmployerGeneralStatistics($currentUser->getSID());
                     $tp->assign('generalStat', $generalStat);
                     break;
                 case 'jobsStat':
                     $active = SJB_Request::getVar('active', 1);
                     $sortingField = SJB_Request::getVar('sortingField', 'postedDate');
                     $sortingOrder = SJB_Request::getVar('sortingOrder', 'DESC');
                     $jobsStat = SJB_Statistics::getEmployerJobsStatistics($currentUser->getSID(), $active, $sortingField, $sortingOrder);
                     $tp->assign('jobsStat', $jobsStat);
                     $tp->assign('active', $active);
                     $tp->assign('sortingField', $sortingField);
                     $tp->assign('sortingOrder', $sortingOrder);
                     break;
                 case 'quickStat':
                     $quickStat = SJB_Statistics::getEmployerQuickStatistics($currentUser->getSID());
                     $tp->assign('quickStat', $quickStat);
                     break;
                 default:
                     break;
             }
         } else {
             $errors['NOT_EMPLOYER'] = true;
         }
     }
     $tp->assign('errors', $errors);
     $tp->display($template);
 }
Beispiel #28
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = SJB_Request::getVar('action', false);
     $sid = SJB_Request::getVar('sid', 0);
     $errors = array();
     switch ($action) {
         case 'activate':
             SJB_ProductsManager::activateProductBySID($sid);
             break;
         case 'deactivate':
             SJB_ProductsManager::deactivateProductBySID($sid);
             break;
         case 'delete':
             if (SJB_ContractManager::getContractQuantityByProductSID($sid) || SJB_InvoiceManager::getInvoiceQuantityByProductSID($sid)) {
                 $errors['PRODUCT_IS_IN_USE'] = 1;
             } else {
                 SJB_ProductsManager::deleteProductBySID($sid);
             }
             break;
     }
     $products = SJB_ProductsManager::getAllProductsInfo();
     foreach ($products as $key => $productInfo) {
         $product = new SJB_Product($productInfo, $productInfo['product_type']);
         $product->setNumberOfListings(1);
         if ($productInfo['product_type'] != 'post_listings' && $productInfo['product_type'] != 'mixed_product') {
             $products[$key]['number_of_postings'] = '-';
         }
         $products[$key]['price'] = $product->getPrice();
         $products[$key]['user_group'] = SJB_UserGroupManager::getUserGroupInfoBySID($productInfo['user_group_sid']);
         $products[$key]['product_type'] = SJB_ProductsManager::getProductTypeByID($productInfo['product_type']);
         $products[$key]['subscribed_users'] = SJB_ContractManager::getContractQuantityByProductSID($productInfo['sid']);
         $products[$key]['invoices'] = SJB_InvoiceManager::getInvoiceQuantityByProductSID($productInfo['sid']);
         if (!empty($productInfo['availability_to']) && $productInfo['availability_to'] <= date('Y-m-d')) {
             $products[$key]['expired'] = 1;
         }
     }
     $tp->assign('errors', $errors);
     $tp->assign('products', $products);
     $tp->display('products.tpl');
 }
Beispiel #29
0
 public function execute()
 {
     $access_type = SJB_Request::getVar('access_type');
     $listing_id = SJB_Request::getVar('listing_id');
     $user_group_id = SJB_Request::getVar('user_group_id');
     $employersGroupSID = SJB_UserGroupManager::getUserGroupSIDByID($user_group_id);
     $employersSIDs = SJB_UserManager::getUserSIDsByUserGroupSID($employersGroupSID);
     $employers = array();
     foreach ($employersSIDs as $emp) {
         $currEmp = SJB_UserManager::getUserInfoBySID($emp);
         if (isset($currEmp['CompanyName']) && $currEmp['CompanyName'] != '') {
             $employers[] = array('name' => $currEmp['CompanyName'], 'sid' => $emp);
         }
     }
     sort($employers);
     $tp = SJB_System::getTemplateProcessor();
     $listing_access_list = SJB_ListingManager::getListingAccessList($listing_id, $access_type);
     $tp->assign('listing_access_list', $listing_access_list);
     $tp->assign('employers', $employers);
     $tp->display('employers_list.tpl');
 }
Beispiel #30
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = SJB_Request::getVar('action', '', SJB_Request::METHOD_GET);
     $mess_id = intval(SJB_Request::getVar('mess', 0, SJB_Request::METHOD_GET));
     $return_to = SJB_Request::getVar('from', 'in', SJB_Request::METHOD_GET);
     $page = intval(SJB_Request::getVar('page', 1, SJB_Request::METHOD_GET));
     $user = SJB_UserManager::getUserInfoBySID(SJB_Request::getVar('user_sid'));
     $user_id = $user['sid'];
     if ($action == 'delete') {
         SJB_DB::query("DELETE FROM `private_message` WHERE `id` = '{$mess_id}'");
         $per_page = 10;
         if ($return_to == 'in') {
             $total = SJB_PrivateMessage::getTotalInbox($user_id);
         } else {
             $total = SJB_PrivateMessage::getTotalOutbox($user_id);
         }
         $max_pages = ceil($total / $per_page);
         if ($max_pages == 0) {
             $max_pages = 1;
         }
         if ($max_pages < $page) {
             $page = $max_pages;
         }
         $site_url = SJB_System::getSystemSettings('SITE_URL');
         SJB_HelperFunctions::redirect($site_url . '/private-messages/pm-' . ($return_to == 'in' ? 'inbox' : 'outbox') . "/?user_sid={$user_id}&page={$page}");
     }
     $message = SJB_PrivateMessage::ReadMessage($mess_id, true);
     $userGroupInfo = SJB_UserGroupManager::getUserGroupInfoBySID($user['user_group_sid']);
     SJB_System::setGlobalTemplateVariable('wikiExtraParam', $userGroupInfo['id']);
     $tp->assign("user_group_info", $userGroupInfo);
     $tp->assign('returt_to', $return_to);
     $tp->assign('username', $user['username']);
     $tp->assign('user_sid', $user_id);
     $tp->assign('message', $message);
     $tp->assign('page', $page);
     $tp->display('pm_read.tpl');
 }