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


PHP main类代码示例

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


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

示例1: getFile

 private function getFile($name, $prepare = 1, $override = 0, $showit = 0)
 {
     global $dbh, $postvar, $getvar, $instance;
     $link = "../themes/" . THEME . "/" . $name;
     if (!file_exists($link) || $override == 1) {
         $link = INC . "/" . $name;
     }
     if (!file_exists($link)) {
         $link = "../install/" . $name;
     }
     if (!file_exists($link)) {
         $link = $name;
     }
     if (!file_exists($link) && INSTALL == 1) {
         $error['Error'] = "File doesn't exist!";
         $error['Path'] = $link;
         main::error($error);
     } else {
         if ($prepare) {
             return self::prepare(file_get_contents($link));
         } else {
             return file_get_contents($link);
         }
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:25,代码来源:class_style.php

示例2: run

 public function run()
 {
     include main::getPluginDir() . '/libs/classes/aws-autoloader.php';
     $ad = $this->params['access_details'];
     main::log(lang::get('Start copy files to Amazon S3', false));
     $files = $this->params['files'];
     $dir = isset($ad['dir']) ? $ad['dir'] : '/';
     $credentials = new Aws\Common\Credentials\Credentials($ad['AccessKeyId'], $ad['SecretAccessKey']);
     $client = Aws\S3\S3Client::factory(array('credentials' => $credentials));
     try {
         $n = count($files);
         for ($i = 0; $i < $n; $i++) {
             $filePath = preg_replace('#[/\\\\]+#', '/', BACKUP_DIR . '/' . $dir . '/' . $files[$i]);
             $key = $dir ? $dir . '/' . basename($filePath) : basename($filePath);
             $key = ltrim(preg_replace('#[/\\\\]+#', '/', $key), '/');
             //if first will be '/', file not will be uploaded, but result will be ok
             $putRes = $client->putObject(array("Bucket" => $ad['bucket'], 'Key' => $key, 'Body' => fopen($filePath, 'r+')));
             if (isset($putRes['RequestId']) && !empty($putRes['RequestId'])) {
                 main::log(str_replace('%s', basename($filePath), lang::get("File(%s) Upload successfully to Amazon S3", false)));
             }
         }
         main::log(lang::get('End copy files to Amazon S3', false));
     } catch (Exception $e) {
         main::log('Error send to Amazon s3: ' . $e->getMessage());
         $this->setError($e->getMessage());
         return false;
     } catch (S3Exception $e) {
         main::log('Error send to Amazon s3: ' . $e->getMessage());
         $this->setError($e->getMessage());
         return false;
     }
     return true;
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:33,代码来源:send-to-s3.php

示例3: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     $client_data = $dbh->client($_SESSION['cuser']);
     $packages_data = $dbh->select("packages", array("id", "=", $client_data['pid']));
     $view_package_array['USER'] = $client_data['user'];
     $view_package_array['SIGNUP'] = main::convertdate("n/d/Y", $client_data['signup']);
     $view_package_array['DOMAIN'] = $client_data['domain'];
     $view_package_array['PACKAGE'] = $packages_data['name'] . " <a href = '?page=upgrade'>Change</a>";
     $view_package_array['DESCRIPTION'] = $packages_data['description'];
     if ($_POST) {
         if (crypto::passhash($postvar['currentpass'], $client_data['salt']) == $client_data['password']) {
             if ($postvar['newpass'] == $postvar['cpass']) {
                 $cmd = main::changeClientPassword($client_data['id'], $postvar['newpass']);
                 if ($cmd === true) {
                     main::errors("Details updated!");
                 } else {
                     main::errors((string) $cmd);
                 }
             } else {
                 main::errors("Your passwords don't match!");
             }
         } else {
             main::errors("Your current password wasn't correct!");
         }
     }
     echo style::replaceVar("tpl/client/view-package.tpl", $view_package_array);
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:28,代码来源:view.php

示例4: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     if (!$dbh->config("delacc")) {
         die('This feature has been disabled.');
     } else {
         if ($_POST) {
             $user = $_SESSION['cuser'];
             $pass = $postvar['password'];
             $client = $dbh->client($user);
             unset($where);
             $where[] = array("is_paid", "=", "0", "AND");
             $where[] = array("uid", "=", $user);
             $balance_query = $dbh->select("invoices", $where, 0, "1", 1);
             if ($dbh->num_rows($balance_query) != 0) {
                 main::errors("You can't close your account with an outstanding balance.  Please contact an administrator for assistance or pay any unpaid invoices.");
             }
             if (crypto::passhash($pass, $client['salt']) == $client['password']) {
                 if (server::terminate($client['id'], "", 1)) {
                     main::errors("Your account has been cancelled successfully.");
                     session_destroy();
                 } else {
                     main::errors("Your account wasn't cancelled.  Please try again or contact your system administrator.");
                 }
             } else {
                 main::errors("The password entered is incorrect.");
             }
         }
         echo style::replaceVar("tpl/client/delete-account.tpl");
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:31,代码来源:delete.php

示例5: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     if ($_POST) {
         check::empty_fields();
         if (!main::errors()) {
             $user = $dbh->staff($_SESSION['user']);
             if (!$user['password']) {
                 main::errors("Wrong username!?");
             } else {
                 if (crypto::passhash($postvar['old'], $user['salt']) == $user['password']) {
                     if ($postvar['new'] != $postvar['confirm']) {
                         main::errors("Your passwords don't match!");
                     } else {
                         $salt = crypto::salt();
                         $newpass = crypto::passhash($postvar['new'], $salt);
                         $update_staff = array("password" => $newpass, "salt" => $salt);
                         $dbh->update("staff", $update_staff, array("id", "=", $_SESSION['user']));
                         main::errors("Password changed!");
                     }
                 } else {
                     main::errors("Your old password was wrong!");
                 }
             }
         }
     }
     echo style::replaceVar("tpl/admin/change-admin-password.tpl");
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:28,代码来源:pass.php

示例6: submit_paypal_post

    function submit_paypal_post()
    {
        global $dbh, $postvar, $getvar, $instance;
        echo "<form action=" . $this->paypal_url . " method='post' name='frm'>";
        foreach ($this->fields as $a => $b) {
            if ($a == "amount") {
                if ($b == "0") {
                    $user_data = $dbh->select("users", array("id", "=", $_SESSION['cuser']));
                    $signup_date = date("m-d-Y", $user_data['signup']);
                    if ($signup_date == date("m-d-Y")) {
                        $noemail = "1";
                    }
                    invoice::set_paid($getvar['iid'], $noemail);
                    main::redirect("../client/?page=invoices");
                    exit;
                }
            }
            echo "<input type='hidden' name='" . $a . "' value='" . $b . "'>";
        }
        echo '</form>
		<script language="JavaScript">
		document.frm.submit();
		</script>';
        exit;
    }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:25,代码来源:paypal.class.php

示例7: getInstance

 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new main();
         self::$instance->_init();
     }
     return self::$instance;
 }
开发者ID:nil12285,项目名称:restapi,代码行数:8,代码来源:main.php

示例8: __construct

 function __construct($data)
 {
     if (!$data) {
         main::log('ERROR', 'data not defined', true);
     }
     if (!is_array($data)) {
         main::log('ERROR', 'data is not an array', true);
     }
     $this->data = $data;
 }
开发者ID:psyb0t,项目名称:websiteMaster.php,代码行数:10,代码来源:actContext.php

示例9: empty_fields

 public function empty_fields($omit = array())
 {
     global $dbh, $postvar, $getvar, $instance;
     foreach ($postvar as $key => $value) {
         if ($value == "" && !$n && !in_array($key, $omit)) {
             main::errors("Please fill in all the fields!");
             $n++;
         }
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:10,代码来源:class_check.php

示例10: loadLibs

 public static function loadLibs($libList)
 {
     foreach ($libList as $lib) {
         $libFile = wm_lib_path . $lib;
         if (!is_file($libFile)) {
             main::log('ERROR', 'inexistent lib file: ' . $lib, true);
         }
         require $libFile;
     }
 }
开发者ID:psyb0t,项目名称:websiteMaster.php,代码行数:10,代码来源:main.php

示例11: getUpdates

function getUpdates($telegram)
{
    date_default_timezone_set('Europe/Rome');
    $today = date("Y-m-d H:i:s");
    $db = new PDO(DB_NAME);
    $data = new getdata();
    $update_manager = new main();
    // Get all the new updates and set the new correct update_id
    $req = $telegram->getUpdates();
    for ($i = 0; $i < $telegram->UpdateCount(); $i++) {
        // You NEED to call serveUpdate before accessing the values of message in Telegram Class
        $telegram->serveUpdate($i);
        $text = $telegram->Text();
        $chat_id = $telegram->ChatID();
        $user_id = $telegram->User_id();
        $location = $telegram->Location();
        $reply_to_msg = $telegram->ReplyToMessage();
        $update_manager->shell($telegram, $db, $data, $text, $chat_id, $user_id, $location, $reply_to_msg);
    }
}
开发者ID:piersoft,项目名称:transportchbot,代码行数:20,代码来源:getUpdates.php

示例12: incMysql

 public function incMysql()
 {
     include main::getPluginDir() . '/libs/classes/as3b-mysql.php';
     $db_param = $this->getDBParams();
     $mysql = new as3b_mysql();
     $mysql->user = $db_param['user'];
     $mysql->password = $db_param['pass'];
     $mysql->host = $db_param['host'];
     $mysql->db = $db_param['db'];
     $mysql->connect();
     return $mysql;
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:12,代码来源:module_as3b.php

示例13: content

 public function content()
 {
     global $dbh, $postvar, $getvar, $instance;
     // An honest attempt to make this system a little less painful (for me)...
     if (array_key_exists("sub", $getvar) && !empty($getvar["sub"])) {
         $sub = "_" . strtolower($getvar["sub"]);
         if (method_exists($this, $sub)) {
             $this->{$sub}();
             return;
         }
         main::error(array(__FILE__ => "<code>\$this->{$sub}</code> isn't a method."));
     }
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:13,代码来源:orderform.php

示例14: conf_perms

 public function conf_perms()
 {
     if (is_writable(INC . "/conf.inc.php")) {
         if (main::perms(INC . "/conf.inc.php", 0444)) {
             main::errors("Configuration File made unwritable.");
         } else {
             main::errors("Failed to make the configuration file unwritable.");
         }
     } else {
         main::errors("Configuration File is already unwritable.");
     }
     echo style::replaceVar('tpl/admin/system/perms-tools.tpl');
 }
开发者ID:cozylife,项目名称:tht-reworked,代码行数:13,代码来源:system.php

示例15: run

 public function run()
 {
     if (!function_exists('get_plugins')) {
         require_once ABSPATH . 'wp-admin/includes/plugin.php';
     }
     $plugin_name = array_pop(explode("/", main::getPluginDir()));
     $plugin_name2 = str_replace("-", "_", $plugin_name);
     $plugin = get_plugins("/{$plugin_name}");
     $pl_version = "";
     if (isset($plugin["{$plugin_name}.php"])) {
         $pl_version = $plugin["{$plugin_name}.php"]['Version'];
     }
     if (isset($plugin["{$plugin_name2}.php"])) {
         $pl_version = $plugin["{$plugin_name2}.php"]['Version'];
     }
     $data_return = array('reply' => 'pong', 'date' => array('time_zone' => date('O'), 'time' => time()), 'system_version' => $wp_version, 'plugin_version' => $pl_version, 'system' => 'wordpress');
     //get info for minimal requirements
     $data_return['php_version'] = @phpversion();
     $data_return['php_max_execution_time'] = @intval(ini_get('max_execution_time'));
     $data_return['php_memory_limit'] = @ini_get('memory_limit');
     $data_return['php_extensions'] = @implode(',', get_loaded_extensions());
     $data_return['php_disabled_functions'] = @ini_get('disable_functions');
     $data_return['php_max_execution_time_up'] = 0;
     $data_return['php_memory_limit_up'] = 0;
     $data_return['mysql_version'] = '';
     $data_return['suhosin_functions_blacklist'] = '';
     //try set new max time
     $newMaxExecutionTime = 3000;
     @set_time_limit($newMaxExecutionTime);
     if (@intval(ini_get('max_execution_time')) == $newMaxExecutionTime) {
         $data_return['php_max_execution_time_up'] = 1;
     }
     //try set new memory limit
     $newMemoryLimit = 256;
     @ini_set('memory_limit', $newMemoryLimit . 'M');
     if (@intval(ini_get('memory_limit')) == $newMemoryLimit) {
         $data_return['php_memory_limit_up'] = 1;
     }
     //try get mysql version
     $mysqli = new mysqli(DB_HOST, DB_USER, DB_PASSWORD);
     if (!mysqli_connect_errno()) {
         $data_return['mysql_version'] = $mysqli->server_info;
     }
     //check suhosin
     if (extension_loaded('suhosin')) {
         $data_return['suhosin_functions_blacklist'] = @ini_get('suhosin.executor.func.blacklist');
     }
     $this->setResult($data_return);
 }
开发者ID:nikitansk,项目名称:devschool,代码行数:49,代码来源:ping.php


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