Exemplo n.º 1
0
 function emailFriend()
 {
     JRequest::checkToken() or jexit('Invalid Token');
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'jobboard_member.php';
     $app = JFactory::getApplication();
     if (JobBoardHelper::verifyHumans()) {
         if (!JobBoardMemberHelper::matchHumanCode(JRequest::getString('human_ver', ''))) {
             $post = JArrayHelper::toObject(JRequest::get('post'));
             $post->errors = 1;
             if (isset($post->human_ver)) {
                 unset($post->human_ver);
             }
             $app->setUserState('com_jobboard.sfields', $post);
             $app->redirect(JRoute::_('index.php?option=com_jobboard&view=share&errors=1&job_id=' . $post->job_id . '&Itemid=' . JRequest::getInt('Itemid')), JText::_('COM_JOBBOARD_FORM_CAPTCHA_FAILMSG'), 'error');
             return;
         }
     }
     $message = new JObject();
     $message->job_id = JRequest::getVar('job_id', '', '', 'int');
     $catid = JRequest::getVar('catid', '', '', 'int');
     $message->job_title = JRequest::getVar('job_title', '', '', 'string');
     $message->job_city = JRequest::getVar('job_city', '', '', 'string');
     $message->personal_message = JRequest::getVar('personal_message', '', '', 'string');
     $uri =& JURI::getInstance();
     $message->link = $uri->getScheme() . '://' . $uri->getHost() . JRequest::getVar('job_path', '', '', 'string');
     $fields_valid = $this->validateFields();
     $message->sender_email = $fields_valid->sender_email;
     $message->sender_name = $fields_valid->sender_name;
     $message->rec_emails = $fields_valid->rec_emails;
     if ($fields_valid->errors === true) {
         $errmsg = $fields_valid->errmsg . '</ul>';
         $app->setUserState('sfields', $message);
         $link = JRoute::_('index.php?option=com_jobboard&view=share&errors=1&job_id=' . $message->job_id . '&Itemid=' . $itemid);
         $this->setRedirect($link, $errmsg, '');
         return;
     } else {
         if (stristr($message->rec_emails, ',') === TRUE) {
             $rec_emailarray = explode(',', $message->rec_emails);
             foreach ($rec_emailarray as $email_recipient) {
                 $this->sendEmail($message, trim($email_recipient));
             }
         } else {
             $this->sendEmail($message, trim($message->rec_emails));
         }
         $mesgModel =& $this->getModel('Message');
         $saved = $mesgModel->saveMessage($message);
         if ($saved) {
             $msg = '&nbsp;' . JText::_('SEND_MSG_SUCCESS');
             $link = JRoute::_('index.php?option=com_jobboard&view=job&id=' . $message->job_id, false);
             $this->setRedirect($link, $msg, '');
             return;
         } else {
             $msg = '&nbsp;' . JText::_('ERR_WAIT');
             $link = JRoute::_('index.php?option=com_jobboard&view=job&id=' . $message->job_id, false);
             $this->setRedirect($link, $msg, '');
             return;
         }
     }
     parent::display();
 }
Exemplo n.º 2
0
 private function _syncJobboardUser($user)
 {
     $app =& JFactory::getApplication();
     $isEnabled = $this->params->get('user_status', 0);
     $api_keys = $this->_getApiKeys();
     if (self::_saveJobboardUser($user, $api_keys, $isEnabled)) {
         require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jobboard' . DS . 'helpers' . DS . 'jobboard_member.php';
         if ($user['is_empl'] == 1) {
             $default_grp = JobBoardMemberHelper::getUserGroup(true);
             $can_feature = JobBoardMemberHelper::canFeature();
             if (JobBoardMemberHelper::setGroupId($user['id'], $default_grp) && JobBoardMemberHelper::setUserDash($user['id'], 1) && JobBoardMemberHelper::setFeaturePerm($user['id'], $can_feature)) {
                 $message = JText::_('PLG_JOBBOARD_USER_REG_SUCCESS');
                 $mg_type = 'Message';
             } else {
                 $message = JText::_('PLG_JOBBOARD_USER_REG_EMP_FAIL');
                 $mg_type = 'error';
             }
         } else {
             $default_grp = JobBoardMemberHelper::getUserGroup();
             if (JobBoardMemberHelper::setGroupId($user['id'], $default_grp)) {
                 $message = JText::_('PLG_JOBBOARD_USER_REG_SUCCESS');
                 $mg_type = 'Message';
             } else {
                 $message = JText::_('PLG_JOBBOARD_USER_REG_EMP_FAIL');
                 $mg_type = 'error';
             }
         }
         $admins = array();
         JPluginHelper::importPlugin('Jobboard');
         $dispatcher =& JDispatcher::getInstance();
         $dispatcher->trigger('onJobboardRegister', array(array('user' => $user, 'admins' => $admins)));
     } else {
         $message = JText::_('PLG_JOBBOARD_USER_REG_EMP_FAIL');
         $mg_type = 'error';
     }
     $itemid = JRequest::getInt('Itemid', 0);
     $itemid_seg = $itemid > 0 ? '&Itemid=' . $itemid : '';
     $app->enqueueMessage($message, $mg_type);
     if (isset($user['goto_board'])) {
         $app->redirect(JRoute::_('index.php?option=com_jobboard' . $itemid_seg));
     }
 }
Exemplo n.º 3
0
 /**
  * Save user registration and notify users and admins if required
  * @return void
  */
 function registerUser()
 {
     JRequest::checkToken() or jexit(JText::_('Invalid Token'));
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'jobboard_member.php';
     $app =& JFactory::getApplication();
     if (JobBoardMemberHelper::verifyReg()) {
         if (!JobBoardMemberHelper::matchHumanCode(JRequest::getString('human_ver', ''))) {
             $app->redirect(JRoute::_('index.php?option=com_jobboard&view=member&iview=register'), JText::_('COM_JOBBOARD_FORM_CAPTCHA_FAILMSG'), 'error');
             return;
         }
     }
     // Get required system objects
     $user = clone JFactory::getUser();
     $pathway =& $app->getPathway();
     $config =& JFactory::getConfig();
     $authorize =& JFactory::getACL();
     $document =& JFactory::getDocument();
     // If user registration is not allowed, show 403 not authorized.
     $usersConfig =& JComponentHelper::getParams('com_users');
     if ($usersConfig->get('allowUserRegistration') == '0') {
         JError::raiseError(403, JText::_('Access Forbidden'));
         return;
     }
     // Initialize new usertype setting
     $newUsertype = $usersConfig->get('new_usertype');
     if (!version_compare(JVERSION, '1.6.0', 'ge')) {
         $newUsertype = !$newUsertype ? 2 : $newUsertype;
     } else {
         $newUsertype = !$newUsertype ? 'Registered' : $newUsertype;
     }
     $post = JRequest::get('post');
     if (!$user->bind($post, 'usertype')) {
         JError::raiseError(500, $user->getError());
     }
     // Set some initial user values
     $user->set('id', 0);
     $user->set('usertype', $newUsertype);
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $user->groups[] = $newUsertype;
     } else {
         $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO'));
     }
     $date =& JFactory::getDate();
     $user->set('registerDate', $date->toMySQL());
     $useractivation = $usersConfig->get('useractivation');
     $user->must_activate = intval($useractivation);
     if ($useractivation == '1') {
         jimport('joomla.user.helper');
         $user->set('activation', JUtility::getHash(JUserHelper::genRandomPassword()));
         $user->set('block', '1');
     }
     $user->is_empl = JRequest::getString('isemployer', '') == 'yes' ? 1 : 0;
     $user->goto_board = true;
     if (!$user->save()) {
         JError::raiseWarning('', JText::_($user->getError()));
         JRequest::setVar('iview', 'register');
         $app->enqueueMessage(JText::_('COM_JOBBOARD_REG_FAIL'), 'error');
         $this->display();
         return false;
     }
 }
Exemplo n.º 4
0
----------------------------------------------------------------------- */
defined('_JEXEC') or die('Restricted access');
$itemid = JRequest::getInt('Itemid');
$document =& JFactory::getDocument();
$document->setTitle(JText::_('COM_JOBBOARD_LOGIN_REG'));
JHTML::_('stylesheet', 'member.css', 'components/com_jobboard/css/');
JHTML::_('behavior.mootools');
JHTML::_('script', 'member.js', 'components/com_jobboard/js/');
$verify_login = JobBoardHelper::verifyLogin();
?>

<?php 
if (JobBoardHelper::allowRegistration()) {
    ?>
  <?php 
    $verify_reg = JobBoardMemberHelper::verifyReg();
    ?>
  <div id="regpanel" class="signup-call-out<?php 
    if ($this->iview == 'login') {
        echo ' hidden';
    }
    ?>
">
    <div class="profile-signup">
      <h1><?php 
    echo JText::_('COM_JOBBOARD_REG');
    ?>
</h1>
      <form id="jjbReg" name="jjbReg" action="<?php 
    echo JRoute::_('index.php?option=com_jobboard&view=member', true, JobBoardHelper::useSecure());
    ?>
Exemplo n.º 5
0
 function saveUnsolicitedCV()
 {
     JRequest::checkToken() or jexit('Invalid Token');
     require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'jobboard_member.php';
     $app = JFactory::getApplication();
     $itemid = JRequest::getInt('Itemid');
     if (JobBoardHelper::verifyHumans()) {
         if (!JobBoardMemberHelper::matchHumanCode(JRequest::getString('human_ver', ''))) {
             $post = JArrayHelper::toObject(JRequest::get('post'));
             $post->errors = 1;
             $post->cover_note = $post->cover_text;
             unset($post->cover_text);
             if (isset($post->human_ver)) {
                 unset($post->human_ver);
             }
             $app->setUserState('com_jobboard.fields', $post);
             $app->redirect(JRoute::_('index.php?option=com_jobboard&view=unsolicited&errors=1&Itemid=' . $itemid), JText::_('COM_JOBBOARD_FORM_CAPTCHA_FAILMSG'), 'error');
             return;
         }
     }
     $app->setUserState('com_jobboard.fields', null);
     $msg = JText::_('CV_SUBMIT_ERR') . '<ul>';
     $fields = $this->validateFields();
     $upload_result = $this->clearForUpload($fields);
     if ($upload_result->errors) {
         $app->setUserState('com_jobboard.fields', $fields->fields);
         $msg .= $upload_result->msg . '</ul>';
         $link = JRoute::_('index.php?option=com_jobboard&view=unsolicited&errors=1&Itemid=' . $itemid, false);
         $this->setRedirect($link, $msg, 'error');
         return;
     }
     //no errors
     $record_application =& $this->getModel('Upload');
     $saved = $record_application->saveUnsolicited($upload_result->hash_filename, $fields);
     if ($saved) {
         $msg = '&nbsp;&nbsp;' . JText::_('CV_SUBMITTED');
         $link = JRoute::_('index.php?option=com_jobboard&view=list&Itemid=' . $itemid);
         $config = JTable::getInstance('config', 'Table');
         $config->load(1);
         $this->sendEmailToUser('unsolicitednew', $fields->fields, 0, $config);
         if ($config->email_cvattach == 1) {
             //-> begin: Bade Adesemowo
             $cvattachment = JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_jobboard' . DS . 'cv' . DS . $upload_result->hash_filename[1] . "_" . $upload_result->hash_filename[0];
             $this->sendEmailUnsolicited('adminnew_unsolicited', $fields->fields, $config, $cvattachment);
             //-> end: Bade Adesemowo
         } else {
             $this->sendEmailUnsolicited('adminnew_unsolicited', $fields->fields, $config);
         }
         $this->setRedirect($link, $msg, 'notice');
         return;
     } else {
         //not saved
         $msg .= '<li>' . JText::_('INTERNAL_ERROR') . '</li></ul>';
         $link = JRoute::_('index.php?option=com_jobboard&view=unsolicited&errors=1&Itemid=' . $itemid, false);
         $this->setRedirect($link, $msg, 'error');
         return;
     }
 }