本文整理汇总了PHP中main类的典型用法代码示例。如果您正苦于以下问题:PHP main类的具体用法?PHP main怎么用?PHP main使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了main类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: content
public function content()
{
global $dbh, $postvar, $getvar, $instance;
$cats_query = $dbh->select("cats");
if (!$dbh->num_rows($cats_query)) {
echo "There are no knowledge base categories or articles!";
} else {
if ($getvar['cat']) {
$cats_data = $dbh->select("cats", array("id", "=", $getvar['cat']));
if (!$cats_data['id']) {
echo "That category doesn't exist!";
} else {
echo main::sub('<img src="<ICONDIR>arrow_rotate_clockwise.png"><a href="?page=kb">Return To Category Selection</a>', '');
$articles_query = $dbh->select("articles", array("catid", "=", $getvar['cat']), 0, 0, 1);
if (!$dbh->num_rows($articles_query)) {
echo "There are no articles in this category!";
} else {
while ($articles_data = $dbh->fetch_array($articles_query)) {
$article_box_array['NAME'] = $articles_data['name'];
$article_box_array['ID'] = $articles_data['id'];
echo style::replaceVar("tpl/kb/article-box.tpl", $article_box_array);
}
}
}
return;
}
if ($getvar['art']) {
$articles_data = $dbh->select("articles", array("id", "=", $getvar['art']));
if (!$articles_data['id']) {
echo "That article doesn't exist!";
} else {
$view_article_array['NAME'] = $articles_data['name'];
$view_article_array['CONTENT'] = $articles_data['content'];
$view_article_array['CATID'] = $articles_data['catid'];
echo style::replaceVar("tpl/kb/view-article.tpl", $view_article_array);
}
return;
}
//Show this by default.
while ($cats_data = $dbh->fetch_array($cats_query)) {
$category_box_array['NAME'] = $cats_data['name'];
$category_box_array['DESCRIPTION'] = $cats_data['description'];
$category_box_array['ID'] = $cats_data['id'];
echo style::replaceVar("tpl/kb/category-box.tpl", $category_box_array);
}
}
}
开发者ID:cozylife,项目名称:tht-reworked,代码行数:47,代码来源:kb.php
示例17: local
private function local()
{
$this->files = readDirectrory(BACKUP_DIR . '/' . $this->params['name'], array('.zip'));
include main::getPluginDir() . '/libs/pclzip.lib.php';
if (($n = count($this->files)) > 0) {
for ($i = 0; $i < $n; $i++) {
main::log(str_replace('%s', basename($this->files[$i]), lang::get("Data decompression: %s", false)));
$this->archive = new PclZip($this->files[$i]);
$file_in_zip = $this->archive->extract(PCLZIP_OPT_PATH, ABSPATH, PCLZIP_OPT_REPLACE_NEWER);
}
if (file_exists(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql')) {
main::log(lang::get("Run process restore Database", false));
$mysql = $this->incMysql();
$mysql->restore(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql');
main::log(lang::get("Stopped process restore Database", false));
main::remove(BACKUP_DIR . '/' . $this->params['name'] . '/mysqldump.sql');
}
}
}
开发者ID:nikitansk,项目名称:devschool,代码行数:19,代码来源:recover.php
示例18: __construct
/**
* Main Constructor
*
* @access public
* @param string Project file or folder
* @param string [Optional] Folder to save the report
* @return void
*/
public function __construct($projectPath, $reportFolder = null)
{
$this->startTime = time();
if (empty($projectPath)) {
throw new \Exception(__METHOD__ . ": Project path given was empty.");
}
$this->projectPath = $projectPath;
$reportFolder = main::getRealPath($reportFolder);
if ($reportFolder !== false) {
$this->reportFolder = $reportFolder;
} else {
$this->reportFolder = PHP7MAR_DIR . DIRECTORY_SEPARATOR . 'reports' . DIRECTORY_SEPARATOR;
}
$this->fullFilePath = $this->reportFolder . date('Y-m-d H.i.s ') . basename($this->projectPath, '.php') . ".md";
$this->file = fopen($this->fullFilePath, 'w+');
register_shutdown_function([$this, 'onShutdown']);
$this->add(date('c', $this->startTime), 0, 1);
$this->add("Scanning {$this->projectPath}", 0, 1);
}
开发者ID:adduc,项目名称:php7mar,代码行数:27,代码来源:reporter.php
示例19: import
public function import()
{
global $dbh, $postvar, $getvar, $instance;
if (!$_POST) {
$servers_query = $dbh->select("servers", array("type", "=", "zpanel"), 0, 0, 1);
while ($servers_data = $dbh->fetch_array($servers_query)) {
$values[] = array($servers_data['name'], $servers_data['id']);
}
$zpanel_array['DROPDOWN'] = main::dropdown("server", $values);
echo style::replaceVar("tpl/admin/import/zpanel.tpl", $zpanel_array);
} elseif ($_POST) {
$postvar['server'] = $postvar['server'];
//Hack to make sure we post the 'server' field as it doesn't post if it's empty.
check::empty_fields();
if (main::errors()) {
echo "<ERRORS>";
} else {
$n = 0;
include INC . "/servers/zpanel.php";
$zpanel = new zpanel($postvar['server']);
$zpanel_accounts = $zpanel->listaccs($postvar['server']);
foreach ($zpanel_accounts as $zpanel_data) {
$packages_data = $dbh->select("packages", array("backend", "=", $zpanel_data['package']));
$users_data = $dbh->select("users", array("user", "=", $zpanel_data['user']));
if (!$packages_data['id']) {
$packages_insert = array("name" => $zpanel_data['package'], "backend" => $zpanel_data['package'], "description" => "Imported from ZPanel: " . $zpanel_data['package'], "type" => "free", "server" => $postvar['server'], "admin" => "1");
$dbh->insert("packages", $packages_insert);
}
$new_packages_data = $dbh->select("packages", array("backend", "=", $zpanel_data['package']));
if (!$users_data['id']) {
$salt = crypto::salt();
$newpass = crypto::passhash(rand(), $salt);
$users_insert = array("user" => $zpanel_data['user'], "zpanel_uid" => $zpanel_data['user'], "email" => $zpanel_data['user'], "password" => $zpanel_data['user'], "salt" => $zpanel_data['user'], "signup" => $zpanel_data['user'], "status" => $zpanel_data['user'], "domain" => $zpanel_data['user'], "pid" => $zpanel_data['user']);
$dbh->insert("users", $users_insert);
$dbh->insert("users_bak", $users_insert);
$n++;
}
}
echo $n . " Accounts have been imported";
}
}
}
开发者ID:cozylife,项目名称:tht-reworked,代码行数:42,代码来源:zpanelimport.php
示例20: create
public function create($uid, $amount, $due, $notes)
{
global $dbh, $postvar, $getvar, $instance;
$client = $dbh->client($uid);
$emailtemp = email::emailTemplate("new-invoice");
$newinvoice_array['USER'] = $client['user'];
$newinvoice_array['AMOUNT'] = main::addzeros($amount);
$newinvoice_array['LINK'] = $dbh->config("url") . "/client/?page=invoices";
$newinvoice_array['DUE'] = main::convertdate("n/d/Y", $due, $uid);
$is_paid = $newinvoice_array['AMOUNT'] == "0.00" ? "1" : "0";
email::send($client['email'], $emailtemp['subject'], $emailtemp['content'], $newinvoice_array);
unset($where);
$where[] = array("amount", "=", "0", "OR");
$where[] = array("amount", "=", "0.00");
$dbh->update("invoices", array("is_paid" => "1"), $where);
//This way people won't see unpaid invoices for $0.
$invoices_insert = array("uid" => $uid, "amount" => $amount, "created" => time(), "due" => $due, "notes" => $notes, "pay_now" => $amount, "is_paid" => $is_paid);
$response = $dbh->insert("invoices", $invoices_insert);
return $response;
}
开发者ID:cozylife,项目名称:tht-reworked,代码行数:20,代码来源:class_invoice.php
注:本文中的main类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论