Ejemplo n.º 1
0
 public function run()
 {
     $msg = "";
     $to = 1;
     $user = new User();
     if (isset($_REQUEST['str'])) {
         $email = mysql_real_escape_string(base64_decode($_REQUEST['str']));
         $confirm_string = substr($_REQUEST['cs'], 0, 10);
         // verify the email belongs to a user
         if ($user->findUserByUsername($email) && substr($user->getConfirm_string(), 0, 10) == $confirm_string) {
             $sql = "\n                    UPDATE " . USERS . "\n                    SET\n                        confirm_string = '',\n                        confirm = 1,\n                        is_active = 1\n                    WHERE username = '******'";
             mysql_query($sql);
             // send welcome email
             Utils::sendTemplateEmail($user->getUsername(), 'welcome', array('nickname' => $user->getNickname()), 'Worklist <*****@*****.**>');
             User::login($user, false);
             //Optionally can login with confirm URL
             $jumbotron = "\n                    <h2>Welcome to Worklist!</h2>\n                    <p>\n                      Click on a job and add your bid, or come join us in our \n                      <a href='https://gitter.im/highfidelity/worklist' target='_blank'>public chat room</a>.\n                      Questions? Check out the <a href='./help'>help tab</a>.\n                    </p>";
         } else {
             Utils::redirect('./');
         }
     } elseif (isset($_REQUEST['ppstr'])) {
         // paypal address confirmation
         $paypal_email = mysql_real_escape_string(base64_decode($_REQUEST['ppstr']));
         $hash = mysql_real_escape_string($_REQUEST['pp']);
         // verify the email belongs to a user
         if (!$user->findUserByPPUsername($paypal_email, $hash)) {
             // hacking attempt, or some other error
             Utils::redirect('./');
         } else {
             $user->setPaypal_verified(true);
             $user->setPaypal_hash('');
             $user->save();
             $jumbotron = "\n                    <h2>Thank you for confirming your Paypal address.</h2>\n                    <p>You can now bid on items in the Worklist!</p>";
         }
     } elseif (isset($_REQUEST['emstr'])) {
         // new email address confirmation
         $new_email = mysql_real_escape_string(base64_decode($_REQUEST['emstr']));
         if (!$user->findUserByUsername($_SESSION['username'])) {
             Utils::redirect('login');
             //we are not logged in
         }
         //save new email
         $user->setUsername($new_email);
         $user->save();
         $_SESSION['username'] = $new_email;
         $jumbotron = "<h2>Thank you for confirming your changed email address.</h2>";
     }
     $jobs = new JobController();
     $jobs->view->jumbotron = $jumbotron;
     $jobs->listView();
 }
Ejemplo n.º 2
0
 protected function init()
 {
     parent::init();
     if (file_exists($this->_cursorFile)) {
         $this->_startId = intval(file_get_contents($this->_cursorFile));
     }
 }
Ejemplo n.º 3
0
 protected function init()
 {
     parent::init();
     $this->_brokerId = $this->getOption('broker', 0);
     $logSuffix = date('Ymd');
     $this->_comboSpreadHouseNotInSolr = sprintf('/data1/logs/Monitor_JpHouseSpreadState-comboSpreadHouseNotInSolr-%d.log', $logSuffix);
     $this->_houseInSolrNotSpread = sprintf('/data1/logs/Monitor_JpHouseSpreadState-houseInSolrNotSpread-%d.log', $logSuffix);
 }
Ejemplo n.º 4
0
 public function job($job)
 {
     $jobParts = explode('-', $job);
     $job = DB::select("EXEC spJobByID_Select @JobID = {$jobParts['0']}")[0];
     $latest = JobController::getLatestJobs();
     $latest = array_slice($latest, 0, 3);
     return View::make('job')->withJob($job)->withRecommended(self::getRecommendedJobs())->withLatest($latest);
 }
Ejemplo n.º 5
0
 public function homepage()
 {
     $output = array();
     $output['messages'] = Content::where('type', 'homepage')->get();
     $output['testimonial'] = Content::where('type', 'testimonial')->where('candidate_facing', 1)->get()->random(1);
     $output['latest'] = JobController::getLatestJobs();
     if (Session::has('candidate')) {
         $output['candidate'] = Session::get('candidate');
     }
     return View::make('homepage.main', $output);
 }
 protected function init()
 {
     parent::init();
     $this->_brokerId = intval($this->getOption('broker', 0));
     if ($this->_brokerId == 0) {
         echo 'Usage: launcher.php Repair_PersonalGalleryV2ByBrokerId --broker=... [--debug=[1|0]] [--release=...]';
         exit;
     }
     $this->_debug = (bool) $this->getOption('debug', true);
     $this->_pidFile = sprintf('/data1/logs/Repair_PersonalGalleryV2ByBrokerId-%d.id', $this->_brokerId);
 }
 /**
  * Candidate FrontPage Route
  **/
 public function candidatesFrontPage()
 {
     if (is_null(Session::get('candidate'))) {
         return Redirect::to('become-a-candidate')->with('info', 'Please login / register to view this page');
     }
     $output = array();
     $output['latest'] = JobController::getLatestJobs();
     $candidate = Candidate::find(Session::get('candidate')->id);
     $testimonial = Content::where('type', 'testimonial')->where('client_facing', 1)->get()->random(1);
     return View::make('candidate.profile', $output)->with(compact('candidate'))->with(compact('testimonial'));
 }
Ejemplo n.º 8
0
 protected function init()
 {
     parent::init();
     $options = $this->getOptions();
     if (isset($options['broker'])) {
         $this->_brokerId = intval($options['broker']);
     }
     if (isset($options['site'])) {
         if (in_array($options['site'], array('ajk', 'hz', 'jp'))) {
             $this->_siteType = $options['site'];
         }
     }
     $this->_noComboBrokerLogFile = sprintf('/data1/logs/Monitor_CheckBrokerHasCombo_NoComboBrokerLogFile-%d-%s.log', date('Ymd'), $this->_siteType);
 }
Ejemplo n.º 9
0
 protected function init()
 {
     parent::init();
     $city = $this->getOption('city', 11);
     if (!is_numeric($city)) {
         $this->logMsg('Usage: launcher.php House_UpDown_RepairSpreadOwner --city=[:number:] [--release=...] ');
         exit;
     }
     $this->_cityId = intval($city);
     $this->_doneFile = sprintf('/data1/logs/House_UpDown_RepairSpreadOwner-%d.done', $city);
     $this->_cursorFile = sprintf('/data1/logs/House_UpDown_RepairSpreadOwner-%d.cursor', $city);
     $this->_houseFile = sprintf('/data1/logs/House_UpDown_RepairSpreadOwner-%d.houseId', $city);
     $this->_startId = intval(file_get_contents($this->_cursorFile));
 }
Ejemplo n.º 10
0
 protected function init()
 {
     parent::init();
     $cityId = $this->getOption('city', 0);
     if (empty($cityId) || !is_numeric($cityId)) {
         $this->logMsg('Usage: launcher.php Combo_JpStopFixPlan --city=... [--release=...] ');
         exit;
     }
     $this->_cursorFile = sprintf('/data1/logs/Combo_JpStopFixPlan-%d.cursor', $cityId);
     $this->_doneFile = sprintf('/data1/logs/Combo_JpStopFixPlan-%d.done', $cityId);
     $this->_cityId = $cityId;
     if (file_exists($this->_cursorFile)) {
         $this->_startId = intval(file_get_contents($this->_cursorFile));
     }
 }
Ejemplo n.º 11
0
 protected function init()
 {
     parent::init();
     $this->tableSplitSuffix = date('m');
     if (!file_exists($this->cursorFile) || !is_readable($this->cursorFile)) {
         return;
     }
     $sCursorInfo = file_get_contents($this->cursorFile);
     if (empty($sCursorInfo)) {
         return;
     }
     $cursorInfo = explode('|', $sCursorInfo);
     if (count($cursorInfo) != 2) {
         return;
     }
     list($this->tableSplitSuffix, $this->queueId) = $cursorInfo;
 }
 protected function init()
 {
     parent::init();
     $cityId = intval($this->getOption('city', 0));
     $site = $this->getOption('site', 'ajk');
     if ($cityId == 0 || !in_array($site, array('ajk', 'hz', 'jp'))) {
         $this->logMsg('Usage: launcher.php Combo_MovePPCFixPlanRelation --city=... --site=[ajk | hz | jp] [--release=...] ');
         exit;
     }
     $this->_cityId = $cityId;
     $this->_dealSite = $site;
     $this->_doneFile = sprintf('/data1/logs/Combo_MovePPCFixPlanRelation-%s-%d.done', $site, $cityId);
     $this->_cursorFile = sprintf('/data1/logs/Combo_MovePPCFixPlanRelation-%s-%d.cursor', $site, $cityId);
     if (file_exists($this->_cursorFile)) {
         $this->_startId = intval(file_get_contents($this->_cursorFile));
     }
 }
 protected function init()
 {
     parent::init();
     $calculateDate = intval($this->getOption('date', 19700101));
     if ($calculateDate == 19700101) {
         $lastCalculateDate = Model_Config_huTablesUploadStatus::getTableLastCalculateDate('ajk_broker_choice_consume');
         if (empty($lastCalculateDate)) {
             $this->logMsg('没有获取到BI的统计上传日期');
             file_put_contents($this->_doneFile, 'YES');
             exit;
         }
         $calculateDate = intval(date('Ymd', strtotime($lastCalculateDate['calDt'])));
     }
     $this->_calculateDate = $calculateDate;
     if (file_exists($this->_cursorFile)) {
         $this->_startId = intval(file_get_contents($this->_cursorFile));
     }
 }
Ejemplo n.º 14
0
 protected function init()
 {
     parent::init();
     if (!file_exists($this->_cursorFile)) {
         if (false === file_put_contents($this->_cursorFile, 0)) {
             $this->logMsg(sprintf('写入游标失败。请检查目录的权限。游标文件:%s', $this->_cursorFile));
             exit;
         }
         return;
     }
     if (!is_readable($this->_cursorFile)) {
         $this->logMsg(sprintf('游标文件:%s 不可读,请检查文件权限。', $this->_cursorFile));
         exit;
     }
     if (!is_writable($this->_cursorFile)) {
         $this->logMsg(sprintf('游标文件:%s 不可写,请检查文件权限。', $this->_cursorFile));
         exit;
     }
     $this->_startId = intval(file_get_contents($this->_cursorFile));
 }
Ejemplo n.º 15
0
/**
 * phpjobseeker
 *
 * Copyright (C) 2009, 2015 Kevin Benton - kbenton at bentonfam dot org
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once 'Libs/autoload.php';
$config = new Config();
$page = new PJSWebPage($config->getTitle() . " - Jobs");
$body = "<h2>Jobs</h2>\n";
$controller = new JobController('read');
$modelList = $controller->getAll();
$modelListView = new JobListView('html', $modelList);
$body .= $modelListView->getView();
$page->setBody($body);
$page->displayPage();
 public static function view(array $restOfRoute)
 {
     JobController::requireLogin();
     $applicationId = self::getIdFromRoute($restOfRoute);
     if (is_null($applicationId)) {
         return;
     }
     $application = ApplicationStudent::getById($applicationId);
     if (is_null($application)) {
         self::error("nonexistent application");
         self::render('notice');
         return;
     }
     // Only the student who submitted the application and the recruiter
     // associated with the job can view the application.
     $myId = $_SESSION['_id'];
     $jobId = $application->getJobId();
     $studentId = $application->getStudentId();
     $recruiterId = JobModel::getRecruiterId($jobId);
     $isRecruiter = $recruiterId == $myId;
     $isStudent = $studentId == $myId;
     if (!$isStudent && !$isRecruiter) {
         self::error("permission denied");
         self::render('notice');
         return;
     }
     // Retrieve data for student.
     $student = StudentModel::getById($studentId, ['name' => 1]);
     $studentName = $student['name'];
     // Retrieve data on the job.
     $job = JobModel::getById($jobId);
     $title = $job['title'];
     $companyId = $job['company'];
     $company = CompanyModel::getById($companyId);
     // Set data from application.
     $profile = $application->getProfile();
     $questions = $application->getQuestions();
     // Add 'text' to questions to show.
     $responses = [];
     foreach ($questions as $question) {
         $_id = $question['_id'];
         $responses[] = ['_id' => $_id, 'text' => Question::getTextById($_id), 'answer' => $question['answer']];
     }
     self::render('jobs/applications/view', ['responses' => toJSON($responses), 'studentname' => $studentName, 'jobtitle' => $title, 'companytitle' => $company['name'], 'isStudent' => $isStudent, 'isRecruiter' => $isRecruiter, 'studentId' => $studentId, 'recruiterId' => $recruiterId]);
     self::render('jobs/student/studentprofile', ['profile' => toJSON($profile)]);
     self::render('jobs/applications/report', ['applicationId' => $applicationId, 'isStudent' => $isStudent, 'isRecruiter' => $isRecruiter]);
 }
Ejemplo n.º 17
0
define("MINIMUM_CRON_GRANULARITY", 60);
define("DEFAULT_CONFIG_DIR", "conf/");
define("DEFAULT_CONFIG_FILE", "default.conf");
define("DEFAULT_PRINT_FORMAT", "text/plaintext");
require_once 'config.php';
// require __DIR__ . '/vendor/autoload.php';
require_once '/home/bshensky/vendor/autoload.php';
require_once 'includes/SpawnTranscoder.php';
require_once 'includes/JobFlusher.php';
require_once 'includes/JobController.php';
$q = isset($_REQUEST['q']) && !empty($_REQUEST['q']) ? $_REQUEST['q'] : 'spawn';
// the following seems to work with the mod_action handler for existing m3u8 files.  If the .htaccess file is rearchitected, this will need servicing too.
if (isset($_SERVER['PATH_TRANSLATED']) && !empty($_SERVER['PATH_TRANSLATED']) && file_exists($_SERVER['PATH_TRANSLATED'])) {
    $q = 'ping';
}
$j = new JobController($config['memcached']);
switch ($q) {
    case 'expire':
    case 'retire':
        // retire expire encoders - best to cron this as often as you are comfortable
        $threshold = isset($_REQUEST['threshold']) && !empty($_REQUEST['threshold']) ? $_REQUEST['threshold'] : MINIMUM_CRON_GRANULARITY;
        $jobs_killed = $j->expire_old_jobs_per_threshold($threshold);
        if (!empty($jobs_killed)) {
            echo "killed: " . implode(',', $jobs_killed);
        }
        break;
    case 'clean':
    case 'clear':
        // put down all encoders - start from ground zero
        $j->flush_all_jobs();
        break;
Ejemplo n.º 18
0
 public function login($redir = './')
 {
     $tokenURL = GITHUB_TOKEN_URL;
     $apiURLBase = GITHUB_API_URL;
     // When Github redirects the user back here, there will be a "code" and "state" parameter in the query string
     if (isset($_GET['code']) && $_GET['code']) {
         // Verify the state matches our stored state
         if (isset($_GET['state']) && $_SESSION['github_auth_state'] == $_GET['state']) {
             // Exchange the auth code for a token
             $response = $this->apiRequest($tokenURL, array('client_id' => GITHUB_OAUTH2_CLIENT_ID, 'client_secret' => GITHUB_OAUTH2_CLIENT_SECRET, 'redirect_uri' => WORKLIST_URL . 'github/login/' . $redir, 'state' => $_SESSION['github_auth_state'], 'code' => $_GET['code']));
             if (isset($response->access_token) && $response->access_token) {
                 $this->access_token = $access_token = $response->access_token;
                 $gh_user = $this->apiRequest($apiURLBase . 'user');
                 if (!$gh_user) {
                     // maybe a wrong access token
                     Utils::redirect('./');
                 }
                 $userId = Session::uid();
                 $user = new User($userId);
                 $testUser = new User();
                 if ($user->getId()) {
                     // user is already logged in in worklist, let's just check if credentials are
                     // already stored and save them in case they're not
                     if (!$testUser->findUserByAuthToken($access_token)) {
                         // credentials not stored in db and not used by any other user
                         $user->storeCredentials($access_token);
                     } else {
                         // credentials found, let's just sync account with GH data
                         $this->sync($user, $gh_user);
                     }
                     Utils::redirect($redir);
                 } else {
                     // user not logged in in worklist, let's check whether he already has a
                     // github-linked account in worklist
                     if ($user->findUserByAuthToken($access_token)) {
                         // already linked account, let's log him in
                         if ($user->isActive()) {
                             $this->sync($user, $gh_user);
                             User::login($user, $redir);
                         } else {
                             // users that didn't confirmed their email addresses
                             $jobs = new JobController();
                             $jobs->view->jumbotron = "<h2>E-mail confirmation required!</h2>\n                                    <p>\n                                      Please check your inbox and follow your e-mail confirmation message\n                                      from Worklist. Then try to login again.\n                                    </p>\n                                    ";
                             $jobs->listView();
                             return;
                         }
                         return;
                     } else {
                         // unknown token, taking to the signup page
                         $this->view = new AuthView();
                         $this->write('access_token', $access_token);
                         $this->write('default_username', isset($gh_user->email) ? $gh_user->email : '');
                         $this->write('default_location', isset($gh_user->location) ? $gh_user->location : '');
                         $this->view->redir_url = $redir;
                         parent::run();
                         return;
                     }
                 }
                 return;
             } else {
                 // probably a refresh on the Auth view, which generated an error
                 // because of the expired verification code, let's save an error just in case
                 error_log(print_r($response, true));
             }
         }
     }
     // let's generate the session state value an try to authorize
     self::generateStateAndLogin($redir);
 }
Ejemplo n.º 19
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$config = new Config();
$webPage = new PJSWebPage($config->getTitle() . ' - Delete Job');
$act = Tools::Param('act');
if ("Delete Job" === $act) {
    $jobModel = new JobModel();
    $jobModel->populateFromForm();
    if (!$jobModel->validateForDelete()) {
        $jobView = new JobFormView('Delete Job', $jobModel);
        $body = "<h2>Invalid data</h2>\n" . $jobView->getForm();
    } else {
        $jobController = new JobController();
        $jobController->delete($jobModel);
        $body = "Deleted job # " . $jobModel->getId() . "<br />\n";
    }
} else {
    $jobController = new JobController();
    $jobModel = $jobController->get(Tools::param('id'));
    $jobView = new JobFormView('Delete Job', $jobModel);
    $body = $jobView->getForm();
}
$webPage->setBody($body);
$webPage->displayPage();
Ejemplo n.º 20
0
 *
 * You should have received a copy of the GNU General Public License along
 * with this program; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
require_once "Libs/autoload.php";
$config = new Config();
$webPage = new PJSWebPage($config->getTitle() . "Jobs - Add Job");
$body = '';
$act = Tools::Param('act');
if ("Add Job" === $act) {
    $model = new JobModel();
    $model->populateFromForm();
    if (!$model->validateForAdd()) {
        $view = new JobFormView('Add Job', $model);
        $body = "<h2>Invalid data</h2>\n" . $view->getForm();
    } else {
        $jobController = new JobController();
        $newId = $jobController->add($model);
        if ($newId > 0) {
            $body = "Added job # " . $newId . "<br />\n";
        }
    }
} else {
    $body = "";
    $view = new JobFormView("Add Job", null);
    $body = $view->getForm();
}
$webPage->setBody($body);
$webPage->displayPage();
 public function __construct()
 {
     $this->logFile = sprintf('/data1/logs/Plan_HzInitChoicePlanBasicNewField-%d.log', date('Ymd'));
     parent::__construct();
 }
Ejemplo n.º 22
0
    echo ApplicationControllerAJAX::deleteCustom();
});
Router::register('employers/searchcustom', function () {
    echo ApplicationControllerAJAX::searchCustom();
});
Router::register('employers/editapplication', function (array $restOfRoute) {
    Controller::displayMetatags('/employers');
    ApplicationController::edit($restOfRoute);
});
Router::register('employers/editcompany', function () {
    Controller::displayMetatags('/employers');
    GLOBALvarGet('CCompany')->edit();
});
Router::register('employers/deletejob', function (array $restOfRoute) {
    Controller::displayMetatags('/employers');
    JobController::delete($restOfRoute);
});
Router::register('employers/editjob', function () {
    Controller::displayMetatags('/employers');
    GLOBALvarGet('CJob')->edit();
});
Router::register('employers/editprofile', function () {
    Controller::displayMetatags('/employers');
    GLOBALvarGet('CRecruiter')->edit();
});
Router::register('employers/forgotpass', function () {
    Controller::displayMetatags('/employers');
    GLOBALvarGet('CRecruiter')->forgotPass();
});
Router::register('employers/home', function () {
    Controller::displayMetatags('/employers');