本文整理汇总了PHP中MainController类的典型用法代码示例。如果您正苦于以下问题:PHP MainController类的具体用法?PHP MainController怎么用?PHP MainController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MainController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: Dispatch
/**
* Dispatch an event to the modules, will call the
* modules with the EventListener() function.
*
* @see http://www.nsslive.net/codon/docs/events
* @param string $eventname
* @param string $origin
* @param list $params list additional parameters after $origin
* @return boolean true by default
*/
public static function Dispatch($eventname, $origin)
{
// if there are parameters added, then call the function
// using those additional params
$params = array();
$params[0] = $eventname;
$params[1] = $origin;
$args = func_num_args();
if ($args > 2) {
for ($i = 2; $i < $args; $i++) {
$tmp = func_get_arg($i);
array_push($params, $tmp);
}
}
# Load each module and call the EventListen function
if (!self::$listeners) {
self::$listeners = array();
}
foreach (self::$listeners as $ModuleName => $Events) {
$ModuleName = strtoupper($ModuleName);
global ${$ModuleName};
# Run if no specific events specified, or if the eventname is there
if (!$Events || in_array($eventname, $Events)) {
self::$lastevent = $eventname;
MainController::Run($ModuleName, 'EventListener', $params);
if (isset(self::$stopList[$eventname]) && self::$stopList[$eventname] == true) {
unset(self::$stopList[$eventname]);
return false;
}
}
}
return true;
}
开发者ID:deanstalker,项目名称:phpVMS,代码行数:43,代码来源:CodonEvent.class.php
示例2: route_submit
/**
* Function: submit
* Submits a post to the blog owner.
*/
public function route_submit()
{
if (!Visitor::current()->group->can("submit_article")) {
show_403(__("Access Denied"), __("You do not have sufficient privileges to submit articles."));
}
if (!empty($_POST)) {
if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
show_403(__("Access Denied"), __("Invalid security key."));
}
if (empty($_POST['body'])) {
Flash::notice(__("Post body can't be empty!"), redirect("/"));
}
if (!isset($_POST['draft'])) {
$_POST['draft'] = "true";
}
$_POST['body'] = "{$_POST['body']}\n\n\n{$_POST['name']}\n{$_POST['email']}\n";
$post = Feathers::$instances[$_POST['feather']]->submit();
if (!in_array(false, $post)) {
Flash::notice(__("Thank you for your submission. ", "submission"), "/");
}
}
if (Theme::current()->file_exists("forms/post/submit")) {
MainController::current()->display("forms/post/submit", array("feather" => $feather), __("Submit a Text Post"));
} else {
require "pages/submit.php";
}
}
开发者ID:betsyzhang,项目名称:chyrp,代码行数:31,代码来源:submission.php
示例3: delete_link
public function delete_link($text = null, $before = null, $after = null, $classes = "")
{
if (!$this->deletable()) {
return false;
}
fallback($text, __("Delete"));
$name = strtolower(get_class($this));
echo $before . '<a href="' . url("delete_attachment/" . $this->id, MainController::current()) . '" title="Delete" class="' . ($classes ? $classes . " " : '') . $name . '_delete_link delete_link" id="' . $name . '_delete_' . $this->id . '">' . $text . '</a>' . $after;
}
开发者ID:vito,项目名称:chyrp-site,代码行数:9,代码来源:model.Attachment.php
示例4: pingback_ping
public function pingback_ping($args)
{
$config = Config::current();
$linked_from = str_replace('&', '&', $args[0]);
$linked_to = str_replace('&', '&', $args[1]);
$cleaned_url = str_replace(array("http://www.", "http://"), "", $config->url);
if ($linked_to == $linked_from) {
return new IXR_ERROR(0, __("The from and to URLs cannot be the same."));
}
if (!substr_count($linked_to, $cleaned_url)) {
return new IXR_Error(0, __("There doesn't seem to be a valid link in your request."));
}
if (preg_match("/url=([^&#]+)/", $linked_to, $url)) {
$post = new Post(array("url" => $url[1]));
} else {
$post = MainController::current()->post_from_url(null, str_replace(rtrim($config->url, "/"), "/", $linked_to), true);
}
if (!$post) {
return new IXR_Error(33, __("I can't find a post from that URL."));
}
# Wait for the "from" server to publish
sleep(1);
$from = parse_url($linked_from);
if (empty($from["host"])) {
return false;
}
if (empty($from["scheme"]) or $from["scheme"] != "http") {
$linked_from = "http://" . $linked_from;
}
# Grab the page that linked here.
$content = get_remote($linked_from);
# Get the title of the page.
preg_match("/<title>([^<]+)<\\/title>/i", $content, $title);
$title = $title[1];
if (empty($title)) {
return new IXR_Error(32, __("There isn't a title on that page."));
}
$content = strip_tags($content, "<a>");
$url = preg_quote($linked_to, "/");
if (!preg_match("/<a[^>]*{$url}[^>]*>([^>]*)<\\/a>/", $content, $context)) {
$url = str_replace("&", "&", preg_quote($linked_to, "/"));
if (!preg_match("/<a[^>]*{$url}[^>]*>([^>]*)<\\/a>/", $content, $context)) {
$url = str_replace("&", "&", preg_quote($linked_to, "/"));
if (!preg_match("/<a[^>]*{$url}[^>]*>([^>]*)<\\/a>/", $content, $context)) {
return false;
}
}
}
$context[1] = truncate($context[1], 100, "...", true);
$excerpt = strip_tags(str_replace($context[0], $context[1], $content));
$match = preg_quote($context[1], "/");
$excerpt = preg_replace("/.*?\\s(.{0,100}{$match}.{0,100})\\s.*/s", "\\1", $excerpt);
$excerpt = "[...] " . trim(normalize($excerpt)) . " [...]";
Trigger::current()->call("pingback", $post, $linked_to, $linked_from, $title, $excerpt);
return _f("Pingback from %s to %s registered!", array($linked_from, $linked_to));
}
开发者ID:relisher,项目名称:chyrp,代码行数:56,代码来源:xmlrpc.php
示例5: hoursMergeForRidesInfo
static function hoursMergeForRidesInfo($weekdayHours, $dateHours)
{
$result = array();
MainController::printArray($dateHours);
// if ($weekdayHours['hour_from'] == $dateHours['hour_from']
// && $weekdayHours['hour_to'] == $dateHours['hour_to']
// && $weekdayHours['direction_id'] == $dateHours['direction_id'])
// {
// $result[] = $weekdayHours;
// }
self::sortHours($result);
return $result;
}
开发者ID:buga1234,项目名称:buga_segforours,代码行数:13,代码来源:HoursController.php
示例6: addInstructorCalendarEvent
public function addInstructorCalendarEvent($reservationsInfo, $instructorInfo, $prevInsrtuctorInfo, $hoursInfo)
{
$date = "";
$description = "";
$total_choosen_places = 0;
$attendee_index = 0;
$instructorID = $instructorInfo['id'];
$hour_id = $hoursInfo['id'];
$prevInsrtuctorID = $prevInsrtuctorInfo['id'];
$reservationsInfoSize = count($reservationsInfo);
for ($resIndex = 0; $resIndex < $reservationsInfoSize; $resIndex++) {
if ($resIndex == 0) {
$date = $reservationsInfo[$resIndex]['resDate'];
$hourCursor = Dispatcher::$mysqli->query("select * from event join instructor " . "on event.`instructor_Person_id`=instructor.`Person_id` " . "where event.`date`='{$date}' " . "and (event.`instructor_Person_id`={$prevInsrtuctorID} or event.`instructor_Person_id`={$instructorID}) " . "and event.hours_id={$hour_id}");
print_r(Dispatcher::$mysqli->error);
if ($hourCursor->num_rows > 0) {
$hourRow = $hourCursor->fetch_assoc();
$prev_calendar_id = $hourRow['calendar_id'];
$prev_event_id = $hourRow['clndr_event_id'];
$event = $this->google_api_service->events->get($prev_calendar_id, $prev_event_id);
} else {
$event = new Google_Service_Calendar_Event();
$event->setLocation('Saska, Praha 1');
$start = new Google_Service_Calendar_EventDateTime();
$start->setDateTime($reservationsInfo[$resIndex]['resDate'] . 'T' . $reservationsInfo[$resIndex]['hour_from'] . ':00.000+02:00');
$start->setTimeZone('Europe/Prague');
$event->setStart($start);
$end = new Google_Service_Calendar_EventDateTime();
$end->setDateTime($reservationsInfo[$resIndex]['resDate'] . 'T' . $reservationsInfo[$resIndex]['hour_to'] . ':00.000+02:00');
$end->setTimeZone('Europe/Prague');
$event->setEnd($end);
}
}
$client_email = $reservationsInfo[$resIndex]['email'];
$client_name = $reservationsInfo[$resIndex]['name'];
$client_telefon = $reservationsInfo[$resIndex]['telefone'];
$choosen_places = $reservationsInfo[$resIndex]['choosen_places'];
$voucherName = $reservationsInfo[$resIndex]['vocuherName'];
$total_choosen_places += $choosen_places;
MainController::printArray($reservationsInfo);
$description .= $client_name . "\n" . $client_email . "\n" . $client_telefon . "\n" . $choosen_places . "\n\n";
$attendee[$attendee_index] = new Google_Service_Calendar_EventAttendee();
$attendee[$attendee_index]->setEmail($client_email);
$attendee[$attendee_index]->setDisplayName($client_name);
$attendee[$attendee_index]->setOptional($client_telefon);
$attendee_index++;
}
if ($reservationsInfoSize > 0) {
if ($hourCursor->num_rows > 0) {
try {
$event->setSummary($total_choosen_places . " " . $voucherName);
$event->description = $description;
$event->attendees = $attendee;
$updatedEvent = $this->google_api_service->events->update($prevInsrtuctorInfo['calendar_id'], $event->getId(), $event);
} catch (Google_Service_Exception $e) {
echo '<pre>';
print_r($e);
syslog(LOG_ERR, $e->getMessage());
}
$event = $this->google_api_service->events->get($prevInsrtuctorInfo['calendar_id'], $updatedEvent->getId());
$event_id = $event->getId();
Dispatcher::$mysqli->query("update event set clndr_event_id='{$event_id}', `instructor_Person_id`={$instructorID} " . "where date='{$date}' and hours_id={$hour_id} and `instructor_Person_id`={$prevInsrtuctorID}");
if ($prev_calendar_id != $instructorInfo['calendar_id']) {
$result = $this->google_api_service->events->move($prev_calendar_id, $event_id, $instructorInfo['calendar_id']);
print_r(Dispatcher::$mysqli->error);
echo '<pre>';
print_r($result);
}
} else {
try {
$event->attendees = $attendee;
$event->description = $description;
$organizer = new Google_Service_Calendar_EventOrganizer();
$organizer->setEmail($instructorInfo['email']);
$organizer->setDisplayName($instructorInfo['name']);
$event->setOrganizer($organizer);
$new_event = $this->google_api_service->events->insert($instructorInfo['calendar_id'], $event);
} catch (Google_Service_Exception $e) {
echo '<pre>';
print_r($e);
syslog(LOG_ERR, $e->getMessage());
}
$event = $this->google_api_service->events->get($instructorInfo['calendar_id'], $new_event->getId());
$instructorID = $instructorInfo['id'];
$hour_id = $hoursInfo['id'];
$event_id = $event->getId();
Dispatcher::$mysqli->query("insert into event(clndr_event_id, `instructor_Person_id`, hours_id, date, has_changes) " . "values('{$event_id}', {$instructorID}, {$hour_id}, '{$date}', 0)");
if ($event != null) {
// echo "Inserted:<br>";
// echo "EventID=" . $event->getId() . " <br>";
// echo "Summary=" . $event->getSummary() . " <br>";
// echo "Status=" . $event->getStatus();
}
}
}
}
开发者ID:buga1234,项目名称:buga_segforours,代码行数:96,代码来源:InstructorCalendarEvents.php
示例7: function
<?php
$app->get('/', function () use($app) {
require 'controllers/MainController.php';
$controller = new MainController();
$controller->index($app);
});
$app->post('/registration', function () use($app) {
require 'controllers/RegistrationController.php';
require 'models/RegistrationModel.php';
$controller = new RegistrationController();
$controller->index($app);
});
$app->post('/auth', function () use($app) {
require 'controllers/AuthController.php';
require 'models/AuthModel.php';
$controller = new AuthController();
$controller->index($app);
});
开发者ID:rostik404,项目名称:TestProject,代码行数:19,代码来源:routes.php
示例8: define
* @author Nabeel Shahzad
* @copyright Copyright (c) 2008, Nabeel Shahzad
* @link http://www.phpvms.net
* @license http://creativecommons.org/licenses/by-nc-sa/3.0/
*/
/* This is the maintenance cron file, which can run nightly.
You should either point to this file directly in your web-host's control panel
Or add an entry into the crontab file. I recommend running this maybe 2-3am,
*/
define('ADMIN_PANEL', true);
include dirname(dirname(__FILE__)) . '/core/codon.config.php';
Auth::$userinfo->pilotid = 0;
error_reporting(E_ALL);
ini_set('display_errors', 'on');
/* Clear expired sessions */
Auth::clearExpiredSessions();
/* Update any expenses */
FinanceData::updateAllExpenses();
if (Config::Get('PILOT_AUTO_RETIRE') == true) {
/* Find any retired pilots and set them to retired */
PilotData::findRetiredPilots();
CronData::set_lastupdate('find_retired_pilots');
}
if (Config::Get('CLOSE_BIDS_AFTER_EXPIRE') === false) {
SchedulesData::deleteExpiredBids();
CronData::set_lastupdate('check_expired_bids');
}
MaintenanceData::optimizeTables();
MainController::Run('Maintenance', 'resetpirepcount');
MainController::Run('Maintenance', 'resethours');
开发者ID:ryanunderwood,项目名称:phpVMS,代码行数:30,代码来源:maintenance.php
示例9: count
<?php
$_POST['filter'] = "all";
$instagram_photos = MainController::getInstaPhotos();
$size = count($instagram_photos);
?>
<div class="modal fade" id="instagram_popup" role="dialog"
data-backdrop="static" aria-labelledby="instagram_popup"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="global-close" data-dismiss="modal" aria-hidden="true">×</button>
<!--<div class="modal-title">INSTAGRAM</div>-->
</div>
<div class="modal-body">
<div id="contacts-container">
<div class="tab-contents">
<div class="tours-contents-title">
<?php
echo $instagram_popup_text['title'];
?>
</div>
</div>
<div class="tab-contents-subtitle">
<?php
echo $instagram_popup_text['subtitle'];
?>
</div>
</div>
开发者ID:buga1234,项目名称:buga_segforours,代码行数:31,代码来源:modul_instagram_popup.php
示例10: define
*/
define('ADMIN_PANEL', true);
include '../core/codon.config.php';
if (!Auth::LoggedIn()) {
Debug::showCritical('Please login first');
die;
}
if (!PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) {
Debug::showCritical('Unauthorized access');
die;
}
$BaseTemplate = new TemplateSet();
$tplname = Config::Get('ADMIN_SKIN');
if ($tplname == '') {
$tplname = 'layout';
}
//load the main skin
$settings_file = SITE_ROOT . '/admin/lib/' . $tplname . '/' . $tplname . '.php';
if (file_exists($settings_file)) {
include $settings_file;
}
$BaseTemplate->template_path = SITE_ROOT . '/admin/lib/' . $tplname;
$BaseTemplate->Set('title', SITE_NAME);
Template::Set('MODULE_NAV_INC', $NAVBAR);
Template::Set('MODULE_HEAD_INC', $HTMLHead);
$BaseTemplate->Show('header.tpl');
flush();
MainController::runAllActions();
$BaseTemplate->Show('footer.tpl');
# Force connection close
DB::close();
开发者ID:deanstalker,项目名称:phpVMS,代码行数:31,代码来源:index.php
示例11: error_reporting
require_once 'model/Database.php';
require_once 'view/LoginView.php';
require_once 'view/DateTimeView.php';
require_once 'view/LayoutView.php';
require_once 'view/RegisterView.php';
require_once 'controller/LoginController.php';
require_once 'controller/RegisterController.php';
require_once 'controller/MainController.php';
//MAKE SURE ERRORS ARE SHOWN... MIGHT WANT TO TURN THIS OFF ON A PUBLIC SERVER
error_reporting(E_ALL);
ini_set('display_errors', 'On');
//Create models
$db = new Database();
$dal = new UserDAL($db);
$loginModel = new LoginModel($dal);
$registerModel = new RegisterModel($dal);
//CREATE OBJECTS OF THE VIEWS
$loginView = new LoginView($loginModel);
$registerView = new RegisterView($registerModel);
$dateTimeView = new DateTimeView();
$layoutView = new LayoutView();
//Create controllers
$loginController = new LoginController($loginView, $loginModel);
$registerController = new RegisterController($registerView, $loginView, $registerModel);
$mainController = new MainController($registerController, $loginController);
$mainController->listen();
if ($mainController->renderRegView()) {
$layoutView->render(false, $registerView, $dateTimeView);
} else {
$layoutView->render($loginModel->isLoggedIn(), $loginView, $dateTimeView);
}
开发者ID:ea222pu,项目名称:1DV608-Assignment4,代码行数:31,代码来源:index.php
示例12:
} else {
$version = $_COOKIE['admin_version'];
}
$main_array = Dispatcher::main_getMain_map($language);
$map_center = $main_array['map_center'];
$main_info = Dispatcher::moduls_getInfo('main');
$user = Dispatcher::admin_getUser();
$popup_text = Dispatcher::getPopupInfo($language, "tours");
$about_seglfie_popup_text = Dispatcher::getPopupInfo($language, "about");
$questions_popup_text = Dispatcher::getPopupInfo($language, "questions");
$contacts_popup_text = Dispatcher::getPopupInfo($language, "contacts");
$instagram_popup_text = Dispatcher::getPopupInfo($language, "instagram");
$terms_popup_text = Dispatcher::getPopupInfo($language, "terms");
$company_popup_text = Dispatcher::getPopupInfo($language, "company");
$_POST['language'] = $language;
$directions_info = MainController::getDirInfo();
require '../menu_items.php';
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>Sysadmin3000 - <?php
echo $menu_item_1;
?>
</title>
<meta name="description" content="">
<?php
include_once '../includes/index.php';
开发者ID:buga1234,项目名称:buga_segforours,代码行数:31,代码来源:index.php
示例13: pre_module_load
if (Config::Get('DEBUG_MODE') == true) {
DB::show_errors();
} else {
DB::hide_errors();
}
if (!DB::connect(DBASE_USER, DBASE_PASS, DBASE_NAME, DBASE_SERVER)) {
Debug::showCritical(Lang::gs('database.connection.failed') . ' (' . DB::$errno . ': ' . DB::$error . ')');
die;
}
# Set the charset type to send to mysql
if (Config::Get('DB_CHARSET_NAME') !== '') {
DB::query('SET NAMES \'' . Config::Get('DB_CHARSET_NAME') . '\'');
}
# Include ORM
#include_once(VENDORS_PATH.DS.'orm'.DS.'idiorm.php');
#include_once(VENDORS_PATH.DS.'orm'.DS.'paris.php');
#ORM::configure('mysql:host='.DBASE_SERVER.';dbname='.DBASE_NAME);
#ORM::configure('username', DBASE_USER);
#ORM::configure('password', DBASE_PASS);
}
include CORE_PATH . DS . 'bootstrap.inc.php';
if (function_exists('pre_module_load')) {
pre_module_load();
}
MainController::loadEngineTasks();
define('ACTIVE_SKIN_PATH', LIB_PATH . DS . 'skins' . DS . CURRENT_SKIN);
Template::setTemplatePath(TEMPLATES_PATH);
Template::setSkinPath(ACTIVE_SKIN_PATH);
if (function_exists('post_module_load')) {
post_module_load();
}
开发者ID:Galihom,项目名称:phpVMS,代码行数:31,代码来源:codon.config.php
示例14: __construct
public function __construct($action, $urlValues)
{
parent::__construct($action, $urlValues);
//create the model object
require "protected/models/news.php";
$this->model = new NewsModel();
}
开发者ID:ashancperera,项目名称:MVC-Sample,代码行数:7,代码来源:news.php
示例15: init
function init()
{
parent::init();
#$this->view->contentItemUri = $this->Content->getItemUri(); #@deprecated since 5/7/2009 use url()!
if (empty($this->Content->ItemCountPerPage)) {
$this->Content->ItemCountPerPage = 15;
}
}
开发者ID:BGCX262,项目名称:zx-zf-hg-to-git,代码行数:8,代码来源:ContentController.php
示例16: beforeAction
public function beforeAction($action)
{
parent::beforeAction($action);
if (Yii::app()->user->model->rang == 1) {
return true;
} else {
throw new CHttpException(403, "Не дорос еще");
}
}
开发者ID:CrystReal,项目名称:Site_backend,代码行数:9,代码来源:AnnouncerController.php
示例17: init
public function init()
{
parent::init();
if (isset($this->_user->loggedIn)) {
$loggedIn = $this->_user->loggedIn;
$this->_project = new Project();
$this->_project->setUserData($loggedIn->uid, $this->_user->getPath(), $loggedIn->name, $loggedIn->email);
}
}
开发者ID:reveil,项目名称:CodeTornado,代码行数:9,代码来源:ProjectController.php
示例18: executeBefore
protected function executeBefore()
{
switch ($this->_action) {
case 'view':
$this->addTitle($this->_model->getTitle());
$this->addCSS('view_message');
break;
}
parent::executeBefore();
}
开发者ID:arieh,项目名称:tree-forum,代码行数:10,代码来源:MessageC.class.php
示例19: __construct
public function __construct()
{
parent::__construct();
Doo::loadClass('UserSession');
$this->usession = new UserSession();
$username = $this->usession->uget('username');
if (!$username) {
header('Location:' . DOO::conf()->SUBFOLDER . 'login');
}
$this->init();
}
开发者ID:berlianaputri,项目名称:rps,代码行数:11,代码来源:UserController.php
示例20: UsersModel
function __construct()
{
parent::__construct();
$this->users_model = new UsersModel();
$this->fields = $this->users_model->fields;
$this->submit();
$this->delete();
$this->view();
$this->edit();
$this->add();
}
开发者ID:antistereotip,项目名称:g-shop,代码行数:11,代码来源:users.controller.php
注:本文中的MainController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论