Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/wp-job-portal/includes/activation.php
+++ b/wp-job-portal/includes/activation.php
@@ -699,18 +699,6 @@
('indeedjob_category', '', 'indeedjob', NULL),
('number_of_tags_for_autocomplete', '15', 'tag', 'tag'),
('newtyped_tags', '0', 'tag', 'tag'),
- ('loginwithfacebook', '0', 'login', 'sociallogin'),
- ('apikeyfacebook', '', 'facebook', 'sociallogin'),
- ('apikeylinkedin', '', 'linkedin', 'sociallogin'),
- ('loginwithlinkedin', '0', 'login', 'sociallogin'),
- ('applywithfacebook', '0', 'jobapply', 'sociallogin'),
- ('applywithxing', '0', 'jobapply', 'sociallogin'),
- ('clientsecretfacebook', '', 'facebook', 'sociallogin'),
- ('clientsecretlinkedin', '', 'linkedin', 'sociallogin'),
- ('loginwithxing', '0', 'login', 'sociallogin'),
- ('apikeyxing', '', 'xing', 'sociallogin'),
- ('clientsecretxing', '', 'xing', 'sociallogin'),
- ('applywithlinkedin', '0', 'jobapply', 'sociallogin'),
('jobs_graph', '1', 'emcontrolpanel', NULL),
('resume_graph', '1', 'emcontrolpanel', NULL),
('box_newestresume', '1', 'emcontrolpanel', NULL),
@@ -1357,13 +1345,13 @@
(9, 'address2', 'Address2', 16, '', 0, NULL, NULL, 1, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(10, 'city', 'City', 17, '', 0, NULL, NULL, 1, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 0, 1, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(11, 'status', 'Status', 23, '', 0, NULL, NULL, 1, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
- (12, 'termsandconditions', 'Terms And Conditions', 24, '', 0, NULL, NULL, 1, 0, 0, 0, 0, 1, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
+ (12, 'termsandconditions', 'Terms and Conditions', 24, '', 0, NULL, NULL, 1, 0, 0, 0, 0, 1, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(13, 'jobtitle', 'Title', 1, '', 0, NULL, NULL, 2, 1, 1, 1, 1, 1, 0, '', '', 1, 1, NULL, 0, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(14, 'company', 'Company', 3, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 1, 0, '', '', 1, 1, NULL, 0, 1, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(15, 'department', 'Department', 5, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 1, 1, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(16, 'jobcategory', 'Category', 2, '', 0, NULL, NULL, 2, 1, 1, 0, 1, 1, 0, '', '', 1, 1, NULL, 0, 1, 0, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(17, 'jobtype', 'Type', 4, '', 0, NULL, NULL, 2, 1, 1, 0, 1, 1, 0, '', '', 1, 1, NULL, 0, 1, 0, '', 0, 0, 0, 0, 0, '', NULL, NULL),
- (18, 'jobstatus', 'Hiring status', 6, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 1, 1, NULL, 0, 1, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
+ (18, 'jobstatus', 'Hiring Status', 6, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 1, 1, NULL, 0, 1, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(19, 'jobsalaryrange', 'Salary Range', 7, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 1, 1, NULL, 0, 1, 0, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(20, 'workplace_type', 'Workplace Type', 8, '', 0, NULL, 'Specify if the job is On-site, Hybrid, or Remote', 2, 1, 1, 0, 0, 0, 0, '', '', 1, 1, NULL, 0, 1, 0, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(21, 'experience', 'Experience', 10, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
@@ -1376,18 +1364,18 @@
(27, 'stoppublishing', 'Stop Publishing', 19, '', 0, 'Enter date', '', 2, 1, 1, 0, 1, 1, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(28, 'city', 'City', 14, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 1, 1, NULL, 0, 1, 0, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(29, 'sendemail', 'Send Email', 20, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
- (30, 'sendmeresume', 'Send me Resume', 21, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
+ (30, 'sendmeresume', 'Send Me Resume', 21, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(31, 'description', 'Description', 22, '', 0, NULL, NULL, 2, 1, 1, 0, 1, 1, 0, '', '', 0, 0, NULL, 1, 0, 0, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(32, 'qualifications', 'Qualifications', 23, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(33, 'prefferdskills', 'Prefered Skills', 24, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(34, 'agreement', 'Agreement', 25, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(35, 'filter', 'Filter', 26, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(36, 'emailsetting', 'Email Setting', 27, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
- (37, 'joblink', 'Redirect on apply', 28, '', 0, NULL, NULL, 2, 0, 0, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
+ (37, 'joblink', 'Redirect on Apply', 28, '', 0, NULL, NULL, 2, 0, 0, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(38, 'tags', 'Tags', 15, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 1, 1, NULL, 0, 0, 0, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(39, 'metadescription', 'Meta Description', 29, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(40, 'metakeywords', 'Meta Keywords', 17, '', 0, NULL, NULL, 2, 1, 1, 0, 0, 0, 0, '', '', 1, 1, NULL, 0, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
- (41, 'termsandconditions', 'Terms And Conditions', 30, '', 0, NULL, NULL, 2, 0, 0, 0, 0, 1, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
+ (41, 'termsandconditions', 'Terms and Conditions', 30, '', 0, NULL, NULL, 2, 0, 0, 0, 0, 1, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(42, 'section_personal', 'Personal Information', 0, '1', 1, NULL, NULL, 3, 1, 1, 1, 1, 1, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(43, 'application_title', 'Application Title', 1, '1', 0, NULL, NULL, 3, 1, 1, 0, 0, 1, 0, '', '', 1, 1, NULL, 0, 1, 0, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(44, 'first_name', 'First Name', 2, '1', 0, NULL, NULL, 3, 1, 1, 1, 1, 1, 0, '', '', 1, 1, NULL, 0, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
@@ -1423,7 +1411,7 @@
(80, 'language', 'Language Name', 59, '8', 0, NULL, NULL, 3, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(81, 'institute_date_from', 'Date From', 36, '3', 0, NULL, NULL, 3, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(82, 'institute_date_to', 'Date To', 35, '3', 0, NULL, NULL, 3, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
- (83, 'termsandconditions', 'Terms And Conditions', 24, '1', 0, NULL, NULL, 3, 0, 0, 0, 0, 1, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
+ (83, 'termsandconditions', 'Terms and Conditions', 24, '1', 0, NULL, NULL, 3, 0, 0, 0, 0, 1, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(84, 'tagline', 'Tag Line', 13, '', 0, NULL, '', 1, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(85, 'salaryfixed', 'Desired Salary', 13, '1', 0, 'e.g. USD 3,500 per month', NULL, 3, 1, 1, 0, 0, 0, 0, '', '', 1, 1, 102, 0, 1, 0, '', 0, 0, 0, 0, 0, '', NULL, NULL),
(86, 'employer_current_status', 'I currently work there', 42, '4', 0, '16', '4', 3, 1, 1, 0, 0, 0, 0, '', '', 0, 0, NULL, 1, 0, 1, '', 0, 0, 0, 0, 0, '', NULL, NULL),
--- a/wp-job-portal/includes/ajax.php
+++ b/wp-job-portal/includes/ajax.php
@@ -12,8 +12,7 @@
add_action("wp_ajax_nopriv_wpjobportal_ajax_popup", array($this, "ajaxhandlerpopup")); // when user is not login
add_action("wp_ajax_wpjobportal_ajax_popup_action", array($this, "ajaxhandlerpopupaction")); // when user is login
add_action("wp_ajax_nopriv_wpjobportal_ajax_popup_action", array($this, "ajaxhandlerpopupaction")); // when user is not login
- add_action("wp_ajax_wpjobportal_loginwith_ajax", array($this, "ajaxhandlerloginwith")); // when user is login
- add_action("wp_ajax_nopriv_wpjobportal_loginwith_ajax", array($this, "ajaxhandlerloginwith")); // when user is not login
+ // Security (2.9.2): Social Login is removed, with its wpjobportal_loginwith_ajax handler.
}
function ajaxhandler() {
@@ -21,14 +20,17 @@
// anything that needs an account or the admin is listed apart and checked here
// before the model runs, on top of each task's own nonce.
$wpjobportal_public_tasks = array(
- 'DataForDepandantFieldResume', 'DataForDepandantField', 'getQuickViewByJobId', 'getShortListViewByJobId',
- 'getShortListViewByJobIdJobPortal', 'getApplyNowByJobid', 'jobapply', 'jobapplyjobmanager', 'getTellaFriend',
+ 'DataForDepandantFieldResume', 'DataForDepandantField', 'getQuickViewByJobId',
+ 'getApplyNowByJobid', 'jobapply', 'jobapplyjobmanager', 'getTellaFriend',
'sendmailtofriend', 'deletecompanylogo', 'deleteResumeLogo', 'listdepartments', 'listDepartments', 'saveTokenInputTag',
'getsubcategorypopup', 'canceljobapplyasvisitor', 'visitorapplyjob', 'removeResumeFileById', 'getResumeSectionAjax',
'deleteResumeSectionAjax', 'savetokeninputcity', 'getPackagePopupJobView',
'getPackagePopupForCompanyContactDetail', 'getPackagePopupForResumeContactDetail', 'isFieldRequired', 'getAjaxJobs',
'executeCompanyCopilot', 'executeJobCopilot', 'executeResumeCopilot', 'executeCoverLetterCopilot');
$wpjobportal_user_tasks = array(
+ // Security (2.9.2, Patchstack 40802): the saved-job popup moved here from the public list; it shows the
+ // signed-in job seeker's own note and rating, so a visitor has nothing to ask it for.
+ 'getShortListViewByJobId', 'getShortListViewByJobIdJobPortal',
'saveJobShortlist', 'saveJobShortlistJobManager', 'changeNotifyOfNotifications', 'changeViewOfNotifications',
'makeJobCopyAjax', 'updateJobApplyResumeStatus', 'getResumeCommentSection', 'getResumeCommentSectionJobManager',
'storeResumeComments', 'setResumeRatting', 'getFolderSection', 'getFolderSectionJobManager', 'saveToFolderResume',
@@ -108,41 +110,6 @@
die();
}
- function ajaxhandlerloginwith() {
- $wpjobportal_socialmedia = sanitize_key(WPJOBPORTALrequest::getVar('socialmedia'));
- $wpjobportal_task = preg_replace('/[^A-Za-z0-9_]/', '', (string) WPJOBPORTALrequest::getVar('task'));
- $wpjobportal_allowed_tasks = array(
- 'facebook' => array('login', 'logout', 'applywithfacebook'),
- 'linkedin' => array('login', 'logout', 'applywithlinkedin'),
- 'xing' => array('login', 'logout', 'applywithxing'),
- );
- if (!isset($wpjobportal_allowed_tasks[$wpjobportal_socialmedia]) || !in_array($wpjobportal_task, $wpjobportal_allowed_tasks[$wpjobportal_socialmedia], true)) {
- die('Not Allowed!');
- }
- $wpjobportal_result = '';
- switch ($wpjobportal_socialmedia) {
- case 'facebook':
- $wpjobportal_object = WPJOBPORTALincluder::getObjectClass('facebook');
- break;
- case 'linkedin':
- $wpjobportal_object = WPJOBPORTALincluder::getObjectClass('linkedin');
- break;
- case 'xing':
- $wpjobportal_object = WPJOBPORTALincluder::getObjectClass('xing');
- break;
- }
- if (!isset($wpjobportal_object) || !method_exists($wpjobportal_object, $wpjobportal_task) || !is_callable(array($wpjobportal_object, $wpjobportal_task))) {
- die('Not Allowed!');
- }
- $wpjobportal_reflection = new ReflectionMethod($wpjobportal_object, $wpjobportal_task);
- if ($wpjobportal_reflection->getNumberOfRequiredParameters() > 0) {
- die('Not Allowed!');
- }
- $wpjobportal_result = $wpjobportal_object->$wpjobportal_task();
- // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Intentional raw response (AJAX / HTML)
- echo $wpjobportal_result;
- die();
- }
}
--- a/wp-job-portal/includes/classes/customfields.php
+++ b/wp-job-portal/includes/classes/customfields.php
@@ -26,8 +26,14 @@
// }
//}
$wpjobportal_visibleclass = "";
+ $wpjobportal_starts_hidden = false;
if (isset($wpjobportal_field->visibleparams) && $wpjobportal_field->visibleparams != ''){
- $wpjobportal_visibleclass = " visible js-form-custm-flds-wrp";
+ // 2026-11-20 (tester): start shown when the resume's saved parent value already meets
+ // the condition, as job and company forms do (Finding 45). Only this resume's own
+ // params are used ('' for a new resume = hidden); js-form-custm-flds-wrp always stays.
+ $wpjobportal_starts_shown = $this->visibleFieldStartsShown($wpjobportal_field, is_string($obj_params) ? $obj_params : '');
+ $wpjobportal_visibleclass = $wpjobportal_starts_shown ? " js-form-custm-flds-wrp" : " visible js-form-custm-flds-wrp";
+ $wpjobportal_starts_hidden = !$wpjobportal_starts_shown;
}
$wpjobportal_themebfclass = " ".$this->class_prefix."-bigfont ";
if(null != $wpjobportal_themecall){
@@ -66,6 +72,12 @@
$cssclass = "";
// }
}
+ // 2026-11-24: a required field that starts hidden by its condition is not required until it
+ // is shown (common.js isFieldRequired() adds it then), as formCustomFields() does for job and
+ // company forms. A hidden required field can never be filled, so Save Resume did nothing.
+ if ($wpjobportal_starts_hidden) {
+ $cssclass = "";
+ }
$wpjobportal_html .= ' </div><div class="' . $wpjobportal_div3 . '">';
$wpjobportal_resumeTitle = wpjobportal::wpjobportal_getVariableValue($wpjobportal_field->fieldtitle);
@@ -103,7 +115,10 @@
}
$specialClass='';
- if($wpjobportal_value != ''){
+ // 2026-11-20 (tester): common.js shows every .specialClass field on load. A conditional field
+ // gets it only when its condition is met (a field whose parent is empty starts hidden; its
+ // saved value is still posted, so nothing is lost).
+ if($wpjobportal_value != '' && $this->conditionalFieldStartsShown($wpjobportal_field, is_string($obj_params) ? $obj_params : '')){
$specialClass = ' specialClass ';
}
@@ -770,6 +785,22 @@
* @param string|null $wpjobportal_params Saved params JSON; default: the record being edited.
* @return bool
*/
+ /**
+ * 2026-11-20: may this field carry the specialClass marker (common.js shows every
+ * .specialClass field on load)? A field without a condition: yes. A conditional
+ * field: only when visibleFieldStartsShown() says its condition is met.
+ *
+ * @param object $wpjobportal_field Field row.
+ * @param string|null $wpjobportal_params Saved params JSON; null: the record being edited.
+ * @return bool
+ */
+ function conditionalFieldStartsShown($wpjobportal_field, $wpjobportal_params = null) {
+ if (!is_object($wpjobportal_field) || empty($wpjobportal_field->visibleparams)) {
+ return true;
+ }
+ return $this->visibleFieldStartsShown($wpjobportal_field, $wpjobportal_params);
+ }
+
function visibleFieldStartsShown($wpjobportal_field, $wpjobportal_params = null) {
if (!is_object($wpjobportal_field) || empty($wpjobportal_field->visibleparams)) {
return false;
@@ -849,6 +880,7 @@
$fvalue = "";
$wpjobportal_value = "";
$wpjobportal_userdataid = "";
+ $wpjobportal_sc_params = null; // params the value is read from (null = the record being edited)
if ($wpjobportal_resumeform == 1) {
if($wpjobportal_section == 1 || $wpjobportal_section == 5 || $wpjobportal_section == 6){ // personal section
if(isset(wpjobportal::$_data[0]['personal_section'])){
@@ -875,6 +907,7 @@
$wpjobportal_value = wpjobportal::$_data[0]['language_section']->params;
}
}
+ $wpjobportal_sc_params = is_string($wpjobportal_value) ? $wpjobportal_value : '';
if($wpjobportal_value){ // data has been stored
$wpjobportal_userfielddataarray = json_decode($wpjobportal_value);
$wpjobportal_valuearray = json_decode($wpjobportal_value,true);
@@ -923,7 +956,8 @@
$wpjobportal_theme_string = '';
$wpjobportal_html = '';
$specialClass = '';
- if($wpjobportal_value != ''){
+ // 2026-11-20: see formCustomFieldsResume() - a conditional field only when its condition is met.
+ if($wpjobportal_value != '' && $this->conditionalFieldStartsShown($wpjobportal_field, $wpjobportal_sc_params)){
$specialClass = ' specialClass ';
}
switch ($wpjobportal_field->userfieldtype) {
--- a/wp-job-portal/includes/classes/handlesearchcookies.php
+++ b/wp-job-portal/includes/classes/handlesearchcookies.php
@@ -32,9 +32,7 @@
}
function init(){
- // set/remove any transients in cookies (existing behavior)
- $this->setCookiesFromTransientData();
- $this->removeCookiesFromTransientData();
+ // Security (2.9.2): Social Login is removed, so its wpjobportal-social* cookies are no longer set or cleared here.
$wpjobportal_isadmin = wpjobportal::$_common->wpjp_isadmin();
$wpjobportal_jstlay = '';
@@ -384,106 +382,6 @@
WPJOBPORTALincluder::getJSModel('common')->setSearchVariableAdmin($this->_jsjp_search_array);
}
- private function setCookiesFromTransientData(){
- // Security: the discontinued Social Login add-on left the signed-in
- // person's social id in ONE site-wide transient, and this handed it to
- // whichever visitor loaded the next page, as a cookie that Core then
- // trusted as a login. Social Login is discontinued and the cookie is no
- // longer an identity (WPJOBPORTALuser::trustedSocialId()), so never turn
- // that transient into cookies; just clear any leftover value.
- if (get_transient('wpjobportal-social-login-data') !== false) {
- delete_transient('wpjobportal-social-login-data');
- }
- return;
- $wpjobportal_user_data = get_transient( 'wpjobportal-social-login-data');
- if( $wpjobportal_user_data !== FALSE){ // it will be false if transient does not exsist
- if($wpjobportal_user_data != '' && is_array($wpjobportal_user_data) && !empty($wpjobportal_user_data)){
- if (!WPJOBPORTALrequest::hasCookie('wpjobportal-socialid')){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialid' , $wpjobportal_user_data['socialid'] , time() + 1209600 , COOKIEPATH);
- if ( SITECOOKIEPATH != COOKIEPATH ){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialid' , $wpjobportal_user_data['socialid'] , time() + 1209600 , SITECOOKIEPATH);
- }
- }
- if (!WPJOBPORTALrequest::hasCookie('wpjobportal-socialfirstname')){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialfirstname' , $wpjobportal_user_data['socialfirstname'] , time() + 1209600 , COOKIEPATH);
- if ( SITECOOKIEPATH != COOKIEPATH ){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialfirstname' , $wpjobportal_user_data['socialfirstname'] , time() + 1209600 , SITECOOKIEPATH);
- }
- }
- if (!WPJOBPORTALrequest::hasCookie('wpjobportal-sociallastname')){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-sociallastname' , $wpjobportal_user_data['sociallastname'], time() + 1209600 , COOKIEPATH);
- if ( SITECOOKIEPATH != COOKIEPATH ){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-sociallastname' , $wpjobportal_user_data['sociallastname'], time() + 1209600 , SITECOOKIEPATH);
- }
- }
- if (!WPJOBPORTALrequest::hasCookie('wpjobportal-socialemail')){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialemail' , $wpjobportal_user_data['socialemail'], time() + 1209600 , COOKIEPATH);
- if ( SITECOOKIEPATH != COOKIEPATH ){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialemail' , $wpjobportal_user_data['socialemail'], time() + 1209600 , SITECOOKIEPATH);
- }
- }
- if (!WPJOBPORTALrequest::hasCookie('wpjobportal-socialmedia')){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialmedia' , $wpjobportal_user_data['socialmedia'], time() + 1209600 , COOKIEPATH);
- if ( SITECOOKIEPATH != COOKIEPATH ){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialmedia' , $wpjobportal_user_data['socialmedia'], time() + 1209600 , SITECOOKIEPATH);
- }
- }
- delete_transient('wpjobportal-social-login-data');// removing transient to avoid re creating cookie on every call
- }
- }
- }
-
- private function removeCookiesFromTransientData(){
- $remove_coookies = get_transient( 'wpjobportal-social-login-logout-cookies');
- if( $remove_coookies !== FALSE){ // it will be false if transient does not exsist
- if($remove_coookies != '' && !empty($remove_coookies) && $remove_coookies == 'remove-cookies' ){
-
- if(WPJOBPORTALrequest::hasCookie('wpjobportal-socialid')){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialid' , '' , time() - 3600 , COOKIEPATH);
- if ( SITECOOKIEPATH != COOKIEPATH ){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialid' , '' , time() - 3600 , SITECOOKIEPATH);
- }
- unset($_COOKIE['wpjobportal-socialid']);
- }
-
- if(WPJOBPORTALrequest::hasCookie('wpjobportal-socialfirstname')){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialfirstname' , '' , time() - 3600 , COOKIEPATH);
- if ( SITECOOKIEPATH != COOKIEPATH ){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialfirstname' , '' , time() - 3600 , SITECOOKIEPATH);
- }
- unset($_COOKIE['wpjobportal-socialfirstname']);
- }
-
- if(WPJOBPORTALrequest::hasCookie('wpjobportal-sociallastname')){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-sociallastname' , '', time() - 3600 , COOKIEPATH);
- if ( SITECOOKIEPATH != COOKIEPATH ){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-sociallastname' , '', time() - 3600 , SITECOOKIEPATH);
- }
- unset($_COOKIE['wpjobportal-sociallastname']);
- }
-
- if(WPJOBPORTALrequest::hasCookie('wpjobportal-socialemail')){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialemail' , '', time() - 3600 , COOKIEPATH);
- if ( SITECOOKIEPATH != COOKIEPATH ){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialemail' , '', time() - 3600 , SITECOOKIEPATH);
- }
- unset($_COOKIE['wpjobportal-socialemail']);
- }
-
- if(WPJOBPORTALrequest::hasCookie('wpjobportal-socialmedia')){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialmedia' , '', time() - 3600 , COOKIEPATH);
- if ( SITECOOKIEPATH != COOKIEPATH ){
- wpjobportalphplib::wpJP_setcookie('wpjobportal-socialmedia' , '', time() - 3600 , SITECOOKIEPATH);
-
- }
- unset($_COOKIE['wpjobportal-socialmedia']);
- }
-
- delete_transient('wpjobportal-social-login-logout-cookies');// removing transient to avoid re creating cookie on every call
- }
- }
- }
-
public function getLayoutValueFromPageNum($wpjobportal_pagenum){
$wpjobportal_layout = 'jobs'; // sensible default
switch($wpjobportal_pagenum){
--- a/wp-job-portal/includes/classes/resumeformlayout.php
+++ b/wp-job-portal/includes/classes/resumeformlayout.php
@@ -42,12 +42,14 @@
}
function getResumeFormUserField($wpjobportal_field, $object , $wpjobportal_section , $wpjobportal_sectionid, $wpjobportal_ishidden,$wpjobportal_themecall=null) {
+ $wpjobportal_id = isset($object->id) ? $object->id : NULL;
+ $params = isset($object->params) ? $object->params : NULL;
$wpjobportal_visibleclass = "";
if (isset($wpjobportal_field->visibleparams) && $wpjobportal_field->visibleparams != ''){
- $wpjobportal_visibleclass = " visible js-form-custm-flds-wrp ";
+ // 2026-11-20 (tester): start shown when the saved parent value meets the condition (see customfields.php formCustomFieldsResume).
+ $wpjobportal_starts_shown = wpjobportal::$_wpjpcustomfield->visibleFieldStartsShown($wpjobportal_field, is_string($params) ? $params : '');
+ $wpjobportal_visibleclass = $wpjobportal_starts_shown ? " js-form-custm-flds-wrp " : " visible js-form-custm-flds-wrp ";
}
- $wpjobportal_id = isset($object->id) ? $object->id : NULL;
- $params = isset($object->params) ? $object->params : NULL;
$wpjobportal_data = NULL;
$wpjobportal_result = wpjobportal::$_wpjpcustomfield->formCustomFieldsResume($wpjobportal_field , $wpjobportal_id , $params,null,$wpjobportal_section , $wpjobportal_sectionid, $wpjobportal_ishidden,$wpjobportal_themecall);
if( isset($wpjobportal_result['value']) && $wpjobportal_result['value'] != null){
--- a/wp-job-portal/includes/classes/resumeviewlayout.php
+++ b/wp-job-portal/includes/classes/resumeviewlayout.php
@@ -508,7 +508,14 @@
$wpjobportal_data_directory = wpjobportal::$_config->getConfigurationByConfigName('data_directory');
$wpjobportal_img = $wpjobportal_wpdir['baseurl'] . '/' . $wpjobportal_data_directory . '/data/jobseeker/resume_' . wpjobportal::$_data[0]['personal_section']->id . '/photo/' . wpjobportal::$_data[0]['personal_section']->photo;
}
- $wpjobportal_html .= '<img alt="' . esc_attr__('Resume photo', 'wp-job-portal') . '" src="' . esc_url($wpjobportal_img) . '" />';
+ // 2026-11-23 C32: in the admin, no photo = the initials circle the lists use (the site keeps its picture).
+ if (wpjobportal::$_data[0]['personal_section']->photo == '' && is_admin() && !wp_doing_ajax()) {
+ $wpjobportal_ps = wpjobportal::$_data[0]['personal_section'];
+ $wpjobportal_ini = WPJOBPORTAL_Admin_Jobs_List_UI::initials(trim((isset($wpjobportal_ps->first_name) ? $wpjobportal_ps->first_name : '') . ' ' . (isset($wpjobportal_ps->last_name) ? $wpjobportal_ps->last_name : '')));
+ $wpjobportal_html .= '<span class="wjpl-resume-initials" aria-hidden="true">' . esc_html($wpjobportal_ini !== '' ? $wpjobportal_ini : '?') . '</span>';
+ } else {
+ $wpjobportal_html .= '<img alt="' . esc_attr__('Resume photo', 'wp-job-portal') . '" src="' . esc_url($wpjobportal_img) . '" />';
+ }
$wpjobportal_html .= '</div>';
}
}
@@ -664,7 +671,14 @@
$wpjobportal_data_directory = wpjobportal::$_config->getConfigurationByConfigName('data_directory');
$wpjobportal_img = $wpjobportal_wpdir['baseurl'] . '/' . $wpjobportal_data_directory . '/data/jobseeker/resume_' . wpjobportal::$_data[0]['personal_section']->id . '/photo/' . wpjobportal::$_data[0]['personal_section']->photo;
}
- $wpjobportal_html .= '<img alt="' . esc_attr__('Resume photo', 'wp-job-portal') . '" src="' . esc_url($wpjobportal_img) . '" />';
+ // 2026-11-23 C32: in the admin, no photo = the initials circle the lists use (the site keeps its picture).
+ if (wpjobportal::$_data[0]['personal_section']->photo == '' && is_admin() && !wp_doing_ajax()) {
+ $wpjobportal_ps = wpjobportal::$_data[0]['personal_section'];
+ $wpjobportal_ini = WPJOBPORTAL_Admin_Jobs_List_UI::initials(trim((isset($wpjobportal_ps->first_name) ? $wpjobportal_ps->first_name : '') . ' ' . (isset($wpjobportal_ps->last_name) ? $wpjobportal_ps->last_name : '')));
+ $wpjobportal_html .= '<span class="wjpl-resume-initials" aria-hidden="true">' . esc_html($wpjobportal_ini !== '' ? $wpjobportal_ini : '?') . '</span>';
+ } else {
+ $wpjobportal_html .= '<img alt="' . esc_attr__('Resume photo', 'wp-job-portal') . '" src="' . esc_url($wpjobportal_img) . '" />';
+ }
$wpjobportal_html .= '</div>';
}
}
@@ -805,6 +819,10 @@
function getRowForView($wpjobportal_text, $wpjobportal_value, &$wpjobportal_i,$wpjobportal_themecall=null,$full=0) {
$wpjobportal_html = '';
+ // 2026-11-23 C29: in the admin, an empty value shows a muted dash instead of nothing (the site is unchanged).
+ if (is_admin() && !wp_doing_ajax() && trim(wp_strip_all_tags((string) $wpjobportal_value)) === '' && strpos((string) $wpjobportal_value, '<img') === false) {
+ $wpjobportal_value = '<span class="wjpl-na">—</span>';
+ }
if(null != $wpjobportal_themecall){
if(1!=$full){
if ($wpjobportal_i == 0 || $wpjobportal_i % 2 == 0) {
--- a/wp-job-portal/includes/classes/uploads.php
+++ b/wp-job-portal/includes/classes/uploads.php
@@ -78,7 +78,10 @@
$wpjobportal_path = $wpjobportal_path . '/employer/job_'.$this->entitey_id.'/custom_uploads';
}elseif($this->uploadfor == 'resume'){
$wpjobportal_path = $wpjobportal_path . '/jobseeker/resume_'.$this->entitey_id.'/custom_uploads';
- }elseif($this->uploadfor == 'profile'){
+ }elseif($this->uploadfor == 'profile' || $this->uploadfor == 'user'){
+ // 2.9.2: the profile's custom fields upload as 'user'. That had no folder, so the
+ // file landed in the data folder itself, which then got a deny-all .htaccess:
+ // on Apache every logo and photo under it stopped loading.
$wpjobportal_path = $wpjobportal_path . '/profile/profile_'.$this->entitey_id.'/custom_uploads';
}else{
--- a/wp-job-portal/includes/classes/user.php
+++ b/wp-job-portal/includes/classes/user.php
@@ -1,308 +1,260 @@
-<?php
-
-if (!defined('ABSPATH'))
- die('Restricted Access');
-
-class WPJOBPORTALuser {
-
- private $currentuser = null;
-
- private static $rows = array();
-
- /**
- * The social-login id of the current visitor, or '' when there is none.
- *
- * Security: the discontinued Social Login add-on identified its users by a
- * plain `wpjobportal-socialid` cookie. A cookie is chosen by the browser,
- * so trusting it let any visitor become any social-login portal user by
- * setting that cookie (and made isguest() false for any non-empty value).
- * Social Login is discontinued in 2.8.0 and nothing sets the cookie any
- * more, so the cookie is never trusted as an identity: this always answers
- * ''. Social-login users sign in with a WordPress account instead.
- *
- * @return string
- */
- public static function trustedSocialId() {
- return '';
- }
-
- public static function forgetOnWrite($wpjobportal_query) {
- if (!empty(self::$rows) && strpos($wpjobportal_query, 'wj_portal_users') !== false && preg_match('/^s*(UPDATE|INSERT|REPLACE|DELETE)b/i', $wpjobportal_query)) {
- self::$rows = array();
- }
- return $wpjobportal_query;
- }
-
- function __construct() {
- if (is_user_logged_in()) { // wp user logged in
- $wpuserid = get_current_user_id();
- if (!is_numeric($wpuserid))
- return false;
- // P-2: this class is built for almost every check on a page. Any write to the
- // users table empties the remembered row, so a new role shows at once.
- if (!array_key_exists($wpuserid, self::$rows)) {
- if (!has_filter('query', array(__CLASS__, 'forgetOnWrite'))) {
- add_filter('query', array(__CLASS__, 'forgetOnWrite'));
- }
- $query = wpjobportal::$_db->prepare("SELECT * FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE uid = %d", $wpuserid);
- self::$rows[$wpuserid] = wpjobportal::$_db->get_row($query);
- }
- $this->currentuser = self::$rows[$wpuserid];
- }else { // wp user is not logged in
- //sanitize_key($_SESSION['wpjobportal-socialid'])
- if (self::trustedSocialId() !== '') { // social user is logged in
-
- $wpjobportal_socialid = self::trustedSocialId();
- $query = wpjobportal::$_db->prepare("SELECT * FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE socialid = %s", $wpjobportal_socialid);
- $this->currentuser = wpjobportal::$_db->get_row($query);
- }
- }
- }
-
- function isguest() {
- if (self::trustedSocialId() !== '') {
- return false;
- } elseif ($this->currentuser == null && !is_user_logged_in()) { // current user is guest
- return true;
- } else {
- return false;
- }
- }
-
- function getEmployerProfile(){
- //if($this->isemployer()==true){
- /*
- * There may be no portal user behind the WordPress one.
- *
- * currentuser is the wj_portal_users row for whoever is signed in, and
- * somebody can be signed in without having one - a Recruit Suite team
- * member is added to a company, not registered through the portal. The
- * isemployer() guard above used to catch that and was commented out,
- * which left this reading ->uid off null and warning about it on every
- * recruiter page load.
- *
- * The test is for the missing row rather than for the employer role,
- * because a recruiter carries roleid 0: putting isemployer() back would
- * stop the warning by taking the profile away from the very people who
- * were seeing it. No row, no profile - which is what the tail of this
- * function already answers.
- */
- if ($this->currentuser == null) {
- return false;
- }
- $wpjobportal_id = $this->currentuser->uid;
- $wpjobportal_string = "users.uid";
- if (self::trustedSocialId() !== '') { // social user is logged in
- $wpjobportal_id = $this->currentuser->id;
- $wpjobportal_string = "users.id";
- }
- if(is_numeric($wpjobportal_id)){
- $query = "SELECT users.id,users.uid,users.first_name,users.photo,users.emailaddress,users.last_name,users.socialmedia
- FROM " . wpjobportal::$_db->prefix . "wj_portal_users AS users
- WHERE users.id != 0 AND " . $wpjobportal_string . " = %d LIMIT 1 ";
- $query = wpjobportal::$_db->prepare($query, $wpjobportal_id);
- return wpjobportal::$_db->get_row($query);
- }
-
-
- //}else{
- return false;
- //}
- }
-
- function getJobSeekerProfile(){
- if($this->isjobseeker()==true){
- $wpjobportal_id = $this->currentuser->uid;
- $wpjobportal_string = "users.uid";
- if (self::trustedSocialId() !== '') { // social user is logged in
- $wpjobportal_id = $this->currentuser->id;
- $wpjobportal_string = "users.id";
- }
- if(is_numeric($wpjobportal_id)){
- $query = "SELECT users.id,users.uid,users.first_name,users.photo,users.emailaddress,users.last_name,users.socialmedia
- FROM " . wpjobportal::$_db->prefix . "wj_portal_users AS users
- WHERE users.id != 0 AND " . $wpjobportal_string . " = %d LIMIT 1 ";
- $query = wpjobportal::$_db->prepare($query, $wpjobportal_id);
- return wpjobportal::$_db->get_row($query);
- }else{
- return false;
- }
- }else{
- return false;
- }
- }
-
- function isisWPJobportalUser() {
- if (is_user_logged_in()) { // wp user logged in
- $wpuserid = get_current_user_id();
- if (!is_numeric($wpuserid))
- return false;
- if (!empty($this->currentuser)) {
- return true;
- } else {
- return false;
- }
- } else {
- if (self::trustedSocialId() !== '') { // social user is logged in
- $wpjobportal_socialid = self::trustedSocialId();
- $query = wpjobportal::$_db->prepare("SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE socialid = %s", $wpjobportal_socialid);
- $wpjobportal_result = wpjobportal::$_db->get_var($query);
- if ($wpjobportal_result > 0) {
- return true;
- } else {
- return false;
- }
- }
- }
- }
-
- function isdisabled() {
- if ($this->currentuser != null && $this->currentuser->status == 0) { // current user is disabled
- return true;
- } else {
- return false;
- }
- }
-
- function isemployer() {
- if ($this->currentuser == null) { // current user is guest
- return false;
- } else {
- if ($this->currentuser->roleid == 1) {
- return true;
- } else {
- return false;
- }
- }
- }
-
- function roleid($wpjobportal_uid=0){
- if(is_numeric($wpjobportal_uid) && $wpjobportal_uid != 0){
- $query = wpjobportal::$_db->prepare("SELECT roleid FROM ".wpjobportal::$_db->prefix."wj_portal_users WHERE id = %d", $wpjobportal_uid);
- return wpjobportaldb::get_var($query);
- }elseif($this->currentuser != null) {
- return $this->currentuser->roleid;
- }
- }
-
- function isjobseeker() {
- if ($this->currentuser == null) { // current user is guest
- return false;
- } else {
- if ($this->currentuser->roleid == 2) {
- return true;
- } else {
- return false;
- }
- }
- }
-
- function uid() {
- if ($this->currentuser != null) {
- return $this->currentuser->id;
- }
- }
-
- function getWPuid() {
- if ($this->currentuser != null) {
- return $this->currentuser->uid;
- }
- }
-
- function emailaddress() {
- if ($this->currentuser == null) { // current user is guest
- return false;
- } else {
- return $this->currentuser->emailaddress;
- }
- }
-
- function fullname($wpjobportal_uid='') {
- if($wpjobportal_uid==''){
- if ($this->currentuser == null) { // current user is guest
- return false;
- } else {
- $wpjobportal_name = $this->currentuser->first_name . ' ' . $this->currentuser->last_name;
- return $wpjobportal_name;
- }
- }else{
- if(is_numeric($wpjobportal_uid)){
- if(wpjobportal::$_common->wpjp_isadmin()){
- // Accounts without a first/last name showed blank in admin lists; fall back to the WP display name, login, then email.
- $query = wpjobportal::$_db->prepare("SELECT TRIM(CONCAT(IFNULL(user.first_name,''),' ',IFNULL(user.last_name,''))) AS name, wpuser.display_name, wpuser.user_login, user.emailaddress
- FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` AS user
- LEFT JOIN `" . wpjobportal::$_db->users . "` AS wpuser ON wpuser.ID = user.uid
- WHERE user.`ID` = %d", $wpjobportal_uid);
- $wpjobportal_row = wpjobportal::$_db->get_row($query);
- if (!$wpjobportal_row) {
- return '';
- }
- foreach (array('name', 'display_name', 'user_login', 'emailaddress') as $wpjobportal_key) {
- if (!empty($wpjobportal_row->$wpjobportal_key)) {
- return $wpjobportal_row->$wpjobportal_key;
- }
- }
- return '';
- }else{
- return '';
- }
- }else{
- return '';
- }
- }
- }
-
- function getAvailableCredits() {
- $wpjobportal_isadmin = (current_user_can('manage_options') ? WPJOBPORTALrequest::getVar('isadmin') : ''); // Security: admin-only flag, never trusted from a non-admin request.
- $wpjobportal_userid = WPJOBPORTALrequest::getVar('userid');
- if($wpjobportal_isadmin && is_numeric($wpjobportal_userid)){
- $wpjobportal_uid = $wpjobportal_userid;
- }else{
- $wpjobportal_uid = $this->uid();
- }
- $wpjobportal_credits = WPJOBPORTALIncluder::getJSModel('user')->getMyAvailableCredits($wpjobportal_uid);
- return $wpjobportal_credits;
- }
-
- function isWPJOBPortalUser() {
- if (is_user_logged_in()) { // wp user logged in
- $wpuserid = get_current_user_id();
- if (!is_numeric($wpuserid))
- return false;
- if (!empty($this->currentuser)) {
- return true;
- } else {
- return false;
- }
- } else {
- if (self::trustedSocialId() !== '') { // social user is logged in
- $wpjobportal_socialid = self::trustedSocialId();
- $query = wpjobportal::$_db->prepare("SELECT COUNT(id) FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE socialid = %s", $wpjobportal_socialid);
- $wpjobportal_result = wpjobportal::$_db->get_var($query);
- if ($wpjobportal_result > 0) {
- return true;
- } else {
- return false;
- }
- }
- }
- }
-
- function isSocialLogin() {
- if (self::trustedSocialId() !== '') {
- return true;
- } else {
- return false;
- }
- }
-
- function getwpjobportaluidbyuserid($wpjobportal_userid){
- if(!is_numeric($wpjobportal_userid)) return false;
- $query = wpjobportal::$_db->prepare("SELECT id FROM `".wpjobportal::$_db->prefix."wj_portal_users` WHERE uid = %d", $wpjobportal_userid);
- $wpjobportal_uid = wpjobportal::$_db->get_var($query);
- return $wpjobportal_uid;
- }
-
-}
-
-?>
+<?php
+
+if (!defined('ABSPATH'))
+ die('Restricted Access');
+
+class WPJOBPORTALuser {
+
+ private $currentuser = null;
+
+ private static $rows = array();
+
+ /*
+ * Security (2.9.2, Wordfence report on the wpjobportal-socialid cookie).
+ * Social Login is removed. Its users were identified by a plain
+ * `wpjobportal-socialid` cookie, which the browser chooses: a forged value
+ * made a visitor any portal account (2.7.2 and older; 2.8.0 stopped
+ * trusting it). The cookie branches and the helpers that went with them
+ * are gone. A portal user is always the signed-in WordPress user.
+ */
+
+ public static function forgetOnWrite($wpjobportal_query) {
+ if (!empty(self::$rows) && strpos($wpjobportal_query, 'wj_portal_users') !== false && preg_match('/^s*(UPDATE|INSERT|REPLACE|DELETE)b/i', $wpjobportal_query)) {
+ self::$rows = array();
+ }
+ return $wpjobportal_query;
+ }
+
+ function __construct() {
+ if (is_user_logged_in()) { // wp user logged in
+ $wpuserid = get_current_user_id();
+ if (!is_numeric($wpuserid))
+ return false;
+ // P-2: this class is built for almost every check on a page. Any write to the
+ // users table empties the remembered row, so a new role shows at once.
+ if (!array_key_exists($wpuserid, self::$rows)) {
+ if (!has_filter('query', array(__CLASS__, 'forgetOnWrite'))) {
+ add_filter('query', array(__CLASS__, 'forgetOnWrite'));
+ }
+ $query = wpjobportal::$_db->prepare("SELECT * FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` WHERE uid = %d", $wpuserid);
+ self::$rows[$wpuserid] = wpjobportal::$_db->get_row($query);
+ }
+ $this->currentuser = self::$rows[$wpuserid];
+ }
+ // A visitor (not signed in to WordPress) has no portal user.
+ }
+
+ function isguest() {
+ if ($this->currentuser == null && !is_user_logged_in()) { // current user is guest
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function getEmployerProfile(){
+ //if($this->isemployer()==true){
+ /*
+ * There may be no portal user behind the WordPress one.
+ *
+ * currentuser is the wj_portal_users row for whoever is signed in, and
+ * somebody can be signed in without having one - a Recruit Suite team
+ * member is added to a company, not registered through the portal. The
+ * isemployer() guard above used to catch that and was commented out,
+ * which left this reading ->uid off null and warning about it on every
+ * recruiter page load.
+ *
+ * The test is for the missing row rather than for the employer role,
+ * because a recruiter carries roleid 0: putting isemployer() back would
+ * stop the warning by taking the profile away from the very people who
+ * were seeing it. No row, no profile - which is what the tail of this
+ * function already answers.
+ */
+ if ($this->currentuser == null) {
+ return false;
+ }
+ $wpjobportal_id = $this->currentuser->uid;
+ $wpjobportal_string = "users.uid";
+ if(is_numeric($wpjobportal_id)){
+ $query = "SELECT users.id,users.uid,users.first_name,users.photo,users.emailaddress,users.last_name,users.socialmedia
+ FROM " . wpjobportal::$_db->prefix . "wj_portal_users AS users
+ WHERE users.id != 0 AND " . $wpjobportal_string . " = %d LIMIT 1 ";
+ $query = wpjobportal::$_db->prepare($query, $wpjobportal_id);
+ return wpjobportal::$_db->get_row($query);
+ }
+
+
+ //}else{
+ return false;
+ //}
+ }
+
+ function getJobSeekerProfile(){
+ if($this->isjobseeker()==true){
+ $wpjobportal_id = $this->currentuser->uid;
+ $wpjobportal_string = "users.uid";
+ if(is_numeric($wpjobportal_id)){
+ $query = "SELECT users.id,users.uid,users.first_name,users.photo,users.emailaddress,users.last_name,users.socialmedia
+ FROM " . wpjobportal::$_db->prefix . "wj_portal_users AS users
+ WHERE users.id != 0 AND " . $wpjobportal_string . " = %d LIMIT 1 ";
+ $query = wpjobportal::$_db->prepare($query, $wpjobportal_id);
+ return wpjobportal::$_db->get_row($query);
+ }else{
+ return false;
+ }
+ }else{
+ return false;
+ }
+ }
+
+ function isisWPJobportalUser() {
+ if (is_user_logged_in()) { // wp user logged in
+ $wpuserid = get_current_user_id();
+ if (!is_numeric($wpuserid))
+ return false;
+ if (!empty($this->currentuser)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return false; // a visitor is not a portal user
+ }
+
+ function isdisabled() {
+ if ($this->currentuser != null && $this->currentuser->status == 0) { // current user is disabled
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function isemployer() {
+ if ($this->currentuser == null) { // current user is guest
+ return false;
+ } else {
+ if ($this->currentuser->roleid == 1) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ function roleid($wpjobportal_uid=0){
+ if(is_numeric($wpjobportal_uid) && $wpjobportal_uid != 0){
+ $query = wpjobportal::$_db->prepare("SELECT roleid FROM ".wpjobportal::$_db->prefix."wj_portal_users WHERE id = %d", $wpjobportal_uid);
+ return wpjobportaldb::get_var($query);
+ }elseif($this->currentuser != null) {
+ return $this->currentuser->roleid;
+ }
+ }
+
+ function isjobseeker() {
+ if ($this->currentuser == null) { // current user is guest
+ return false;
+ } else {
+ if ($this->currentuser->roleid == 2) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ function uid() {
+ if ($this->currentuser != null) {
+ return $this->currentuser->id;
+ }
+ }
+
+ function getWPuid() {
+ if ($this->currentuser != null) {
+ return $this->currentuser->uid;
+ }
+ }
+
+ function emailaddress() {
+ if ($this->currentuser == null) { // current user is guest
+ return false;
+ } else {
+ return $this->currentuser->emailaddress;
+ }
+ }
+
+ function fullname($wpjobportal_uid='') {
+ if($wpjobportal_uid==''){
+ if ($this->currentuser == null) { // current user is guest
+ return false;
+ } else {
+ $wpjobportal_name = $this->currentuser->first_name . ' ' . $this->currentuser->last_name;
+ return $wpjobportal_name;
+ }
+ }else{
+ if(is_numeric($wpjobportal_uid)){
+ if(wpjobportal::$_common->wpjp_isadmin()){
+ // Accounts without a first/last name showed blank in admin lists; fall back to the WP display name, login, then email.
+ $query = wpjobportal::$_db->prepare("SELECT TRIM(CONCAT(IFNULL(user.first_name,''),' ',IFNULL(user.last_name,''))) AS name, wpuser.display_name, wpuser.user_login, user.emailaddress
+ FROM `" . wpjobportal::$_db->prefix . "wj_portal_users` AS user
+ LEFT JOIN `" . wpjobportal::$_db->users . "` AS wpuser ON wpuser.ID = user.uid
+ WHERE user.`ID` = %d", $wpjobportal_uid);
+ $wpjobportal_row = wpjobportal::$_db->get_row($query);
+ if (!$wpjobportal_row) {
+ return '';
+ }
+ foreach (array('name', 'display_name', 'user_login', 'emailaddress') as $wpjobportal_key) {
+ if (!empty($wpjobportal_row->$wpjobportal_key)) {
+ return $wpjobportal_row->$wpjobportal_key;
+ }
+ }
+ return '';
+ }else{
+ return '';
+ }
+ }else{
+ return '';
+ }
+ }
+ }
+
+ function getAvailableCredits() {
+ $wpjobportal_isadmin = (current_user_can('manage_options') ? WPJOBPORTALrequest::getVar('isadmin') : ''); // Security: admin-only flag, never trusted from a non-admin request.
+ $wpjobportal_userid = WPJOBPORTALrequest::getVar('userid');
+ if($wpjobportal_isadmin && is_numeric($wpjobportal_userid)){
+ $wpjobportal_uid = $wpjobportal_userid;
+ }else{
+ $wpjobportal_uid = $this->uid();
+ }
+ $wpjobportal_credits = WPJOBPORTALIncluder::getJSModel('user')->getMyAvailableCredits($wpjobportal_uid);
+ return $wpjobportal_credits;
+ }
+
+ function isWPJOBPortalUser() {
+ if (is_user_logged_in()) { // wp user logged in
+ $wpuserid = get_current_user_id();
+ if (!is_numeric($wpuserid))
+ return false;
+ if (!empty($this->currentuser)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return false; // a visitor is not a portal user
+ }
+
+ /** Social Login is removed (2.9.2); kept so older callers get the answer they would get now. */
+ function isSocialLogin() {
+ return false;
+ }
+
+ function getwpjobportaluidbyuserid($wpjobportal_userid){
+ if(!is_numeric($wpjobportal_userid)) return false;
+ $query = wpjobportal::$_db->prepare("SELECT id FROM `".wpjobportal::$_db->prefix."wj_portal_users` WHERE uid = %d", $wpjobportal_userid);
+ $wpjobportal_uid = wpjobportal::$_db->get_var($query);
+ return $wpjobportal_uid;
+ }
+
+}
+
+?>
--- a/wp-job-portal/includes/classes/usercredits.php
+++ b/wp-job-portal/includes/classes/usercredits.php
@@ -14,6 +14,14 @@
$wpjobportal_id = WPJOBPORTALRequest::getVar('id');
$wpjobportal_payment = WPJOBPORTALRequest::getVar('payment');
$wpjobportal_actionid = WPJOBPORTALRequest::getVar('actiona');
+ // Security (2.9.2): this popup action is open to everyone (wp_ajax_nopriv) and its
+ // only check was common.js_nonce, which every page prints, visitors included. The
+ // add-ons then took the owner from the record, so a visitor could feature (or reset
+ // the featuring of) any resume, job or company, and send its e-mail. Now only an
+ // administrator, or the signed-in owner of that record, may act on it.
+ if (!current_user_can('manage_options') && !$this->callerOwnsRecord($wpjobportal_actionname, $wpjobportal_id)) {
+ return false;
+ }
switch ($wpjobportal_actionname) {
case 'featured_company':
$wpjobportal_result = apply_filters('wpjobportal_addons_company_credit_featurecompany',$wpjobportal_id,$wpjobportal_actionid,false,$wpjobportal_payment);
@@ -31,6 +39,34 @@
return $wpjobportal_result;
}
+ /**
+ * Whether the signed-in portal user owns the record a popup action names.
+ * A visitor (portal uid 0) owns nothing, so records stored with uid 0 (a
+ * visitor's job, an import) are not theirs either.
+ *
+ * @param string $wpjobportal_actionname featured_company, featured_job, featured_resume or copy_job.
+ * @param mixed $wpjobportal_id Record id from the request.
+ * @return bool
+ */
+ private function callerOwnsRecord($wpjobportal_actionname, $wpjobportal_id) {
+ $wpjobportal_tables = array(
+ 'featured_company' => 'wj_portal_companies',
+ 'featured_job' => 'wj_portal_jobs',
+ 'copy_job' => 'wj_portal_jobs',
+ 'featured_resume' => 'wj_portal_resume',
+ );
+ $wpjobportal_uid = absint(WPJOBPORTALincluder::getObjectClass('user')->uid());
+ $wpjobportal_id = absint($wpjobportal_id);
+ if ($wpjobportal_uid < 1 || $wpjobportal_id < 1 || !isset($wpjobportal_tables[$wpjobportal_actionname])) {
+ return false;
+ }
+ $wpjobportal_owner = wpjobportal::$_db->get_var(wpjobportal::$_db->prepare(
+ 'SELECT uid FROM `' . wpjobportal::$_db->prefix . $wpjobportal_tables[$wpjobportal_actionname] . '` WHERE id = %d',
+ $wpjobportal_id
+ ));
+ return $wpjobportal_owner !== null && absint($wpjobportal_owner) === $wpjobportal_uid;
+ }
+
function getUserCreditsDetailForAction($wpjobportal_actionname) {
// Security: these values are printed into the popup's inline script.
$wpjobportal_actionname = preg_replace('/[^a-z0-9_]/', '', strtolower((string) $wpjobportal_actionname));
--- a/wp-job-portal/includes/classes/wpjobportaladminsidemenu.php
+++ b/wp-job-portal/includes/classes/wpjobportaladminsidemenu.php
@@ -15,6 +15,22 @@
$wpjobportal_counts['updates'] = WPJOBPORTAL_Admin_Menu_Service::update_count();
$wpjobportal_groups = WPJOBPORTAL_Admin_Menu_Service::groups();
+// Frame A: Website, Setup and System start folded; the admin's own choice is kept in
+// a cookie (read here, so the menu is drawn folded or open without a jump). The group
+// that holds the current page is always open.
+$wpjobportal_folded_cookie = WPJOBPORTALrequest::cookie('wpjobportaladmin_menu_folded');
+if ($wpjobportal_folded_cookie === null) {
+ $wpjobportal_folded = array('website', 'setup', 'system');
+} else {
+ $wpjobportal_folded = array_filter(array_map('sanitize_key', explode('.', (string) $wpjobportal_folded_cookie)));
+}
+$wpjobportal_current_group = '';
+foreach ($wpjobportal_sections as $wpjobportal_s) {
+ if ($wpjobportal_s['id'] === $wpjobportal_current['section'] && isset($wpjobportal_s['group'])) {
+ $wpjobportal_current_group = $wpjobportal_s['group'];
+ }
+}
+
wp_register_script('wpjobportal-menu-handle', '', array(), WPJOBPORTAL_VERSION, false);
wp_enqueue_script('wpjobportal-menu-handle');
@@ -31,17 +47,7 @@
?>
<?php
$wpjobportal_mode_label = class_exists('WPJOBPORTAL_Product_Mode_Service') ? WPJOBPORTAL_Product_Mode_Service::get_label() : '';
-$wpjobportal_create = array(
- array(__('New job', 'wp-job-portal'), 'wpjobportal_job&wpjobportallt=formjob', 'job'),
- array(__('New company', 'wp-job-portal'), 'wpjobportal_company&wpjobportallt=formcompany', 'co'),
-);
-if (in_array('departments', (array) wpjobportal::$_active_addons, true)) {
- $wpjobportal_create[] = array(__(