Esempio n. 1
0
function ftt_save_log($sPath, $sLogName, $sMsg)
{
    global $application_folder;
    // by codeignitor
    if (substr($sPath, 0, 1) == '/') {
        $sPath = substr($sPath, 1);
    }
    if (substr($sPath, -1) != '/') {
        $sPath .= '/';
    }
    $sLogFile = dirname($application_folder) . '/application/logs/' . $sPath . date("Ym") . '/' . $sLogName . '_' . date('Ymd') . '.txt';
    $oLog = ftt_get_instance('ftt/SimpleLog');
    $oLog->setFile($sLogFile);
    $nSize = $oLog->save($sMsg . "\n");
    return $nSize;
}
Esempio n. 2
0
 /**
  * Constructor.  Accepts one parameter containing the database
  * connection settings.
  *
  * @param array
  */
 function __construct($params)
 {
     if (is_array($params)) {
         foreach ($params as $key => $val) {
             $this->{$key} = $val;
         }
         if (isset($params['hostname'])) {
             // backup for retry // modified by itraveler
             $this->org_hostname_port['hostname'] = $params['hostname'];
         }
         if (isset($params['port'])) {
             $this->org_hostname_port['port'] = $params['port'];
         }
         if (isset($params['ikey'])) {
             $db_account_loader = ftt_get_instance('ftt/DBAccountLoader');
             $db_account = $db_account_loader->load($params['ikey']);
             if ($db_account == null) {
                 log_message('error', "invalid ikey ('{$params['ikey']}')");
             } else {
                 $this->username = $db_account->id;
                 $this->password = $db_account->pw;
             }
         }
     }
     log_message('debug', 'Database Driver Class Initialized');
 }