public function show()
 {
     //if(!$this->id) return '';
     global $LANG, $lInfo, $DB;
     list($amount, $bonustime, $closetime) = $this->getBalance();
     //list($amount2,$bonustime2,$closetime2) = $this->getBalance_old();
     $whois = new Whois($this->domain);
     if (!empty($this->domain)) {
         $result = $DB->make_select('Domains', '*', "`username`='{$this->username}' AND `ServerID`='{$this->ServerID}'");
         if (!($row = $DB->row($result))) {
             $DB->make_insert('Domains', array('name' => $this->domain, 'username' => $this->username, 'ServerID' => $this->ServerID));
             $result = $DB->make_select('Domains', '*', "`username`='{$this->username}' AND `ServerID`='{$this->ServerID}'");
             $row = $DB->row($result);
         }
         $domain = new Domain();
         $domain->load($row);
         if (!empty($domain->expirate)) {
             $domain_str = "<a href='http://{$this->domain}' target='_blank'>{$this->domain}</a>" . '<br />Истекает: ' . $domain->expirate;
         } else {
             //if($_SERVER['HTTP_HOST'] != 'localhost') {
             if ($whois->is_available()) {
                 $domain_str = "<a href='http://{$this->ServerID}/~{$this->username}/' target='_blank'>{$this->domain} [Not Delegeted]</a>";
             } else {
                 $whois_parsed = $whois->parsed_info();
                 $domain_str = "<a href='http://{$this->domain}' target='_blank'>{$this->domain}</a>" . '<br />Истекает: ' . $whois_parsed['expirate'];
                 $domain->expirate = $whois_parsed['expirate'];
                 $DB->make_update('Domains', '`DomainID`=' . $domain->id, array('expirate' => $domain->expirate));
             }
             //}else $domain_str = "<a href='http://$this->domain' target='_blank'>$this->domain</a>";
         }
     } else {
         $domain_str = "<a href='http://{$this->domain}' target='_blank'>{$this->domain}</a>";
     }
     $show = beginTable("{$LANG['AccountDetails']} c ID {$this->id} , {$this->reseller->label}", '100%');
     $show .= StaticField($LANG['Domain'], $domain_str);
     $show .= StaticField($LANG['Server'], $this->ServerID);
     if (!empty($this->ServerID)) {
         $show .= StaticField('Проверить', '<a href="http://' . $this->ServerID . '/~' . $this->username . '/">' . $this->ServerID . '/~' . $this->username . '</a>');
     }
     $show .= StaticField($LANG['Username'], $this->username);
     $show .= StaticField($LANG['Password'], $this->password);
     $show .= StaticField('Дата Создания', date('d.m.Y H:i:s', strtotime($this->opentime)));
     $show .= '<tr><td colspan="2">Биллинг:</td></tr>';
     $show .= StaticField($LANG['Status'], Account::show_status($this->status));
     if ($this->status == 'Suspend' || $this->status == 'Deleted') {
         $show .= StaticField('Остановлен', '<b>' . date('d.m.Y H:i', strtotime($this->closetime)) . '</b>');
     } else {
         $show .= StaticField('Оплачен по', date('d.m.Y H:i', $closetime));
         if ($this->billing_opts['credit_days'] > 0) {
             $show .= StaticField('Проработает до', date('d.m.Y H:i', $closetime + iDAY * $this->billing_opts['credit_days']));
         }
     }
     $show .= StaticField($LANG['Amount'], '<b>' . round($amount, 2) . ' руб.</b>');
     $show .= StaticField($LANG['Bonus'], '<b>' . round($bonustime / iDAY, 1) . '</b> дн.');
     //$show .= StaticField('OLD | Оплачен по', date('d.m.Y H:i', $closetime2));
     //$show .= StaticField('OLD | '.$LANG['Amount'], '<b>'.round($amount2,2).' руб.</b>');
     //$show .= StaticField('OLD | '.$LANG['Bonus'], '<b>'.round($bonustime2/iDAY,1).'</b> дн.');
     $show .= StaticField('Макс. глубина минуса', $this->billing_opts['negativ_days'] . ' дн.');
     $show .= StaticField('Возможный кредит', $this->billing_opts['credit_days'] . ' дн.');
     $show .= StaticField($LANG['Package'], '<a href="' . iSELF . '?object=package&amp;action=show&amp;PackageID=' . $this->package->id . '">' . $this->package->title . ' (' . round($this->package->price, 2) . ' руб.)</a>');
     $show .= '<tr><td colspan="2">Доп. информация:</td></tr>';
     $show .= StaticField($LANG['Client_type'], $lInfo[$this->contype]);
     $show .= StaticField('RUCenter Anketa', $this->info['ruanketa']);
     $show .= StaticField('<a href="?object=account&amp;action=edit_comment&amp;AccountID=' . $this->id . '">' . Account::$LANG['comment'] . '</a>', '<pre>' . $this->info['comment'] . '</pre>');
     $show .= StaticField('Последний вход', $this->lastlogin == '0000-00-00 00:00:00' ? 'никогда' : date('d.m.Y H:i', strtotime($this->lastlogin)));
     if ($this->itsResellerID) {
         $show .= StaticField('Система управления бизнесом', '<font color="blue"><b>' . $this->itsResellerID . '</b></font>');
     }
     $show .= endTable();
     $show .= '<br />' . $this->contact->show();
     return $show;
 }
 public static function load_domains($columns = null, $filter = null, $sortby = null, $sortdir = null, $limit = null, $start = null)
 {
     global $DB;
     $result = $DB->make_select('Domains', $columns, $filter, $sortby, $sortdir, $limit, $start);
     $domain_array = array();
     while ($data = $DB->row($result)) {
         $domain = new Domain();
         $domain->load($data);
         $domain_array[] = $domain;
     }
     return $domain_array;
 }