function edit($args) { throw new Exception('Look at ticket #1527'); if (_Core_Request::getCurrent()->method == 'POST') { $params = $_POST; isset($params['id']) ? 1 : ($pda = 1); isset($params['id']) ? 1 : ($params['id'] = $args[0]); $account = Account::load($params); if (!$account->update($this->user, $params)) { $this->tpl->assign('error', array('text' => 'Счёт не удалён')); } $this->tpl->assign('result', array('text' => 'Счёт успешно изменён')); $this->tpl->assign('name_page', 'info_panel/info_panel'); } else { $acm = new Account_Model(); $acc = $acm->getAccountPdaInformation($args[0]); $this->tpl->assign('acc', $acc); $this->tpl->assign('name_page', 'account/edit'); } }
function load($returnType = RETURN_BOOLEAN) { global $dbh; $query = ' SELECT `name` , `dateJoined` FROM `userDetails` WHERE `uniqueID` = "' . $this->getUniqueID() . '"'; switch ($returnType) { case RETURN_BOOLEAN: default: // return a boolean result $returnValue = false; parent::load(); try { $statement = $dbh->prepare($query); $statement->execute(); $row = $statement->fetch(); $this->setName($row["name"]); $this->setDateJoined($row["dateJoined"]); $returnValue = true; } catch (PDOException $e) { print "Error[ 102 ]: " . $e->getMessage() . "<br/>"; die; } break; case "1": // return the query $returnValue = $query; break; } return $returnValue; }
/** * Создает и записывает бухгалтерскую проводку * * @param mixed $acc_d id или код дебетового счета * @param mixed $acc_c id или код кредитового счета * @param mixed $amount Сумма (в копейках) Отрицательное значение выполняет сторнирование. * @param mixed $document_id документ-основание * @param mixed $document_date дата документа * * @return возвращает сообщение об ошибке иначе пустую строку */ public static function AddEntry($acc_d, $acc_c, $amount, $document_id, $document_date) { if ($amount == 0) { return; } $dt = Account::load($acc_d); if ($dt == false && $acc_d > 0) { return "Неверный код счета '{$acc_d}'"; } $ct = Account::load($acc_c); if ($ct == false && $acc_c > 0) { return "Неверный код счета '{$acc_c}'"; } $entry = new Entry(); $entry->acc_d = $acc_d == -1 ? 0 : $dt->acc_code; //дебетовый счет $entry->acc_c = $acc_c == -1 ? 0 : $ct->acc_code; //кредитовый счет $entry->amount = $amount; $entry->document_id = $document_id; $entry->document_date = $document_date; $entry->Save(); return ""; }
function calc_accts() { global $DB, $error_ar; echo "Billing accounts ...\n"; $start_time = microtime(1); //$n = 0; $account_result = $DB->make_select('Accounts'); //$account_result = $DB->make_select('Accounts', '', "`status`='Open'"); for ($n = 0; $account_row = $DB->row($account_result); $n++) { $status = $account_row['status']; $amount = $account_row['amount']; $bonustime = $account_row['bonustime']; //$statusinfo = $account_row['statusinfo']; $NOW = date('Y-m-d H:i:s'); $now = strtotime($NOW); //$now = time(); $addsql = array(); if ($status == 'Active') { $account = new Account(); $account->load($account_row); list($amount, $bonustime, $closetime) = $account->getBalance(); $ostperiod = $closetime - $now; $ostdays = round($ostperiod / iDAY, 0); $addsql['closetime'] = date('Y-m-d H:i:s', $closetime); if ($ostperiod + iDAY * $account->billing_opts['credit_days'] <= 0) { echo "Suspend account {$account->domain} (id={$account->id})\n"; if (ACTION) { if ($account->suspend(false)) { } $account->mail_send(3); } } elseif ($ostdays == 7 || $ostdays == 3 || $ostdays <= 1) { echo "Send mail to account {$account->domain} ({$account->contact->Email}) with '{$status}' status about close date in {$ostdays} days\n"; if (ACTION) { $account->mail_send(2); } } unset($account); $addsql['amount'] = $amount; $addsql['bonustime'] = $bonustime; } elseif ($status == 'Open') { $account = new Account(); $account->load($account_row); //$amount = 0; $bonustime = 0; $period_live = $now - strtotime($account_row['opentime']); $days_live = round($period_live / iDAY, 0); if ($days_live == 25) { if (ACTION) { $account->mail_send(2); } echo "Send mail to account {$account->domain} ({$account->contact->Email}) with '{$status}' status about close date in {$ostdays} days\n"; } elseif ($days_live >= 30) { echo "Close account {$account->domain} (id={$account->id})\n"; if (ACTION) { if ($account->suspend(false)) { } $account->mail_send(3); } } unset($account); //$addsql['amount'] = $amount; //$addsql['bonustime'] = $bonustime; } elseif ($status == 'Suspend') { $account = new Account(); $account->load($account_row); $period = $now - strtotime($account_row['closetime']); if ($period >= 60 * iDAY) { echo "Delete account {$account_row['domain']} (id={$account_row['AccountID']})\n"; if (ACTION) { log_event('delete account', 'notice', '', $account_row['AccountID'], $account_row['ResellerID']); $whm = new WhmAPI($account->ServerID); $result = $whm->killacct($account); if ($result) { //echo nl2br($whm->xml->rawout); } else { echo $whm->geterrmsg(); } } $addsql['status'] = 'Deleted'; //$addsql['statusinfo'] = "$statusinfo\nautomatic deleted $NOW"; } } elseif ($status == 'Deleted') { $addsql['lastproc'] = 0; // pack and archive account if closetime > 6 * iMON } elseif ($status == 'Staff') { // our accounts } else { $error_ar[] = "Unknown Status for account {$account_row['domain']} (id={$account_row['AccountID']})\n"; } if (ACTION) { $addsql['lastproc'] = $NOW; $result = $DB->make_update('Accounts', '`AccountID`=' . $account_row['AccountID'], $addsql); } //$n++; } echo "Finished Step. {$n} account calculated. Time " . intval((microtime(1) - $start_time) * 1000) . "ms.\n\n"; }
$s->prefs['name'] = trim($_POST["defname"]); $s->nickname = trim($_POST["nickname"]); $s->fullname = trim($_POST["fullname"]); $s->email = trim($_POST["email"]); if (in_array($_POST["country"], $country_codes)) { $s->country = $_POST["country"]; } if (in_array($_POST["language"], $language_codes)) { $s->language = $_POST["language"]; } if (in_array($_POST["timezone"], $timezone_strings)) { $s->timezone = $_POST["timezone"]; } $s->prefs = $_POST["kvp"]; $s->save(); $s->load($s->id); $_SESSION["user"]["id"] = $s->id; $_SESSION["user"]["prefs"] = $s->prefs; $_SESSION["user"]["nick"] = !empty($s->nickname) ? $s->nickname : $_SESSION["user"]["nick"]; $_SESSION["user"]["fullname"] = $s->fullname; $_SESSION["user"]["apikey"] = $s->apikey; $_SESSION["user"]["guid"] = $s->guid; $_SESSION["user"]["adminLevel"] = $s->adminLevel; $_SESSION["user"]["timezone"] = $s->timezone; } if (!$s) { Template::Error("No Such Account", _("Sorry, your account could not be found.")); exit; } $t->assign('account', &$s); $t->assign('countries', &$country_codes);
<?php # controllers/paybill.php # Logic $account = new Account(); $account->load(['bill_id' => Route::param('id'), 'user_id' => Auth::user()->id]); if ($account->id) { $account->paid = 1; $account->save(); } # Redirect URL::redirect('/');
static function load_accounts($columns = null, $filter = null, $sortby = null, $sortdir = null, $limit = null, $start = null) { global $DB, $FOUND_ROWS; $result = $DB->make_select('Accounts', $columns, $filter, $sortby, $sortdir, $limit, $start); $FOUND_ROWS = $DB->row($DB->query_adv('SELECT FOUND_ROWS()')); $FOUND_ROWS = $FOUND_ROWS['FOUND_ROWS()']; $dbo_array = array(); //$count = $DB->count($result); //raw($count); while ($data = $DB->row($result)) { $dbo = new Account(); $dbo->load($data); $dbo_array[] = $dbo; } //$result->free(); return $dbo_array; }
$acct = Account::existsByOID($_SESSION["user"]["official"]); if ($acct === false) { $acct = Account::createAccount(); $acct->addUsername($_SESSION["user"]["official"], $_SESSION["user"]["username"]); $acct->setDetails($id, $sreg); //$acct->save(); if (isset($_COOKIE["pbguid"])) { $acct->setGUID($_COOKIE["pbguid"]); } $acct->setAPIKey(makeApiKey()); $acct = new Account($acct->id); } else { $acct = new Account($acct); $acct->updateLastLogin(); } $acct->load($acct->id); $_SESSION["user"]["id"] = $acct->id; $_SESSION["user"]["prefs"] = $acct->prefs; $_SESSION["user"]["nick"] = !empty($acct->nickname) ? $acct->nickname : $openid; $_SESSION["user"]["fullname"] = $acct->fullname; $_SESSION["user"]["apikey"] = $acct->apikey; $_SESSION["user"]["guid"] = $acct->guid; $_SESSION["user"]["adminLevel"] = $acct->adminLevel; $_SESSION["user"]["timezone"] = $acct->timezone; } else { Template::Simple("New OpenID Associated", "Thank you! Your new OpenID username has been associated with this account. You may now <a href='/settings.php'>continue with more settings</a>."); exit; } session_write_close(); if (isset($_GET["redir"])) { if (preg_match(',/login\\.php$,', $_GET["redir"])) {
$this->id = $record['record_id']; $this->parent = $record['parentid']; $this->itemType = intval($record['itemtype']); $this->title = $record['title']; $this->description = $record['description']; $this->phone = $record['phone']; $this->email = $record['email']; $this->image = "demo/images/photos/" . $record['photo']; $this->href = "showdetails.php?recordid=" . $this->id; } } // create hash and group all children by parentid $items = array(); while ($record = mysql_fetch_array($response)) { $account = new Account(); $account->load($record); array_push($items, $account); } function encodeURIComponent($str) { $revert = array('%21' => '!', '%2A' => '*', '%27' => "'", '%28' => '(', '%29' => ')'); return strtr(rawurlencode($str), $revert); } // serialize $rootAccount object including all its children into JSON string $jsonstring = encodeURIComponent(json_encode($items)); ?> <!DOCTYPE html> <html> <head> <title>jQuery Widget Hierarchical Chart PHP Demo</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />