public function __construct() { $this->start_time = microtime(1) * 1000; parent::__construct(false); parent::makeTemplate("index.html"); $filterArgs = array('jid' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH), 'start' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'page' => array('filter' => FILTER_SANITIZE_NUMBER_INT)); $getInput = (object) filter_input_array(INPUT_GET, $filterArgs); $this->jid = $getInput->jid; $this->password = $getInput->password; $this->start_from = $getInput->start; $this->page = $getInput->page; $this->job = Chunks_ChunkDao::getByIdAndPassword($this->jid, $this->password); if (isset($_GET['step'])) { $this->step = $_GET['step']; } else { $this->step = 1000; } if (is_null($this->page)) { $this->page = 1; } if (is_null($this->start_from)) { $this->start_from = ($this->page - 1) * $this->step; } if (isset($_GET['filter'])) { $this->filter_enabled = true; } else { $this->filter_enabled = false; } $this->downloadFileName = ""; $this->doAuth(); $this->generateAuthURL(); }
public function __construct() { //SESSION ENABLED parent::sessionStart(); parent::__construct(); parent::makeTemplate("oauth_response_handler.html"); $this->user_logged = true; $this->client = OauthClient::getInstance()->getClient(); $plus = new Google_Service_Oauth2($this->client); $filterArgs = array('code' => array('filter' => FILTER_SANITIZE_STRING), 'error' => array('filter' => FILTER_SANITIZE_STRING)); $__postInput = filter_input_array(INPUT_GET, $filterArgs); $code = $__postInput['code']; $error = $__postInput['error']; if (isset($code) && $code) { $this->client->authenticate($code); $_SESSION['access_token'] = $this->client->getAccessToken(); $user = $plus->userinfo->get(); //get response from third-party $this->userData['email'] = $user['email']; $this->userData['first_name'] = $user['givenName']; $this->userData['last_name'] = $user['familyName']; } else { if (isset($error)) { $this->user_logged = false; } } //get url to redirect to //add default if not set if (!isset($_SESSION['incomingUrl']) or empty($_SESSION['incomingUrl'])) { $_SESSION['incomingUrl'] = '/'; } $this->redirectUrl = $_SESSION['incomingUrl']; //remove no more used var unset($_SESSION['incomingUrl']); }
public function __construct() { parent::__construct(false); parent::makeTemplate("upload.html"); $this->guid = Utils::create_guid(); $this->lang_handler = Langs_Languages::getInstance(); $this->subject_handler = Langs_LanguageDomains::getInstance(); $this->subjectArray = $this->subject_handler->getEnabledDomains(); }
public function __construct() { parent::__construct(); parent::makeTemplate("editlog.html"); $filterArgs = array('jid' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH)); $__postInput = filter_input_array(INPUT_GET, $filterArgs); $this->jid = $__postInput["jid"]; $this->password = $__postInput["password"]; $this->thisUrl = $_SERVER['REQUEST_URI']; }
public function __construct() { parent::__construct(false); parent::makeTemplate("upload.html"); $filterArgs = array('project_name' => array('filter' => FILTER_SANITIZE_STRING), 'private_tm_key' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH)); $__postInput = filter_input_array(INPUT_GET, $filterArgs); $this->project_name = $__postInput["project_name"]; $this->private_tm_key = $__postInput["private_tm_key"]; $this->guid = Utils::create_guid(); $this->lang_handler = Langs_Languages::getInstance(); $this->subject_handler = Langs_LanguageDomains::getInstance(); $this->subjectArray = $this->subject_handler->getEnabledDomains(); }
public function __construct() { parent::__construct(true); parent::makeTemplate("manage.html"); $filterArgs = array('page' => array('filter' => array(FILTER_SANITIZE_NUMBER_INT)), 'filter' => array('filter' => array(FILTER_VALIDATE_BOOLEAN), 'options' => array(FILTER_NULL_ON_FAILURE))); $postInput = filter_input_array(INPUT_GET, $filterArgs); $this->page = $postInput['page']; if ($this->page == null || empty($this->page)) { $this->page = 1; } $this->lang_handler = Langs_Languages::getInstance(); if ($postInput['filter'] !== null && $postInput['filter']) { $this->filter_enabled = true; } else { $this->filter_enabled = false; } }
public function __construct() { //SESSION ENABLED parent::sessionStart(); parent::__construct(); parent::makeTemplate("login.html"); $filterArgs = array('incomingUrl' => array('filter' => FILTER_SANITIZE_URL)); $__postInput = filter_input_array(INPUT_GET, $filterArgs); $this->incomingUrl = $__postInput['incomingUrl']; //if nothing is specified by user if (empty($this->incomingUrl)) { //open session to pull put information about incoming url $this->incomingUrl = $_SESSION['incomingUrl']; } else { //else, update session $_SESSION['incomingUrl'] = $this->incomingUrl; } }
public function __construct() { parent::sessionStart(); parent::__construct(false); $filterArgs = array('pid' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'jid' => array('filter' => FILTER_SANITIZE_NUMBER_INT), 'password' => array('filter' => FILTER_SANITIZE_STRING, 'flags' => FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH)); $postInput = filter_input_array(INPUT_GET, $filterArgs); $this->pid = $postInput['pid']; $this->jid = $postInput['jid']; $pass = $postInput['password']; if (!empty($this->jid)) { parent::makeTemplate("jobAnalysis.html"); $this->jpassword = $pass; $this->ppassword = null; } else { parent::makeTemplate("analyze.html"); $this->jid = null; $this->jpassword = null; $this->ppassword = $pass; } }
/** * When Called it perform the controller action to retrieve/manipulate data * * @return mixed */ function doAction() { Utils::sendErrMailReport($this->error_mail_content); //echo $this->error_mail_content;exit; parent::makeTemplate("badConfiguration.html"); }
/** * Set the template vars to the redirect Page * * @return mixed|void */ public function setTemplateVars() { $shop_cart = Shop_Cart::getInstance('outsource_to_external'); if (!$shop_cart->countItems()) { /** * redirectFailurePage is a white page with an error for session expired * */ parent::makeTemplate("redirectFailurePage.html"); return null; } else { /** * redirectSuccessPage is a white page with a form submitted by javascript * */ parent::makeTemplate("redirectSuccessPage.html"); } //we need a list not an hashmap $item_list = array(); foreach (array($shop_cart->getItem($this->data_key_content)) as $item) { $item_list[] = $item; } $this->template->tokenAuth = $this->tokenAuth; $this->template->data = json_encode($item_list); $this->template->redirect_url = $this->review_order_page; $this->template->data_key = $this->data_key_content; //clear the cart after redirection //$shop_cart->emptyCart(); }
public function setTemplateVars() { if ($this->job_not_found) { parent::makeTemplate('job_not_found.html'); return; } if ($this->job_cancelled) { parent::makeTemplate('job_cancelled.html'); } if ($this->job_archived) { parent::makeTemplate('job_archived.html'); } $this->template->jid = $this->jid; $this->template->password = $this->password; if ($this->job_cancelled || $this->job_archived) { $this->template->pid = null; $this->template->target = null; $this->template->source_code = null; $this->template->target_code = null; $this->template->firstSegmentOfFiles = 0; $this->template->fileCounter = 0; $this->template->owner_email = $this->job_owner; $this->template->jobOwnerIsMe = $this->logged_user->email == $this->job_owner; $this->template->job_not_found = $this->job_not_found; $this->template->job_archived = $this->job_archived ? INIT::JOB_ARCHIVABILITY_THRESHOLD : ''; $this->template->job_cancelled = $this->job_cancelled; $this->template->logged_user = $this->logged_user !== false ? $this->logged_user->shortName() : ""; $this->template->extended_user = $this->logged_user !== false ? trim($this->logged_user->fullName()) : ""; $this->template->incomingUrl = '/login?incomingUrl=' . $this->thisUrl; return; } else { $this->template->pid = $this->pid; $this->template->target = $this->target; $this->template->source_code = $this->source_code; $this->template->target_code = $this->target_code; $this->template->firstSegmentOfFiles = $this->firstSegmentOfFiles; $this->template->fileCounter = $this->fileCounter; } $this->template->owner_email = $this->job_owner; $this->template->jobOwnerIsMe = $this->logged_user->email == $this->job_owner; $this->template->job_not_found = $this->job_not_found; $this->template->job_archived = $this->job_archived ? INIT::JOB_ARCHIVABILITY_THRESHOLD : ''; $this->template->job_cancelled = $this->job_cancelled; $this->template->logged_user = $this->logged_user !== false ? $this->logged_user->shortName() : ""; $this->template->extended_user = $this->logged_user !== false ? trim($this->logged_user->fullName()) : ""; $this->template->incomingUrl = '/login?incomingUrl=' . $this->thisUrl; $this->template->page = 'cattool'; $this->template->cid = $this->cid; $this->template->create_date = $this->create_date; $this->template->pname = $this->pname; $this->template->tid = var_export($this->tid, true); $this->template->source = $this->source; $this->template->source_rtl = $this->source_rtl; $this->template->target_rtl = $this->target_rtl; $this->template->authURL = $this->authURL; $this->template->mt_engines = $this->translation_engines; $this->template->mt_id = $this->project_status['id_mt_engine']; $this->template->first_job_segment = $this->first_job_segment; $this->template->last_job_segment = $this->last_job_segment; $this->template->last_opened_segment = $this->last_opened_segment; $this->template->owner_email = $this->job_owner; $this->template->isLogged = $this->isLoggedIn(); // used in template $this->template->isAnonymousUser = var_export(!$this->isLoggedIn(), true); // used by the client $this->job_stats['STATUS_BAR_NO_DISPLAY'] = $this->project_status['status_analysis'] == Constants_ProjectStatus::STATUS_DONE ? '' : 'display:none;'; $this->job_stats['ANALYSIS_COMPLETE'] = $this->project_status['status_analysis'] == Constants_ProjectStatus::STATUS_DONE ? true : false; $this->template->user_keys = $this->_keyList; $this->template->job_stats = $this->job_stats; $this->template->stat_quality = $this->qa_data; $this->template->overall_quality = $this->qa_overall; $this->template->overall_quality_class = strtolower(str_replace(' ', '', $this->qa_overall)); $end_time = microtime(true) * 1000; $load_time = $end_time - $this->start_time; $this->template->load_time = $load_time; $this->template->tms_enabled = var_export((bool) $this->project_status['id_tms'], true); $this->template->mt_enabled = var_export((bool) $this->project_status['id_mt_engine'], true); $this->template->downloadFileName = urlencode($this->downloadFileName); $this->template->warningPollingInterval = 1000 * INIT::$WARNING_POLLING_INTERVAL; $this->template->segmentQACheckInterval = 1000 * INIT::$SEGMENT_QA_CHECK_INTERVAL; $this->template->filtered = $this->filter_enabled; $this->template->filtered_class = $this->filter_enabled ? ' open' : ''; $this->template->isReview = var_export(self::isRevision(), true); $this->template->reviewClass = self::isRevision() ? ' review' : ''; $this->template->hideMatchesClass = self::isRevision() ? '' : ' hideMatches'; $this->template->tagLockCustomizable = INIT::$UNLOCKABLE_TAGS == true ? true : false; $this->template->editLogClass = $this->getEditLogClass(); $this->template->maxNumSegments = INIT::$MAX_NUM_SEGMENTS; $this->template->copySourceInterval = INIT::$COPY_SOURCE_INTERVAL; $this->template->time_to_edit_enabled = INIT::$TIME_TO_EDIT_ENABLED; //check if it is a composite language, for cjk check that accepts only ISO 639 code if (strpos($this->target_code, '-') !== false) { //pick only first part $tmp_lang = explode('-', $this->target_code); $target_code_no_country = $tmp_lang[0]; unset($tmp_lang); } else { //not a RFC code, it's fine $target_code_no_country = $this->target_code; } //check if cjk if (array_key_exists($target_code_no_country, CatUtils::$cjk)) { // $this->template->taglockEnabled = 0; } /* * Line Feed PlaceHolding System */ $this->template->brPlaceholdEnabled = $placeHoldingEnabled = true; if ($placeHoldingEnabled) { $this->template->lfPlaceholder = CatUtils::lfPlaceholder; $this->template->crPlaceholder = CatUtils::crPlaceholder; $this->template->crlfPlaceholder = CatUtils::crlfPlaceholder; $this->template->lfPlaceholderClass = CatUtils::lfPlaceholderClass; $this->template->crPlaceholderClass = CatUtils::crPlaceholderClass; $this->template->crlfPlaceholderClass = CatUtils::crlfPlaceholderClass; $this->template->lfPlaceholderRegex = CatUtils::lfPlaceholderRegex; $this->template->crPlaceholderRegex = CatUtils::crPlaceholderRegex; $this->template->crlfPlaceholderRegex = CatUtils::crlfPlaceholderRegex; $this->template->tabPlaceholder = CatUtils::tabPlaceholder; $this->template->tabPlaceholderClass = CatUtils::tabPlaceholderClass; $this->template->tabPlaceholderRegex = CatUtils::tabPlaceholderRegex; $this->template->nbspPlaceholder = CatUtils::nbspPlaceholder; $this->template->nbspPlaceholderClass = CatUtils::nbspPlaceholderClass; $this->template->nbspPlaceholderRegex = CatUtils::nbspPlaceholderRegex; } if (INIT::$COMMENTS_ENABLED) { $this->template->comments_enabled = true; $this->template->sse_base_url = INIT::$SSE_BASE_URL; } $this->template->uses_matecat_filters = Utils::isJobBasedOnMateCatFilters($this->jid); $this->decorator = new CatDecorator($this, $this->template); $this->decorator->decorate(); }
public function setTemplateVars() { if ($this->project_not_found) { parent::makeTemplate('project_not_found.html'); return; } $this->template->jobs = $this->jobs; $this->template->fast_analysis_wc = $this->fast_analysis_wc; $this->template->fast_analysis_wc_print = $this->fast_analysis_wc_print; $this->template->tm_analysis_wc = $this->tm_analysis_wc; $this->template->tm_analysis_wc_print = $this->tm_analysis_wc_print; $this->template->standard_analysis_wc = $this->standard_analysis_wc; $this->template->standard_analysis_wc_print = $this->standard_analysis_wc_print; $this->template->total_raw_word_count = $this->total_raw_word_count; $this->template->total_raw_word_count_print = $this->total_raw_word_count_print; $this->template->pname = $this->pname; $this->template->pid = $this->pid; $this->template->project_password = $this->ppassword; $this->template->project_not_found = $this->project_not_found; $this->template->fast_wc_time = $this->fast_wc_time; $this->template->tm_wc_time = $this->tm_wc_time; $this->template->tm_wc_unit = $this->tm_wc_unit; $this->template->fast_wc_unit = $this->fast_wc_unit; $this->template->standard_wc_unit = $this->standard_wc_unit; $this->template->raw_wc_time = $this->raw_wc_time; $this->template->standard_wc_time = $this->standard_wc_time; $this->template->raw_wc_unit = $this->raw_wc_unit; $this->template->project_status = $this->project_status; $this->template->num_segments = $this->num_segments; $this->template->num_segments_analyzed = $this->num_segments_analyzed; $this->template->logged_user = $this->logged_user !== false ? $this->logged_user->shortName() : ""; $this->template->extended_user = $this->logged_user !== false ? trim($this->logged_user->fullName()) : ""; $this->template->build_number = INIT::$BUILD_NUMBER; $this->template->enable_outsource = INIT::$ENABLE_OUTSOURCE; $this->template->outsource_service_login = $this->_outsource_login_API; $this->template->support_mail = INIT::$SUPPORT_MAIL; $langDomains = Langs_LanguageDomains::getInstance(); $this->subject = $langDomains::getDisplayDomain($this->subject); $this->template->subject = $this->subject; $this->template->isLoggedIn = $this->isLoggedIn(); if (isset($_SESSION['_anonym_pid']) && !empty($_SESSION['_anonym_pid'])) { $_SESSION['incomingUrl'] = INIT::$HTTPHOST . $_SERVER['REQUEST_URI']; $_SESSION['_newProject'] = 1; $this->template->showModalBoxLogin = true; } else { $this->template->showModalBoxLogin = false; } //url to which to send data in case of login $client = OauthClient::getInstance()->getClient(); $this->template->oauthFormUrl = $client->createAuthUrl(); $this->template->incomingUrl = '/login?incomingUrl=' . $_SERVER['REQUEST_URI']; //perform check on running daemons and send a mail randomly $misconfiguration = Status::thereIsAMisconfiguration(); if ($misconfiguration && mt_rand(1, 3) == 1) { $msg = "<strong>The analysis daemons seem not to be running despite server configuration.</strong><br />Change the application configuration or start analysis daemons."; Utils::sendErrMailReport($msg, "Matecat Misconfiguration"); } $this->template->daemon_misconfiguration = var_export($misconfiguration, true); }