/** * Smarty plugin * @package Smarty * @subpackage plugins */ function smarty_function_EmbeddedDocumentAttachmentList($params, &$smarty) { $object_type_id = $params['object_type_id']; $object_id = $params['object_id']; $height = $params['height']; if (empty($height)) { $height = 75; } $url = URLBuilder::getURL(array('object_type_id' => $object_type_id, 'object_id' => $object_id), Environment::getBaseURL() . '/document/EmbeddedDocumentAttachmentList.php'); $retval = '<iframe style="width:100%; height:' . $height . 'px; border: 5px" id="DocumentAttachmentFactory" name="DocumentAttachmentFactory" src="' . $url . '"></iframe>'; return $retval; }
/** * Smarty plugin * @package Smarty * @subpackage plugins */ function smarty_function_EmbeddedMessageList($params, &$smarty) { $object_type_id = $params['object_type_id']; $object_id = $params['object_id']; $height = $params['height']; if (empty($height)) { $height = 250; } //urlbuilder script="../message/EmbeddedMessageList.php" values="object_type_id=10,object_id=$default_schedule_control_id" merge="FALSE"} $url = URLBuilder::getURL(array('object_type_id' => $object_type_id, 'object_id' => $object_id), Environment::getBaseURL() . '/message/EmbeddedMessageList.php'); //$retval = '<iframe style="width:100%; height:'.$height.'px; border: 0px" id="MessageFactory" name="MessageFactory" src="'.$url.'#form_start"></iframe>'; $retval = '<iframe style="width:100%; height:' . $height . 'px; border: 5px" id="MessageFactory" name="MessageFactory" src="' . $url . '"></iframe>'; return $retval; }
/** * Smarty plugin * @package Smarty * @subpackage plugins */ function smarty_function_LayerMessageList($params, &$smarty) { $object_type_id = $params['object_type_id']; $object_id = $params['object_id']; $height = $params['height']; if ($object_type_id == '') { return FALSE; } if ($object_id == '') { return FALSE; } if (empty($height)) { $height = 335; } $url = URLBuilder::getURL(array('template' => 1, 'object_type_id' => $object_type_id, 'object_id' => $object_id), Environment::getBaseURL() . '/message/EmbeddedMessageList.php'); $retval = ' <div id="MessageFactoryLayer" style="background:#000000;visibility:hidden; position: absolute; left: 5000px; top: 130px; width: 90%; height:' . $height . 'px"> <div id="rowContent"> <div id="titleTab"><div class="textTitle"><span class="textTitleSub">Messages</span></div></div> </div> <div id="rowContentInner"> <div id="contentBoxTwoEdit"> <table class="tblList"> <tr> <td> '; $retval .= '<iframe style="width:100%; height:' . $height . 'px; border: 5px" id="LayerMessageFactoryFrame" name="LayerMessageFactoryFrame" src="' . $url . '"></iframe>'; $retval .= ' </td> </tr> </table> </div> </div> </div> '; return $retval; }
function getBaseURL() { return Environment::getBaseURL(); }
if (isset($pref_data['enable_email_notification_message'])) { $upf->setEnableEmailNotificationMessage(TRUE); } else { $upf->setEnableEmailNotificationMessage(FALSE); } if (isset($pref_data['enable_email_notification_home'])) { $upf->setEnableEmailNotificationHome(TRUE); } else { $upf->setEnableEmailNotificationHome(FALSE); } if ($upf->isValid()) { $upf->Save(FALSE); if ($current_user->getId() == $upf->getUser()) { TTi18n::setLocaleCookie($pref_data['language'] . '_' . $current_user->getCountry()); } Redirect::Page(URLBuilder::getURL(array('user_id' => $pref_data['user_id'], 'data_saved' => 1), Environment::getBaseURL() . '/users/EditUserPreference.php')); unset($upf); break; } default: if (!isset($user_id) or isset($user_id) and $user_id == '') { $user_id = $current_user->getId(); } $ulf->getByIdAndCompanyId($user_id, $current_company->getId()); if ($ulf->getRecordCount() > 0) { $user_obj = $ulf->getCurrent(); } if (!isset($action)) { BreadCrumb::setCrumb($title); $uplf = TTnew('UserPreferenceListFactory'); $uplf->getByUserIDAndCompanyID($user_id, $current_company->getId());
} elseif ($bank_data['company_id'] != '' and $bank_data['user_id'] == '' and $permission->Check('company', 'edit_own_bank')) { Debug::Text('Specified Company', __FILE__, __LINE__, __METHOD__, 10); //Company bank. $baf->setCompany($bank_data['company_id']); $redirect_arr = array('company_id' => $company_id, 'data_saved' => TRUE); } else { $permission->Redirect(FALSE); } if (isset($bank_data['institution'])) { $baf->setInstitution($bank_data['institution']); } $baf->setTransit($bank_data['transit']); $baf->setAccount($bank_data['account']); if ($baf->isValid()) { $baf->Save(); Redirect::Page(URLBuilder::getURL($redirect_arr, Environment::getBaseURL() . '/bank_account/EditBankAccount.php')); break; } else { Debug::Text('Invalid bank data...', __FILE__, __LINE__, __METHOD__, 10); } default: $balf = TTnew('BankAccountListFactory'); $ulf = TTnew('UserListFactory'); $country = NULL; if (($user_id == '' or $user_id == $current_user->getId()) and $company_id == '' and $permission->Check('user', 'edit_own_bank')) { //Current user $balf->getUserAccountByCompanyIdAndUserId($current_company->getId(), $current_user->getId()); $user_id = $current_user->getId(); $user_obj = $ulf->getByIdAndCompanyId($user_id, $current_company->getId())->getCurrent(); $country = $user_obj->getCountry(); } elseif ($user_id != '' and $permission->Check('user', 'edit_bank')) {
function getScheduleIcalendarURL($user_name = NULL, $type_id = NULL) { if ($user_name == '') { $user_name = $this->getUserObject()->getUserName(); } if ($type_id == '') { $type_id = $this->getScheduleIcalendarType(); } $retval = Environment::getBaseURL() . 'ical/ical.php'; if ($type_id == 2) { $retval .= '?u=' . $user_name . '&k=' . $this->getScheduleIcalendarKey(); } return $retval; }
function scheduleFooter() { global $config_vars; $margins = $this->pdf->getMargins(); //Don't scale footer text lines as they aren't that important anyways. $this->pdf->SetFont($this->config['other']['default_font'], '', 8); //Save x,y and restore after footer is set. $x = $this->pdf->getX(); $y = $this->pdf->getY(); //Jump to end of page. if ($this->pdf->getPageHeight() - $margins['bottom'] - $margins['top'] - 15 > $y) { $this->pdf->setY($this->pdf->getPageHeight() - $margins['bottom'] - $margins['top'] - 15); } $company_obj = $this->getUserObject()->getCompanyObject(); if (is_object($company_obj) and $company_obj->getProductEdition() > 10) { if ($config_vars['other']['force_ssl'] == 1) { $protocol = 'https'; } else { $protocol = 'http'; } $url = $protocol . '://' . Misc::getHostName() . Environment::getBaseURL() . 'ical/ical.php'; $this->pdf->Cell($this->pdf->getPageWidth() - $margins['right'] - $margins['left'], 5, TTi18n::getText('Synchronize this schedule to your desktop/mobile phone calendar application') . ': ' . $url, 1, 0, 'C', 0, NULL, 1); $this->pdf->Ln(); } $this->pdf->SetFont($this->config['other']['default_font'], '', 8); $this->pdf->Cell($this->pdf->getPageWidth() - $margins['right'], 5, TTi18n::getText('Page') . ' ' . $this->pdf->PageNo() . ' of ' . $this->pdf->getAliasNbPages(), 0, 0, 'C', 0); $this->pdf->Ln(); $this->pdf->SetFont($this->config['other']['default_font'], '', 6); $this->pdf->Cell($this->pdf->getPageWidth() - $margins['right'], 5, TTi18n::gettext('Report Generated By') . ' ' . APPLICATION_NAME . ' v' . APPLICATION_VERSION . ' @ ' . TTDate::getDate('DATE+TIME', $this->start_time), 0, 0, 'C', 0); $this->pdf->setX($x); $this->pdf->setY($y); return TRUE; }
function sendCompanyVersionData($company_id) { Debug::Text('Sending Company Version Data...', __FILE__, __LINE__, __METHOD__, 10); $cf = TTnew('CompanyFactory'); $tt_version_data['registration_key'] = $this->getLocalRegistrationKey(); $tt_version_data['company_id'] = $company_id; $sslf = TTnew('SystemSettingListFactory'); $sslf->getByName('system_version'); if ($sslf->getRecordCount() == 1) { $tt_version_data['system_version'] = $sslf->getCurrent()->getValue(); } $sslf->getByName('tax_engine_version'); if ($sslf->getRecordCount() == 1) { $tt_version_data['tax_engine_version'] = $sslf->getCurrent()->getValue(); } $sslf->getByName('tax_data_version'); if ($sslf->getRecordCount() == 1) { $tt_version_data['tax_data_version'] = $sslf->getCurrent()->getValue(); } $sslf->getByName('schema_version_group_A'); if ($sslf->getRecordCount() == 1) { $tt_version_data['schema_version']['A'] = $sslf->getCurrent()->getValue(); } $sslf->getByName('schema_version_group_B'); if ($sslf->getRecordCount() == 1) { $tt_version_data['schema_version']['B'] = $sslf->getCurrent()->getValue(); } $sslf->getByName('schema_version_group_T'); if ($sslf->getRecordCount() == 1) { $tt_version_data['schema_version']['T'] = $sslf->getCurrent()->getValue(); } if (isset($_SERVER['SERVER_SOFTWARE'])) { $server_software = $_SERVER['SERVER_SOFTWARE']; } else { $server_software = 'N/A'; } if (isset($_SERVER['SERVER_NAME'])) { $server_name = $_SERVER['SERVER_NAME']; } else { $server_name = 'N/A'; } $db_server_info = $cf->db->ServerInfo(); $sys_version_data = array('php_version' => phpversion(), 'zend_version' => zend_version(), 'web_server' => $server_software, 'database_type' => $cf->db->databaseType, 'database_version' => $db_server_info['version'], 'database_description' => $db_server_info['description'], 'server_name' => $server_name, 'base_url' => Environment::getBaseURL(), 'php_os' => PHP_OS, 'system_information' => php_uname()); $version_data = array_merge($tt_version_data, $sys_version_data); if (isset($version_data) and is_array($version_data)) { Debug::Text('Sent Company Version Data!', __FILE__, __LINE__, __METHOD__, 10); $retval = $this->getSoapObject()->saveCompanyVersionData($version_data); if ($retval == FALSE) { Debug::Text('Server failed saving data!', __FILE__, __LINE__, __METHOD__, 10); } //$this->printSoapDebug(); return $retval; } Debug::Text('NOT Sending Company Version Data!', __FILE__, __LINE__, __METHOD__, 10); return FALSE; }
function destroyCookie() { setcookie('StationID', NULL, time() + 9999999, Environment::getBaseURL()); return TRUE; }
function sendPasswordResetEmail() { global $config_vars; if ($this->getHomeEmail() != FALSE or $this->getWorkEmail() != FALSE) { if ($this->getWorkEmail() != FALSE) { $primary_email = $this->getWorkEmail(); if ($this->getHomeEmail() != FALSE) { $secondary_email = $this->getHomeEmail(); } else { $secondary_email = NULL; } } else { $primary_email = $this->getHomeEmail(); $secondary_email = NULL; } $this->setPasswordResetKey(md5(uniqid())); $this->setPasswordResetDate(time()); $this->Save(FALSE); if ($config_vars['other']['force_ssl'] == 1) { $protocol = 'https'; } else { $protocol = 'http'; } $subject = 'Password Reset requested at ' . TTDate::getDate('DATE+TIME', time()) . ' from ' . $_SERVER['REMOTE_ADDR']; $body = ' <html><body> If you did not request your password to be reset, you may ignore this email. <br> <br> If you did request the password for ' . $this->getUserName() . ' to be reset, please click <a href="' . $protocol . '://' . Misc::getHostName() . Environment::getBaseURL() . 'ForgotPassword.php?action:password_reset=null&key=' . $this->getPasswordResetKey() . '">here</a> </body></html> '; //Debug::Text('Emailing Report to: '. $this->getUserName() .' Email: '. $primary_email , __FILE__, __LINE__, __METHOD__,10); //Debug::Arr($body, 'Email Report', __FILE__, __LINE__, __METHOD__,10); //echo "<pre>$body</pre><br>\n"; //$retval = -->liam<--($primary_email, $subject, $body, "MIME-Version: 1.0\nContent-type: text/html; charset=iso-8859-1\nFrom: \"TimeTrex - Password Reset\"<DoNotReply@".Misc::getHostName().">\nCc: ". $secondary_email ."\n"); //Debug::Text('Mail() result: '. (int)$retval, __FILE__, __LINE__, __METHOD__,10); TTLog::addEntry($this->getId(), 500, TTi18n::getText('Employee Password Reset By') . ': ' . $_SERVER['REMOTE_ADDR'] . ' ' . TTi18n::getText('Key') . ': ' . $this->getPasswordResetKey(), NULL, $this->getTable()); $headers = array('From' => '"TimeTrex - Password Reset"<DoNotReply@' . Misc::getHostName(FALSE) . ">", 'Subject' => $subject, 'Cc' => $secondary_email, 'MIME-Version' => '1.0', 'Content-type' => 'text/html; charset=iso-8859-1'); $mail = new TTMail(); $mail->setTo($primary_email); $mail->setHeaders($headers); $mail->setBody($body); $retval = $mail->Send(); return $retval; } return FALSE; }
function emailMessage() { Debug::Text('emailMessage: ', __FILE__, __LINE__, __METHOD__, 10); $email_to_arr = $this->getEmailMessageAddresses(); if ($email_to_arr == FALSE) { return FALSE; } $from = $reply_to = 'DoNotReply@' . Misc::getHostName(FALSE); global $current_user, $config_vars; if (is_object($current_user) and $current_user->getWorkEmail() != '') { $reply_to = $current_user->getWorkEmail(); } Debug::Text('From: ' . $from . ' Reply-To: ' . $reply_to, __FILE__, __LINE__, __METHOD__, 10); $to = array_shift($email_to_arr); Debug::Text('To: ' . $to, __FILE__, __LINE__, __METHOD__, 10); if (is_array($email_to_arr) and count($email_to_arr) > 0) { $bcc = implode(',', $email_to_arr); } else { $bcc = NULL; } $email_subject = TTi18n::gettext('New message waiting in') . ' ' . APPLICATION_NAME; $email_body = TTi18n::gettext('*DO NOT REPLY TO THIS EMAIL - PLEASE USE THE LINK BELOW INSTEAD*') . "\n\n"; $email_body .= TTi18n::gettext('You have a new message waiting for you in') . ' ' . APPLICATION_NAME . "\n"; if ($this->getSubject() != '') { $email_body .= TTi18n::gettext('Subject:') . ' ' . $this->getSubject() . "\n"; } $protocol = 'http'; if (isset($config_vars['other']['force_ssl']) and $config_vars['other']['force_ssl'] == 1) { $protocol .= 's'; } $email_body .= TTi18n::gettext('Link:') . ' <a href="' . $protocol . '://' . Misc::getHostName() . Environment::getBaseURL() . '">' . APPLICATION_NAME . ' ' . TTi18n::getText('Login') . '</a>'; //Define subject/body variables here. $search_arr = array('#employee_first_name#', '#employee_last_name#'); $replace_arr = array(NULL, NULL); $subject = str_replace($search_arr, $replace_arr, $email_subject); Debug::Text('Subject: ' . $subject, __FILE__, __LINE__, __METHOD__, 10); $headers = array('From' => $from, 'Subject' => $subject, 'Bcc' => $bcc, 'Reply-To' => $reply_to, 'Return-Path' => $reply_to, 'Errors-To' => $reply_to); Debug::Arr($headers, 'Headers: ', __FILE__, __LINE__, __METHOD__, 10); $body = '<pre>' . str_replace($search_arr, $replace_arr, $email_body) . '</pre>'; Debug::Text('Body: ' . $body, __FILE__, __LINE__, __METHOD__, 10); $mail = new TTMail(); $mail->setTo($to); $mail->setHeaders($headers); @$mail->getMIMEObject()->setHTMLBody($body); $mail->setBody($mail->getMIMEObject()->get()); $retval = $mail->Send(); if ($retval == TRUE) { TTLog::addEntry($this->getId(), 500, TTi18n::getText('Email Message to') . ': ' . $to . ' Bcc: ' . $headers['Bcc'], NULL, $this->getTable()); return TRUE; } return TRUE; //Always return true }
function getLink() { $link = FALSE; //Only show links on add/edit/allow actions. if (!in_array($this->getAction(), array(10, 20, 200))) { return $link; } switch ($this->getTableName()) { case 'authentication': break; case 'company': $link = 'company/EditCompany.php?id=' . $this->getObject(); break; case 'branch': $link = 'branch/EditBranch.php?id=' . $this->getObject(); break; case 'department': $link = 'department/EditDepartment.php?id=' . $this->getObject(); break; case 'currency': $link = 'currency/EditCurrency.php?id=' . $this->getObject(); break; case 'accrual': //$link = 'currency/EditCurrency.php?id='. $this->getObject(); break; case 'authorizations': break; case 'request': $link = 'request/ViewRequest.php?id=' . $this->getObject(); break; case 'permission_control': $link = 'permission/EditPermissionControl.php?id=' . $this->getObject(); break; case 'holidays': break; case 'bank_account': break; case 'roe': break; case 'station': $link = 'station/EditStation.php?id=' . $this->getObject(); break; case 'punch': break; case 'other_field': break; case 'system_setting': break; case 'cron': break; case 'policy_group': $link = 'policy/EditPolicyGroup.php?id=' . $this->getObject(); break; case 'schedule_policy': $link = 'policy/EditSchedulePolicy.php?id=' . $this->getObject(); break; case 'round_interval_policy': $link = 'policy/EditRoundIntervalPolicy.php?id=' . $this->getObject(); break; case 'meal_policy': $link = 'policy/EditMealPolicy.php?id=' . $this->getObject(); break; case 'accrual_policy': $link = 'policy/EditAccrualPolicy.php?id=' . $this->getObject(); break; case 'over_time_policy': $link = 'policy/EditOverTimePolicy.php?id=' . $this->getObject(); break; case 'premium_policy': $link = 'policy/EditPremiumTimePolicy.php?id=' . $this->getObject(); break; case 'absence_policy': $link = 'policy/EditAbsencePolicy.php?id=' . $this->getObject(); break; case 'exception_policy_control': $link = 'policy/EditExceptionControlPolicy.php?id=' . $this->getObject(); break; case 'holiday_policy': $link = 'policy/EditHolidayPolicy.php?id=' . $this->getObject(); break; case 'pay_period': $link = 'payperiod/ViewPayPeriod.php?pay_period_id=' . $this->getObject(); break; case 'pay_period_schedule': $link = 'payperiod/EditPayPeriodSchedule.php?id=' . $this->getObject(); break; case 'pay_period_time_sheet_verify': break; case 'pay_stub': break; case 'pay_stub_amendment': $link = 'pay_stub_amendment/EditPayStubAmendment.php?id=' . $this->getObject(); break; case 'pay_stub_entry_account': $link = 'pay_stub/EditPayStubEntryAccount.php?id=' . $this->getObject(); break; case 'pay_stub_entry_account_link': break; case 'recurring_holiday': $link = 'policy/EditRecurringHoliday.php?id=' . $this->getObject(); break; case 'recurring_ps_amendment': $link = 'pay_stub_amendment/EditRecurringPayStubAmendment.php?id=' . $this->getObject(); break; case 'recurring_schedule_control': $link = 'schedule/EditRecurringSchedule.php?id=' . $this->getObject(); break; case 'recurring_schedule_template_control': $link = 'schedule/EditRecurringScheduleTemplate.php?id=' . $this->getObject(); break; case 'user_date_total': break; case 'user_default': $link = 'users/EditUserDefault.php?id=' . $this->getObject(); break; case 'user_generic_data': break; case 'user_preference': $link = 'users/EditUserPreference.php?user_id=' . $this->getObject(); break; case 'users': $link = 'users/EditUser.php?id=' . $this->getObject(); break; case 'company_deduction': $link = 'company/EditCompanyDeduction.php?id=' . $this->getObject(); break; case 'user_deduction': $link = 'users/EditUserDeduction.php?id=' . $this->getObject(); break; case 'user_title': $link = 'users/EditUserTitle.php?id=' . $this->getObject(); break; case 'user_wage': $link = 'users/EditUserWage.php?id=' . $this->getObject(); break; case 'job': $link = 'job/EditJob.php?id=' . $this->getObject(); break; case 'job_item': $link = 'job_item/EditJobItem.php?id=' . $this->getObject(); break; case 'job_item_amendment': $link = 'job_item/EditJobItemAmendment.php?id=' . $this->getObject(); break; case 'document': $link = 'document/EditDocument.php?document_id=' . $this->getObject(); break; case 'document_revision': break; case 'client': $link = 'client/EditClient.php?client_id=' . $this->getObject(); break; case 'client_contact': $link = 'client/EditClientContact.php?id=' . $this->getObject(); break; case 'client_payment': $link = 'client/EditClientPayment.php?id=' . $this->getObject(); break; case 'invoice': $link = 'invoice/EditInvoice.php?id=' . $this->getObject(); break; case 'invoice_config': $link = 'invoice/EditInvoiceConfig.php'; break; case 'invoice_transaction': $link = 'invoice/EditTransaction.php?id=' . $this->getObject(); break; case 'product': $link = 'product/EditProduct.php?id=' . $this->getObject(); break; case 'tax_area_policy': $link = 'invoice_policy/EditTaxAreaPolicy.php?id=' . $this->getObject(); break; case 'tax_policy': $link = 'invoice_policy/EditTaxPolicy.php?id=' . $this->getObject(); break; } if ($link !== FALSE) { $link = Environment::getBaseURL() . $link; } return $link; }
$psenaf->setId($value_arr['id']); } $psenaf->setCompany($current_company->getId()); $psenaf->setPayStubEntryNameId($pay_stub_entry_name_id); $psenaf->setDebitAccount($value_arr['debit_account']); $psenaf->setCreditAccount($value_arr['credit_account']); if ($psenaf->isValid()) { $psenaf->Save(); } } elseif (isset($value_arr['id']) and $value_arr['id'] != '' and $value_arr['debit_account'] == '' and $value_arr['credit_account'] == '') { Debug::Text('Delete: ', __FILE__, __LINE__, __METHOD__, 10); } } //$psenaf->FailTransaction(); $psenaf->CommitTransaction(); Redirect::Page(URLBuilder::getURL(NULL, Environment::getBaseURL() . '/pay_stub/EditPayStubEntryNameAccount.php')); break; default: if (!isset($action)) { BreadCrumb::setCrumb($title); $psenalf = new PayStubEntryNameAccountListFactory(); $psenalf->getByCompanyId($current_company->getId()); foreach ($psenalf as $name_account_obj) { //Debug::Arr($department,'Department', __FILE__, __LINE__, __METHOD__,10); $name_account_data[$name_account_obj->getPayStubEntryNameId()] = array('id' => $name_account_obj->getId(), 'pay_stub_entry_name_id' => $name_account_obj->getPayStubEntryNameId(), 'debit_account' => $name_account_obj->getDebitAccount(), 'credit_account' => $name_account_obj->getCreditAccount(), 'created_date' => $name_account_obj->getCreatedDate(), 'created_by' => $name_account_obj->getCreatedBy(), 'updated_date' => $name_account_obj->getUpdatedDate(), 'updated_by' => $name_account_obj->getUpdatedBy(), 'deleted_date' => $name_account_obj->getDeletedDate(), 'deleted_by' => $name_account_obj->getDeletedBy()); } //Get all accounts $psenlf = new PayStubEntryNameListFactory(); $psenlf->getAll(); $type_options = $psenlf->getOptions('type'); $i = 0;
function sendPasswordResetEmail() { global $config_vars; if ($this->getHomeEmail() != FALSE or $this->getWorkEmail() != FALSE) { if ($this->getWorkEmail() != FALSE) { $primary_email = $this->getWorkEmail(); if ($this->getHomeEmail() != FALSE) { $secondary_email = $this->getHomeEmail(); } else { $secondary_email = NULL; } } else { $primary_email = $this->getHomeEmail(); $secondary_email = NULL; } $this->setPasswordResetKey(md5(uniqid())); $this->setPasswordResetDate(time()); $this->Save(FALSE); if ($config_vars['other']['force_ssl'] == 1) { $protocol = 'https'; } else { $protocol = 'http'; } $subject = APPLICATION_NAME . ' ' . TTi18n::gettext('password reset requested at ') . TTDate::getDate('DATE+TIME', time()) . ' ' . TTi18n::gettext('from') . ' ' . $_SERVER['REMOTE_ADDR']; $body = '<html><body>'; $body .= TTi18n::gettext('A password reset has been requested for') . ' "' . $this->getUserName() . '", '; $body .= ' <a href="' . $protocol . '://' . Misc::getHostName() . Environment::getBaseURL() . 'ForgotPassword.php?action:password_reset=1&key=' . $this->getPasswordResetKey() . '">' . TTi18n::gettext('please click here to reset your password now') . '</a>.'; $body .= '<br><br>'; $body .= TTi18n::gettext('If you did not request your password to be reset, you may ignore this email.'); $body .= '<br><br>'; $body .= '--<br>'; $body .= APPLICATION_NAME; $body .= '</body></html>'; TTLog::addEntry($this->getId(), 500, TTi18n::getText('Employee Password Reset By') . ': ' . $_SERVER['REMOTE_ADDR'] . ' ' . TTi18n::getText('Key') . ': ' . $this->getPasswordResetKey(), NULL, $this->getTable()); $headers = array('From' => '"' . APPLICATION_NAME . ' - ' . TTi18n::gettext('Password Reset') . '"<DoNotReply@' . Misc::getHostName(FALSE) . '>', 'Subject' => $subject, 'Cc' => $secondary_email); $mail = new TTMail(); $mail->setTo($primary_email); $mail->setHeaders($headers); @$mail->getMIMEObject()->setHTMLBody($body); $mail->setBody($mail->getMIMEObject()->get($mail->default_mime_config)); $retval = $mail->Send(); return $retval; } return FALSE; }
function __construct($message) { global $db; //debug_print_backtrace(); $db->FailTrans(); echo "======================================================================<br>\n"; echo "EXCEPTION!<br>\n"; echo "======================================================================<br>\n"; echo "<b>Error message: </b>" . $message . "<br>\n"; echo "<b>Error code: </b>" . $this->getCode() . "<br>\n"; echo "<b>Script Name: </b>" . $this->getFile() . "<br>\n"; echo "<b>Line Number: </b>" . $this->getLine() . "<br>\n"; echo "======================================================================<br>\n"; echo "EXCEPTION!<br>\n"; echo "======================================================================<br>\n"; Debug::Arr(Debug::backTrace(), ' BackTrace: ', __FILE__, __LINE__, __METHOD__, 10); //Dump debug buffer. Debug::Display(); Debug::writeToLog(); Debug::emailLog(); ob_flush(); ob_clean(); Redirect::Page(URLBuilder::getURL(array('exception' => 'GeneralError'), Environment::getBaseURL() . 'DownForMaintenance.php')); exit; }
break; case 'add_mass_punch': Debug::Text('Add Mass Punch!', __FILE__, __LINE__, __METHOD__, 10); if (!$permission->Check('punch', 'enabled') or !($permission->Check('punch', 'edit') or $permission->Check('punch', 'edit_own') or $permission->Check('punch', 'edit_child'))) { $permission->Redirect(FALSE); //Redirect } $comment = TTi18n::gettext('Adding Punches...'); break; case 'add_mass_schedule': Debug::Text('Add Mass Schedule!', __FILE__, __LINE__, __METHOD__, 10); if (!$permission->Check('schedule', 'enabled') or !($permission->Check('schedule', 'edit') or $permission->Check('schedule', 'edit_own') or $permission->Check('schedule', 'edit_child'))) { $permission->Redirect(FALSE); //Redirect } $comment = TTi18n::gettext('Adding Schedule Shifts...'); break; default: $comment = TTi18n::gettext('Test Progress Bar...'); //$smarty->assign_by_ref('user_data', $user_data); break; } /* This suffers from URLs that are too long, especially when coming from Mass Punch/Schedule. Offer a method to store the data in the user_generic_data table, and retreive it on the ProgressBar.php page, bypassing the URL completely. */ $url = URLBuilder::getURL(array('action' => $action, 'pay_period_ids' => $pay_period_ids, 'filter_user_id' => $filter_user_id, 'pay_stub_ids' => $pay_stub_ids, 'data' => $data, 'next_page' => urlencode($next_page)), Environment::getBaseURL() . '/progress_bar/ProgressBar.php'); $smarty->assign_by_ref('comment', $comment); //$smarty->assign_by_ref('next_page', $next_page); $smarty->assign_by_ref('url', $url); $smarty->display('progress_bar/ProgressBarControl.tpl');
private function setCookie() { if ($this->getSessionID()) { $cookie_expires = time() + 7776000; //90 Days if ($this->getEnableExpireSession() === TRUE) { $cookie_expires = 0; //Expire when browser closes. } Debug::text('Cookie Expires: ' . $cookie_expires, __FILE__, __LINE__, __METHOD__, 10); setcookie($this->getName(), NULL, time() + 9999999, Environment::getBaseURL(), NULL, $this->isSSL()); //Delete old directory cookie as it can cause a conflict if it stills exists. //Set cookie in root directory so other interfaces can access it. setcookie($this->getName(), $this->getSessionID(), $cookie_expires, '/', NULL, $this->isSSL()); return TRUE; } return FALSE; }
static function redirectMobileBrowser() { //FIXME: Add GET parameter override to prevent any redirection from happening. //Set mobile=1 extract(FormVariables::GetVariables(array('desktop'))); if (getTTProductEdition() != TT_PRODUCT_COMMUNITY and $desktop != 1) { $browser = self::detectMobileBrowser(); if ($browser == 'ios') { Redirect::Page(URLBuilder::getURL(NULL, Environment::getBaseURL() . '/iphone/punch/punch.php')); } elseif ($browser == 'html5' or $browser == 'android') { Redirect::Page(URLBuilder::getURL(NULL, Environment::getBaseURL() . '/quick_punch/QuickPunchLogin.php')); } elseif ($browser == 'wap') { Redirect::Page(URLBuilder::getURL(NULL, Environment::getBaseURL() . '/wap/WAPPunch.php')); } } else { Debug::Text('Desktop browser override: ' . (int) $desktop, __FILE__, __LINE__, __METHOD__, 10); } return FALSE; }
function getPreLoginData($api = NULL) { global $config_vars; return array('primary_company_id' => PRIMARY_COMPANY_ID, 'base_url' => Environment::getBaseURL(), 'api_url' => Environment::getAPIURL($api), 'api_base_url' => Environment::getAPIBaseURL($api), 'api_json_url' => Environment::getAPIURL('json'), 'images_url' => Environment::getImagesURL(), 'powered_by_logo_enabled' => $this->isPoweredByLogoEnabled(), 'product_edition' => $this->getTTProductEdition(FALSE), 'product_edition_name' => $this->getTTProductEdition(TRUE), 'deployment_on_demand' => $this->getDeploymentOnDemand(), 'web_session_expire' => (isset($config_vars['other']['web_session_expire']) and $config_vars['other']['web_session_expire'] != '') ? (bool) $config_vars['other']['web_session_expire'] : FALSE, 'analytics_enabled' => $this->isAnalyticsEnabled(), 'registration_key' => $this->getRegistrationKey(), 'http_host' => $this->getHTTPHost(), 'application_version' => $this->getApplicationVersion(), 'is_logged_in' => $this->isLoggedIn(), 'language_options' => Misc::addSortPrefix(TTi18n::getLanguageArray()), 'language' => TTi18n::getLanguageFromLocale(TTi18n::getLocaleCookie())); }
function Redirect($result) { if ($result !== TRUE) { Redirect::Page(URLBuilder::getURL(NULL, Environment::getBaseURL() . '/permission/PermissionDenied.php')); } return TRUE; }
form: {}, searchForm: {}, invoice: {}, currency: {}, punch: {}, schedule: {} }; }(); //Schedule functions TIMETREX.schedule = function() { return { editSchedule: function( scheduleID, userID, date, status_id, start_time, end_time, schedule_policy_id, absence_policy_id) { try { eS=window.open('<?php echo Environment::getBaseURL(); ?> schedule/EditSchedule.php?id='+ encodeURI(scheduleID) +'&user_id='+ encodeURI(userID) +'&date_stamp='+ encodeURI(date) +'&status_id='+ encodeURI(status_id) +'&start_time='+ encodeURI(start_time) +'&end_time='+ encodeURI(end_time) +'&schedule_policy_id='+ encodeURI(schedule_policy_id) +'&absence_policy_id='+ encodeURI(absence_policy_id),"Edit_Schedule","toolbar=0,status=1,menubar=0,scrollbars=1,fullscreen=no,width=580,height=470,resizable=1"); } catch (e) { //DN } } }; }(); //Punch/Edit Punch functions TIMETREX.punch = function() { return { selectJobOption: function( src_quick_job_id, src_job_id ) { if ( isUndefined( src_quick_job_id ) ) { quick_job_obj = document.getElementById('quick_job_id');
static function FormatArray($nodes, $type = 'HTML', $include_root = FALSE) { $type = strtolower($type); if ($include_root === TRUE) { if (!is_array($nodes)) { $nodes = array(); } $root_node = array('id' => 0, 'name' => 'Root', 'level' => 0); array_unshift($nodes, $root_node); } if ($nodes === FALSE) { return FALSE; } foreach ($nodes as $node) { switch ($type) { case 'no_tree_text': $spacing = str_repeat('| ', $node['level'] * 1); $text = $node['name']; break; case 'text': $spacing = str_repeat('| ', $node['level'] * 1); $text = $spacing . $node['name']; break; case 'plain_text': $spacing = str_repeat('| ', $node['level'] * 1); $text = $spacing . $node['name']; break; case 'html': $width = ($node['level'] - 1) * 20; $spacing = '<img src="' . Environment::getBaseURL() . 'images/s.gif" width="' . $width . '">'; $text = $spacing . ' ' . $node['name']; break; case 'array': break; } $node['spacing'] = $spacing; $node['text'] = $text; $retarr[] = $node; unset($node); } return $retarr; }
function getLatestVersionURL() { if (isset($_SERVER["HTTPS"])) { $prefix = 'https'; } else { $prefix = 'http'; } $retval = $prefix . '://' . $_SERVER["HTTP_HOST"] . '/' . Environment::getBaseURL() . '/help/Timetrex_Client.exe'; Debug::text('Client URL: ' . $retval, __FILE__, __LINE__, __METHOD__, 10); return $retval; }
function emailException($u_obj, $user_date_obj, $ep_obj = NULL) { if (!is_object($u_obj)) { return FALSE; } if (!is_object($user_date_obj)) { return FALSE; } if (!is_object($ep_obj)) { $ep_obj = $this->getExceptionPolicyObject(); } //Only email on active exceptions. if ($this->getType() != 50) { return FALSE; } $email_to_arr = $this->getEmailExceptionAddresses($u_obj, $ep_obj); if ($email_to_arr == FALSE) { return FALSE; } $from = 'DoNotReply@' . Misc::getHostName(FALSE); $to = array_shift($email_to_arr); Debug::Text('To: ' . $to, __FILE__, __LINE__, __METHOD__, 10); if (is_array($email_to_arr) and count($email_to_arr) > 0) { $bcc = implode(',', $email_to_arr); } else { $bcc = NULL; } $exception_email_subject = ' #exception_name# (#exception_code#) ' . TTi18n::gettext('exception for') . ' #employee_first_name# #employee_last_name# ' . TTi18n::gettext('on') . ' #date#'; $exception_email_body = TTi18n::gettext('Employee:') . ' #employee_first_name# #employee_last_name#' . "\n"; $exception_email_body .= TTi18n::gettext('Date:') . ' #date#' . "\n"; $exception_email_body .= TTi18n::gettext('Exception:') . ' #exception_name# (#exception_code#)' . "\n"; $exception_email_body .= TTi18n::gettext('Severity:') . ' #exception_severity#' . "\n"; $exception_email_body .= TTi18n::gettext('Link:') . ' <a href="http://' . Misc::getHostName() . Environment::getBaseURL() . '">' . APPLICATION_NAME . ' ' . TTi18n::gettext('Login') . '</a>'; //Define subject/body variables here. $search_arr = array('#employee_first_name#', '#employee_last_name#', '#exception_code#', '#exception_name#', '#exception_severity#', '#date#', '#link#'); $replace_arr = array($u_obj->getFirstName(), $u_obj->getLastName(), $ep_obj->getType(), Option::getByKey($ep_obj->getType(), $ep_obj->getOptions('type')), Option::getByKey($ep_obj->getSeverity(), $ep_obj->getOptions('severity')), TTDate::getDate('DATE', $user_date_obj->getDateStamp()), NULL); //For some reason the EOL defaults to \r\n, which seems to screw with Amavis if (!defined('MAIL_MIMEPART_CRLF')) { define('MAIL_MIMEPART_CRLF', "\n"); } $subject = str_replace($search_arr, $replace_arr, $exception_email_subject); Debug::Text('Subject: ' . $subject, __FILE__, __LINE__, __METHOD__, 10); $headers = array('From' => $from, 'Subject' => $subject, 'Bcc' => $bcc, 'Reply-To' => $to, 'Return-Path' => $to, 'Errors-To' => $to); Debug::Arr($headers, 'Headers: ', __FILE__, __LINE__, __METHOD__, 10); $body = '<pre>' . str_replace($search_arr, $replace_arr, $exception_email_body) . '</pre>'; Debug::Text('Body: ' . $body, __FILE__, __LINE__, __METHOD__, 10); $mail = new TTMail(); $mail->setTo($to); $mail->setHeaders($headers); @$mail->getMIMEObject()->setHTMLBody($body); $mail->setBody($mail->getMIMEObject()->get()); $retval = $mail->Send(); if ($retval == TRUE) { TTLog::addEntry($this->getId(), 500, TTi18n::getText('Email Exception to') . ': ' . $to . ' Bcc: ' . $headers['Bcc'], NULL, $this->getTable()); return TRUE; } return TRUE; }
static function Display() { $crumbs = self::getCrumbs(); if (is_array($crumbs)) { $crumbs = array_reverse($crumbs); } //var_dump($crumbs); $links[] = '<a href="' . Environment::getBaseURL() . '">' . TTi18n::gettext(self::$home_name) . '</a>'; if ($crumbs != FALSE) { $total_crumbs = count($crumbs); $i = 1; foreach ($crumbs as $crumb) { if ($i == 1 and $crumb['name'] == 'Home') { } else { if ($i == $total_crumbs) { $links[] = TTi18n::gettext($crumb['name']); } else { if ($crumb['name'] != 'Home') { $links[] = '<a href="' . $crumb['url'] . '">' . TTi18n::gettext($crumb['name']) . '</a>'; } } } $i++; } } return implode(self::$seperator, $links); }
public static function setLocaleCookie($locale = NULL) { if ($locale == '') { $locale = self::getLocale(); } setcookie('language', $locale, time() + 9999999, Environment::getBaseURL()); return TRUE; }
private function destroyCookie() { setcookie($this->getName(), NULL, time() + 9999999, Environment::getBaseURL(), NULL, $this->isSSL()); return TRUE; }
$profiler->stopTimer("Interface.inc - Check for UNREAD messages..."); $profiler->startTimer("Interface.inc - Check for Exceptions"); $elf = new ExceptionListFactory(); $elf->getFlaggedExceptionsByUserIdAndPayPeriodStatus($current_user->getId(), 10); $display_exception_flag = FALSE; if ($elf->getRecordCount() > 0) { foreach ($elf as $e_obj) { if ($e_obj->getColumn('severity_id') == 30) { $display_exception_flag = 'red'; } elseif ($e_obj->getColumn('severity_id') == 20) { $display_exception_flag = 'yellow'; } break; } } unset($elf, $e_obj); if (isset($display_exception_flag)) { Debug::text('Exception Flag to Display: ' . $display_exception_flag, __FILE__, __LINE__, __METHOD__, 10); $smarty->assign_by_ref('display_exception_flag', $display_exception_flag); //Make sure we leave this variable around for the menu.js.php. } $profiler->stopTimer("Interface.inc - Check for Exceptions"); } } if (isset($current_station)) { $smarty->assign_by_ref('current_station', $current_station); } $smarty->assign('BASE_URL', Environment::getBaseURL()); $smarty->assign('global_script_start_time', $global_script_start_time); $smarty->assign('profiler', $profiler); $smarty->assign_by_ref('permission', $permission);
$baf->setUser($bank_data['user_id']); } elseif ($bank_data['company_id'] != '' and $bank_data['user_id'] == '' and $permission->Check('company', 'edit_own_bank')) { Debug::Text('Specified Company', __FILE__, __LINE__, __METHOD__, 10); //Company bank. $baf->setCompany($bank_data['company_id']); } else { $permission->Redirect(FALSE); } if (isset($bank_data['institution'])) { $baf->setInstitution($bank_data['institution']); } $baf->setTransit($bank_data['transit']); $baf->setAccount($bank_data['account']); if ($baf->isValid()) { $baf->Save(); Redirect::Page(URLBuilder::getURL(array('user_id' => $user_id, 'company_id' => $company_id, 'data_saved' => TRUE), Environment::getBaseURL() . '/bank_account/EditBankAccount.php')); break; } default: $balf = new BankAccountListFactory(); $ulf = new UserListFactory(); if ($user_id == '' and $company_id == '' and $permission->Check('user', 'edit_own_bank')) { //Current user $balf->getUserAccountByCompanyIdAndUserId($current_company->getId(), $current_user->getId()); $user_id = $current_user->getId(); $user_obj = $ulf->getByIdAndCompanyId($user_id, $current_company->getId())->getCurrent(); $country = $user_obj->getCountry(); } elseif ($user_id != '' and $permission->Check('user', 'edit_bank')) { //Specified User $balf->getUserAccountByCompanyIdAndUserId($current_company->getId(), $user_id); $user_obj = $ulf->getByIdAndCompanyId($user_id, $current_company->getId())->getCurrent();