本文整理汇总了PHP中common::LoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP common::LoggedIn方法的具体用法?PHP common::LoggedIn怎么用?PHP common::LoggedIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类common
的用法示例。
在下文中一共展示了common::LoggedIn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowCategory
function ShowCategory()
{
$this->showing_category = $this->catindex;
$catname = $this->categories[$this->catindex];
//paginate
$per_page = SimpleBlogCommon::$data['per_page'];
$page = 0;
if (isset($_GET['page']) && is_numeric($_GET['page'])) {
$page = (int) $_GET['page'];
}
$start = $page * $per_page;
$include_drafts = common::LoggedIn();
$show_posts = $this->WhichCatPosts($start, $per_page, $include_drafts);
$this->ShowPosts($show_posts);
//pagination links
echo '<p class="blog_nav_links">';
if ($page > 0) {
$html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page=' . ($page - 1), 'class="blog_newer"');
echo gpOutput::GetAddonText('Newer Entries', $html);
echo ' ';
}
if (($page + 1) * $per_page < $this->total_posts) {
$html = SimpleBlogCommon::CategoryLink($this->catindex, $catname, '%s', 'page=' . ($page + 1), 'class="blog_older"');
echo gpOutput::GetAddonText('Older Entries', $html);
}
echo '</p>';
}
示例2: getStuff
public static function getStuff()
{
$config = self::getConfig();
if (common::LoggedIn()) {
if ($config['wysiwygEnabled']) {
global $addonPathCode, $page;
require_once $addonPathCode . "/Renderer.php";
$renderer = new Renderer($config, $addonPathCode . "/lib/parsedown");
print $renderer->render($_REQUEST['content']);
//haha, very secure. NOT!
$nonce_str = 'EasyMark4Life!';
//TODO: sanitize $config stuff
//"stuff" is defined in edit.js
print "<script>";
print "var nonceStr = '" . $nonce_str . "';";
print "var postNonce = '" . common::new_nonce('post', true) . "';";
print "setTimeout(stuff, " . htmlspecialchars($config['wysiwygDelay']) . "*1000);";
print "</script>";
// cleanup old page object
unset($page);
}
} else {
print "Have to be logged in to use this feature";
}
}
示例3: __construct
function __construct()
{
global $page, $langmessage, $config, $contact_message_sent, $message_send_attempt;
$this->sent = $contact_message_sent;
if (empty($config['toemail'])) {
if (common::LoggedIn()) {
$url = common::GetUrl('Admin_Configuration');
msg($langmessage['enable_contact'], $url);
}
echo $langmessage['not_enabled'];
return;
}
$cmd = common::GetCommand();
switch ($cmd) {
case 'gp_send_message':
if (!$message_send_attempt) {
$message_send_attempt = true;
if (!$this->sent && $this->SendMessage()) {
$this->sent = $contact_message_sent = true;
break;
}
}
default:
break;
}
$this->ShowForm();
}
示例4: GenerateContent_Admin
function GenerateContent_Admin()
{
global $addonFolderName, $page;
static $done = false;
if ($done || !common::LoggedIn()) {
return;
}
$done = true;
}
示例5: SimpleSearch
function SimpleSearch()
{
global $page, $langmessage, $addonPathData;
$this->config_file = $addonPathData . '/search_config.php';
$this->GetConfig();
if (common::LoggedIn()) {
$page->admin_links[] = array('Special_Search', 'Configuration', 'cmd=config');
$cmd = common::GetCommand();
switch ($cmd) {
case 'save_config':
if ($this->SaveConfig()) {
break;
}
return;
case 'config':
$this->Config($this->search_config);
return;
}
}
$query =& $_GET['q'];
echo '<div class="search_results">';
echo '<form action="' . common::GetUrl('Special_Search') . '" method="get">';
echo '<h2>';
echo gpOutput::GetAddonText('Search');
echo ' ';
echo '<input name="q" type="text" class="text" value="' . htmlspecialchars($query) . '"/>';
echo '<input type="hidden" name="src" value="gadget" /> ';
$html = '<input type="submit" name="" class="submit" value="%s" />';
echo gpOutput::GetAddonText('Search', $html);
echo '</h2>';
echo '</form>';
if (!empty($query)) {
$query = strtolower($query);
preg_match_all("/\\S+/", $query, $words);
$words = array_unique($words[0]);
$pattern = '#(';
$bar = '';
foreach ($words as $word) {
$pattern .= $bar . preg_quote($word, '#');
$bar = '|';
}
$pattern .= ')#Si';
$this->SearchPages($pattern);
$this->SearchBlog($pattern);
}
if (count($this->files) > 0) {
foreach ($this->files as $result) {
echo $result;
}
} else {
echo '<p>';
echo gpOutput::GetAddonText('Sorry, there weren\'t any results for your search. ');
echo '</p>';
}
echo '</div>';
}
示例6: RunScript
function RunScript()
{
global $gp_index, $langmessage, $page;
$scriptinfo = special_display::GetScriptInfo($this->requested);
if ($scriptinfo === false) {
switch ($this->requested) {
case 'Special_ExtraJS':
$this->ExtraJS();
//dies
}
$this->Error_404($this->title);
return;
}
$this->gp_index = $gp_index[$this->requested];
$this->label = common::GetLabel($this->requested);
$this->TitleInfo = $scriptinfo;
$menu_permissions = false;
if (common::LoggedIn()) {
$menu_permissions = admin_tools::HasPermission('Admin_Menu');
if ($menu_permissions) {
$page->admin_links[] = common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', ' name="gpajax" ');
$page->admin_links[] = common::Link('Admin_Menu', $langmessage['current_layout'], 'cmd=layout&from=page&index=' . urlencode($this->gp_index), ' title="' . $langmessage['current_layout'] . '" name="gpabox"');
}
if (admin_tools::HasPermission('Admin_User')) {
$page->admin_links[] = common::Link('Admin_Users', $langmessage['permissions'], 'cmd=file_permissions&index=' . urlencode($this->gp_index), ' title="' . $langmessage['permissions'] . '" name="gpabox" ');
}
}
//allow addons to affect page actions and how a page is displayed
$cmd = common::GetCommand();
$cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
if ($cmd !== $cmd_after) {
$cmd = $cmd_after;
if ($cmd === 'return') {
return;
}
}
if ($menu_permissions) {
switch ($cmd) {
// rename & details
case 'renameform':
$this->RenameForm();
return;
case 'renameit':
if ($this->RenameFile()) {
return;
}
break;
}
}
$this->contentBuffer = special_display::ExecInfo($scriptinfo);
}
示例7: RunScript
function RunScript()
{
global $gp_index, $langmessage, $page;
$scriptinfo = special_display::GetScriptInfo($this->title);
if ($scriptinfo === false) {
switch ($this->title) {
case 'Special_ExtraJS':
$this->ExtraJS();
//dies
}
$this->Error_404($this->title);
return;
}
$this->gp_index = $gp_index[$this->title];
$this->TitleInfo = $scriptinfo;
if (!$this->CheckVisibility()) {
return false;
}
//allow addons to affect page actions and how a page is displayed
$cmd = common::GetCommand();
$cmd_after = gpPlugin::Filter('PageRunScript', array($cmd));
if ($cmd !== $cmd_after) {
$cmd = $cmd_after;
if ($cmd === 'return') {
return;
}
}
if (common::LoggedIn()) {
$menu_permissions = admin_tools::HasPermission('Admin_Menu');
if ($menu_permissions) {
switch ($cmd) {
// rename & details
case 'renameform':
$this->RenameForm();
return;
case 'renameit':
if ($this->RenameFile()) {
return;
}
break;
case 'ToggleVisibility':
$this->ToggleVisibility();
break;
}
}
$this->AdminLinks();
}
$this->contentBuffer = special_display::ExecInfo($scriptinfo);
}
示例8: special_galleries
function special_galleries()
{
$this->galleries = special_galleries::GetData();
if (common::LoggedIn()) {
$cmd = common::GetCommand();
switch ($cmd) {
case 'edit':
$this->EditGalleries();
return;
case 'newdrag':
$this->NewDrag();
return;
}
}
$this->GenerateOutput();
}
示例9: GetGpxContent
function GetGpxContent()
{
if (!empty($this->show_admin_content)) {
echo '<div id="gpx_content">';
echo '<div id="admincontent">';
admin_tools::AdminContentPanel();
if (common::LoggedIn()) {
echo '<div id="admincontent_inner">';
echo $this->contentBuffer;
echo '</div>';
} else {
echo $this->contentBuffer;
}
echo '</div>';
echo '</div>';
}
}
示例10: ParseLess
/**
* Handle the processing of multiple less files into css
*
* @return mixed Compiled css string or false
*
*/
static function ParseLess(&$less_files, $files_hash = false)
{
global $dataDir;
if (!$files_hash) {
$files_hash = common::ArrayHash($less_files);
}
$compiled = false;
// don't use less if the memory limit is less than 64M
$limit = @ini_get('memory_limit');
if ($limit) {
$limit = common::getByteValue($limit);
//if less than 64M, disable less compiler if we can't increase
if ($limit < 67108864 && @ini_set('memory_limit', '96M') === false) {
if (common::LoggedIn()) {
msg('LESS compilation disabled. Please increase php\'s memory_limit');
}
return false;
//if less than 96M, try to increase
} elseif ($limit < 100663296) {
@ini_set('memory_limit', '96M');
}
}
//compiler options
$options = array();
//$options['compress'] = true;
/*
$source_map_file = '/data/_cache/'.$files_hash.'.map';
$options['sourceMap'] = true;
$options['sourceMapBasepath'] = $dataDir;
$options['sourceMapWriteTo'] = $dataDir.$source_map_file;
$options['sourceMapURL'] = common::GetDir($source_map_file);
*/
//prepare the compiler
includeFile('thirdparty/less.php/Less.php');
$parser = new Less_Parser($options);
$import_dirs[$dataDir] = common::GetDir('/');
$parser->SetImportDirs($import_dirs);
$parser->cache_method = 'php';
$parser->SetCacheDir($dataDir . '/data/_cache');
// combine files
try {
foreach ($less_files as $less) {
//treat as less markup if there are newline characters
if (strpos($less, "\n") !== false) {
$parser->Parse($less);
continue;
}
// handle relative and absolute paths
if (strpos($less, $dataDir) === false) {
$relative = $less;
$less = $dataDir . '/' . ltrim($less, '/');
} else {
$relative = substr($less, strlen($dataDir));
}
$parser->ParseFile($less, common::GetDir(dirname($relative)));
}
$compiled = $parser->getCss();
} catch (Exception $e) {
if (common::LoggedIn()) {
msg('LESS Compile Failed: ' . $e->getMessage());
}
return false;
}
// significant difference in used memory 15,000,000 -> 6,000,000. Max still @ 15,000,000
if (function_exists('gc_collect_cycles')) {
gc_collect_cycles();
}
$less_files = $parser->allParsedFiles();
return $compiled;
}
示例11: SearchPage
function SearchPage($title, $index)
{
global $gp_menu, $gp_titles;
//search hidden?
if (!$this->search_hidden && !isset($gp_menu[$index])) {
return;
}
//private pages
if (!common::LoggedIn()) {
if (isset($gp_titles[$index]['vis'])) {
return;
}
}
$full_path = gpFiles::PageFile($title);
$file_sections = gpFiles::Get($full_path, 'file_sections');
if (!$file_sections) {
return;
}
$content = section_content::Render($file_sections, $title, gpFiles::$last_stats);
$label = common::GetLabel($title);
$this->FindString($content, $label, $title);
}
示例12: ErrorBuffer
static function ErrorBuffer($check_user = true, $jquery = true)
{
global $wbErrorBuffer, $config, $dataDir, $rootDir;
if (count($wbErrorBuffer) == 0) {
return;
}
if (isset($config['Report_Errors']) && !$config['Report_Errors']) {
return;
}
if ($check_user && !common::LoggedIn()) {
return;
}
$dataDir_len = strlen($dataDir);
$rootDir_len = strlen($rootDir);
$img_path = common::IdUrl('er');
$i = 0;
foreach ($wbErrorBuffer as $error) {
//remove $dataDir or $rootDir from the filename
$file_name = common::WinPath($error['ef' . $i]);
if ($dataDir_len > 1 && strpos($file_name, $dataDir) === 0) {
$file_name = substr($file_name, $dataDir_len);
} elseif ($rootDir_len > 1 && strpos($file_name, $rootDir) === 0) {
$file_name = substr($file_name, $rootDir_len);
}
$error['ef' . $i] = substr($file_name, -100);
$new_path = $img_path . '&' . http_build_query($error, '', '&');
//maximum length of 2000 characters
if (strlen($new_path) > 2000) {
break;
}
$img_path = $new_path;
$i++;
}
return common::IdReq($img_path, $jquery);
}
示例13: IncludeContent
/**
* Include the content of a page or gadget as specified in $data
* @param array $data
* @param string The included content
*/
static function IncludeContent($data)
{
global $langmessage, $gp_index;
if (isset($data['index'])) {
$requested = common::IndexToTitle($data['index']);
} else {
$requested = $data['content'];
}
if (empty($requested)) {
return '<p>' . $langmessage['File Include'] . '</p>';
}
if (self::$title == $requested) {
if (common::LoggedIn()) {
msg('Infinite loop detected: ' . htmlspecialchars($requested));
}
return;
}
if (isset($data['include_type'])) {
$type = $data['include_type'];
} else {
$type = common::SpecialOrAdmin($requested);
}
switch ($type) {
case 'gadget':
return self::IncludeGadget($requested);
case 'special':
return self::IncludeSpecial($requested);
default:
return self::IncludePage($requested);
}
}
示例14: SimilarTitleArray
/**
* Get a list of existing titles similar to the requested page
* @return array
*
*/
function SimilarTitleArray($title)
{
global $gp_index, $gp_titles;
$similar = array();
$percent_similar = array();
$lower = str_replace(' ', '_', strtolower($title));
$admin = common::LoggedIn();
foreach ($gp_index as $title => $index) {
//skip private pages
if (!$admin) {
$visibility = display::OrConfig($index, 'vis');
if ($visibility) {
continue;
}
}
similar_text($lower, strtolower($title), $percent);
$similar[$title] = $percent;
}
arsort($similar);
return $similar;
}
示例15: define
<?php
define('is_running', true);
//define('gpdebug',true);
require_once '../common.php';
common::EntryPoint(2, 'update.php');
/* check permissions */
if (!common::LoggedIn()) {
die('You must be logged in to access this area.');
}
if (!isset($gpAdmin['granted']) || $gpAdmin['granted'] !== 'all') {
die('Sorry, you do not have sufficient privileges to access this area.');
}
includeFile('tool/update.php');
common::GetLangFile();
$page = new update_class();
gpOutput::HeadContent();
includeFile('install/template.php');