public function doAction() { switch ($this->__postInput['exec']) { case 'stayAnonymous': unset($_SESSION['_anonym_pid']); unset($_SESSION['incomingUrl']); unset($_SESSION['_newProject']); break; case 'ping': $db = Database::obtain(); $db->query("SELECT 1"); $this->result['data'] = array("OK", time()); break; case 'checkTMKey': //get MyMemory apiKey service $tmxHandler = new TMSService(); $tmxHandler->setTmKey($this->__postInput['tm_key']); //validate the key try { $keyExists = $tmxHandler->checkCorrectKey(); } catch (Exception $e) { /* PROVIDED KEY IS NOT VALID OR WRONG, $keyExists IS NOT SET */ Log::doLog($e->getMessage()); } if (!isset($keyExists) || $keyExists === false) { $this->result['errors'][] = array("code" => -9, "message" => "TM key is not valid."); Log::doLog(__METHOD__ . " -> TM key is not valid."); $this->result['success'] = false; } else { $this->result['errors'] = array(); $this->result['success'] = true; } break; } }
function showPost($id) { $db = Database::obtain(); $sql = "SELECT " . tbl_blog . ".id, title, content, date_posted, username \n FROM " . tbl_blog . "\n JOIN " . tbl_users . " \n ON " . tbl_blog . ".user_id = " . tbl_users . ".id\n \tWHERE " . tbl_blog . ".id = " . (int) $id; $rows = $db->fetch_array($sql); return $rows; }
function testReturnsNonCompletedProject() { $this->setValidProjectWithAllTranslatedSegments(); // get project chunks $chunksDao = new Chunks_ChunkDao(Database::obtain()); $chunks = $chunksDao->getByProjectID($this->test_data->project->id_project); $this->assertEquals(1, count($chunks)); $chunk = $chunks[0]; // split job in two $splitTest = new CurlTest(); $params = array('action' => 'splitJob', 'exec' => 'apply', 'project_id' => $this->test_data->project->id_project, 'project_pass' => $this->test_data->project->project_pass, 'job_id' => $chunk->id, 'job_pass' => $chunk->password, 'num_split' => 2, 'split_values' => array('5', '1')); $splitTest->params = $params; $splitTest->method = 'POST'; $response = $splitTest->getResponse(); $chunks = $chunksDao->getByProjectID($this->test_data->project->id_project); $this->assertEquals(2, count($chunks)); $first_chunk = $chunks[0]; $second_chunk = $chunks[1]; integrationSetChunkAsComplete(array('params' => array('id_job' => $first_chunk->id, 'password' => $first_chunk->password))); $test = new CurlTest(); $test->path = '/api/v2/project-completion-status/' . $this->test_data->project->id_project; $test->method = 'GET'; $test->headers = $this->test_data->headers; $response = $test->getResponse(); $expected = array('project_status' => array('id' => $this->test_data->project->id_project, 'completed' => false, 'chunks' => array(array('id' => $second_chunk->id, 'password' => $second_chunk->password)))); $this->assertEquals(json_encode($expected), $response['body']); }
/** * Create a new FileFormatConverter, using old or new converters. * This function looks for converters in the 'converters' table in the db. * $converterVersion can be "legacy", "latest", or something like "1.0.0". * In the first case legacy converters will be used; in the second case, * the latest version of new converters will be used; in the third case, * this function will look for the converters with the provided version, * and if not found will use the converters with higher but closest version. * Version check is done on the conversion_api_version field of the * converters db table; new converters are expected to have a value like * "open 1.0.0". */ public function __construct($converterVersion = null) { $this->converterVersion = $converterVersion; $this->opt['httpheader'] = array("Content-Type:multipart/form-data;charset=UTF-8"); $this->lang_handler = Langs_Languages::getInstance(); $this->conversionObject = new ArrayObject(array('ip_machine' => null, 'ip_client' => null, 'path_name' => null, 'file_name' => null, 'path_backup' => null, 'file_size' => 0, 'direction' => null, 'error_message' => null, 'src_lang' => null, 'trg_lang' => null, 'status' => 'ok', 'conversion_time' => 0), ArrayObject::ARRAY_AS_PROPS); // Get converters instances list from database, $db = Database::obtain(); // The base query to obtain the converters $baseQuery = 'SELECT ip_converter, cpu_weight, ip_storage, segmentation_rule' . ' FROM converters' . ' WHERE status_active = 1 AND status_offline = 0'; // Complete the $baseQuery according to the converter's version if ($this->converterVersion == Constants_ConvertersVersions::LEGACY) { // Retrieve only old converters $query = $baseQuery . (INIT::$USE_ONLY_STABLE_CONVERTERS ? ' AND stable = 1' : '') . ' AND conversion_api_version NOT LIKE "open %"'; $converters = $db->fetch_array($query); } else { // Here we use new converters if ($this->converterVersion == Constants_ConvertersVersions::LATEST) { // Get the converters with the latest version $query = $baseQuery . ' AND conversion_api_version = (' . 'SELECT MAX(conversion_api_version)' . ' FROM converters' . ' WHERE conversion_api_version LIKE "open %"' . (INIT::$USE_ONLY_STABLE_CONVERTERS ? ' AND stable = 1' : '') . ' AND status_active = 1 AND status_offline = 0' . ')'; $converters = $db->fetch_array($query); } else { $converters = self::__getSuitableConvertersByVersion($db, $this->converterVersion); } } foreach ($converters as $converter_storage) { $this->converters[$converter_storage['ip_converter']] = $converter_storage['cpu_weight']; $this->storage_lookup_map[$converter_storage['ip_converter']] = $converter_storage['ip_storage']; $this->converter2segmRule[$converter_storage['ip_converter']] = $converter_storage['segmentation_rule']; } // $this->converters = array('10.30.1.32' => 1);//for debugging purposes // $this->storage_lookup_map = array('10.30.1.32' => '10.30.1.32');//for debugging purposes }
public function __construct() { $this->ROOT = realpath(dirname(__FILE__) . '/../../../'); //imports require_once $this->ROOT . '/inc/config.inc.php'; Bootstrap::start(); $this->db = Database::obtain(INIT::$DB_SERVER, INIT::$DB_USER, INIT::$DB_PASS, INIT::$DB_DATABASE); $this->db->connect(); //init params $this->path = $this->ROOT . '/lib/Utils/converter_checker'; $resultSet = $this->db->fetch_array(self::selectAllNotOffline); if (empty($resultSet)) { self::_prettyEcho("------------------------------------"); self::_prettyEcho("************* WARNING **************"); self::_prettyEcho("------------------------------------"); $this->alertForEmptyPool(); die(1); } foreach ($resultSet as $conv) { // self::$ipLog = $conv[ 'ip_converter' ]; $this->resultSet[$conv['ip_converter']] = $conv; $this->host_machine_map[$conv['ip_converter']] = array('ip_machine_host' => $conv['ip_machine_host'], 'machine_host_user' => $conv['machine_host_user'], 'machine_host_pass' => $conv['machine_host_pass'], 'instance_name' => $conv['instance_name']); // self::_prettyEcho( "Retrieving Processes Info on " . $conv[ 'ip_converter' ] ); // $converter_json_top = self::getNodeProcessInfo( $conv[ 'ip_converter' ] ); // if ( !empty( $converter_json_top ) ) { // $this->convertersTop[ $conv[ 'ip_converter' ] ] = array( // 'converter_load' => $converter_json_top[ 0 ], // 'converter_json_top' => $converter_json_top[ 1 ] // ); // } } $this->converterFactory = new FileFormatConverter(); }
function addFriend($id, $target) { $db = Database::obtain(); $sql = 'SELECT friends FROM users WHERE id = ' . $db->escape($id); $query = $db->query($sql); $result = $db->fetch($query); $friends = $result['friends']; $fids = explode(",", $friends); foreach ($fids as $fid) { if ($fid == $target) { $true = 1; } } if ($true != 1) { if ($target == $id) { echo "You can't friend yourself."; } else { if ($friends == "") { $friends .= $target; } else { $friends .= ',' . $target; } $data['friends'] = $friends; $where = 'id = ' . $db->escape($id); $sql = $db->update('users', $data, $where); echo 'Friend added.'; } } else { echo 'You already friend with this player.'; } }
static function uncompletedChunksByProjectId($id_project) { // for each project you can have several jobs, one per targert language. // for each job you can have one or more chunks. // jobs are identified by id_job and target language. // chunks are identified by id_job and password. // // translations have a reference to job, not to the chunk. // in order to associate the segment_translation to the chunk we need to // refer to the start and stop segment stored on the job. // // I would be great if we could have a chunk identifier on the segment_translation. // segments don't have a reference to the job neither, since they are linked to the file. // $query_most_recent_completion_events_for_chunk = " " . " SELECT * FROM ( " . " SELECT * FROM chunk_completion_events WHERE id_project = :id_project " . " ORDER BY create_date DESC ) t " . " GROUP BY id_project, id_job, password "; // This query should return no records, meaning all submitted events have // create_date greater than the chunk's latest translation date. $query_for_event_submitted_at_least_once = "SELECT ch.id_job, ch.password " . " FROM segment_translations st INNER JOIN " . "( {$query_most_recent_completion_events_for_chunk} ) ch ON " . " st.id_segment BETWEEN ch.job_first_segment AND ch.job_last_segment " . " AND st.id_job = ch.id_job AND ch.id_project = :id_project " . " AND ch.create_date < st.translation_date"; // This query should return no records, meaning all jobs have at least one // submitted chunk completion event. $query_to_return_unsubmitted_chunks = "SELECT jobs.id as id_job, jobs.password " . " FROM jobs LEFT JOIN chunk_completion_events ch ON " . " jobs.id = ch.id_job AND " . " jobs.password = ch.password AND " . " jobs.job_first_segment = ch.job_first_segment AND " . " jobs.job_last_segment = ch.job_last_segment AND " . " jobs.id_project = ch.id_project " . " WHERE jobs.id_project = :id_project " . " AND ch.id IS NULL "; $union_query = "SELECT * FROM ( {$query_to_return_unsubmitted_chunks} " . " UNION ALL {$query_for_event_submitted_at_least_once} ) t1 " . " GROUP BY id_job, password "; $query_to_return_chunks = "SELECT * from jobs INNER JOIN ( {$union_query} ) filtered " . " ON jobs.id = filtered.id_job AND jobs.password = filtered.password "; $conn = Database::obtain()->getConnection(); Log::doLog($query_to_return_chunks); $stmt = $conn->prepare($query_to_return_chunks); $stmt->execute(array('id_project' => $id_project)); $stmt->setFetchMode(PDO::FETCH_CLASS, 'Chunks_ChunkStruct'); return $stmt->fetchAll(); }
static function create($values) { $values = array_merge(array('uid' => 1, 'feature_code' => 'project_completion', 'options' => '{}', 'enabled' => true), $values); $dao = new OwnerFeatures_OwnerFeatureDao(Database::obtain()); $struct = new OwnerFeatures_OwnerFeatureStruct($values); return $dao->create($struct); }
function post($request) { $response = new Response($request); if (isset($_POST['exception'])) { $db = Database::obtain(); $exception = $_POST['exception']; $query_obj = array(); $sql = "SELECT * FROM `" . TABLE_ERRORS . "` WHERE `exception`='" . $exception . "'"; $row = $db->query_first($sql); if (empty($row['id'])) { $query_obj['exception'] = $_POST['exception']; $query_obj['appearance'] = 0; } else { $query_obj['exception'] = $row['exception']; $query_obj['first_submit'] = $row['first_submit']; $query_obj['appearance'] = $row['appearance']; if (!empty($row['solution'])) { $query_obj['solution'] = $row['solution']; } } $response->code = Response::OK; $response->addHeader('Content-type', 'text/plain'); $response->body = json_encode($query_obj); } else { $response->code = Response::BADREQUEST; } return $response; }
function showTemplates($start_record, $end_record, $category_id = NULL) { $db = Database::obtain(); if ($category_id == NULL) { $filter = ''; } else { $filter = 'WHERE `template_category` = ' . $db->escape($category_id); } $sql = "SELECT * FROM `" . TABLE_TEMPLATES . "`\n\t\t\t\t" . $filter . "\n\t\t\t\tORDER BY name ASC\n\t\t\t\tLIMIT " . $start_record . "," . $end_record . ""; $templates = $db->fetch_array($sql); $templateList = array(); foreach ($templates as $template) { $templateList[] = $template['name']; if ($template['id'] == $website_template) { $website_template = $template['name']; } } $form = '<table cellspacing="10" border="0" align="center"><tr>'; foreach ($templateList as $i => $t) { $form .= '<td align="center">'; if ($t == $website_template) { $form .= $t . '<br><img src="templates/' . $t . '/preview.jpg" width="150px" height="100px"><br>' . MSG00092 . ' <input name="website_template" value="' . $t . '" type="radio" checked="checked" /><br/>'; } else { $form .= $t . '<br><img src="templates/' . $t . '/preview.jpg" width="150px" height="100px"><br>' . MSG00092 . ' <input name="website_template" value="' . $t . '" type="radio" /><br />'; } $form .= '</td>'; if (($i + 1) % 4 == 0) { $form .= '<tr></tr>'; } } $form .= '</tr></table>'; $form .= linkButton(scriptName() . '?website&edit=' . $website_id . '&settings', MSG00089); echo $form; }
function getAllUsers() { $db = Database::obtain(); $sql = "SELECT *\n\t\t\tFROM " . tbl_users; $rows = $db->fetch_array($sql); return $rows; }
public function login($username, $password) { $username = htmlentities($username); $password = md5($password); if (User::user_exists($username)) { $db = Database::obtain(); $sql = "SELECT `id`,`username`,`password` FROM " . TABLE_USERS . "\n\t\t\t\t\tWHERE `username` = '" . $db->escape($username) . "'"; $userdata = $db->query_first($sql); if ($username == $userdata['username'] && $password == $userdata['password']) { $_SESSION['userkey'] = md5($_SERVER["REMOTE_ADDR"] . $_SERVER["HTTP_USER_AGENT"] . md5($userdata['password'])); $_SESSION['userid'] = $userdata['id']; // Check if Javascript is enable from hidden value in <noscript></noscript> in the login form $js_disabled = 0; $_SESSION['js_disabled'] = 0; if (isset($_POST['js_disabled'])) { $js_disabled = $_POST['js_disabled']; } if ($js_disabled == 1) { $_SESSION['js_disabled'] = 1; } $this->userid = $userdata['id']; $this->logged_in = true; return true; } } else { return false; } }
/** * @param $start start segment * @param $stop stop segment * @return array array aggregated by id_segment */ public static function getAggregatedBySegmentIdInInterval($start, $stop) { $conn = Database::obtain()->getConnection(); $stmt = $conn->prepare("SELECT id_segment, id, note FROM segment_notes " . " WHERE id_segment BETWEEN :start AND :stop "); $stmt->execute(array('start' => $start, 'stop' => $stop)); return $stmt->fetchAll(PDO::FETCH_GROUP | PDO::FETCH_ASSOC); }
function saveWebsiteSettings($website) { $db = Database::obtain(); $id = $website['id']; $db->update(TABLE_WEBSITES, $website, "id='" . $id . "'"); sysMsg(MSG00003); }
function createNavbar($logged_in) { $db = Database::obtain(); $sql = "SELECT id, name, url\n\t\t\tFROM " . tbl_pages . "\n\t\t\tWHERE logged_in = " . (int) $logged_in; $row = $db->fetch_array($sql); return $row; }
function get($request) { // admin Only Utilities::checkAdmin(); $db = Database::obtain(); $response = new Response($request); $this->tm->smarty->assign('title', 'Admin Infos Tours'); $no_tours = $db->query_first("SELECT count(*) AS no FROM " . TABLE_TOURS); $no_tours = $no_tours['no']; $last_page = ceil($no_tours / $this->rows); //this makes sure the page number isn't below one, or more than our maximum pages if ($this->page < 1) { $this->page = 1; } elseif ($this->page > $last_page) { $this->page = $last_page; } $max = 'LIMIT ' . ($this->page - 1) * $this->rows . ',' . $this->rows; $tours = $db->fetch_array("SELECT * FROM `" . TABLE_TOURS . "` " . $max); $this->tm->smarty->assign('lastpage', $last_page); $this->tm->smarty->assign('pagenum', $this->page); $em = GeocacheManager::getInstance(); $tours_obj = array(); foreach ($tours as $tour) { $tours_obj[] = $geocacheManager = $em->fetchTour($tour['webcode']); } $this->tm->smarty->assign('tours', $tours_obj); $body = $this->tm->render('admin_info_tour'); $response->code = Response::OK; $response->addHeader('Content-type', 'text/html'); $response->body = $body; return $response; }
static function create($values = array()) { $email_counter = self::$email_counter += 1; $values = array_merge(array('email' => "test-email-{$email_counter}@example.org", 'salt' => '1234abcd', 'pass' => '1234abcd', 'first_name' => 'John', 'last_name' => 'Connor', 'api_key' => '1234abcd'), $values); $dao = new Users_UserDao(Database::obtain()); $userStruct = new Users_UserStruct($values); return $dao->createUser($userStruct); }
static function findByKey($key, $options = array()) { $conn = Database::obtain()->getConnection(); $stmt = $conn->prepare("SELECT * FROM api_keys WHERE enabled AND api_key = :key "); $stmt->execute(array('key' => $key)); $stmt->setFetchMode(PDO::FETCH_CLASS, 'ApiKeys_ApiKeyStruct'); return $stmt->fetch(); }
public static function getByJobId($id_job) { $conn = Database::obtain()->getConnection(); $stmt = $conn->prepare("SELECT * FROM files " . " INNER JOIN files_job ON files_job.id_file = files.id " . " AND id_job = :id_job "); $stmt->execute(array('id_job' => $id_job)); $stmt->setFetchMode(PDO::FETCH_CLASS, 'Files_FileStruct'); return $stmt->fetchAll(); }
public static function getUp() { if (self::$db == null) { self::$db = Database::obtain(self::$DB_SERVER, self::$DB_USER, self::$DB_PASS, self::$DB_DATABASE); self::$db->connect(); } return self::$db; }
public static function getByOwnerEmailAndCode($feature_code, $email) { $conn = Database::obtain()->getConnection(); $stmt = $conn->prepare("SELECT * FROM owner_features " . " INNER JOIN users ON users.uid = owner_features.uid " . " WHERE users.email = :email " . " AND owner_features.feature_code = :feature_code " . " AND owner_features.enabled "); $stmt->execute(array('email' => $email, 'feature_code' => $feature_code)); $stmt->setFetchMode(PDO::FETCH_CLASS, 'OwnerFeatures_OwnerFeatureStruct'); return $stmt->fetch(); }
static function create($values) { self::$unique_key = self::$unique_key + 1; $values = array_merge(array('uid' => 1, 'api_key' => md5(self::$unique_key), 'api_secret' => 'api_secret', 'enabled' => true), $values); $dao = new ApiKeys_ApiKeyDao(Database::obtain()); $struct = new ApiKeys_ApiKeyStruct($values); return $dao->create($struct); }
function newMessage($id, $lobby, $message) { $db = Database::obtain(); global $user; $message = stripslashes($message); $data = array('playerid' => $id, 'lobbyid' => $lobby, 'text' => $message); $insert = $db->insert('chat', $data); return '<dt>' . $user->nickname . ':</dt><dd>' . $message . '<span class="time">' . date("G:i") . '</span></dd>'; }
/** * When Called it perform the controller action to retrieve/manipulate data * * @return mixed */ function doAction() { try { $this->_checkData("auto_propagation.log"); } catch (Exception $e) { if ($e->getCode() == -1) { Utils::sendErrMailReport($e->getMessage()); } Log::doLog($e->getMessage()); return $e->getCode(); } $cookie_key = '_auto-propagation-' . $this->id_job . "-" . $this->password; $boolString = (string) (int) $this->propagateAll; $cookieLife = new DateTime(); $cookieLife->modify('+15 days'); $db = Database::obtain(); if ($this->propagateAll) { $db->begin(); $old_translation = getCurrentTranslation($this->id_job, $this->id_segment); //check tag mismatch //get original source segment, first $segment = getSegment($this->id_segment); //compare segment-translation and get results $check = new QA($segment['segment'], $this->translation); $check->performConsistencyCheck(); if ($check->thereAreWarnings()) { $err_json = $check->getWarningsJSON(); $translation = $this->translation; } else { $err_json = ''; $translation = $check->getTrgNormalized(); } $TPropagation = array(); $TPropagation['id_job'] = $this->id_job; $TPropagation['translation'] = $translation; $TPropagation['status'] = Constants_TranslationStatus::STATUS_DRAFT; $TPropagation['autopropagated_from'] = $this->id_segment; $_Translation['serialized_errors_list'] = $err_json; $TPropagation['warning'] = $check->thereAreWarnings(); $TPropagation['translation_date'] = date("Y-m-d H:i:s"); $TPropagation['segment_hash'] = $old_translation['segment_hash']; try { propagateTranslation($TPropagation, $this->jobData, $this->id_segment, true); $db->commit(); } catch (Exception $e) { $db->rollback(); $msg = $e->getMessage() . "\n\n" . $e->getTraceAsString(); Log::doLog($msg); Utils::sendErrMailReport($msg); } } setcookie($cookie_key, $boolString, $cookieLife->getTimestamp(), "/", $_SERVER['HTTP_HOST']); Log::doLog("Auto-propagation for already translated segments on Job " . $this->id_job . " set to '" . var_export($this->propagateAll, true) . "'. Cookie Expire at " . $cookieLife->format('Y-m-d H:i:s')); $this->result['errors'][] = array("code" => 0, "message" => "OK"); }
public function lobbyserver($id) { if (!$id || $id == $this->id) { return $this->sid; } $db = Database::obtain(); $sql = 'SELECT * FROM lobbies WHERE id = ' . $db->escape($id); $query = $db->query($sql); $lobbyinfo = $db->fetch($query); return $lobbyinfo['sid']; }
function informacje_dod_modal($id_wiz) { $sql49 = "SELECT * FROM wizyty_inf_dod WHERE id_wizyty = " . $id_wiz; $result = mysql_query($sql49); $row = mysql_fetch_array($result); $id_firmy_sql = "select sl_uslugi.id_firmy from sl_uslugi, wizyty where wizyty.typ_wiz = sl_uslugi.id and wizyty.id = " . $id_wiz; $db = Database::obtain(); $id_firmy = $db->query_first($id_firmy_sql); echo '<script> $(function() { var $tekst' . $id_wiz . '; '; if ($id_firmy['id_firmy'] != 0) { echo '$tekst' . $id_wiz . ' = "Nr zlecenia: ' . $row[2] . '"'; } echo ' $("#wiz_abc' . $id_wiz . '").empty().append($tekst' . $id_wiz . '); $("#wiz_inf_dod' . $id_wiz . '").click(function() { $( "#dialog-modal' . $id_wiz . '" ).dialog({ bgiframe: true, autoOpen: true, width: 490, modal: true, overlay: { backgroundColor: "#FFFFFF", opacity: 0.8 }, buttons: { "Zapisz": function() { $(this).dialog("close"); $("#wiz_abc' . $id_wiz . '").empty().append("Nr zlecenia: " + $("#nr_zlecenia' . $id_wiz . '").val()); $.ajax({ type : "GET", url : "grafik_inf_dod.php", data: { nr_zlecenia : $("#nr_zlecenia' . $id_wiz . '").val(), id_wiz : ' . $id_wiz . ' } }) }, "Anuluj": function() { $(this).dialog("close"); } } });'; echo '}); }); </script> <div id="dialog-modal' . $id_wiz . '" title="Informacje dodatkowe" style="display:none;"> <p>Numer zlecenia:<input type="text" size="10" name="nr_zlecenia' . $id_wiz . '" id="nr_zlecenia' . $id_wiz . '" value="' . $row['nr_zlecenia'] . '"></p> </div>'; }
/** * @param Users_UserStruct $input * * @return Users_UserStruct * @throws Exception */ public function sanitize($input) { $con = Database::obtain(); parent::_sanitizeInput($input, self::STRUCT_TYPE); $input->uid = $input->uid !== null ? (int) $input->uid : null; $input->email = $input->email !== null ? $con->escape($input->email) : null; $input->create_date = $input->create_date !== null ? $con->escape($input->create_date) : null; $input->first_name = $input->first_name !== null ? $con->escape($input->first_name) : null; $input->last_name = $input->last_name !== null ? $con->escape($input->last_name) : null; return $input; }
public function lastTranslationByJobOrChunk($chunk) { $conn = Database::obtain()->getConnection(); $query = "SELECT * FROM segment_translations " . " WHERE id_job = :id_job " . " AND segment_translations.id_segment BETWEEN :job_first_segment AND :job_last_segment " . " ORDER BY translation_date DESC " . " LIMIT 1 "; Log::doLog($query); $stmt = $conn->prepare($query); $array = array('id_job' => $chunk->id, 'job_first_segment' => $chunk->job_first_segment, 'job_last_segment' => $chunk->job_last_segment); $stmt->execute($array); $stmt->setFetchMode(PDO::FETCH_CLASS, 'Translations_SegmentTranslationStruct'); return $stmt->fetch(); }
public function __construct(ArrayObject $projectStructure = null) { if ($projectStructure == null) { $projectStructure = new RecursiveArrayObject(array('id_project' => null, 'id_customer' => null, 'user_ip' => null, 'project_name' => null, 'result' => null, 'private_tm_key' => 0, 'private_tm_user' => null, 'private_tm_pass' => null, 'uploadToken' => null, 'array_files' => array(), 'file_id_list' => array(), 'file_references' => array(), 'source_language' => null, 'target_language' => null, 'job_subject' => 'general', 'mt_engine' => null, 'tms_engine' => null, 'ppassword' => null, 'array_jobs' => array('job_list' => array(), 'job_pass' => array(), 'job_segments' => array()), 'job_segments' => array(), 'segments' => array(), 'translations' => array(), 'query_translations' => array(), 'status' => Constants_ProjectStatus::STATUS_NOT_READY_FOR_ANALYSIS, 'job_to_split' => null, 'job_to_split_pass' => null, 'split_result' => null, 'job_to_merge' => null, 'lang_detect_files' => array(), 'tm_keys' => array(), 'userIsLogged' => false, 'uid' => null, 'skip_lang_validation' => false, 'pretranslate_100' => 0, 'dqf_key' => null)); } $this->projectStructure = $projectStructure; //get the TMX management component from the factory $this->tmxServiceWrapper = new TMSService(); $this->langService = Langs_Languages::getInstance(); $this->checkTMX = 0; $this->dbHandler = Database::obtain(); }
public function doAction() { $gold_offset = (int) $this->gold_offset; $id = (int) $this->id; log::doLog("CASMACAT: gold offset: " . $gold_offset . " id: " . $id); $db = Database::obtain(); try { $db->query("UPDATE fixation_event SET gold_offset='{$gold_offset}' WHERE header_id = '{$id}'"); } catch (Exception $e) { log::doLog("CASMACAT: expection " . $e); } }