本文整理汇总了PHP中GWF_Website::addDefaultOutput方法的典型用法代码示例。如果您正苦于以下问题:PHP GWF_Website::addDefaultOutput方法的具体用法?PHP GWF_Website::addDefaultOutput怎么用?PHP GWF_Website::addDefaultOutput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GWF_Website
的用法示例。
在下文中一共展示了GWF_Website::addDefaultOutput方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Upgrade_Slaytags_1_01
function Upgrade_Slaytags_1_01(Module_Slaytags $module)
{
GWF_Website::addDefaultOutput(GWF_HTML::message('Slaytags', "BPM and Key"));
$songs = GDO::table('Slay_Song');
$songs->createColumn('ss_bpm');
$songs->createColumn('ss_key');
}
示例2: Upgrade_WeChall_1_06
function Upgrade_WeChall_1_06(Module_WeChall $module)
{
GWF_Website::addDefaultOutput(GWF_HTML::message('WC5', "Regat table now stores challs_solved. (thx Jinx)"));
$db = gdo_db();
$regat = GWF_TABLE_PREFIX . 'wc_regat';
$query = "ALTER TABLE {$regat} ADD COLUMN regat_challsolved INT(11) NOT NULL DEFAULT -1";
if (false === $db->queryWrite($query)) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
示例3: Upgrade_News_1_01
function Upgrade_News_1_01(Module_News $module)
{
if (false === gdo_db()->query('ALTER TABLE ' . GWF_TABLE_PREFIX . 'newstrans' . ' ADD COLUMN newst_threadid INT(11) UNSIGNED NOT NULL DEFAULT 0')) {
return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$msg = GWF_HTML::message('News', 'It is now possible to have news in forums.');
if (GWF_OUTPUT_BUFFERING) {
echo $msg;
} else {
GWF_Website::addDefaultOutput($msg);
}
return '';
}
示例4: Upgrade_WeChall_5_03
function Upgrade_WeChall_5_03(Module_WeChall $module)
{
GWF_Website::addDefaultOutput(GWF_HTML::message('WC5', "Sites can have multiple warboxes now. (thx awe)"));
$module->includeClass('WC_Site');
$sites = GDO::table('WC_Site');
$columns = array('site_warport', 'site_warhost', 'site_war_rs', 'site_war_ip');
$back = '';
foreach ($columns as $column) {
if (!$sites->dropColumn($column)) {
$back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
}
return $back;
}
示例5: __construct
/**
* @param array $config
* @param string $basepath = dirname(__FILE__)
* $basepath is the GWF_WWW_PATH without trailing slash
* @return GWF3
*/
public function __construct($basepath = NULL, array $config = array())
{
self::$CONFIG = $config = array_merge(self::$CONFIG, $config);
# Set session_name to something we might clean up ourselves from time to time.
# We don't use php sessions(yet), but 3rd party might use it, and we can even cleanup.
session_name(GWF_SESS_NAME);
# Bootstrap
if (true === $config['bootstrap']) {
GWF_Bootstrap::init();
}
# Windows patch
// if (GWF_ServerInfo::isWindows())
// {
// $basepath = str_replace('\\', '/', $basepath);
// }
# Important definements...
$basepath = $basepath === NULL ? GWF_PATH . 'www' : $basepath;
Common::defineConst('GWF_WWW_PATH', $basepath . '/');
Common::defineConst('GWF_PROTECTED_PATH', GWF_WWW_PATH . 'protected/');
Common::defineConst('GWF_CONFIG_PATH', GWF_PROTECTED_PATH . 'config.php');
Common::defineConst('GWF_LOGGING_PATH', GWF_PROTECTED_PATH . 'logs');
# Load config
if (true === $config['load_config']) {
$this->onLoadConfig(GWF_CONFIG_PATH);
}
# WebSite is down?
if (true === defined('GWF_WORKER_IP')) {
if (GWF_WORKER_IP !== (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '')) {
die(GWF_SITENAME . ' is down for maintainance.<br/>' . GWF_DOWN_REASON);
} else {
GWF_Website::addDefaultOutput('<p style="color: #ff0000">Welcome back Admin! GWF_WORKER_IP is activated</p>');
}
}
# Set valid mo/me
$_GET['mo'] = Common::getGetString('mo', GWF_DEFAULT_MODULE);
$_GET['me'] = Common::getGetString('me', GWF_DEFAULT_METHOD);
# Setting the Design... TODO...
self::setDesign(Common::getConst('GWF_DEFAULT_DESIGN', 'default'));
# abort script execution on user disconnect?
ignore_user_abort($config['ignore_user_abort']);
# define GWF_WEB_ROOT
self::onDefineWebRoot();
# Init the config?
if (true === $config['init']) {
$this->init();
}
// return $this;
}
示例6: Upgrade_WeChall_5_04
function Upgrade_WeChall_5_04(Module_WeChall $module)
{
GWF_Website::addDefaultOutput(GWF_HTML::message('WC5', "Warboxes can have flags now. (thx Steven)"));
$back = '';
# Kill Old Warbox mode bit
$killbit = WC_Site::NO_V1_SCRIPTS;
$module->includeClass('WC_Site');
$sites = GDO::table('WC_Site');
if (!$sites->update("site_options=site_options&{$killbit}")) {
$back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
$module->includeClass('WC_Warbox');
$boxes = GDO::table('WC_Warbox');
if (!$boxes->createColumn('wb_options')) {
$back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
return $back;
}
示例7: Upgrade_WeChall_5_02
function Upgrade_WeChall_5_02(Module_WeChall $module)
{
GWF_Website::addDefaultOutput(GWF_HTML::message('WC5', "Sites have hostname, port, reducescore and IP now. (thx epoch)"));
$module->includeClass('WC_Site');
$sites = GDO::table('WC_Site');
if (!$sites->createColumn('site_warhost')) {
return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (!$sites->createColumn('site_warport')) {
return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (!$sites->createColumn('site_war_rs')) {
return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (!$sites->createColumn('site_war_ip')) {
return GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
return '';
}
示例8: call
/**
* Call a hook. User is a default argument. calls hook($user, array $args)
* @param string $name unique ID
* @param GWF_User $user the current user
* @param array $args
*/
public static function call($name, GWF_User $user, array $args = array())
{
self::initHooks();
if (!isset(self::$HOOKS[$name])) {
// GWF_Log::logCritical('Unknown hook: '.$name);
return true;
}
$output = '';
foreach (self::$HOOKS[$name] as $hook) {
$modulename = Common::substrFrom($hook[0], '_');
if (false !== ($module = GWF_Module::loadModuleDB($modulename, true, true))) {
$output .= self::cleanResult($hook, call_user_func(array($module, $hook[1]), $user, $args));
}
}
if ($output === '') {
return true;
}
GWF_Website::addDefaultOutput($output);
return false;
}
示例9: getQuickSearchConditions
/**
* Create a WHERE clause from fields and searchterm.
* This function does not sanitize the fields anymore!
* @param GDO $gdo
* @param array $fields
* @param string $term
* @return string the where clause
*/
public static function getQuickSearchConditions(GDO $gdo, array $fields, $term)
{
$term = trim($term);
if (false === ($tokens = self::search_tokenize($term))) {
GWF_Website::addDefaultOutput(GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)));
return false;
}
# Whitelist fields
// foreach ($fields as $field)
// {
// if (false === $gdo->getWhitelistedBy($field))
// {
// GWF_Website::addDefaultOutput(GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)));
// return false;
// }
// }
# Concat the Fields, (we are doing a full search anyway)
$concat = 'CONCAT(' . implode(', ":", ', $fields) . ')';
$prev = array(self::SEARCH_EMPTY, '');
$prevnot = false;
$where = array();
foreach ($tokens as $token) {
$type = $token[0] & self::SEARCH_TYPE;
$not = ($token[0] & self::SEARCH_NOT) > 0;
$sql = $token[1];
$setprev = true;
switch ($type) {
case self::SEARCH_TERM:
switch ($prev[0]) {
case self::SEARCH_BRACKET_CLOSE:
case self::SEARCH_TERM:
// break;
// break;
default:
$where[] = 'AND';
case self::SEARCH_EMPTY:
$not = $prevnot ? ' NOT' : '';
$prevnot = false;
$where[] = sprintf('%s%s LIKE \'%%%s%%\'', $concat, $not, $gdo->escape($sql));
break;
}
break;
case self::SEARCH_NEAR:
echo "NEAR NOT SUPPORTED YET.";
break;
case self::SEARCH_BRACKET_OPEN:
// if ($prev[0] === self::SEARCH_TERM)
// {
// $where[] = 'AND';
// }
// $where[] = $sql;
break;
case self::SEARCH_BRACKET_CLOSE:
break;
case self::SEARCH_OR:
case self::SEARCH_AND:
$where[] = $sql;
break;
default:
if ($token[0] === self::SEARCH_NOT) {
$prevnot = true;
$setprev = false;
}
break;
}
if ($setprev === true) {
$prev = $token;
}
}
$back = implode(' ', $where);
return $back === '' ? '1' : $back;
}
示例10: hookLoginAfter
/**
* We succesfully logged in and add your last location as link.
* @param $user
* @param $args
* @return unknown_type
*/
public function hookLoginAfter(GWF_User $user, array $args)
{
# Show last location
$url = htmlspecialchars($args[0]);
GWF_Website::addDefaultOutput(GWF_Box::box($this->lang('pi_login_link', array($url, $url))));
return '';
}
示例11: sendWithAttachments
public function sendWithAttachments($cc, $bcc)
{
$to = $this->getUTF8Receiver();
$from = $this->getUTF8Sender();
$subject = $this->getUTF8Subject();
$random_hash = md5(microtime(true));
$bound_mix = "GWF3-MIX-{$random_hash}";
$bound_alt = "GWF3-ALT-{$random_hash}";
$headers = "Content-Type: multipart/mixed; boundary=\"{$bound_mix}\"" . self::HEADER_NEWLINE . "MIME-Version: 1.0" . self::HEADER_NEWLINE . "Content-Transfer-Encoding: 8bit" . self::HEADER_NEWLINE . "X-Mailer: PHP" . self::HEADER_NEWLINE . 'From: ' . $from . self::HEADER_NEWLINE . 'Reply-To: ' . $this->getUTF8Reply() . self::HEADER_NEWLINE . 'Return-Path: ' . $this->getUTF8Return();
$message = "--{$bound_mix}\n";
$message .= "Content-Type: multipart/alternative; boundary=\"{$bound_alt}\"\n";
$message .= "\n";
$message .= "--{$bound_alt}\n";
$message .= "Content-Type: text/plain; charset=utf-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n";
$message .= "\n";
$message .= $this->encrypt($this->nestedTextBody());
$message .= "\n\n";
$message .= "--{$bound_alt}\n";
$message .= "Content-Type: text/html; charset=utf-8\n";
$message .= "Content-Transfer-Encoding: 8bit\n";
$message .= "\n";
$message .= $this->encrypt($this->nestedHTMLBody());
$message .= "\n\n";
$message .= "--{$bound_alt}--\n";
$message .= "\n";
foreach ($this->attachments as $filename => $attachdata) {
list($attach, $mime, $encrypted) = $attachdata;
$filename = preg_replace("/[^a-z0-9_\\-\\.]/i", '', $filename);
$message .= "--{$bound_mix}\n";
$message .= "Content-Type: {$mime}; name=\"{$filename}\"\n";
$message .= "Content-Transfer-Encoding: base64\nContent-Disposition: attachment\n\n";
if ($encrypted) {
$message .= $this->encrypt(chunk_split(base64_encode($attach)));
} else {
$message .= chunk_split(base64_encode($attach));
}
}
$message .= "--{$bound_mix}--\n\n";
// echo $message;
// $encrypted = $this->encrypt($message);
if (GWF_DEBUG_EMAIL & 16) {
GWF_Website::addDefaultOutput(sprintf('<h1>Local EMail:</h1><pre>%s<br/>%s</pre>', htmlspecialchars($this->subject), $message));
return true;
} else {
return @mail($to, $subject, $message, $headers);
#, '-r ' . $this->sender);
}
}
示例12: logCriticalError
private function logCriticalError(GWF_Module $module, GWF_Order $order)
{
$message = $this->error('err_crit', $order->getOrderToken());
GWF_Log::logCritical($message);
GWF_Website::addDefaultOutput($message);
return '';
}
示例13: Upgrade_WeChall_5_06
function Upgrade_WeChall_5_06(Module_WeChall $module)
{
GWF_Website::addDefaultOutput(GWF_HTML::message('WC5', "Database additions for speedy warboxes."));
gdo_db()->setDieOnError(false);
GWF_Debug::setDieOnError(false);
$back = '';
# Copy warchalls to warflags table
$module->includeClass('WC_Warchall');
$module->includeClass('WC_Warchalls');
$module->includeClass('WC_Warflag');
$module->includeClass('WC_Warflags');
$flag = GDO::table('WC_Warflag');
$flags = GDO::table('WC_Warflags');
#
if (!$flag->createColumn('wf_solvers')) {
$back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (!$flag->createColumn('wf_options')) {
$back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (!$flag->dropColumn('wf_flag')) {
$back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
$flag->update("wf_options=1");
$now = GWF_Time::getDate();
$chall = GDO::table('WC_Warchall');
$challs = GDO::table('WC_Warchalls');
foreach ($chall->selectAll('*', '', '', NULL, -1, -1, GDO::ARRAY_O) as $c) {
$c instanceof WC_Warchall;
$boxid = $c->getVar('wc_boxid');
$newflag = new WC_Warflag(array('wf_id' => '0', 'wf_wbid' => $boxid, 'wf_order' => '0', 'wf_cat' => 'exploit', 'wf_score' => '1', 'wf_solvers' => '0', 'wf_title' => $c->getVar('wc_level'), 'wf_url' => '', 'wf_authors' => 'Steven', 'wf_status' => 'up', 'wf_login' => '', 'wf_flag_enc' => NULL, 'wf_created_at' => $now, 'wf_last_solved_at' => NULL, 'wf_last_solved_by' => NULL, 'wf_options' => WC_Warflag::WARCHALL));
$newflag->replace();
$nfid = $newflag->getID();
foreach ($challs->selectAll('*', "wc_wcid={$c->getID()}", '', NULL, -1, -1, GDO::ARRAY_O) as $entry) {
$entry instanceof WC_Warchalls;
$flags->insertAssoc(array('wf_wfid' => $nfid, 'wf_uid' => $entry->getVar('wc_uid'), 'wf_solved_at' => $entry->getVar('wc_solved_at'), 'wf_attempts' => '1', 'wf_last_attempt' => NULL));
}
}
$flag->update("wf_solvers = (SELECT COUNT(*) FROM wc4_wc_warflags WHERE wf_wfid=wf_id)");
$flag->update("wf_last_solved_at = (SELECT MAX(wf_solved_at) FROM wc4_wc_warflags WHERE wf_wfid=wf_id)");
$flag->update("wf_last_solved_by = (SELECT wf_uid FROM wc4_wc_warflags WHERE wf_wfid=wf_id ORDER BY wf_solved_at DESC LIMIT 1)");
$module->includeClass('WC_Warbox');
$boxes = GDO::table('WC_Warbox');
if (!$boxes->createColumn('wb_players')) {
$back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (!$boxes->createColumn('wb_flags')) {
$back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (!$boxes->createColumn('wb_challs')) {
$back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
if (!$boxes->createColumn('wb_totalscore')) {
$back .= GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__));
}
foreach ($boxes->selectAll('*', "", "", NULL, -1, -1, GDO::ARRAY_O) as $box) {
$box instanceof WC_Warbox;
$box->recalcPlayersAndScore();
}
$box->update("wb_challs=(SELECT COUNT(*) FROM wc4_wc_warflag WHERE wf_wbid=wb_id)");
$box->update("wb_levels=(SELECT COUNT(*) FROM wc4_wc_warflag WHERE wf_wbid=wb_id AND wf_options&2)");
$box->update("wb_flags=(SELECT COUNT(*) FROM wc4_wc_warflag WHERE wf_wbid=wb_id AND wf_options&1)");
$chall->dropTable();
$challs->dropTable();
return $back;
}
示例14: displayAjax
private static function displayAjax(&$subject)
{
$back = '';
foreach ($subject as $messages) {
foreach ($messages as $msg) {
$m = GWF_Debug::shortpath(self::decode($msg));
$back .= sprintf('0:%d:%s', strlen($m), $m) . PHP_EOL;
}
}
GWF_Website::addDefaultOutput($back);
return $back;
}
示例15: onDelete
public function onDelete(GWF_Page $page, $do_cleanup = true)
{
# History is per page basis, and can be deleted easily.
if (false === GWF_PageHistory::onDelete($page)) {
return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
#
if (false === GWF_PageTagMap::onDelete($page)) {
return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
# Last of them?
$num_trans = $page->selectVar('COUNT(*)', "page_otherid={$oid}");
if ($num_trans === 1) {
if (false === GWF_PageGID::onDelete($page)) {
return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
} elseif ($page->isRoot()) {
if (!$this->newRoot($page)) {
return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
}
if (false === $page->delete()) {
return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
if ($do_cleanup) {
if (false === $this->onDeleteCleanup()) {
return GWF_Error::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
}
GWF_Website::addDefaultOutput($this->module->message('msg_deleted'));
return true;
}