Esempio n. 1
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;
 }
Esempio n. 2
0
 public static function getDetails($listing_type_sid, $pageID = 0)
 {
     $system_details = array(array('id' => 'featured', 'caption' => 'Featured', 'type' => 'boolean', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => null), array('id' => 'priority', 'caption' => 'Priority Listing', 'type' => 'boolean', 'length' => '20', 'is_required' => false, 'is_system' => true, 'order' => null));
     $listing_field_manager = new SJB_ListingFieldManager();
     $common_details = $listing_field_manager->getCommonListingFieldsInfo($pageID);
     $extra_details = $listing_field_manager->getListingFieldsInfoByListingType($listing_type_sid, $pageID);
     $details = array_merge($common_details, $extra_details);
     foreach ($details as $key => $detail) {
         $details[$key]['is_system'] = true;
         if ($detail['type'] == 'complex' || $detail['id'] == 'ApplicationSettings') {
             $details[$key]['is_system'] = false;
         } elseif ($detail['id'] == 'access_type') {
             $details[$key]['is_system'] = true;
             $details[$key]['list_values'] = array(array('id' => 'everyone', 'caption' => 'Everyone'), array('id' => 'no_one', 'caption' => 'No one'), array('id' => 'only', 'caption' => 'Only selected employers'), array('id' => 'except', 'caption' => 'Everyone except selected employers'));
         }
     }
     $details = array_merge($system_details, $details);
     $isPageLast = SJB_PostingPagesManager::isLastPageByID($pageID, $listing_type_sid);
     if ($isPageLast) {
         $status_details = array(array('id' => 'status', 'caption' => 'Approve Status', 'type' => 'list', 'list_values' => array(array('id' => 'pending', 'caption' => 'Pending'), array('id' => 'approved', 'caption' => 'Approved'), array('id' => 'rejected', 'caption' => 'Rejected')), 'is_required' => false, 'is_system' => true, 'order' => 1000000));
         $details = array_merge($details, $status_details);
         $rejectReasonDetails = array(array('id' => 'reject_reason', 'caption' => 'Reject Reason', 'type' => 'text', 'is_required' => false, 'is_system' => true, 'order' => 1000000));
         $details = array_merge($details, $rejectReasonDetails);
         if (SJB_PluginManager::isPluginActive('CaptchaPlugin') && SJB_System::getSettingByName('postJobCaptcha') && strpos(SJB_System::getURI(), '/add-listing/') === 0) {
             $details_captcha = array(array('id' => 'captcha', 'caption' => 'Enter code from image', 'type' => 'captcha', 'length' => '20', 'is_required' => true, 'is_system' => true, 'order' => 10000000));
             $details = array_merge($details, $details_captcha);
         }
     }
     return $details;
 }
Esempio n. 3
0
 /**
  * @return bool
  */
 private function isCaptchaEnable()
 {
     $isCaptcha = false;
     if (SJB_PluginManager::isPluginActive('CaptchaPlugin') && SJB_Session::getValue('CURRENT_THEME') != 'mobile') {
         $userType = SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') != SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE') ? 'user' : 'admin';
         $captchaSettingName = '';
         if (!($currentFunction = SJB_Request::getVar('currentFunction'))) {
             $currentFunction = SJB_Array::get(SJB_System::getModuleManager()->getCurrentFunction(), 1);
         }
         switch ($currentFunction) {
             case 'apply_now':
                 $captchaSettingName = 'contactUserCaptcha';
                 break;
             case 'flag_listing':
                 $captchaSettingName = 'flagListingCaptcha';
                 break;
             case 'tell_friend':
                 $captchaSettingName = 'tellFriendCaptcha';
                 break;
             case 'contact_form':
                 $captchaSettingName = 'contactUsCaptcha';
                 break;
             default:
                 if (SJB_System::getSettingByName('captcha_max_allowed_auth_attempts') != 0) {
                     if (SJB_Session::getValue($userType . 'LoginCounter') >= SJB_System::getSettingByName('captcha_max_allowed_auth_attempts')) {
                         $isCaptcha = true;
                         if (SJB_Session::getValue($userType . 'LoginCounter') == SJB_System::getSettingByName('captcha_max_allowed_auth_attempts')) {
                             SJB_Session::setValue($userType . 'LoginCounter', SJB_Session::getValue($userType . 'LoginCounter') + 1);
                             $this->isNotValidate = true;
                         }
                     }
                 }
         }
         if (!$isCaptcha) {
             $isCaptcha = SJB_System::getSettingByName($captchaSettingName) == 1;
         }
     }
     return $isCaptcha;
 }
Esempio n. 4
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $action = SJB_Request::getVar('action', 'search');
     $filter = SJB_Request::getVar('filter', array());
     $template = SJB_Request::getVar('template', 'general_statistics.tpl');
     $errors = array();
     switch ($action) {
         case 'export':
             $period = SJB_Request::getVar('period', false);
             $groupBy = SJB_Request::getVar('group_by', 'day');
             $statistics = SJB_Statistics::getGeneralStatistics($period, $groupBy, $filter);
             if (!empty($statistics['errors'])) {
                 $errors[] = $statistics['errors'];
             }
             if (!$errors && $statistics) {
                 $type = SJB_Request::getVar('type', 'csv');
                 $listingTypes = SJB_ListingTypeManager::getListingAllTypesForListType();
                 $userGroups = SJB_UserGroupManager::getAllUserGroupsIDsAndCaptions();
                 SJB_StatisticsExportController::createExportDirectory();
                 switch ($type) {
                     case 'csv':
                         $exportData = SJB_StatisticsExportController::getGeneralExportData($statistics, $userGroups, $listingTypes, $filter);
                         $fileName = 'general_statistics.csv';
                         SJB_StatisticsExportController::makeCSVExportFile($exportData, $fileName, 'General Statistics');
                         SJB_StatisticsExportController::archiveAndSendExportFile('general_statistics', 'csv');
                         break;
                     case 'xls':
                         $exportData = SJB_StatisticsExportController::getGeneralExportData($statistics, $userGroups, $listingTypes, $filter);
                         $fileName = 'general_statistics.xls';
                         SJB_StatisticsExportController::makeXLSExportFile($exportData, $fileName, 'General Statistics');
                         SJB_StatisticsExportController::archiveAndSendExportFile('general_statistics', 'xls');
                         break;
                 }
                 break;
             }
         case 'search':
             $search = SJB_Request::getVar('search', false);
             $period = SJB_Request::getVar('period', false);
             $groupBy = SJB_Request::getVar('group_by', 'day');
             $statistics = array();
             if ($search) {
                 $i18n = SJB_I18N::getInstance();
                 $from = $i18n->getInput('date', $period['from']);
                 $to = $i18n->getInput('date', $period['to']);
                 if (!empty($period['from']) && !empty($period['to']) && strtotime($from) > strtotime($to)) {
                     $errors[] = 'SELECTED_PERIOD_IS_INCORRECT';
                 } else {
                     if (count($filter) > 1) {
                         $statistics = SJB_Statistics::getGeneralStatistics($period, $groupBy, $filter);
                         if (!empty($statistics['errors'])) {
                             $errors[] = $statistics['errors'];
                         }
                     } else {
                         $errors[] = 'EMPTY_PARAMETER';
                     }
                 }
             }
             $listingTypes = SJB_ListingTypeManager::getListingAllTypesForListType();
             $userGroups = SJB_UserGroupManager::getAllUserGroupsIDsAndCaptions();
             $listPlugins = SJB_PluginManager::getAllPluginsList();
             $tp->assign('listPlugins', $listPlugins);
             $tp->assign('countItems', count($statistics) + 2);
             $tp->assign('userGroups', $userGroups);
             $tp->assign('listingTypes', $listingTypes);
             $tp->assign('errors', $errors);
             $tp->assign('groupBy', $groupBy);
             $tp->assign('statistics', $statistics);
             $tp->assign('period', $period);
             break;
     }
     $tp->assign('filter', $filter);
     $tp->assign('action', $action);
     $tp->display($template);
 }
Esempio n. 5
0
 /**
  * @param SJB_Listing $listing
  */
 public static function createTemplateStructureForListing($listing, $extraInfo = array())
 {
     $listing_info = parent::getObjectInfo($listing);
     if (SJB_MemoryCache::has('listingTypeInfo' . $listing->getListingTypeSID())) {
         $listing_type_info = SJB_MemoryCache::get('listingTypeInfo' . $listing->getListingTypeSID());
     } else {
         $listing_type_info = SJB_ListingTypeManager::getListingTypeInfoBySID($listing->getListingTypeSID());
         SJB_MemoryCache::set('listingTypeInfo' . $listing->getListingTypeSID(), $listing_type_info);
     }
     foreach ($listing->getProperties() as $property) {
         if ($property->isComplex()) {
             $isPropertyEmpty = true;
             $properties = $property->type->complex->getProperties();
             $properties = is_array($properties) ? $properties : array();
             foreach ($properties as $subProperty) {
                 if (!empty($listing_info['user_defined'][$property->getID()][$subProperty->getID()]) && is_array($listing_info['user_defined'][$property->getID()][$subProperty->getID()])) {
                     foreach ($listing_info['user_defined'][$property->getID()][$subProperty->getID()] as $subValue) {
                         if (!empty($subValue)) {
                             $isPropertyEmpty = false;
                         }
                     }
                 }
             }
             if ($isPropertyEmpty) {
                 $listing_info['user_defined'][$property->getID()] = '';
             }
         }
         if ($property->getType() == 'list') {
             $value = $property->getValue();
             $properties = $property->type->property_info;
             $listValues = isset($properties['list_values']) ? $properties['list_values'] : array();
             foreach ($listValues as $listValue) {
                 if ($listValue['id'] == $value) {
                     $listing_info['user_defined'][$property->getID()] = $listValue['caption'];
                 }
             }
         } elseif ($property->getType() == 'multilist') {
             $value = $property->getValue();
             if (!is_array($property->getValue())) {
                 $value = explode(',', $property->getValue());
             }
             $properties = $property->type->property_info;
             $listValues = isset($properties['list_values']) ? $properties['list_values'] : array();
             $listing_info['user_defined'][$property->getID()] = array();
             foreach ($listValues as $listValue) {
                 if (in_array($listValue['id'], $value)) {
                     $listing_info['user_defined'][$property->getID()][$listValue['id']] = $listValue['caption'];
                 }
             }
         } elseif ($property->getType() == 'location' && is_array($listing_info['user_defined'][$property->getID()])) {
             foreach ($property->type->fields as $locationField) {
                 if (array_key_exists($locationField['id'], $listing_info['user_defined'][$property->getID()])) {
                     if ($locationField['id'] == 'State') {
                         $listValues = SJB_StatesManager::getStateNamesBySid($property->value['State'], 'state_name');
                     } else {
                         $listValues = isset($locationField['list_values']) ? $locationField['list_values'] : array();
                     }
                     $value = $property->getValue();
                     $value = isset($value[$locationField['id']]) ? $value[$locationField['id']] : '';
                     foreach ($listValues as $listValue) {
                         if ($listValue['id'] == $value) {
                             $listing_info['user_defined'][$property->getID()][$locationField['id']] = $listValue['caption'];
                             $listing_info['user_defined'][$property->getID()][$locationField['id'] . '_Code'] = $listValue['Code'];
                             $listing_info['user_defined'][$property->getID()][$locationField['id'] . '_Name'] = $listValue['Name'];
                         }
                     }
                 }
             }
         }
     }
     $cache = SJB_Cache::getInstance();
     $cacheId = md5('SJB_UserManager::getObjectBySID' . $listing_info['system']['user_sid']);
     $user_info = array();
     if ($cache->test($cacheId)) {
         $user_info = $cache->load($cacheId);
     } else {
         $user = SJB_UserManager::getObjectBySID($listing_info['system']['user_sid']);
         $user_info = !empty($user) ? SJB_UserManager::createTemplateStructureForUser($user) : null;
         $cache->save($user_info, $cacheId, array(SJB_Cache::TAG_USERS));
     }
     $productInfo = SJB_ProductsManager::createTemplateStructureForProduct($listing_info['system']['product_info']);
     $priceForUpgradeToFeatured = 0;
     $priceForUpgradeToPriority = 0;
     if (!empty($listing_info['system']['product_info'])) {
         $listingProductInfo = unserialize($listing_info['system']['product_info']);
         $priceForUpgradeToFeatured = SJB_Array::get($listingProductInfo, 'upgrade_to_featured_listing_price', 0);
         $priceForUpgradeToPriority = SJB_Array::get($listingProductInfo, 'upgrade_to_priority_listing_price', 0);
     }
     $structure = array('id' => $listing_info['system']['id'], 'type' => array('id' => $listing_type_info['id'], 'caption' => $listing_type_info['name']), 'user' => $user_info, 'activation_date' => $listing_info['system']['activation_date'], 'expiration_date' => $listing_info['system']['expiration_date'], 'featured' => $listing_info['system']['featured'], 'priority' => $listing_info['system']['priority'], 'views' => $listing_info['system']['views'], 'active' => $listing_info['system']['active'], 'product' => $productInfo, 'contract_id' => $listing_info['system']['contract_id'], 'number_of_pictures' => isset($listing_info['user_defined']['pictures']) ? count($listing_info['user_defined']['pictures']) : 0, 'approveStatus' => $listing_info['system']['status'], 'complete' => $listing_info['system']['complete'], 'external_id' => $listing_info['system']['external_id'], 'priceForUpgradeToFeatured' => $priceForUpgradeToFeatured, 'priceForUpgradeToPriority' => $priceForUpgradeToPriority);
     if (SJB_Settings::getSettingByName('jobg8Installed') && SJB_PluginManager::isPluginActive('JobG8IntegrationPlugin')) {
         $structure['jobType'] = JobG8::getJobProperty($listing_info['system']['id'], 'jobType');
     }
     if (array_search('comments', $extraInfo)) {
         $structure['comments_num'] = SJB_CommentManager::getCommentsNumToListing($listing_info['system']['id']);
     }
     if (array_search('ratings', $extraInfo)) {
         $structure['rating_num'] = SJB_Rating::getRatingNumToListing($listing_info['system']['id']);
         $structure['rating'] = SJB_Rating::getRatingToListing($listing_info['system']['id']);
         $structure['rating_array'] = SJB_Rating::getRatingTplToListing($listing_info['system']['id']);
     }
     if (!empty($listing_info['system']['subuser_sid'])) {
         $structure['subuser'] = SJB_UserManager::getUserInfoBySID($listing_info['system']['subuser_sid']);
     }
     $structure['METADATA'] = array('activation_date' => array('type' => 'date'), 'expiration_date' => array('type' => 'date'), 'views' => array('type' => 'integer'), 'number_of_pictures' => array('type' => 'integer'), 'approveStatus' => array('type' => 'string'), 'rejectReason' => array('type' => 'string'));
     $structure = array_merge($structure, $listing_info['user_defined']);
     $structure['METADATA'] = array_merge($structure['METADATA'], parent::getObjectMetaData($listing));
     $listing_user_meta_data = array();
     if (isset($user_info['METADATA'])) {
         $listing_user_meta_data = $user_info['METADATA'];
         unset($user_info['METADATA']);
     }
     $listing_product_meta_data = array();
     if (isset($productInfo['METADATA'])) {
         $listing_product_meta_data = $productInfo['METADATA'];
         unset($productInfo['METADATA']);
     }
     $listing_type_meta_data = array('caption' => array('type' => 'string', 'propertyID' => 'listing_type'));
     $structure['METADATA'] = array_merge($structure['METADATA'], array('user' => $listing_user_meta_data, 'product' => $listing_product_meta_data, 'type' => $listing_type_meta_data));
     return array_merge($structure, $listing_info['user_defined']);
 }
Esempio n. 6
0
 /**
  * @param string $pluginName
  * @return bool
  */
 public static function isPluginActive($pluginName)
 {
     $plugin = SJB_PluginManager::getPluginByName($pluginName);
     return $plugin && $plugin['active'] == '1';
 }
Esempio n. 7
0
 public static function init()
 {
     SJB_DB::init(SJB_System::getSystemSettings('DBHOST'), SJB_System::getSystemSettings('DBUSER'), SJB_System::getSystemSettings('DBPASSWORD'), SJB_System::getSystemSettings('DBNAME'));
     ini_set('zlib.output_compression', SJB_System::getSettingByName('gzip_compression'));
     $GLOBALS['fatal_error_reserve_buffer'] = str_repeat('x', 1024 * 200);
     ob_start(array('SJB_Error', 'fatalErrorHandler'));
     SJB_Session::init(SJB_System::getSystemSettings('SITE_URL'));
     $sessionId = SJB_DB::queryValue("SELECT `session_id` FROM `user_session_data_storage` WHERE `session_id` = ?s", SJB_Session::getSessionId());
     // if not updated (row not exists) - insert that value
     if (empty($sessionId)) {
         SJB_DB::query("INSERT INTO `user_session_data_storage` SET `last_activity` = NOW(), `session_id` = ?s", SJB_Session::getSessionId());
     } else {
         SJB_DB::query("UPDATE `user_session_data_storage` SET `last_activity` = NOW() WHERE `session_id` = ?s", $sessionId);
     }
     //set timezone
     if (SJB_Settings::getSettingByName('timezone')) {
         ini_set('date.timezone', SJB_Settings::getSettingByName('timezone'));
     }
     // Set Error Handler and Shutdown function
     set_error_handler(array('SJB_Error', 'errorHandler'));
     register_shutdown_function(array('SJB_System', 'shutdownFunction'));
     SJB_System::prepareGlobalArrays();
     SJB_System::setGlobalTemplateVariable('is_ajax', SJB_Request::isAjax());
     SJB_System::setGlobalTemplateVariable('site_url', SJB_System::getSystemSettings('SITE_URL'));
     SJB_System::setGlobalTemplateVariable('user_site_url', SJB_System::getSystemSettings('USER_SITE_URL'));
     SJB_System::setGlobalTemplateVariable('admin_site_url', SJB_System::getSystemSettings('ADMIN_SITE_URL'));
     SJB_System::setGlobalTemplateVariable('radius_search_unit', SJB_System::getSettingByName('radius_search_unit'));
     SJB_System::setGlobalTemplateVariable('settings', SJB_Settings::getSettings());
     ThemeManager::getCurrentTheme();
     SJB_PluginManager::loadPlugins(SJB_System::getSystemSettings('PLUGINS_DIR'));
     SJB_System::setGlobalTemplateVariable('plugins', SJB_PluginManager::getAllPluginsList());
     $GLOBALS['System']['MODULE_MANAGER'] = new SJB_ModuleManager();
     SJB_Event::dispatch('moduleManagerCreated');
     $GLOBALS['System']['MODULE_MANAGER']->executeModulesStartupFunctions();
     // define if subadmin loged in and set subamdinmode for templates
     if (SJB_System::getSystemSettings('SYSTEM_ACCESS_TYPE') == SJB_System::getSystemSettings('ADMIN_ACCESS_TYPE') && SJB_SubAdmin::getSubAdminSID()) {
         SJB_System::setGlobalTemplateVariable('subAdminSID', SJB_SubAdmin::getSubAdminSID());
     }
     $GLOBALS['uri'] = SJB_Navigator::getURI();
 }
Esempio n. 8
0
 public function execute()
 {
     $tp = SJB_System::getTemplateProcessor();
     $saved = false;
     $action = SJB_Request::getVar('action');
     $form_submitted = SJB_Request::getVar('submit');
     $template = 'plugins.tpl';
     $errors = array();
     if (SJB_Request::getVar('error', false)) {
         $errors[] = SJB_Request::getVar('error', false);
     }
     $messages = array();
     if (SJB_Request::getVar('message', false)) {
         $messages[] = SJB_Request::getVar('message', false);
     }
     switch ($action) {
         case 'save':
             $paths = SJB_Request::getVar('path');
             $active = SJB_Request::getVar('active');
             $subAdminSID = SJB_SubAdmin::getSubAdminSID();
             if (SJB_System::getSystemSettings('isDemo')) {
                 $errors[] = 'You don\'t have permissions for it. This is a Demo version of the software.';
             } else {
                 foreach ($paths as $key => $path) {
                     $config = SJB_PluginManager::getPluginConfigFromIniFile($path);
                     // check subadmins permissions
                     if ($subAdminSID) {
                         switch ($key) {
                             case 'FacebookSocialPlugin':
                                 if (!$this->acl->isAllowed('set_facebook_plug-in', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'LinkedinSocialPlugin':
                                 if (!$this->acl->isAllowed('set_linkedin_plug-in', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'PhpBBBridgePlugin':
                                 if (!$this->acl->isAllowed('set_phpbb_plug-in', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'TwitterIntegrationPlugin':
                                 if (!$this->acl->isAllowed('set_twitter_plug-in', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'WordPressBridgePlugin':
                                 if (!$this->acl->isAllowed('set_wordpress_plug-in', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'ShareThisPlugin':
                                 if (!$this->acl->isAllowed('set_sharethisplugin', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'CaptchaPlugin':
                                 if (!$this->acl->isAllowed('set_captchaplugin', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'IndeedPlugin':
                                 if (!$this->acl->isAllowed('set_indeedplugin', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'JujuPlugin':
                                 if (!$this->acl->isAllowed('set_jujuplugin', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'SimplyHiredPlugin':
                                 if (!$this->acl->isAllowed('set_simplyhiredplugin', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'GoogleAnalyticsPlugin':
                                 if (!$this->acl->isAllowed('set_googleanalyticsplugin', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                             case 'BeyondPlugin':
                                 if (!$this->acl->isAllowed('set_beyondplugin', $subAdminSID)) {
                                     continue 2;
                                 }
                                 break;
                         }
                     }
                     $config['active'] = $active[$key];
                     $saved = SJB_PluginManager::savePluginConfigIntoIniFile($path, $config);
                     if (!$saved) {
                         $errors[] = 'Failed to save ' . $key . ' settings';
                     }
                 }
             }
             SJB_PluginManager::reloadPlugins();
             break;
         case 'save_settings':
             $request = $_REQUEST;
             $request = self::checkRequiredFields($request);
             if (!isset($request['setting_errors'])) {
                 SJB_Settings::updateSettings($request);
                 if ($form_submitted == 'save') {
                     break;
                 } else {
                     if ($form_submitted == 'apply') {
                         $pluginName = SJB_Request::getVar('plugin');
                         SJB_HelperFunctions::redirect('?action=settings&plugin=' . $pluginName);
                     }
                 }
             } else {
                 unset($request['setting_errors']);
                 $errors = $request;
             }
         case 'settings':
             $pluginName = SJB_Request::getVar('plugin');
             $plugin = SJB_PluginManager::getPluginByName($pluginName);
             if (isset($plugin['name'])) {
                 $pluginObj = new $plugin['name']();
                 $settings = $pluginObj->pluginSettings();
                 $template = 'plugin_settings.tpl';
                 $savedSettings = SJB_Settings::getSettings();
                 SJB_Event::dispatch('RedefineSavedSetting', $savedSettings, true);
                 SJB_Event::dispatch('RedefineTemplateName', $template, true);
                 $tp->assign('plugin', $plugin);
                 $tp->assign('settings', $settings);
                 $tp->assign('savedSettings', $savedSettings);
             }
             break;
         case 'editCaptcha':
             $info = $_REQUEST;
             SJB_Event::dispatch('editCaptcha', $info, true);
             foreach ($info as $key => $val) {
                 $tp->assign($key, $val);
             }
             $template = $info['template'];
             break;
     }
     $listPlugins = SJB_PluginManager::getAllPluginsList();
     $plugins = array();
     foreach ($listPlugins as $key => $plugin) {
         $group = !empty($plugin['group']) ? $plugin['group'] : 'Common';
         $plugins[$group][$key] = $plugin;
         if (array_key_exists($key, $this->socialMediaPlugins)) {
             $plugins[$group][$key]['socialMedia'] = $this->socialMediaPlugins[$key];
         }
     }
     $tp->assign('saved', $saved);
     $tp->assign('groups', $plugins);
     $tp->assign('errors', $errors);
     $tp->assign('messages', $messages);
     $tp->display($template);
 }