<?php require_once 'init.php'; // Redirect user to login page if not logged in if (!User::is_logged_in()) { redirect(); } $user = new User($_SESSION['user_id']); // Require admin access: if (!$user->is_admin()) { redirect(); } $assets_ids = Asset::get_assets(); $assets = array(); foreach ($assets_ids as $asset_id) { $asset = Asset::init($asset_id, $config['asset'][$asset_id]['properties']); $short_name = $config['asset'][$asset_id]['properties']['short_name']; $class = 'CryptoNote_Wallet_' . $asset->short_name; if (!class_exists($class)) { $class = 'CryptoNote_Wallet'; } $wallet = new $class($config['asset'][$asset_id]['wallet_host'], $config['asset'][$asset_id]['wallet_port']); $class = 'CryptoNote_Daemon_' . $asset->short_name; if (!class_exists($class)) { $class = 'CryptoNote_Daemon'; } $daemon = new $class($config['asset'][$asset_id]['daemon_host'], $config['asset'][$asset_id]['daemon_port']); $assets[] = array('id' => $asset_id, 'config' => $config['asset'][$asset_id], 'class' => $asset, 'wallet' => $wallet, 'daemon' => $daemon, 'wallet_ready' => $wallet->is_responding()); } include 'views/admin/dashboard.php';
<?php require_once 'init.php'; if (User::is_logged_in()) { $user = new User($_SESSION['user_id']); $asset = Asset::init(XMR, $config['asset'][XMR]['properties']); $asset_config = $config['asset'][XMR]; $asset_id = $asset->get_id(); $user_id = $user->id(); $payment_id = null; $balance = null; $balance = $asset->get_balance($user); $payment_id = $asset->get_payment_id($user); // If payment id was not found, create one if (!$payment_id or isset($_POST['new_payment_id'])) { $asset->create_payment_id($user); refresh(); } if (isset($_POST['withdraw_xmr'])) { $amount = trim($_POST['xmr_amount']); // Prepare POST data $post = array('address' => trim($_POST['xmr_address']), 'payment_id' => trim($_POST['xmr_payment_id']), 'amount' => $amount, 'mixin' => filter_var($_POST['xmr_mixin'], FILTER_VALIDATE_INT, array('options' => array('default' => $asset_config['default_mixin'], 'min_range' => $asset_config['min_mixin'], 'max_range' => $asset_config['max_mixin']))), 'receivable_amount' => bc::op($amount, '-', $asset_config['withdraw_fee']), 'asset_id' => $asset->id); if (!csrf_check($_POST['csrf_token'])) { $error->set('xmr_address', 'Invalid CSRF, session expired. Please refresh.'); } if (!$asset->valid_address($post['address'])) { $error->set('xmr_address', 'Please enter a valid XMR Address'); } if (!$asset->valid_payment_id($post['payment_id'])) { $error->set('xmr_payment_id', 'Please enter a valid Payment ID (64 characters, alpha-numeric string) or leave the field empty to send without payment id'); }
protected function init(&$data) { parent::init($data); $this->assetRefs += array('parent'); $this->propMap['asset_genre'] = array('parent' => 'genre_parent', 'title' => 'genre_title', 'description' => 'genre_description'); }
protected function init(&$data) { parent::init($data); $this->assetRefs += array('source', 'origSource'); $this->propMap['asset_video'] = array('source' => 'video_source', 'origSource' => 'video_orig_source', 'title' => 'video_title', 'lossy' => 'video_lossy', 'type' => 'video_type', 'copyright' => 'video_copyright', 'license' => 'video_license', 'width' => 'video_xres', 'height' => 'video_yres', 'depth' => 'video_depth', 'chroma' => 'video_chroma', 'fps' => 'video_fps', 'frames' => 'video_frames', 'seqformat' => 'video_seqformat'); }
protected function init(&$data) { parent::init($data); $this->assetRefs += array('source', 'origSource'); $this->propMap['asset_picture'] = array('source' => 'picture_source', 'origSource' => 'picture_orig_source', 'title' => 'picture_title', 'lossy' => 'picture_lossy', 'type' => 'picture_type', 'copyright' => 'picture_copyright', 'license' => 'picture_license', 'width' => 'picture_xres', 'height' => 'picture_yres', 'depth' => 'picture_depth', 'chroma' => 'picture_chroma', 'filename' => 'picture_filename'); }