function remoteSave()
 {
     $ttsc = new TimeTrexSoapClient();
     if ((getTTProductEdition() == TT_PRODUCT_PROFESSIONAL or $ttsc->isUpdateNotifyEnabled() == TRUE) and PRODUCTION == TRUE and DEMO_MODE == FALSE) {
         $ttsc->sendCompanyData($this->getId());
         $ttsc->sendCompanyVersionData($this->getId());
         return TRUE;
     }
     return FALSE;
 }
Beispiel #2
0
 function Send()
 {
     Debug::Text('Attempting to send email To: ' . $this->getTo(), __FILE__, __LINE__, __METHOD__, 10);
     if ($this->getTo() == FALSE) {
         Debug::Text('To Address invalid...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     if ($this->getBody() == FALSE) {
         Debug::Text('Body invalid...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     Debug::Text('Sending Email To: ' . $this->getTo() . ' Body Size: ' . strlen($this->getBody()) . ' Method: ' . $this->getDeliveryMethod(), __FILE__, __LINE__, __METHOD__, 10);
     if (PRODUCTION == FALSE) {
         Debug::Text('Not in production mode, not sending emails...', __FILE__, __LINE__, __METHOD__, 10);
         //$to = 'root@localhost';
         return FALSE;
     }
     if (DEMO_MODE == TRUE) {
         Debug::Text('In DEMO mode, not sending emails...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     switch ($this->getDeliveryMethod()) {
         case 'smtp':
         case 'mail':
             $send_retval = $this->getMailObject()->send($this->getTo(), $this->getMIMEHeaders(), $this->getBody());
             if (PEAR::isError($send_retval)) {
                 Debug::Text('Send Email Failed... Error: ' . $send_retval->getMessage(), __FILE__, __LINE__, __METHOD__, 10);
                 $send_retval = FALSE;
             }
             break;
         case 'soap':
             $ttsc = new TimeTrexSoapClient();
             $send_retval = $ttsc->sendEmail($this->getTo(), $this->getMIMEHeaders(), $this->getBody());
             break;
     }
     if ($send_retval == TRUE) {
         return TRUE;
     }
     Debug::Arr($send_retval, 'Send Email Failed!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
 function getLatestTimeTrexVersion()
 {
     if ($this->checkSOAP() == 0) {
         $ttsc = new TimeTrexSoapClient();
         return $ttsc->getSoapObject()->getInstallerLatestVersion();
     }
     return FALSE;
 }
            $obj = $sslf->getCurrent();
        } else {
            $obj = new SystemSettingListFactory();
        }
        $obj->setName('anonymous_update_notify');
        if (isset($data['anonymous_update_notify']) and $data['anonymous_update_notify'] == 1) {
            $obj->setValue(1);
        } elseif (getTTProductEdition() == TT_PRODUCT_PROFESSIONAL) {
            $obj->setValue(0);
        } else {
            $obj->setValue(0);
        }
        if ($obj->isValid()) {
            $obj->Save();
        }
        $ttsc = new TimeTrexSoapClient();
        $ttsc->saveRegistrationKey();
        $handle = fopen('http://www.timetrex.com/' . URLBuilder::getURL(array('v' => $install_obj->getFullApplicationVersion(), 'page' => 'system_setting', 'update_notify' => (int) $data['update_notify'], 'anonymous_update_notify' => (int) $data['anonymous_update_notify']), 'pre_install.php'), "r");
        fclose($handle);
        Redirect::Page(URLBuilder::getURL(array('external_installer' => $external_installer), 'Company.php'));
        break;
    default:
        Debug::Text('Request URI: ' . $_SERVER['REQUEST_URI'], __FILE__, __LINE__, __METHOD__, 10);
        $data = array('host_name' => $_SERVER['HTTP_HOST'], 'base_url' => str_replace('/install', '', dirname($_SERVER['REQUEST_URI'])), 'log_dir' => $config_vars['path']['log'], 'storage_dir' => $config_vars['path']['storage'], 'cache_dir' => $config_vars['cache']['dir']);
        $smarty->assign_by_ref('data', $data);
        break;
}
$handle = @fopen('http://www.timetrex.com/' . URLBuilder::getURL(array('v' => $install_obj->getFullApplicationVersion(), 'page' => 'system_setting'), 'pre_install.php'), "r");
@fclose($handle);
$smarty->assign_by_ref('install_obj', $install_obj);
$smarty->assign_by_ref('external_installer', $external_installer);
 * "Powered by TimeTrex" logo. If the display of the logo is not reasonably
 * feasible for technical reasons, the Appropriate Legal Notices must display
 * the words "Powered by TimeTrex".
 ********************************************************************************/
/*
 * $Revision: 1396 $
 * $Id: CheckForUpdate.php 1396 2007-11-07 16:49:35Z ipso $
 * $Date: 2007-11-07 08:49:35 -0800 (Wed, 07 Nov 2007) $
 */
/*
 * Checks for any version updates...
 *
 */
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'global.inc.php';
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'CLI.inc.php';
$ttsc = new TimeTrexSoapClient();
if ($ttsc->isUpdateNotifyEnabled() == TRUE) {
    $clf = new CompanyListFactory();
    $clf->getAll();
    if ($clf->getRecordCount() > 0) {
        $i = 0;
        foreach ($clf as $c_obj) {
            if ($ttsc->getLocalRegistrationKey() == FALSE or $ttsc->getLocalRegistrationKey() == '') {
                $ttsc->saveRegistrationKey();
            }
            //We must ensure that the data is up to date
            //Otherwise version check will fail.
            $ttsc->sendCompanyData($c_obj->getId());
            $ttsc->sendCompanyUserLocationData($c_obj->getId());
            $ttsc->sendCompanyUserCountData($c_obj->getId());
            $ttsc->sendCompanyVersionData($c_obj->getId());
 static function updateCurrencyRates($company_id)
 {
     /*
     	Contact info@timetrex.com to request adding custom currency data feeds.
     */
     $base_currency = FALSE;
     $clf = TTnew('CurrencyListFactory');
     $clf->getByCompanyId($company_id);
     if ($clf->getRecordCount() > 0) {
         foreach ($clf as $c_obj) {
             if ($c_obj->getBase() == TRUE) {
                 $base_currency = $c_obj->getISOCode();
             }
             if ($c_obj->getStatus() == 10 and $c_obj->getAutoUpdate() == TRUE) {
                 $active_currencies[] = $c_obj->getISOCode();
             }
         }
     }
     unset($clf, $c_obj);
     if ($base_currency != FALSE and isset($active_currencies) and is_array($active_currencies) and count($active_currencies) > 0) {
         $ttsc = new TimeTrexSoapClient();
         $currency_rates = $ttsc->getCurrencyExchangeRates($company_id, $active_currencies, $base_currency);
     } else {
         Debug::Text('Invalid Currency Data, not getting rates...', __FILE__, __LINE__, __METHOD__, 10);
     }
     if (isset($currency_rates) and is_array($currency_rates) and count($currency_rates) > 0) {
         foreach ($currency_rates as $currency => $rate) {
             if (is_numeric($rate)) {
                 $clf = TTnew('CurrencyListFactory');
                 $clf->getByCompanyIdAndISOCode($company_id, $currency);
                 if ($clf->getRecordCount() == 1) {
                     $c_obj = $clf->getCurrent();
                     if ($c_obj->getAutoUpdate() == TRUE) {
                         $c_obj->setActualRate($rate);
                         $c_obj->setConversionRate($c_obj->getPercentModifiedRate($rate));
                         $c_obj->setActualRateUpdatedDate(time());
                         if ($c_obj->isValid()) {
                             $c_obj->Save();
                         }
                     }
                 }
             } else {
                 Debug::Text('Invalid rate from data feed! Currency: ' . $currency . ' Rate: ' . $rate, __FILE__, __LINE__, __METHOD__, 10);
             }
         }
         return TRUE;
     }
     Debug::Text('Updating Currency Data Failed...', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }
Beispiel #7
0
             $permission_arr[$section] = $permission->Check($section, 'enabled');
         }
         $encoded_data = array('company_name' => $current_company->getName(), 'product_edition' => $current_company->getProductEdition(), 'version' => $system_settings['system_version'], 'registration_key' => $system_settings['registration_key'], 'first_name' => $current_user->getFirstName(), 'last_name' => $current_user->getLastName(), 'work_email' => $current_user->getWorkEmail(), 'permissions' => $permission_arr);
         if (function_exists('gzdeflate')) {
             $encoded_data = urlencode(base64_encode(gzdeflate(serialize($encoded_data))));
         } else {
             $encoded_data = urlencode(base64_encode(serialize($encoded_data)));
         }
         //Debug::Text(' Encoded Data ('.strlen($encoded_data).'): '. $encoded_data, __FILE__, __LINE__, __METHOD__,10);
     }
     Redirect::Page(URLBuilder::getURL(array('data' => $encoded_data), 'https://www.timetrex.com/university.php'));
     exit;
     break;
 case 'check_for_updates':
     Debug::Text('Check For Update!', __FILE__, __LINE__, __METHOD__, 10);
     $ttsc = new TimeTrexSoapClient();
     //We must ensure that the data is up to date
     //Otherwise version check will fail.
     $ttsc->sendCompanyData($current_company->getId(), TRUE);
     $ttsc->sendCompanyUserLocationData($current_company->getId());
     $ttsc->sendCompanyUserCountData($current_company->getId());
     $ttsc->sendCompanyVersionData($current_company->getId());
     $latest_version = $ttsc->isLatestVersion($current_company->getId());
     $latest_tax_engine_version = $ttsc->isLatestTaxEngineVersion($current_company->getId());
     $latest_tax_data_version = $ttsc->isLatestTaxDataVersion($current_company->getId());
     $sslf = new SystemSettingListFactory();
     $sslf->getByName('new_version');
     if ($sslf->getRecordCount() == 1) {
         $obj = $sslf->getCurrent();
     } else {
         $obj = new SystemSettingListFactory();
Beispiel #8
0
 function isNewVersionAvailable($ytd = 0, $all_companies = FALSE)
 {
     Debug::Text('Check For Update!', __FILE__, __LINE__, __METHOD__, 10);
     $current_company = $this->getCurrentCompanyObject();
     $data = $this->getAboutData($ytd, $all_companies);
     $ttsc = new TimeTrexSoapClient();
     //We must ensure that the data is up to date
     //Otherwise version check will fail.
     $ttsc->sendCompanyData($current_company->getId(), TRUE);
     $ttsc->sendCompanyUserLocationData($current_company->getId());
     $ttsc->sendCompanyUserCountData($current_company->getId());
     $ttsc->sendCompanyVersionData($current_company->getId());
     $license = new TTLicense();
     $license->getLicenseFile(FALSE);
     //Download updated license file if one exists.
     $latest_version = $ttsc->isLatestVersion($current_company->getId());
     $latest_tax_engine_version = $ttsc->isLatestTaxEngineVersion($current_company->getId());
     $latest_tax_data_version = $ttsc->isLatestTaxDataVersion($current_company->getId());
     $sslf = TTnew('SystemSettingListFactory');
     $sslf->getByName('new_version');
     if ($sslf->getRecordCount() == 1) {
         $obj = $sslf->getCurrent();
     } else {
         $obj = TTnew('SystemSettingListFactory');
     }
     $obj->setName('new_version');
     if ($latest_version == FALSE or $latest_tax_engine_version == FALSE or $latest_tax_data_version == FALSE) {
         $obj->setValue(1);
         $data['new_version'] = TRUE;
     } else {
         $obj->setValue(0);
         $data['new_version'] = FALSE;
     }
     if ($obj->isValid()) {
         $obj->Save();
     }
     return $this->returnHandler($data);
 }
 function Send()
 {
     Debug::Text('Attempting to send email To: ' . $this->getTo(), __FILE__, __LINE__, __METHOD__, 10);
     if ($this->getTo() == FALSE) {
         Debug::Text('To Address invalid...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     if ($this->getBody() == FALSE) {
         Debug::Text('Body invalid...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     if (PRODUCTION == FALSE) {
         Debug::Text('Not in production mode, not sending emails...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     if (DEMO_MODE == TRUE) {
         Debug::Text('In DEMO mode, not sending emails...', __FILE__, __LINE__, __METHOD__, 10);
         return FALSE;
     }
     /*
     		if ( PRODUCTION == FALSE ) {
     			$to = 'root@localhost';
     		}
     */
     Debug::Text('Sending Email To: ' . $this->getTo() . ' Body Size: ' . strlen($this->getBody()) . ' Method: ' . $this->getDeliveryMethod(), __FILE__, __LINE__, __METHOD__, 10);
     //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");
     }
     switch ($this->getDeliveryMethod()) {
         case 'smtp':
         case 'mail':
             $send_retval = $this->getMailObject()->send($this->getTo(), $this->getMIMEHeaders(), $this->getBody());
             break;
         case 'soap':
             $ttsc = new TimeTrexSoapClient();
             $send_retval = $ttsc->sendEmail($this->getTo(), $this->getMIMEHeaders(), $this->getBody());
             break;
     }
     if ($send_retval == TRUE) {
         return TRUE;
     }
     Debug::Arr($send_retval, 'Send Email Failed!', __FILE__, __LINE__, __METHOD__, 10);
     return FALSE;
 }