Ejemplo n.º 1
0
 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();
 }
 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();
 }
Ejemplo n.º 3
0
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;
    }
}
 /**
  * @param $Thread
  * @todo Use pages model.
  */
 function thread($Thread = NULL)
 {
     if (!CheckPermissions('moderator')) {
         return;
     }
     $this->main_frame->Load();
 }
Ejemplo n.º 5
0
 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');
 }
 /**
  * @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();
 }
Ejemplo n.º 7
0
 function generateHeatmap()
 {
     if (!CheckPermissions('admin')) {
         return;
     }
     //create and ouput
 }
Ejemplo n.º 8
0
 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();
 }
 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();
 }
Ejemplo n.º 10
0
 /**
  *	@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();
 }
 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();
 }
Ejemplo n.º 12
0
 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();
 }
Ejemplo n.º 13
0
 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();
 }
 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();
 }
Ejemplo n.º 15
0
 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();
 }
Ejemplo n.º 16
0
 function index()
 {
     if (!CheckPermissions('public')) {
         return;
     }
     $spotlight = $this->home_hack_model->getArticlesByTags(array('news', 'spotlight'), 1);
     $this->home_hack_model->ignore($spotlight);
     $inmyview = $this->home_hack_model->getArticlesByTags(array('in-my-view'), 2);
     $this->home_hack_model->ignore($inmyview);
     $features = $this->home_hack_model->getArticlesByTags(array('news', 'feature'), 6);
     $this->home_hack_model->ignore($features);
     $blogs = $this->home_hack_model->getArticlesByTags(array('news', 'blog'), 6);
     $this->home_hack_model->ignore($blogs);
     $uninews = $this->home_hack_model->getArticlesByTags(array('news'), 16);
     $boxes = array();
     $boxes[] = array('type' => 'spotlight', 'articles' => $spotlight);
     $boxes[] = array('type' => 'article_list', 'title' => 'latest features', 'title_link' => '', 'size' => '1/3', 'position' => 'right', 'last' => true, 'articles' => $features);
     $boxes[] = array('type' => 'article_list', 'title' => 'latest news', 'title_link' => '', 'size' => '2/3', 'position' => '', 'last' => false, 'articles' => $uninews);
     $boxes[] = array('type' => 'adsense_third', 'position' => '', 'last' => true);
     $boxes[] = array('type' => 'article_list', 'title' => 'latest comment', 'title_link' => '', 'size' => '1/3', 'position' => 'right', 'last' => true, 'articles' => $blogs);
     $boxes[] = array('type' => 'article_list', 'title' => 'in my view', 'title_link' => '/news/' . $inmyview[0]['id'], 'title_image' => '/images/version2/banners/in_my_view2.png', 'size' => '2/3', 'position' => '', 'last' => false, 'articles' => $inmyview);
     $data = array('boxes' => $boxes);
     $this->pages_model->SetPageCode('homepage_news');
     $this->main_frame->SetData('menu_tab', 'news');
     $this->main_frame->SetContentSimple('flexibox/layout', $data);
     $this->main_frame->IncludeCss('stylesheets/home.css');
     $this->main_frame->Load();
 }
Ejemplo n.º 17
0
 function Imagecp()
 {
     parent::Controller();
     if (!CheckPermissions('office')) {
         return;
     }
     $this->load->helper(array('url', 'form', 'entity'));
     $this->load->library('image');
 }
 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');
     $this->load->model('directory_model');
     //setup the page properties
     $this->pages_model->SetPageCode('viparea_contactpr');
     //set the defaults for the email
     $signature = $this->directory_model->GetOrganisationEmailSignature(VIPOrganisation());
     $subject = '';
     $content = "\r\r" . $signature;
     //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;
     }
     //users data
     $user_name = $this->members_model->GetMemberName($this->user_auth->entityId);
     if (isset($_POST['submit_save_advert'])) {
         if ($_POST['a_subject'] == '') {
             $this->messages->AddMessage('error', 'You must enter a subject for the email.');
             $content = $_POST['a_content'];
         } else {
             if ($_POST['a_content'] == '') {
                 $this->messages->AddMessage('error', 'You must enter a message for the email.');
                 $subject = $_POST['a_subject'];
             } else {
                 //no errors so send the email
                 $this->load->helper('yorkermail');
                 $to = $rep['email'];
                 $from = VipOrganisationName() . ' - ' . $user_name . ' <' . $this->members_model->GetMemberEmail($this->user_auth->entityId) . '>';
                 //try to send the email, report fail if error occurs
                 try {
                     yorkermail($to, $_POST['a_subject'], $_POST['a_content'], $from);
                     $this->messages->AddMessage('success', 'The email has been sent.');
                 } catch (Exception $e) {
                     $this->main_frame->AddMessage('error', $e->getMessage());
                 }
             }
         }
     }
     $data = array('main_text' => $this->pages_model->GetPropertyWikitext('main_text'), 'message_pr_target' => vip_url('contactpr'), 'rep' => $rep, 'subject' => $subject, 'content' => $content);
     $this->main_frame->SetContentSimple('viparea/contactpr', $data);
     $this->main_frame->Load();
 }
Ejemplo n.º 19
0
 function edit()
 {
     if (!CheckPermissions('office')) {
         return;
     }
     // Set up the public frame
     $this->main_frame->SetTitle('FAQ Admin');
     $this->main_frame->SetContentSimple('faq/editfaq');
     // Load the public frame view (which will load the content view)
     $this->main_frame->Load();
 }
 function edit()
 {
     if (!CheckPermissions('admin')) {
         return;
     }
     $this->pages_model->SetPageCode('admin_users');
     // Set up the public frame
     $this->main_frame->SetContentSimple('login/user');
     // Load the public frame view (which will load the content view)
     $this->main_frame->Load();
 }
Ejemplo n.º 21
0
 function test()
 {
     if (!CheckPermissions('admin')) {
         return;
     }
     $this->load->model('calendar/recurrence_model');
     $this->main_frame->SetTitle('Testing iCalendar RRULE examples');
     $this->load->library('academic_calendar');
     $this->main_frame->SetContent(new Rrule_selftester());
     $this->main_frame->Load();
 }
Ejemplo n.º 22
0
 function compose()
 {
     if (!CheckPermissions('vip+pr')) {
         return;
     }
     $this->pages_model->SetPageCode('viparea_notices_compose');
     $this->_SetupTabs('compose');
     $data = array();
     $this->main_frame->SetContentSimple('notices/compose', $data);
     $this->main_frame->SetTitleParameters(array('organisation' => VipOrganisationName()));
     $this->main_frame->Load();
 }
 function index()
 {
     if (!CheckPermissions('office')) {
         return;
     }
     $this->pages_model->SetPageCode('office_index');
     $data = array();
     // Set up the content
     $this->main_frame->SetData('menu_tab', 'business');
     $this->main_frame->SetContentSimple('office/business', $data);
     $this->main_frame->Load();
 }
Ejemplo n.º 24
0
 function index()
 {
     if (!CheckPermissions('public')) {
         return;
     }
     // Set up the public frame
     $this->main_frame->SetTitle('Search');
     $data = array('search_form' => 'TODO Searchform again');
     $this->main_frame->SetContentSimple('search/search', $data);
     // Load the public frame view (which will load the content view)
     $this->main_frame->Load();
 }
    function add()
    {
        if (!CheckPermissions()) {
            return;
        }
        $this->load->helper('string');
        $safety = $this->input->post('safety');
        $username = $this->input->post('username');
        $password = $this->input->post('password');
        $salt = random_string('alnum', 32);
        $hash = sha1($salt . $password);
        if ('grannysmith' === $safety) {
            $sql_add_entity = '
				INSERT INTO entities (
					entity_username,
					entity_password,
					entity_salt
				) VALUES (?,?,?)';
            $this->db->query($sql_add_entity, array($username, $hash, $salt));
            if (1 || $this->db->affected_rows() > 0) {
                $entity_id = $this->db->insert_id();
                $firstname = $this->input->post('firstname');
                $surname = $this->input->post('surname');
                $email = $this->input->post('email');
                $nickname = $this->input->post('nickname');
                $officepassword = $this->input->post('officepassword');
                $hashoffice = sha1($salt . $officepassword);
                $sql_add_entity = '
					INSERT INTO users (
						user_entity_id,
						user_firstname,
						user_surname,
						user_nickname,
						user_gender,
						user_office_password,
						user_office_access,
						user_admin
					) VALUES (?,?,?,?,\'m\',?,1,1)';
                $this->db->query($sql_add_entity, array($entity_id, $firstname, $surname, $nickname, $hashoffice));
                if ($this->db->affected_rows() > 0) {
                    $this->main_frame->AddMessage('success', 'Inserted user successfully');
                } else {
                    $this->main_frame->AddMessage('error', 'Entity created but user could not be. This needs cleaning up the the db (entity_id=' . $entity_id . ')!');
                }
            } else {
                $this->main_frame->AddMessage('error', 'Could not create entity');
            }
        } else {
            $this->main_frame->AddMessage('error', 'Incorrect key');
        }
        redirect('test/useradder');
    }
 function deleted()
 {
     if (!CheckPermissions('admin')) {
         return;
     }
     $this->pages_model->SetPageCode('admin_feedback');
     $data['entries'] = $this->feedback_model->GetAllFeedback(1);
     $data['new_entries'] = $this->feedback_model->GetFeedbackCount();
     $data['deleted_entries'] = $this->feedback_model->GetFeedbackCount(1);
     $data['editable'] = false;
     $this->main_frame->SetContentSimple('admin/feedback', $data);
     $this->main_frame->Load();
 }
 function index()
 {
     if (!CheckPermissions('office')) {
         return;
     }
     /// Get changeable page content
     $this->pages_model->SetPageCode('office_content_schedule');
     $data['articlelist'] = $this->news_model->getContentSchedule();
     /// Set up the main frame
     $this->main_frame->SetData('menu_tab', 'articles');
     $this->main_frame->SetContentSimple('office/news/content_schedule', $data);
     $this->main_frame->Load();
 }
 function add()
 {
     if (!CheckPermissions('office')) {
         return;
     }
     if (!CheckRolePermissions('ANNOUNCEMENT_SEND')) {
         return;
     }
     // AJAX
     $this->load->library('xajax');
     $this->xajax->registerFunction(array('_getRecipients', &$this, '_getRecipients'));
     $this->xajax->processRequests();
     $this->pages_model->SetPageCode('office_announcements');
     $data['roles'] = $this->notifications_model->getAllUserRoles();
     $data['bylines'] = $this->notifications_model->getUserBylines();
     if (isset($_POST['preview']) || isset($_POST['post'])) {
         if (!empty($_POST['sender'])) {
             foreach ($data['bylines'] as $byline) {
                 if ($byline->id == $_POST['sender']) {
                     $data['preview']['byline'] = $byline;
                     break;
                 }
             }
         }
         if (empty($data['preview']['byline'])) {
             $this->main_frame->AddMessage('error', 'You need to have a byline to post an announcement. Go and make one now!');
         } else {
             $this->load->library('wikiparser');
             $data['preview']['content'] = $this->wikiparser->parse($_POST['content']);
             if (isset($_POST['post'])) {
                 if (empty($_POST['subject']) || empty($_POST['content'])) {
                     $this->main_frame->AddMessage('error', 'Please make sure you have provided a subject and message for this announcement.');
                 } elseif (empty($_POST['sendto'])) {
                     $this->main_frame->AddMessage('error', 'Please select which group of users you wish to send the announcement to.');
                 } elseif (empty($_POST['sender'])) {
                     $this->main_frame->AddMessage('error', 'Please choose the byline you wish to post the announcement with.');
                 } else {
                     $this->notifications_model->postAnnouncement($_POST['subject'], $_POST['content'], $_POST['sendto'], $_POST['sender']);
                     $this->main_frame->AddMessage('success', 'New announcement has been posted.');
                     redirect('/office/announcements');
                 }
             }
         }
     }
     // Set up the content
     $this->main_frame->IncludeCss('/stylesheets/office_interface.css');
     $this->main_frame->SetExtraHead($this->xajax->getJavascript(null, '/javascript/xajax.js'));
     $this->main_frame->SetContentSimple('office/announcements/post', $data);
     $this->main_frame->Load();
 }
Ejemplo n.º 29
0
 function barcrawl()
 {
     if (!CheckPermissions('public')) {
         return;
     }
     $this->load->model('pingu_model', 'pingu_model');
     $this->pages_model->SetPageCode('barcrawl');
     $data = array();
     // Set up the public frame
     $this->frame_public->SetTitle('Bar Crawl Mockup');
     $this->frame_public->SetContentSimple('test/pingutest4', $data);
     // Load the public frame view (which will load the content view)
     $this->frame_public->Load();
 }
Ejemplo n.º 30
0
 function index()
 {
     if (!CheckPermissions('office')) {
         return;
     }
     $this->pages_model->SetPageCode('admin_index');
     $data = array();
     $this->load->model('feedback_model');
     $data['feedback_count'] = $this->feedback_model->GetFeedbackCount();
     // Set up the content
     $this->main_frame->SetData('menu_tab', 'admin');
     $this->main_frame->SetContentSimple('admin/admin', $data);
     $this->main_frame->Load();
 }