本文整理汇总了PHP中App::LoadClass方法的典型用法代码示例。如果您正苦于以下问题:PHP App::LoadClass方法的具体用法?PHP App::LoadClass怎么用?PHP App::LoadClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App
的用法示例。
在下文中一共展示了App::LoadClass方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Alert
/**
* Send an email notification to the site admin
* @param string $subject The subject of the alert email
* @param string $body The body of the message for the alert email
* @return void sends an alert email to site admin
*/
static function Alert($subject, $body)
{
App::LoadClass('Mail');
$mail = new Mail();
$mail->subject = $subject;
$mail->body = $body;
$mail->Send(Settings::Get('admin_email'));
}
示例2: dirname
<?php
// Include required files
include_once dirname(dirname(dirname(__FILE__))) . '/config/bootstrap.php';
App::LoadClass('User');
App::LoadClass('Message');
App::LoadClass('Privacy');
App::LoadClass('Mail');
// Establish page variables, objects, arrays, etc
View::InitView('message_send');
Plugin::Trigger('message_send.start');
Functions::RedirectIf(View::$vars->logged_in = User::LoginCheck(), HOST . '/login/');
View::$vars->user = new User(View::$vars->logged_in);
View::$vars->to = NULL;
View::$vars->subject = NULL;
View::$vars->msg = NULL;
View::$vars->errors = array();
View::$vars->message = null;
$message = array();
// Verify if request came from outside page
if (isset($_GET['username'])) {
$username = trim($_GET['username']);
$data = array('username' => $username);
$id = User::Exist($data);
if ($id) {
$recipient = new User($id);
View::$vars->to = $recipient->username;
}
// Verify if request came from reply
} elseif (isset($_GET['msg']) && is_numeric($_GET['msg'])) {
$message_id = trim($_GET['msg']);
示例3: dirname
<?php
// Include required files
include_once dirname(dirname(dirname(__FILE__))) . '/config/bootstrap.php';
App::LoadClass('User');
App::LoadClass('Privacy');
// Establish page variables, objects, arrays, etc
View::InitView('privacy_settings');
Plugin::Trigger('privacy_settings.start');
Functions::RedirectIf(View::$vars->logged_in = User::LoginCheck(), HOST . '/login/');
View::$vars->user = new User(View::$vars->logged_in);
View::$vars->privacy = Privacy::LoadByUser(View::$vars->user->user_id);
View::$vars->data = array();
View::$vars->errors = array();
View::$vars->message = null;
/**************************
* Handle Form if submitted
*************************/
if (isset($_POST['submitted'])) {
// Validate Video Comments
if (isset($_POST['video_comment']) && in_array($_POST['video_comment'], array('0', '1'))) {
View::$vars->data['video_comment'] = $_POST['video_comment'];
} else {
View::$vars->errors['video_comment'] = TRUE;
}
// Validate Private Message
if (isset($_POST['new_message']) && in_array($_POST['new_message'], array('0', '1'))) {
View::$vars->data['new_message'] = $_POST['new_message'];
} else {
View::$vars->errors['new_message'] = TRUE;
}
示例4: dirname
<?php
// Include required files
include_once dirname(dirname(dirname(__FILE__))) . '/config/bootstrap.php';
App::LoadClass('Video');
// Establish page variables, objects, arrays, etc
View::InitView('mobile_videos');
Plugin::Trigger('mobile_videos.start');
// Retrieve video count
$query = "SELECT COUNT(video_id) FROM " . DB_PREFIX . "videos WHERE status = 'approved' AND private = '0' AND gated = '0'";
$result = $db->Query($query);
View::$vars->count = $db->FetchRow($result);
View::$vars->count = View::$vars->count[0];
// Retrieve video list
$query = "SELECT video_id FROM " . DB_PREFIX . "videos WHERE status = 'approved' AND private = '0' AND gated = '0' ORDER BY video_id DESC LIMIT 20";
View::$vars->videos = array();
$result = $db->Query($query);
while ($video = $db->FetchObj($result)) {
View::$vars->videos[] = $video->video_id;
}
// Output Page
Plugin::Trigger('mobile_videos.before_render');
View::Render('videos.tpl');
示例5: dirname
<?php
// Include required files
include_once dirname(dirname(__FILE__)) . '/config/bootstrap.php';
App::LoadClass('User');
App::LoadClass('Page');
// Establish page variables, objects, arrays, etc
View::InitView();
Plugin::Trigger('page.start');
View::$vars->logged_in = User::LoginCheck();
if (View::$vars->logged_in) {
View::$vars->user = new User(View::$vars->logged_in);
}
$page_id = null;
// Parse preview request
if (!empty($_GET['preview']) && is_numeric($_GET['preview'])) {
$page_id = Page::Exist(array('page_id' => $_GET['preview']));
// Parse the URI request
} else {
$request = preg_replace('/^\\/?(.*?)\\/?$/', '$1', basename($_SERVER['REQUEST_URI']));
$page_id = Page::Exist(array('slug' => $request, 'status' => 'published'));
}
### Validate requested page
if ($page_id) {
// Retrieve custom page
$page = new Page($page_id);
$page_name = 'page_' . $page->slug;
// Set view settings for custom page
View::$vars->page = $page;
View::$options->page = $page_name;
View::$vars->meta = Language::GetMeta($page_name);
示例6: dirname
<?php
// Include required files
include_once dirname(dirname(__FILE__)) . '/cc-core/config/admin.bootstrap.php';
App::LoadClass('User');
App::LoadClass('Plugin');
// Retrieve video information
if (!isset($_POST['token'], $_POST['timestamp'])) {
App::Throw404();
}
// Load main session and validate login
session_write_close();
session_id($_POST['token']);
session_start();
Functions::RedirectIf($logged_in = User::LoginCheck(), HOST . '/login/');
$admin = new User($logged_in);
Functions::RedirectIf(User::CheckPermissions('admin_panel', $admin), HOST . '/myaccount/');
// Validate file upload key
$upload_key = md5(md5($_POST['timestamp']) . SECRET_KEY);
if (!isset($_SESSION['upload_key']) || $_SESSION['upload_key'] != $upload_key) {
App::Throw404();
}
try {
### Verify upload was made
if (empty($_FILES) || !isset($_FILES['upload']['name'])) {
throw new Exception('nofile');
}
### Check for upload errors
if ($_FILES['upload']['error'] != 0) {
App::Alert('Error During Plugin Upload', 'There was an HTTP FILE POST error (Error code #' . $_FILES['upload']['error'] . ').');
throw new Exception('error');
示例7: dirname
<?php
// Include required files
include_once dirname(dirname(dirname(__FILE__))) . '/config/bootstrap.php';
App::LoadClass('User');
App::LoadClass('Message');
App::LoadClass('Pagination');
// Establish page variables, objects, arrays, etc
View::InitView('message_inbox');
Plugin::Trigger('message_inbox.start');
Functions::RedirectIf(View::$vars->logged_in = User::LoginCheck(), HOST . '/login/');
View::$vars->user = new User(View::$vars->logged_in);
$records_per_page = 20;
$url = HOST . '/myaccount/message/inbox';
View::$vars->message = null;
/***********************
Handle form if submitted
***********************/
// Delete message (Request came from this page)
if (isset($_POST['submitted'])) {
// Verify messages were chosen
if (!empty($_POST['delete']) && is_array($_POST['delete'])) {
foreach ($_POST['delete'] as $value) {
$data = array('recipient' => View::$vars->user->user_id, 'message_id' => $value);
$message_id = Message::Exist($data);
if ($message_id) {
Message::Delete($message_id);
Plugin::Trigger('message_inbox.purge_single_message');
}
}
View::$vars->message = Language::GetText('success_messages_purged');
示例8: dirname
<?php
// Include required files
include_once dirname(dirname(__FILE__)) . '/cc-core/config/admin.bootstrap.php';
App::LoadClass('User');
App::LoadClass('Category');
// Establish page variables, objects, arrays, etc
Functions::RedirectIf($logged_in = User::LoginCheck(), HOST . '/login/');
$admin = new User($logged_in);
Functions::RedirectIf(User::CheckPermissions('admin_panel', $admin), HOST . '/myaccount/');
$page_title = 'Video Categories';
$categories = array();
$data = array();
$errors = array();
$message = null;
/**************************
Handle create category form
**************************/
if (isset($_POST['submitted_add'])) {
try {
// Validate title
if (empty($_POST['cat_name']) || ctype_space($_POST['cat_name'])) {
throw new Exception('Invalid category name. Please try again.');
}
$data['slug'] = Functions::CreateSlug(trim($_POST['cat_name']));
$data['cat_name'] = htmlspecialchars(trim($_POST['cat_name']));
if (Category::Exist(array('slug' => $data['slug']))) {
throw new Exception('Category name or slug already exists. Please note that in the slug special characters are replaced by hyphens.');
}
Category::Create($data);
$message = $data['cat_name'] . ' was successfully created.';
示例9: Approve
/**
* Make a user visible to the public and notify admin of registration
* @global object $config Site configuration settings
* @param string $action Step in the approval proccess to perform. Allowed values: create|activate|approve
* @return void User is activated, and admin alerted. If approval is
* required user is marked pending and placed in queue
*/
public function Approve($action)
{
global $config;
$send_alert = false;
Plugin::Trigger('user.before_approve');
// 1) Admin created user in Admin Panel
// 2) User signed up & activated
// 3) User is being approved by admin for first time
if (in_array($action, array('create', 'activate')) || $action == 'approve' && $this->released == 0) {
// User is activating account, but approval is required
if ($action == 'activate' && Settings::Get('auto_approve_users') == '0') {
// Send Admin Approval Alert
$send_alert = true;
$subject = 'New Member Awaiting Approval';
$body = 'A new member has registered and is awaiting admin approval.';
// Set Pending
$this->Update(array('status' => 'pending'));
Plugin::Trigger('user.approve_required');
} else {
// Send Admin Alert
if (in_array($action, array('create', 'activate')) && Settings::Get('alerts_users') == '1') {
$send_alert = true;
$subject = 'New Member Registered';
$body = 'A new member has registered.';
}
// Activate & Release
$this->Update(array('status' => 'active', 'released' => 1));
// Update user's anonymous comments IF/APP
$query = "UPDATE " . DB_PREFIX . "comments SET user_id = {$this->user_id} WHERE email = '{$this->email}'";
$this->db->Query($query);
// Send Welcome email
if ($action == 'approve') {
App::LoadClass('Mail');
$mail = new Mail();
$mail->LoadTemplate('account_approved', array('sitename' => $config->sitename));
$mail->Send($this->email);
}
Plugin::Trigger('user.release');
}
// User is being re-approved
} else {
if ($action == 'approve' && $this->released != 0) {
// Activate User
$this->Update(array('status' => 'active'));
Plugin::Trigger('user.reapprove');
}
}
// Send admin alert
if ($send_alert) {
$body .= "\n\n=======================================================\n";
$body .= "Username: {$this->username}\n";
$body .= "Profile URL: " . HOST . "/members/{$this->username}/\n";
$body .= "=======================================================";
App::Alert($subject, $body);
}
Plugin::Trigger('user.approve');
}
示例10: dirname
<?php
// Include required files
include_once dirname(dirname(__FILE__)) . '/config/bootstrap.php';
App::LoadClass('User');
App::LoadClass('Video');
App::LoadClass('Rating');
App::LoadClass('Subscription');
App::LoadClass('Flag');
App::LoadClass('Post');
// Establish page variables, objects, arrays, etc
View::InitView('profile');
Plugin::Trigger('profile.start');
View::$vars->logged_in = User::LoginCheck();
if (View::$vars->logged_in) {
View::$vars->user = new User(View::$vars->logged_in);
}
$success = NULL;
$errors = NULL;
$sub_id = NULL;
$post_count = 5;
// Verify Member was supplied
if (isset($_GET['username'])) {
$data = array('username' => $_GET['username'], 'status' => 'Active');
$user_id = User::Exist($data);
} else {
App::Throw404();
}
// Verify Member exists
if ($user_id) {
View::$vars->member = new User($user_id);
示例11: dirname
<?php
// Include required files
include_once dirname(dirname(__FILE__)) . '/config/bootstrap.php';
App::LoadClass('User');
App::LoadClass('Subscription');
Plugin::Trigger('subscribe.ajax.start');
// Establish page variables, objects, arrays, etc
$logged_in = User::LoginCheck();
if ($logged_in) {
$user = new User($logged_in);
}
Plugin::Trigger('subscribe.ajax.login_check');
// Verify passed values
if (empty($_POST['type']) || !in_array($_POST['type'], array('subscribe', 'unsubscribe'))) {
App::Throw404();
}
if (empty($_POST['user']) || !is_numeric($_POST['user'])) {
App::Throw404();
}
// Validate user
if (!User::Exist(array('user_id' => $_POST['user'], 'status' => 'active'))) {
App::Throw404();
}
$member = new User($_POST['user']);
### Handle subscribe/unsubscribe
switch ($_POST['type']) {
### Handle subscribe user to a member
case 'subscribe':
// Verify user is logged in
if (!$logged_in) {
示例12: __construct
<?php
App::LoadClass('PHPMailer');
class Mail
{
private $config;
public $template;
public $phpmailer;
public $from_name;
public $from_address;
public $subject = '';
public $body = '';
/**
* Instantiate object
* @global object $config Site configuration settings
* @return object Returns object of class type
*/
public function __construct()
{
global $config;
$this->config = $config;
$this->phpmailer = new PHPMailer();
// Retrieve "From" name and address
$url = parse_url(HOST);
$this->from_name = Settings::Get('from_name');
$this->from_address = Settings::Get('from_address');
$this->from_name = empty($this->from_name) ? $this->config->sitename : $this->from_name;
$this->from_address = empty($this->from_address) ? 'cumulusclips@' . $url['host'] : $this->from_address;
$this->phpmailer->FromName = $this->from_name;
$this->phpmailer->From = $this->from_address;
// Retrieve SMTP settings
示例13: dirname
<?php
// Include required files
include_once dirname(dirname(__FILE__)) . '/cc-core/config/admin.bootstrap.php';
App::LoadClass('User');
App::LoadClass('Video');
App::LoadClass('Flag');
// Establish page variables, objects, arrays, etc
Functions::RedirectIf($logged_in = User::LoginCheck(), HOST . '/login/');
$admin = new User($logged_in);
Functions::RedirectIf(User::CheckPermissions('admin_panel', $admin), HOST . '/myaccount/');
$page_title = 'Edit Video';
$private_url = Video::GeneratePrivate();
$categories = array();
$data = array();
$errors = array();
$message = null;
// Retrieve Category names
$query = "SELECT cat_id, cat_name FROM " . DB_PREFIX . "categories";
$result = $db->Query($query);
while ($row = $db->FetchObj($result)) {
$categories[$row->cat_id] = $row->cat_name;
}
// Build return to list link
if (!empty($_SESSION['list_page'])) {
$list_page = $_SESSION['list_page'];
} else {
$list_page = ADMIN . '/videos.php';
}
### Verify a video was provided
if (isset($_GET['id']) && is_numeric($_GET['id']) && $_GET['id'] != 0) {
示例14: Approve
/**
* Make a video visible to the public and notify subscribers of new video
* @global object $config Site configuration settings
* @param string $action Step in the approval proccess to perform. Allowed values: create|activate|approve
* @return void Video is activated, subscribers are notified, and admin
* alerted. If approval is required video is marked as pending and placed in queue
*/
public function Approve($action)
{
App::LoadClass('User');
App::LoadClass('Privacy');
App::LoadClass('Mail');
global $config;
$send_alert = false;
Plugin::Trigger('video.before_approve');
// 1) Admin created video in Admin Panel
// 2) User created video
// 3) Video is being approved by admin for first time
if (in_array($action, array('create', 'activate')) || $action == 'approve' && $this->released == 0) {
// User uploaded video but needs admin approval
if ($action == 'activate' && Settings::Get('auto_approve_videos') == '0') {
// Send Admin Approval Alert
$send_alert = true;
$subject = 'New Video Awaiting Approval';
$body = 'A new video has been uploaded and is awaiting admin approval.';
// Set Pending
$this->Update(array('status' => 'pending approval'));
Plugin::Trigger('video.approve_required');
} else {
// Send Admin Alert
if (in_array($action, array('create', 'activate')) && Settings::Get('alerts_videos') == '1') {
$send_alert = true;
$subject = 'New Video Uploaded';
$body = 'A new video has been uploaded.';
}
// Activate & Release
$this->Update(array('status' => 'approved', 'released' => 1));
// Send subscribers notification if opted-in
$query = "SELECT user_id FROM " . DB_PREFIX . "subscriptions WHERE member = {$this->user_id}";
$result = $this->db->Query($query);
while ($opt = $this->db->FetchObj($result)) {
$subscriber = new User($opt->user_id);
$privacy = Privacy::LoadByUser($opt->user_id);
if ($privacy->OptCheck('new_video')) {
$replacements = array('host' => HOST, 'sitename' => $config->sitename, 'email' => $subscriber->email, 'member' => $this->username, 'title' => $this->title, 'video_id' => $this->video_id, 'slug' => $this->slug);
$mail = new Mail();
$mail->LoadTemplate('new_video', $replacements);
$mail->Send($subscriber->email);
Plugin::Trigger('video.notify_subscribers');
}
}
Plugin::Trigger('video.release');
}
// Video is being re-approved
} else {
if ($action == 'approve' && $this->released != 0) {
// Approve Video
$this->Update(array('status' => 'approved'));
Plugin::Trigger('video.reapprove');
}
}
// Send admin alert
if ($send_alert) {
$body .= "\n\n=======================================================\n";
$body .= "Title: {$this->title}\n";
$body .= "URL: {$this->url}\n";
$body .= "=======================================================";
App::Alert($subject, $body);
}
Plugin::Trigger('video.approve');
}
示例15: stdClass
// Load App class and perform pre-init checks
if (!class_exists('App')) {
include LIB . '/App.php';
}
App::InstallCheck();
App::MaintCheck();
// Load DB & FTP credentials
include_once 'config.php';
// Load Main Classes
App::LoadClass('Database');
App::LoadClass('Settings');
App::LoadClass('Functions');
App::LoadClass('Language');
App::LoadClass('View');
App::LoadClass('Plugin');
App::LoadClass('Filesystem');
// Retrieve site settings from DB
$db = Database::GetInstance();
Settings::LoadSettings();
// General Site Settings from DB
define('HOST', Settings::Get('base_url'));
define('MOBILE_HOST', Settings::Get('base_url') . '/m');
define('SECRET_KEY', Settings::Get('secret_key'));
$config = new stdClass();
$config->sitename = Settings::Get('sitename');
$config->roles = unserialize(Settings::Get('roles'));
$config->enable_uploads = Settings::Get('enable_uploads');
$config->debug_conversion = Settings::Get('debug_conversion') == '1' ? true : false;
$config->video_size_limit = Settings::Get('video_size_limit');
$config->accepted_video_formats = array('flv', 'wmv', 'avi', 'ogg', 'mpg', 'mp4', 'mov', 'm4v');
$config->accepted_avatar_formats = array('png', 'jpeg', 'jpg', 'gif');