本文整理汇总了PHP中CheckPermissions函数的典型用法代码示例。如果您正苦于以下问题:PHP CheckPermissions函数的具体用法?PHP CheckPermissions怎么用?PHP CheckPermissions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckPermissions函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
function log()
{
if (!CheckPermissions('admin')) {
return;
}
$this->load->helper('url');
$bulk = 'Valid logs are ' . anchor('admin/dev/log/web/', 'log/web') . ' and ' . anchor('admin/dev/log/irc/', 'log/irc') . '.';
$segments = $this->uri->segment_array();
switch ($this->uri->segment(4)) {
case "web":
$web = dir('../log');
while (false !== ($entry = $web->read())) {
if ($entry != '.' or $entry != '..') {
$bulk .= '<p>' . anchor('admin/dev/log/web/' . $entry, $entry) . '</p>';
}
}
if ($this->uri->segment(5)) {
$bulk .= nl2br(file_get_contents('../log/' . $this->uri->segment(5)));
}
break;
case "irc":
$irc = dir('../supybot/logs/ChannelLogger/afsmg/#theyorker');
while (false !== ($entry = $irc->read())) {
$entry = trim($entry, '#');
$bulk .= '<p>' . anchor('admin/dev/log/irc/' . $entry, $entry) . '</p>';
}
if ($this->uri->segment(5)) {
$bulk .= nl2br(xml_escape(file_get_contents('../supybot/logs/ChannelLogger/afsmg/#theyorker/#' . $this->uri->segment(5))));
}
break;
}
$this->main_frame->SetContent(new SimpleView($bulk));
$this->main_frame->SetTitle('Log Viewer');
$this->main_frame->Load();
}
示例2: index
function index()
{
if (!CheckPermissions('public')) {
return;
}
$homepage_article_type = 'lifestyle';
// Get page properties information
$this->pages_model->SetPageCode('homepage_' . $homepage_article_type);
$main_articles_num = (int) $this->pages_model->GetPropertyText('max_num_main_articles');
$more_articles_num = (int) $this->pages_model->GetPropertyText('max_num_more_articles');
// Obtain banner for homepage
$data['banner'] = $this->Home_Model->GetBannerImageForHomepage($homepage_article_type);
// Get main article
$featured_article_id = $this->News_model->GetLatestFeaturedId($homepage_article_type);
if ($featured_article_id === NULL) {
// No featured article, use the most recent
$latest_article_id = $this->News_model->GetLatestId($homepage_article_type, 1);
$featured_article_id = $latest_article_id[0];
}
$data['main_articles'] = $this->Home_Hack_Model->getArticleTitles(array($featured_article_id), '%W, %D %M %Y');
// Get sub-types for article section
$data['section_articles'] = array();
$sub_types = $this->News_model->getSubArticleTypes($homepage_article_type);
foreach ($sub_types as $type) {
// Make sure we don't get duplicate articles
$offset = $this->getNumberOfType($data['main_articles'], $type['codename']);
$article_ids = $this->News_model->GetLatestId($type['codename'], $more_articles_num, $offset);
$data['section_articles'][strtolower($type['name'])] = $this->Home_Hack_Model->getArticleTitles($article_ids, '%W, %D %M %Y');
}
$this->main_frame->SetData('menu_tab', 'lifestyle');
$this->main_frame->IncludeCss('stylesheets/home.css');
$this->main_frame->SetContentSimple('homepages/' . $homepage_article_type, $data);
$this->main_frame->Load();
}
示例3: ShowUpdatePage
function ShowUpdatePage()
{
global $LNG, $CONF;
$template = new template();
$template->message('<p>This Site is currently under construction, because the update system brings somtimes inconsistent game installations.</p><p>Alternate update process: <a href="http://2moons.cc/b4-support/b7-installation-update-und-konvertierung/t1721-howto-update-your-2moons-game-with-private-modifications-without-edit-files-one-by-one/" target="blank"><u>2moons.cc Board</u></a></p><p>We apologize for any inconvenience.</p>');
exit;
if (!function_exists('curl_init')) {
$template = new template();
$template->message($LNG['up_need_curl']);
}
if (isset($_REQUEST['version'])) {
$Temp = explode('.', $_REQUEST['version']);
$Temp = array_map('intval', $Temp);
if (count(GetLogs($Temp[2]), COUNT_RECURSIVE) > 8) {
Config::update(array('VERSION' => $Temp[0] . '.' . $Temp[1] . '.' . $Temp[2]));
}
}
$ACTION = HTTP::_GP('action', '');
switch ($ACTION) {
case "download":
DownloadUpdates();
break;
case "check":
CheckPermissions();
break;
case "update":
ExecuteUpdates();
break;
default:
DisplayUpdates();
break;
}
}
示例4: thread
/**
* @param $Thread
* @todo Use pages model.
*/
function thread($Thread = NULL)
{
if (!CheckPermissions('moderator')) {
return;
}
$this->main_frame->Load();
}
示例5: update
function update($quote_id)
{
//has user got access to office
if (!CheckPermissions('office')) {
return;
}
$this->load->model('user_auth');
if (!($this->user_auth->officeType == 'High' || $this->user_auth->officeType == 'Admin')) {
$this->messages->AddMessage('error', 'Permission denied. You must be an editor to perform this operation.');
redirect('/office/quotes');
}
$quote_text = $this->input->post('quote_text');
$quote_author = $this->input->post('quote_author');
$quote_scheduled = $this->input->post('quote_scheduled');
$quote_schedule_date = $this->input->post('quote_schedule_date');
$quote_last_displayed_timestamp = $quote_scheduled ? $quote_schedule_date : null;
$delete = $this->input->post('name_delete_button') == 'Delete';
$this->load->model('Quote_Model');
if ($delete) {
$this->Quote_Model->RemoveQuote($quote_id);
$this->messages->AddMessage('success', 'Quote deleted successfully');
} else {
if ($quote_text && $quote_author) {
$this->Quote_Model->UpdateQuote($quote_id, $quote_text, $quote_author, $quote_last_displayed_timestamp);
$this->messages->AddMessage('success', 'Quote update successfully');
} else {
$this->messages->AddMessage('error', 'Quote update failed: no data was provided.');
}
}
redirect('/office/quotes');
}
示例6: index
/**
* @brief Wikitest test page.
*/
function index()
{
if (!CheckPermissions('office')) {
return;
}
$this->load->helper('wikitext_smiley');
// No POST data? just set wikitext to default string
$wikitext = $this->input->post('wikitext');
if ($wikitext === FALSE) {
$wikitext = '==This is the yorker wikitext parser==' . "\n";
$wikitext .= '*This is an unordered list' . "\n";
$wikitext .= '*#With an ordered list within' . "\n";
$wikitext .= '*#And another item' . "\n";
$wikitext .= "\n";
$wikitext .= '#This is an ordered list' . "\n";
$wikitext .= '#*With an unordered list within' . "\n";
$wikitext .= '#*And another item' . "\n";
$wikitext .= implode('', array_keys(_get_smiley_array())) . "\n";
}
$parsed_wikitext = $wikitext;
$parsed_wikitext = wikitext_parse_smileys($parsed_wikitext);
$parsed_wikitext = $this->wikiparser->parse($parsed_wikitext . "\n", 'wiki test');
$data = array('parsed_wikitext' => $parsed_wikitext, 'wikitext' => $wikitext);
// Set up the public frame
$this->main_frame->SetTitle('Wikitext Preview');
$this->main_frame->IncludeJs('javascript/wikitoolbar.js');
$this->main_frame->SetContentSimple('test/wikitext', $data);
// Load the public frame view (which will load the content view)
$this->main_frame->Load();
}
示例7: generateHeatmap
function generateHeatmap()
{
if (!CheckPermissions('admin')) {
return;
}
//create and ouput
}
示例8: index
function index()
{
if (!CheckPermissions('public')) {
return;
}
$spotlight = $this->home_hack_model->getArticlesByTags(array('food', 'spotlight'), 1);
$this->home_hack_model->ignore($spotlight);
$features = $this->home_hack_model->getArticlesByTags(array('food', 'feature'), 9);
$this->home_hack_model->ignore($features);
$broke_student = $this->home_hack_model->getArticlesByTags(array('the-broke-student'));
$weird_wonderful = $this->home_hack_model->getArticlesByTags(array('weird-and-wonderful'));
$taste_test = $this->home_hack_model->getArticlesByTags(array('the-taste-test'));
$boxes = array();
$boxes[] = array('type' => 'spotlight', 'articles' => $spotlight);
$boxes[] = array('type' => 'article_list', 'title' => 'latest features', 'title_link' => $features[0]['id'], 'size' => '1/3', 'position' => 'right', 'last' => true, 'articles' => $features);
$boxes[] = array('type' => 'article_list', 'title' => 'the broke student', 'title_link' => $broke_student[0]['id'], 'size' => '1/3', 'position' => '', 'last' => false, 'articles' => $broke_student);
$boxes[] = array('type' => 'article_list', 'title' => 'weird and wonderful', 'title_link' => $weird_wonderful[0]['id'], 'size' => '1/3', 'position' => '', 'last' => false, 'articles' => $weird_wonderful);
$boxes[] = array('type' => 'article_list', 'title' => 'the taste test', 'title_link' => $taste_test[0]['id'], 'size' => '1/3', 'position' => '', 'last' => false, 'articles' => $taste_test);
$boxes[] = array('type' => 'adsense_third', 'position' => '', 'last' => false);
$data = array('boxes' => $boxes);
$this->pages_model->SetPageCode('homepage_food');
$this->main_frame->SetData('menu_tab', 'food');
$this->main_frame->SetContentSimple('flexibox/layout', $data);
$this->main_frame->IncludeCss('stylesheets/home.css');
$this->main_frame->Load();
}
示例9: edit
function edit($id)
{
if (!CheckPermissions('editor')) {
return;
}
//Get page properties information
$this->pages_model->SetPageCode('office_specials_edit');
$data['page_information'] = $this->pages_model->GetPropertyWikiText('page_information');
$num_of_articles_to_get = (int) $this->pages_model->GetPropertyText('num_articles_to_show');
//Max number articles to pick from
//Get information about the article type
$article_type = $this->Article_model->getSubArticleType($id);
//Use codename to get list of articles to possible change the special to.
$articles = array();
$article_ids = $this->News_model->GetLatestId($article_type['codename'], $num_of_articles_to_get, false);
foreach ($article_ids as $article_id) {
$article = $this->News_model->GetSimpleArticle($article_id);
$article['id'] = $article_id;
$articles[] = $article;
}
//Find out the current featured article (if there is one)
$current_special_id = $this->News_model->GetLatestFeaturedId($article_type['codename']);
//Load Data into data to go to view
$data['articles'] = $articles;
$data['article_type'] = $article_type;
$data['current_special_id'] = $current_special_id;
$this->main_frame->SetContentSimple('office/specials/edit', $data);
// Load the public frame view (which will load the content view)
$this->main_frame->Load();
}
示例10: index
/**
* @brief Display style guide
*/
function index()
{
if (!CheckPermissions('office')) {
return;
}
/// Style guide stored in page properties
$this->pages_model->SetPageCode('office_style_guide');
/// Get the blocks array from page properties
$blocks = $this->pages_model->GetPropertyArray('blocks', array(array('pre' => '[', 'post' => ']', 'type' => 'int'), array('pre' => '.', 'type' => 'enum', 'enum' => array(array('title', 'text'), array('blurb', 'wikitext'), array('image', 'text')))));
if (FALSE === $blocks) {
$blocks = array();
}
/// Create data array.
$data = array();
$data['textblocks'] = array();
/// Process page properties
foreach ($blocks as $key => $block) {
$curdata = array();
$curdata['title'] = $block['title'];
$curdata['shorttitle'] = str_replace(' ', '_', $block['title']);
$curdata['blurb'] = $block['blurb'];
if (array_key_exists('image', $block)) {
$curdata['image'] = $this->image->getThumb($block['image'], 'medium');
} else {
$curdata['image'] = null;
}
$data['textblocks'][] = $curdata;
}
/// Load the main frame
$this->main_frame->SetContentSimple('office/guide/guide', $data);
$this->main_frame->Load();
}
示例11: completelist
function completelist($content_type_codename)
{
//check permissions
if (!CheckPermissions('office')) {
return;
}
//load Navbar frame
$this->_SetupNavbar($content_type_codename);
$this->main_frame->SetPage('completelist');
$content_type_id = $this->pr_model->GetContentTypeId($content_type_codename);
$content_type_fullname = $this->pr_model->GetContentTypeNiceName($content_type_codename);
$this->main_frame->SetTitleParameters(array('content_type' => $content_type_fullname));
//Load page properties stuff
$this->pages_model->SetPageCode('office_review_complete_list');
$data = array();
$data['page_information'] = $this->pages_model->GetPropertyWikiText('page_information');
// Get the search pattern from POST (optional)
$search_pattern = $this->input->post('search_directory', TRUE);
// Get the organisations matching the search and pass the search pattern
// to the view as well
$data['organisations'] = $this->pr_model->GetReviewContextListFromId($content_type_id);
$data['content_type_codename'] = $content_type_codename;
$data['search'] = $search_pattern;
// Set up the public frame to use the directory view
$this->main_frame->SetContentSimple('office/reviews/reviewlist', $data);
// Include the javascript
$this->main_frame->IncludeJs('javascript/directory.js');
$this->main_frame->IncludeCss('stylesheets/directory.css');
// Load the public frame view
$this->main_frame->Load();
}
示例12: index_old
function index_old()
{
if (!CheckPermissions('office')) {
return;
}
// AJAX
$this->load->library('xajax');
$this->xajax->registerFunction(array('_readAnnouncement', &$this, '_readAnnouncement'));
$this->xajax->processRequests();
$this->pages_model->SetPageCode('office_index');
$article_requests = $this->requests_model->GetMyRequests($this->user_auth->entityId);
$photos_requests = $this->photos_model->GetMyRequests($this->user_auth->entityId);
$all_requests = array();
while (count($article_requests) > 0 || count($photos_requests) > 0) {
if (count($article_requests) > 0 && (count($photos_requests) == 0 || $article_requests[0]['deadline'] < $photos_requests[0]['deadline'])) {
$all_requests[] = array_shift($article_requests);
} else {
$all_requests[] = array_shift($photos_requests);
}
}
$data['announcements'] = $this->notifications_model->getAnnouncements();
$data['my_requests'] = $all_requests;
// Set up the content
$this->main_frame->SetExtraHead($this->xajax->getJavascript(null, '/javascript/xajax.js'));
$this->main_frame->IncludeCss('/stylesheets/office_interface.css');
$this->main_frame->IncludeJs('/javascript/office_interface.js');
$this->main_frame->SetContentSimple('office/index', $data);
$this->main_frame->Load();
}
示例13: preports
function preports($charity_id = 1)
{
if (!CheckPermissions('public')) {
return;
}
$this->load->model('news_model', 'news');
$this->load->model('charity_model', 'charity');
$this->pages_model->SetPageCode('charity_pr');
$data['sections'] = array('charity' => $this->charity->GetCharity($charity_id), 'progress_reports' => array('title' => $this->pages_model->GetPropertyText('section_progress_reports_title', TRUE)), 'sidebar_links' => array('title' => $this->pages_model->GetPropertyText('sidebar_links_title', FALSE), 'text' => $this->pages_model->GetPropertyText('sidebar_links_text', FALSE)));
$data['sections']['progress_reports']['totalcount'] = $this->progressreports->GetCharityCampaignProgressReportCount($charity_id, true);
//needs a general model as progress reports can be for campaigns and for charities
$pr_temp = $this->progressreports->GetCharityCampaignProgressReports($charity_id, false, true);
if (count($pr_temp) > 0) {
foreach ($pr_temp as $row) {
$data['sections']['progress_reports']['entries'][$row] = $this->news->GetFullArticle($row);
}
}
//Obtain banner for homepage
$data['banner'] = $this->Home_Model->GetBannerImageForHomepage('ourcharity');
// Set up the public frame
$this->main_frame->SetTitleParameters(array('name' => $data['sections']['charity']['name']));
$this->main_frame->SetContentSimple('charity/charitypr', $data);
// Load the public frame view (which will load the content view)
$this->main_frame->Load();
}
示例14: index
function index()
{
if (!CheckPermissions('vip')) {
return;
}
//load the required models and libraries
$this->load->model('pr_model', 'pr_model');
$this->load->model('members_model', 'members_model');
$organisation = VipOrganisation();
if (empty($organisation)) {
$organisation = VipOrganisation(TRUE);
redirect('viparea/' . $organisation);
return;
}
$this->pages_model->SetPageCode('viparea_index');
//get the rep data from the pr model
$rep_data = $this->pr_model->GetOrganisationRatings(VipOrganisation());
if (isset($rep_data['rep'])) {
$rep = $rep_data['rep'];
$rep['email'] = $this->members_model->GetMemberEmail($rep['id']);
$rep['has_rep'] = true;
} else {
$rep['name'] = $this->config->item('pr_officer_name');
$rep['email'] = $this->config->item('pr_officer_email_address');
$rep['has_rep'] = false;
}
$data = array('main_text' => $this->pages_model->GetPropertyWikitext('main_text'), 'organisation' => VipOrganisation(), 'enable_members' => TRUE, 'rep' => $rep);
// Set up the content
$this->main_frame->SetTitleParameters(array('organisation' => VipOrganisationName()));
$this->main_frame->SetContentSimple('viparea/main', $data);
// Load the main frame
$this->main_frame->Load();
}
示例15: index
function index($photo_id = NULL)
{
if (!CheckPermissions('public')) {
return;
}
if ($photo_id === NULL || ($photo = $this->photos_model->GetPhotoDetails($photo_id)) === NULL) {
show_404();
}
$this->load->library('image');
$this->pages_model->SetPageCode('gallery');
$data = array();
$data['photo_title'] = $photo->photo_title;
$data['photo_xhtml'] = $this->image->getThumb($photo->photo_id, 'gallery', true);
$data['tags'] = $this->photos_model->GetPhotosTags($photo_id);
$data['tags_photos'] = array();
foreach ($data['tags'] as $tag) {
$photos = $this->photos_model->GetPhotosForTag($tag['tag_id']);
$data['tags_photos'][$tag['tag_id']] = array();
foreach ($photos as $p) {
$selected = $p['photo_id'] == $photo_id ? array('class' => 'selected') : array();
$data['tags_photos'][$tag['tag_id']][] = array('id' => $p['photo_id'], 'xhtml' => $this->image->getThumb($p['photo_id'], 'small', false, $selected));
}
}
$this->main_frame->SetTitleParameters(array('photo_title' => $data['photo_title']));
$this->main_frame->SetContentSimple('gallery/view', $data);
$this->main_frame->Load();
}