Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for scripts/php/sk-nic/SK-NIC.php between version 1.1 and 1.2

version 1.1, 2007/03/11 03:49:48 version 1.2, 2007/03/11 03:54:40
Line 13 
Line 13 
  *   *
  */   */
   
 /* $Platon$ */  /* $Platon: scripts/php/sk-nic/SK-NIC.php,v 1.1 2007-03-11 03:49:48 nepto Exp $ */
   
 require_once 'DB.php';  require_once 'DB.php';
   
Line 85  class SK_NIC
Line 85  class SK_NIC
   
         function _cleanImport() /* {{{ */          function _cleanImport() /* {{{ */
         {          {
                 $result = $this->_db->query('DELETE FROM domains_import');                  $result = $this->_db->query('DELETE FROM sknic_domains_import');
                 DB::isError($result) && $this->error($result);                  DB::isError($result) && $this->error($result);
         } /* }}} */          } /* }}} */
   
Line 111  class SK_NIC
Line 111  class SK_NIC
                         $dt_valid = strtotime($dt_valid);                          $dt_valid = strtotime($dt_valid);
                         $dt_valid = date('Y-m-d', $dt_valid);                          $dt_valid = date('Y-m-d', $dt_valid);
   
                         $query = sprintf('INSERT INTO domains_import'                          $query = sprintf('INSERT INTO sknic_domains_import'
                                         .' (domain,id_reg,id_owner,flag,status,ns1,ns2,ns3,ns4,ico_owner,dt_valid,dt_changed)'                                          .' (domain,id_reg,id_owner,flag,status,ns1,ns2,ns3,ns4,ico_owner,dt_valid,dt_changed)'
                                         .' VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',                                          .' VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)',
                                         $this->_db->quote($domain), $this->_db->quote($id_reg), $this->_db->quote($id_owner),                                          $this->_db->quote($domain), $this->_db->quote($id_reg), $this->_db->quote($id_owner),
Line 132  class SK_NIC
Line 132  class SK_NIC
         {          {
                 static $dt_deleted = null;                  static $dt_deleted = null;
                 if ($dt_deleted == null) {                  if ($dt_deleted == null) {
                         $dt_deleted = $this->_db->getOne('select distinct dt_changed from domains_import');                          $dt_deleted = $this->_db->getOne('select distinct dt_changed from sknic_domains_import');
                         if (strlen($dt_deleted) <= 0) {                          if (strlen($dt_deleted) <= 0) {
                                 $dt_deleted = date('Y-m-d');                                  $dt_deleted = date('Y-m-d');
                         }                          }
                 }                  }
                 $history_cols = $this->_tableColumns('domains_history');                  $history_cols = $this->_tableColumns('sknic_domains_history');
                 $cols = '';                  $cols = '';
                 $vals = '';                  $vals = '';
                 foreach ($history_cols as $col) {                  foreach ($history_cols as $col) {
Line 147  class SK_NIC
Line 147  class SK_NIC
                                 $vals .= ',';                                  $vals .= ',';
                         }                          }
                 }                  }
                 $query = sprintf('INSERT INTO domains_history'                  $query = sprintf('INSERT INTO sknic_domains_history'
                                 .' (%s dt_deleted) VALUES (%s %s)',                                  .' (%s dt_deleted) VALUES (%s %s)',
                                 $cols, $vals,                                  $cols, $vals,
                                 $deleted ? $this->_db->quote($dt_deleted) : 'NULL');                                  $deleted ? $this->_db->quote($dt_deleted) : 'NULL');
Line 156  class SK_NIC
Line 156  class SK_NIC
                 $this->_db->popExpect();                  $this->_db->popExpect();
                 if (DB::isError($result)) {                  if (DB::isError($result)) {
                         if ($result->getCode() == DB_ERROR_ALREADY_EXISTS) {                          if ($result->getCode() == DB_ERROR_ALREADY_EXISTS) {
                                 echo 'WARNING: domains_history entry already exists',"\n";                                  echo 'WARNING: sknic_domains_history entry already exists',"\n";
                         } else {                          } else {
                                 $this->error($result);                                  $this->error($result);
                         }                          }
Line 170  class SK_NIC
Line 170  class SK_NIC
                         $update_str .= "$col = ".$this->_db->quote($rec["i_$col"]).',';                          $update_str .= "$col = ".$this->_db->quote($rec["i_$col"]).',';
                 }                  }
                 $update_str = substr($update_str, 0, strlen($update_str) - 1);                  $update_str = substr($update_str, 0, strlen($update_str) - 1);
                 $query = sprintf('UPDATE domains SET %s WHERE domain = %s',                  $query = sprintf('UPDATE sknic_domains SET %s WHERE domain = %s',
                                 $update_str,                                  $update_str,
                                 $this->_db->quote($rec['c_domain']));                                  $this->_db->quote($rec['c_domain']));
                 $result = $this->_db->query($query);                  $result = $this->_db->query($query);
Line 179  class SK_NIC
Line 179  class SK_NIC
   
         function _insertDomain($rec) /* {{{ */          function _insertDomain($rec) /* {{{ */
         {          {
                 $columns = $this->_tableColumns('domains');                  $columns = $this->_tableColumns('sknic_domains');
                 $cols = '';                  $cols = '';
                 $vals = '';                  $vals = '';
                 foreach ($columns as $col) {                  foreach ($columns as $col) {
Line 191  class SK_NIC
Line 191  class SK_NIC
                 }                  }
                 $cols = substr($cols, 0, strlen($cols) - 1);                  $cols = substr($cols, 0, strlen($cols) - 1);
                 $vals = substr($vals, 0, strlen($vals) - 1);                  $vals = substr($vals, 0, strlen($vals) - 1);
                 $query = sprintf('INSERT INTO domains'                  $query = sprintf('INSERT INTO sknic_domains'
                                 .' (%s) VALUES (%s)',                                  .' (%s) VALUES (%s)',
                                 $cols, $vals);                                  $cols, $vals);
                 $result = $this->_db->query($query);                  $result = $this->_db->query($query);
Line 201  class SK_NIC
Line 201  class SK_NIC
         function doComparison() /* {{{ */          function doComparison() /* {{{ */
         {          {
                 $changed        = 0;                  $changed        = 0;
                 $import_cols    = $this->_tableColumns('domains_import');                  $import_cols    = $this->_tableColumns('sknic_domains_import');
                 $domains_cols   = $this->_tableColumns('domains');                  $domains_cols   = $this->_tableColumns('sknic_domains');
   
                 $query = 'SELECT 1';                  $query = 'SELECT 1';
                 foreach ($import_cols as $col) {                  foreach ($import_cols as $col) {
Line 211  class SK_NIC
Line 211  class SK_NIC
                 foreach ($domains_cols as $col) {                  foreach ($domains_cols as $col) {
                         $query .= ",c.$col AS c_$col"; // 'c' means "current"                          $query .= ",c.$col AS c_$col"; // 'c' means "current"
                 }                  }
                 $query .= ' FROM domains_import i %s domains c';                  $query .= ' FROM sknic_domains_import i %s sknic_domains c';
                 $query .= ' ON i.domain = c.domain';                  $query .= ' ON i.domain = c.domain';
   
                 //$data = array();                  //$data = array();
Line 232  class SK_NIC
Line 232  class SK_NIC
                                         //echo 'deleted domain: ',$rec['c_domain'],"\n";                                          //echo 'deleted domain: ',$rec['c_domain'],"\n";
                                         $changed++;                                          $changed++;
                                         $this->_writeDomainHistory($rec, 1);                                          $this->_writeDomainHistory($rec, 1);
                                         $query = sprintf('DELETE FROM domains WHERE domain = %s',                                          $query = sprintf('DELETE FROM sknic_domains WHERE domain = %s',
                                                         $this->_db->quote($rec['c_domain']));                                                          $this->_db->quote($rec['c_domain']));
                                         $result = $this->_db->query($query);                                          $result = $this->_db->query($query);
                                         DB::isError($result) && $this->error($result);                                          DB::isError($result) && $this->error($result);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top