当前位置: 首页>>代码示例>>PHP>>正文


PHP template::add_message方法代码示例

本文整理汇总了PHP中template::add_message方法的典型用法代码示例。如果您正苦于以下问题:PHP template::add_message方法的具体用法?PHP template::add_message怎么用?PHP template::add_message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在template的用法示例。


在下文中一共展示了template::add_message方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($parts = array())
 {
     // Initialize
     global $config, $template;
     // Set variables
     if ($config['is_setup'] == 1 && preg_match("/^admin/", trim($_GET['route'], '/'))) {
         $panel = 'admin';
         $require_login = true;
     } else {
         $panel = 'public';
         $require_login = false;
     }
     // Check IP restrictions
     if ($panel == 'admin' && isset($config['ipallow']) && $config['ipallow'] != '') {
         $ok = false;
         $ips = explode("\n", $config['ipallow']);
         foreach ($ips as $ip) {
             if (preg_match("/^{$ip}/", $_SERVER['REMOTE_ADDR'])) {
                 $ok = true;
                 break;
             }
         }
         if ($ok === false) {
             echo "Access dened by IP restrictions.";
             exit(0);
         }
     }
     // Continue setup, if needed
     if (DBNAME == '' && isset($_POST['submit']) && $_POST['submit'] == tr('Continue to Next Step')) {
         // Initialize
         $template = new template('admin/setup/first_time2');
         require_once SITE_PATH . '/data/lib/sqlparser.php';
         // Check database connection
         if (!mysqli_connect($_POST['dbhost'], $_POST['dbuser'], $_POST['dbpass'], $_POST['dbname'], $_POST['dbport'])) {
             $template->add_message("Unable to connect to mySQL database using information supplied.  Please double check the mySQL information, and try again.", 'error');
         }
         if (!is_writeable(SITE_PATH . '/data/config.php')) {
             $template->add_message("Unable to write to file at /data/config.php.  Please change file permissions appropriately, and reload the page.", 'error');
         }
         if (!is_writeable(SITE_PATH . '/data/backups')) {
             $template->add_message("Unable to write to directory at /data/backups/.  Please change directory permissions appropriately, and reload the page.", 'error');
         }
         if (!is_writeable(SITE_PATH . '/data/log')) {
             $template->add_message("Unable to write to directory at /data/log/.  Please change directory permissions appropriately, and reload the page.", 'error');
         }
         if (!is_writeable(SITE_PATH . '/data/tpl_c')) {
             $template->add_message("Unable to write to directory at /data/tpl_c/.  Please change directory permissions appropriately, and reload the page.", 'error');
         }
         // Check for errors
         if ($template->has_errors == 1) {
             $template->route = 'admin/setup/first_time';
             echo $template->parse();
             exit(0);
         }
         // Define MeekroDB settings
         DB::$dbName = $_POST['dbname'];
         DB::$user = $_POST['dbuser'];
         DB::$password = $_POST['dbpass'];
         DB::$host = $_POST['dbhost'];
         DB::$port = $_POST['dbport'];
         // Parse sql
         $sql_lines = SqlParser::parse(file_get_contents(SITE_PATH . '/data/sql/install.sql'));
         foreach ($sql_lines as $line) {
             DB::query($line);
         }
         // Save config.php file
         $conf = "<?php\n";
         $conf .= "define('DBNAME', '" . $_POST['dbname'] . "');\n";
         $conf .= "define('DBUSER', '" . $_POST['dbuser'] . "');\n";
         $conf .= "define('DBPASS', '" . $_POST['dbpass'] . "');\n";
         $conf .= "define('DBHOST', '" . $_POST['dbhost'] . "');\n";
         $conf .= "define('DBPORT', '" . $_POST['dbport'] . "');\n";
         $conf .= "define('COOKIE_NAME', '" . generate_random_string(6) . "');\n";
         $conf .= "define('ENCRYPT_PASS', '" . generate_random_string(32) . "');\n";
         $conf .= "define('TESTNET', 0);\n";
         $conf .= "?>\n";
         // Save config file
         file_put_contents(SITE_PATH . '/data/config.php', $conf);
         // Parse template
         echo $template->parse();
         exit(0);
     } elseif ($config['is_setup'] != '1' && isset($_POST['_setup_step']) && $_POST['_setup_step'] == '2') {
         // Initialize
         $template = new template('admin/setup/first_time3');
         if (strlen($_POST['username']) < 4) {
             $template->add_message('Administrator username must be at least 4 characters in length.', 'error');
         }
         // Create user
         $user = new user();
         $user->create(1);
         // Update config vars
         update_config_var('site_name', $_POST['site_name']);
         update_config_var('company_name', $_POST['company_name']);
         // Check for errors
         if ($template->has_errors == 1) {
             $template->route = 'admin/setup/first_time2';
         } else {
             // Login
             $auth = new auth();
             $auth->login('admin', false);
//.........这里部分代码省略.........
开发者ID:nachatate,项目名称:synala,代码行数:101,代码来源:default.php

示例2: array

                break;
            }
        }
        if ($found === false) {
            array_push($no_keys, array('num' => $num, 'public_key' => $public_key));
            $num++;
        }
    }
    // Print response
    if (count($no_keys) > 0) {
        $template = new template('admin/setup/invalid_bip32_keys');
        $template->assign('keys', $no_keys);
        $template->parse();
        exit(0);
    } else {
        $template->add_message('Successfully verified public keys, and all private keys match appropriately.');
    }
}
// Initialize
$bip32 = new bip32();
// Get wallets
$first = true;
$bip32_key_fields = '';
$required_sigs = 0;
$wallet_id = 0;
$wallet_javascript = '';
$wallet_options = '';
$rows = DB::query("SELECT * FROM coin_wallets WHERE status = 'active' ORDER BY display_name");
foreach ($rows as $row) {
    $wallet_id = $row['id'];
    $balance = $bip32->get_balance($row['id']);
开发者ID:nachatate,项目名称:synala,代码行数:31,代码来源:wallets.php

示例3: User

// Initialize
global $template;
$registration_successful = false;
// Create new user
if (isset($_POST['submit']) && $_POST['submit'] == tr('Register Now')) {
    $user = new User();
    $userid = $user->create();
    // Redirect to payment, if needed
    if ($template->has_errors != 1) {
        // Login
        $auth = new auth();
        $auth->login('public', false);
        // Redirect, as needed
        if ($_POST['is_payment'] == 1) {
            $template = new template('pay');
            $template->add_message("Successfully created new user, {$_POST['username']}.  You may now login with your account.");
            $template->parse();
            exit(0);
        } else {
            $template->add_message("Successfully created new user, {$_POST['username']}.  You may now login with your account.");
        }
    }
}
// Set variables
if (isset($_REQUEST['is_payment']) && $_REQUEST['is_payment'] == 1) {
    $is_payment = 1;
    $amount = $_REQUEST['amount'];
    $currency = $_REQUEST['currency'];
    $wallet_id = $_REQUEST['wallet_id'];
    $product_id = $_REQUEST['product_id'];
} else {
开发者ID:nachatate,项目名称:synala,代码行数:31,代码来源:register.php

示例4: add_wallet

 public function add_wallet()
 {
     // Initialize
     global $template;
     $enc_client = new encrypt();
     // Set variables
     $required_sigs = $_POST['address_type'] == 'standard' ? 1 : $_POST['multisig_sig_required'];
     $total_sigs = $_POST['address_type'] == 'standard' ? 1 : $_POST['multisig_sig_total'];
     // Validate public keys
     if ($_POST['autogen_keys'] == 0) {
         for ($x = 1; $x <= $total_sigs; $x++) {
             if (!($import = $this->import($_POST['bip32_key' . $x]))) {
                 $template->add_message("The #{$x} BIP32 key you specified is an invalid BIP32 key.", 'error');
             } elseif ($import['type'] != 'public') {
                 $template->add_message("The #{$x} BIP32 key you specified is an invalid BIP32 key.", 'error');
             }
         }
     }
     // Create wallet, if no errors
     $wallet_id = 0;
     if ($template->has_errors != 1) {
         // Add to DB
         DB::insert('coin_wallets', array('address_type' => $_POST['address_type'], 'sigs_required' => $required_sigs, 'sigs_total' => $total_sigs, 'display_name' => $_POST['wallet_name']));
         $wallet_id = DB::insertId();
         // Gather BIP32 keys
         $keys = array();
         for ($x = 1; $x <= $total_sigs; $x++) {
             // Auto-generate, if needed
             if ($_POST['autogen_keys'] == 1) {
                 $private_key = $this->generate_master_key();
                 $public_key = $this->extended_private_to_public($private_key);
                 array_push($keys, array('num' => $x, 'private_key' => $private_key, 'public_key' => $public_key));
             } else {
                 $public_key = $_POST['bip32_key' . $x];
             }
             // Add key to db
             DB::insert('coin_wallets_keys', array('wallet_id' => $wallet_id, 'public_key' => $enc_client->encrypt($public_key)));
         }
         // User message
         if ($_POST['autogen_keys'] == 1) {
             $template = new template('admin/setup/bip32_keys');
             $template->assign('keys', $keys);
             $template->parse();
             exit(0);
         } else {
             $template->add_message("Successfully added new wallet, {$_POST['wallet_name']}");
         }
     }
     // Return
     return $wallet_id;
 }
开发者ID:nachatate,项目名称:synala,代码行数:51,代码来源:bip32.php

示例5: invalid_login

 private function invalid_login($type = 'public')
 {
     // Init template
     if ($type == 'admin') {
         $template = new template('admin/login');
     } else {
         $template = new template('login');
     }
     // User message
     $template->add_message("Incorrect username or password specified.  Please try again.", 'error');
     $template->parse();
     exit(0);
 }
开发者ID:nachatate,项目名称:synala,代码行数:13,代码来源:auth.php

示例6: elseif

<?php

// Initialize
global $template;
$show_user_list = false;
// Search users, if needed
if (isset($_POST['submit']) && $_POST['submit'] == tr('Manage User')) {
    // Search for users
    $rows = DB::query("SELECT * FROM users WHERE username LIKE %ss OR email LIKE %ss", $_POST['username'], $_POST['username']);
    $num = DB::affectedRows();
    // Manage user
    if ($num > 1) {
        $show_user_list = true;
    } elseif ($num == 1) {
        $_REQUEST['username'] = $rows[0]['username'];
        $template = new template('admin/user/manage2');
        echo $template->parse();
        exit(0);
    } else {
        $template->add_message("No users match the username or e-mail address {$_POST['username']}.  Please try again.");
    }
}
// Template variables
$template->assign('show_user_list', $show_user_list);
开发者ID:nachatate,项目名称:synala,代码行数:24,代码来源:manage.php


注:本文中的template::add_message方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。