function updateRawCoin($marketname, $symbol, $name = 'unknown') { if ($symbol == 'BTC') { return; } $coin = getdbosql('db_coins', "symbol=:symbol", array(':symbol' => $symbol)); if (!$coin) { debuglog("new coin {$marketname} {$symbol} {$name}"); $coin = new db_coins(); $coin->txmessage = true; $coin->hassubmitblock = true; $coin->name = $name; $coin->symbol = $symbol; $coin->created = time(); $coin->save(); mail(YAAMP_ADMIN_EMAIL, "New coin {$symbol}", "new coin {$symbol} ({$name}) on {$marketname}"); sleep(30); } else { if ($coin->name == 'unknown' && $name != 'unknown') { $coin->name = $name; $coin->save(); } } $list = getdbolist('db_coins', "symbol=:symbol or symbol2=:symbol", array(':symbol' => $symbol)); foreach ($list as $coin) { $market = getdbosql('db_markets', "coinid={$coin->id} and name='{$marketname}'"); if (!$market) { $market = new db_markets(); $market->coinid = $coin->id; $market->name = $marketname; } $market->deleted = false; $market->save(); } ///////// // if($coin->enable || !empty($coin->algo) || !empty($coin->errors) || $coin->name == 'unknown') return; // debuglog("http://www.cryptocoinrank.com/$coin->name"); // $data = file_get_contents("http://www.cryptocoinrank.com/$coin->name"); // if($data) // { // $b = preg_match('/Algo: <span class=\"d-gray\">(.*)<\/span>/', $data, $m); // if($b) // { // $coin->errors = trim($m[1]); // $coin->save(); // } // } }
public function actionCreate() { if (!$this->admin) { return; } $coin = new db_coins(); $coin->txmessage = true; $coin->created = time(); if (isset($_POST['db_coins'])) { $coin->attributes = $_POST['db_coins']; if ($coin->save()) { $this->redirect(array('index')); } } $this->render('_form', array('coin' => $coin, 'update' => false)); }
public function actionCreate() { if (!$this->admin) { return; } $coin = new db_coins(); $coin->txmessage = true; $coin->created = time(); $coin->index_avg = 1; $coin->difficulty = 1; $coin->installed = 1; $coin->visible = 1; // $coin->deposit_minimum = 1; $coin->lastblock = ''; if (isset($_POST['db_coins'])) { $coin->attributes = $_POST['db_coins']; if ($coin->save()) { $this->redirect(array('admin')); } } $this->render('coin_form', array('update' => false, 'coin' => $coin)); }