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 '&nbsp;';
     }
     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>';
 }
Example #2
0
 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";
     }
 }
Example #3
0
 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();
 }
Example #4
0
 function GenerateContent_Admin()
 {
     global $addonFolderName, $page;
     static $done = false;
     if ($done || !common::LoggedIn()) {
         return;
     }
     $done = true;
 }
Example #5
0
 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 ' &nbsp; ';
     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>';
 }
Example #6
0
 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);
 }
Example #7
0
 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);
 }
Example #8
0
 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();
 }
Example #9
0
 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>';
     }
 }
Example #10
0
 /**
  * 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;
 }
Example #11
0
 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);
 }
Example #12
0
 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);
 }
Example #13
0
 /**
  * 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);
     }
 }
Example #14
0
 /**
  * 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;
 }
Example #15
0
<?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');
Example #16
0
 /**
  * Display the links at the bottom of a post
  *
  */
 public function PostLinks()
 {
     $post_key = SimpleBlogCommon::AStrKey('str_index', $this->post_id);
     echo '<p class="blog_nav_links">';
     //blog home
     $html = common::Link('Special_Blog', '%s', '', 'class="blog_home"');
     echo gpOutput::GetAddonText('Blog Home', $html);
     echo '&nbsp;';
     // check for newer posts and if post is draft
     $isDraft = false;
     if ($post_key > 0) {
         $i = 0;
         do {
             $i++;
             $next_index = SimpleBlogCommon::AStrGet('str_index', $post_key - $i);
             if (!common::loggedIn()) {
                 $isDraft = SimpleBlogCommon::AStrGet('drafts', $next_index);
             }
         } while ($isDraft);
         if (!$isDraft) {
             $html = SimpleBlogCommon::PostLink($next_index, '%s', '', 'class="blog_newer"');
             echo gpOutput::GetAddonText('Newer Entry', $html);
             echo '&nbsp;';
         }
     }
     //check for older posts and if older post is draft
     $i = 0;
     $isDraft = false;
     do {
         $i++;
         $prev_index = SimpleBlogCommon::AStrGet('str_index', $post_key + $i);
         if ($prev_index === false) {
             break;
         }
         if (!common::loggedIn()) {
             $isDraft = SimpleBlogCommon::AStrGet('drafts', $prev_index);
         }
         if (!$isDraft) {
             $html = SimpleBlogCommon::PostLink($prev_index, '%s', '', 'class="blog_older"');
             echo gpOutput::GetAddonText('Older Entry', $html);
         }
     } while ($isDraft);
     if (common::LoggedIn()) {
         echo '&nbsp;';
         echo common::Link('Admin_Blog', 'New Post', 'cmd=new_form', 'class="blog_post_new"');
     }
     echo '</p>';
 }
Example #17
0
 /**
  * Display the html for a single blog post
  *
  */
 public function ShowPostContent($post_index)
 {
     if (!common::LoggedIn() && SimpleBlogCommon::AStrGet('drafts', $post_index)) {
         return false;
     }
     $post = SimpleBlogCommon::GetPostContent($post_index);
     $class = $id = '';
     if (common::LoggedIn()) {
         SimpleBlog::EditLinks($post_index, $class, $id);
     }
     echo '<div class="blog_post post_list_item' . $class . '" ' . $id . '>';
     $header = '<h2 id="blog_post_' . $post_index . '">';
     if (SimpleBlogCommon::AStrGet('drafts', $post_index)) {
         $header .= '<span style="opacity:0.3;">';
         $header .= gpOutput::SelectText('Draft');
         $header .= '</span> ';
     } elseif ($post['time'] > time()) {
         $header .= '<span style="opacity:0.3;">';
         $header .= gpOutput::SelectText('Pending');
         $header .= '</span> ';
     }
     $label = SimpleBlogCommon::Underscores($post['title']);
     $header .= SimpleBlogCommon::PostLink($post_index, $label);
     $header .= '</h2>';
     SimpleBlogCommon::BlogHead($header, $post_index, $post);
     echo '<div class="twysiwygr">';
     if (!empty(SimpleBlogCommon::$data['post_abbrev']) && SimpleBlogCommon::$data['abbrev_image']) {
         $this->GetImageFromPost($post['content']);
     }
     echo $this->AbbrevContent($post['content'], $post_index, SimpleBlogCommon::$data['post_abbrev']);
     echo '</div>';
     echo '</div>';
     if (SimpleBlogCommon::$data['abbrev_cat'] && isset($post['categories']) && count($post['categories'])) {
         $temp = array();
         foreach ($post['categories'] as $catindex) {
             $title = SimpleBlogCommon::AStrGet('categories', $catindex);
             if (!$title) {
                 continue;
             }
             if (SimpleBlogCommon::AStrGet('categories_hidden', $catindex)) {
                 continue;
             }
             $temp[] = SimpleBlogCommon::CategoryLink($catindex, $title, $title);
         }
         if (count($temp)) {
             echo '<div class="category_container">';
             echo gpOutput::GetAddonText('Categories') . ' ';
             echo implode(', ', $temp);
             echo '</div>';
         }
     }
     echo '<div class="clear"></div>';
 }
Example #18
0
 function Admin()
 {
     global $page;
     if (!common::LoggedIn()) {
         return false;
     }
     $page->admin_links[] = array('special_gpsearch', 'Configuration', 'cmd=config', 'data-cmd="gpabox"');
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'save_config':
             if ($this->SaveConfig()) {
                 break;
             }
             return true;
         case 'config':
             $this->Config($this->search_config);
             return true;
     }
     return false;
 }
Example #19
0
 /**
  * Check the page's visibility
  *
  */
 function CheckVisibility()
 {
     $this->visibility = display::OrConfig($this->gp_index, 'vis');
     if (!common::LoggedIn() && $this->visibility) {
         $this->Error_404($this->title);
         return false;
     }
     return true;
 }
Example #20
0
 /**
  * Prompt the administrator if they really want to remove the comment
  *
  */
 function CommentRm($cmd)
 {
     global $page, $langmessage;
     if (!common::LoggedIn()) {
         return;
     }
     if ($this->ajax_delete) {
         $page->ajaxReplace = array();
     }
     if (!isset($_REQUEST['i']) || !isset($this->comment_data[$_REQUEST['i']])) {
         message($langmessage['OOPS'] . ' (Invalid Request)');
         return false;
     }
     $comment_key = $_REQUEST['i'];
     $nonce_str = 'easy_comment_rm:' . count($this->comment_data) . ':' . $comment_key;
     //prompt for confirmation first
     if (!isset($_POST['confirmed'])) {
         $this->CommentRm_Prompt($cmd);
         return true;
     }
     if (!common::verify_nonce($nonce_str, $_POST['nonce'])) {
         message($langmessage['OOPS'] . ' (Invalid Nonce)');
         return false;
     }
     //remove from this page's comment data
     unset($this->comment_data[$comment_key]);
     if (!$this->SaveCommentData()) {
         message($langmessage['OOPS'] . ' (Not Saved)');
         return false;
     }
     //update the index file
     $this->UpdateIndex($comment_key);
     if ($this->ajax_delete) {
         $class = '.easy_comment_' . $this->current_index . '_' . $comment_key;
         $page->ajaxReplace[] = array('eval', '', '$("' . $class . '").detach();');
     }
     return true;
 }
Example #21
0
 *	Flow Control
 */
if (!empty($GLOBALS['config']['updating_message'])) {
    die($GLOBALS['config']['updating_message']);
}
$title = common::WhichPage();
$type = common::SpecialOrAdmin($title);
switch ($type) {
    case 'special':
        includeFile('special.php');
        $page = new special_display($title, $type);
        break;
    case 'admin':
        if (common::LoggedIn()) {
            includeFile('admin/admin_display.php');
            $page = new admin_display($title, $type);
        } else {
            includeFile('admin/admin_login.php');
            $page = new admin_login($title, $type);
        }
        break;
    default:
        if (common::LoggedIn()) {
            includeFile('tool/editing_page.php');
            $page = new editing_page($title, $type);
        } else {
            $page = new display($title, $type);
        }
        break;
}
gpOutput::RunOut();
Example #22
0
 /**
  * Outputs the sitemap link, admin login/logout link, powered by link, admin html and messages
  * @static
  */
 function GetAdminLink()
 {
     global $config, $langmessage, $page;
     if (!isset($config['showsitemap']) || $config['showsitemap']) {
         echo ' <span class="sitemap_link">';
         echo common::Link('Special_Site_Map', $langmessage['site_map']);
         echo '</span>';
     }
     if (!isset($config['showlogin']) || $config['showlogin']) {
         echo ' <span class="login_link">';
         if (common::LoggedIn()) {
             echo common::Link($page->title, $langmessage['logout'], 'cmd=logout', ' name="creq" rel="nofollow" ');
         } else {
             echo common::Link('Admin_Main', $langmessage['login'], 'file=' . $page->title, ' rel="nofollow" name="login"');
         }
         echo '</span>';
     }
     if (!isset($config['showgplink']) || $config['showgplink']) {
         echo ' <span id="powered_by_link">';
         echo 'Powered by <a href="http://gpEasy.com" title="A Free and Easy CMS in PHP">gp|Easy CMS</a>';
         echo '</span>';
     }
     GetMessages();
 }
Example #23
0
 function Get404()
 {
     global $langmessage, $page;
     gpOutput::AddHeader('Not Found', true, 404);
     $page->head .= '<meta name="robots" content="noindex,nofollow" />';
     //this isn't getting to the template because $page isn't available yet
     //message for admins
     if (common::LoggedIn()) {
         if ($this->requested && !common::SpecialOrAdmin($this->requested)) {
             $with_spaces = htmlspecialchars($this->requested);
             $link = common::GetUrl('Admin_Menu', 'cmd=add_hidden&redir=redir&title=' . rawurlencode($this->requested)) . '" title="' . $langmessage['create_new_file'] . '" name="gpajax';
             $message = sprintf($langmessage['DOESNT_EXIST'], $with_spaces, $link);
             message($message);
         }
     }
     //Contents of 404 page
     $wrap = gpOutput::ShowEditLink('Admin_Missing');
     if ($wrap) {
         echo gpOutput::EditAreaLink($edit_index, 'Admin_Missing', $langmessage['edit'], 'cmd=edit404', ' title="' . $langmessage['404_Page'] . '" ');
         echo '<div class="editable_area" id="ExtraEditArea' . $edit_index . '">';
         // class="edit_area" added by javascript
     }
     echo special_missing::Get404Output();
     if ($wrap) {
         echo '</div>';
     }
 }
Example #24
0
 function AdminContentPanel()
 {
     global $page, $config, $langmessage, $gp_menu;
     //the login form does not need the panel
     if (!common::LoggedIn()) {
         return;
     }
     echo '<div id="admincontent_panel" class="toolbar">';
     echo '<div class="right">';
     echo '<span class="admin_arrow_out"></span>';
     echo '<a class="docklink" name="gp_docklink"></a>';
     echo '</div>';
     reset($gp_menu);
     $homepath = common::IndexToTitle(key($gp_menu));
     echo common::Link_Page($homepath);
     echo ' &#187; ';
     echo common::Link('Admin_Main', $langmessage['administration']);
     if (!empty($page->title) && !empty($page->label) && $page->title != 'Admin_Main') {
         echo ' &#187; ';
         echo common::Link($page->title, $page->label);
     }
     echo '</div>';
 }
Example #25
0
 /**
  * Check the page's visibility
  *
  */
 function CheckVisibility()
 {
     global $gp_titles;
     if (isset($gp_titles[$this->gp_index]['vis'])) {
         $this->visibility = $gp_titles[$this->gp_index]['vis'];
     }
     if (!common::LoggedIn() && $this->visibility) {
         $this->Error_404($this->title);
         return false;
     }
     return true;
 }
Example #26
0
 /**
  * Output the html for a blog post's comments
  *
  */
 function GetCommentHtml($data, $post_index)
 {
     global $langmessage;
     if (!is_array($data)) {
         continue;
     }
     foreach ($data as $key => $comment) {
         echo '<div class="comment_area">';
         echo '<p class="name">';
         if (SimpleBlogCommon::$data['commenter_website'] == 'nofollow' && !empty($comment['website'])) {
             echo '<b><a href="' . $comment['website'] . '" rel="nofollow">' . $comment['name'] . '</a></b>';
         } elseif (SimpleBlogCommon::$data['commenter_website'] == 'link' && !empty($comment['website'])) {
             echo '<b><a href="' . $comment['website'] . '">' . $comment['name'] . '</a></b>';
         } else {
             echo '<b>' . $comment['name'] . '</b>';
         }
         echo ' &nbsp; ';
         echo '<span>';
         echo strftime(SimpleBlogCommon::$data['strftime_format'], $comment['time']);
         echo '</span>';
         if (common::LoggedIn()) {
             echo ' &nbsp; ';
             $attr = 'class="delete gpconfirm" title="' . $langmessage['delete_confirm'] . '" name="postlink" data-nonce= "' . common::new_nonce('post', true) . '"';
             echo SimpleBlogCommon::PostLink($post_index, $langmessage['delete'], 'cmd=delete_comment&comment_index=' . $key, $attr);
         }
         echo '</p>';
         echo '<p class="comment">';
         echo $comment['comment'];
         echo '</p>';
         echo '</div>';
     }
 }
Example #27
0
 private function renderContent()
 {
     if (common::LoggedIn()) {
         if ($this->settings['wysiwygEnabled']) {
             global $addonPathCode, $page;
             require_once $addonPathCode . "/Renderer.php";
             $renderer = new Renderer($this->settings, $addonPathCode . "/lib/parsedown");
             print $renderer->render($_REQUEST['content']);
             //haha, very secure. NOT!
             $nonce_str = 'EasyMark4Life!';
             //TODO: sanitize $config stuff
             //"getPostResponseEasyMark" is defined in edit.js
             print "<script>";
             print "var postNonce = '" . common::new_nonce('post', true) . "';";
             print "setTimeout(gp_editor.getPostResponseEasyMark, " . htmlspecialchars($this->settings['wysiwygDelay']) . "*1000);";
             print "</script>";
             // cleanup old page object
             unset($page);
         }
     } else {
         print "Have to be logged in to use this feature";
     }
 }
Example #28
0
 /**
  * Send content of all files in the $scripts array to the client
  *
  */
 static function SendScripts($scripts)
 {
     global $dataDir, $dirPrefix;
     self::Header();
     Header('Vary: Accept,Accept-Encoding');
     // for proxies
     $scripts = array_unique($scripts);
     //send all scripts
     foreach ($scripts as $script) {
         //absolute paths don't need $dataDir
         $full_path = $script;
         if (strpos($script, $dataDir) !== 0) {
             //fix addon paths that use $addonRelativeCode
             if (!empty($dirPrefix) && strpos($script, $dirPrefix) === 0) {
                 $script = substr($script, strlen($dirPrefix));
             }
             $full_path = $dataDir . $script;
         }
         if (!file_exists($full_path)) {
             if (common::LoggedIn()) {
                 $msg = 'Admin Notice: The following file could not be found: \\n\\n' . $full_path;
                 echo 'if(isadmin){alert(' . json_encode($msg) . ');}';
             }
             continue;
         }
         echo ';';
         //echo "\n/**\n* $script\n*\n*/\n";
         readfile($full_path);
     }
 }