Beispiel #1
0
 function ShowRecent()
 {
     global $langmessage;
     $page->css_admin[] = '/include/css/addons.css';
     //for hmargin css pre gpEasy 3.6
     echo '<h2 class="hmargin">';
     $label = gpOutput::SelectText('Blog');
     echo common::Link('Special_Blog', $label);
     echo ' &#187; ';
     echo common::Link('Admin_Blog', $langmessage['configuration']);
     echo ' <span>|</span> ';
     echo common::Link('Admin_BlogCategories', 'Categories');
     echo ' <span>|</span> ';
     echo gpOutput::SelectText('Comments');
     echo '</h2>';
     echo '<table style="width:100%" class="bordered">';
     echo '<tr><th>';
     echo 'Comment';
     echo '</th><th>';
     echo 'Time / Website';
     echo '</th><th>';
     echo 'Options';
     echo '</th></tr>';
     uasort($this->cache, array('SimpleBlogComments', 'Sort'));
     foreach ($this->cache as $comment) {
         $this->OutputComment($comment);
     }
     echo '</table>';
 }
 /**
  *  Print all categories and their contents on gadget
  *
  */
 function Run()
 {
     echo '<div class="simple_blog_gadget"><div>';
     echo '<span class="simple_blog_gadget_label">';
     echo gpOutput::GetAddonText('Categories');
     echo '</span>';
     echo '<ul>';
     foreach ($this->categories as $catdata) {
         if (!$catdata['visible']) {
             continue;
             //skip hidden categories
         }
         echo '<li>';
         $sum = count($catdata['posts']);
         echo '<a class="blog_gadget_link">' . $catdata['ct'] . ' (' . $sum . ')</a>';
         if ($sum) {
             echo '<ul class="nodisplay">';
             foreach ($catdata['posts'] as $post_index => $post_title) {
                 echo '<li>';
                 echo common::Link('Special_Blog', $post_title, 'id=' . $post_index);
                 echo '</li>';
             }
             echo '</ul>';
         }
         echo '</li>';
     }
     echo '</ul>';
     echo '</div></div>';
 }
Beispiel #3
0
 function Check($passed)
 {
     $message = gpOutput::SelectText('Sorry, your answer to the verification challenge was incorrect. Please try again.');
     if (empty($_POST['asm_1']) || empty($_POST['asm_2']) || empty($_POST['asm_3'])) {
         message($message . ' (1)');
         return false;
     }
     $operator_key = $_POST['asm_2'];
     if (!isset($this->operators[$operator_key])) {
         message($message . ' (2)');
         return false;
     }
     switch ($operator_key) {
         case 1:
             $result = $_POST['asm_1'] + $_POST['asm_3'];
             break;
         case 2:
             $result = $_POST['asm_1'] - $_POST['asm_3'];
             break;
         case 3:
             $result = $_POST['asm_1'] / $_POST['asm_3'];
             break;
         case 4:
             $result = $_POST['asm_1'] * $_POST['asm_3'];
             break;
     }
     $compare = $_POST['asm_4'];
     //message('result: '.$result.' vs submitted: '.$compare);
     if ($compare != $result) {
         message($message . ' (3)');
         return false;
     }
     //message('passed');
     return $passed;
 }
Beispiel #4
0
 /**
  * Very rough integration test of the updater
  * Passes if no errors are thrown
  * Also defines $page for subsequent tests
  *
  */
 function UpdateOutputTest()
 {
     global $page;
     ob_start();
     includeFile('tool/update.php');
     $page = new update_class();
     gpOutput::HeadContent();
     includeFile('install/template.php');
     ob_get_clean();
 }
 function EditGalleries()
 {
     global $page, $langmessage;
     $page->head_js[] = '/include/js/special_galleries.js';
     $page->css_admin[] = '/include/css/edit_gallery.css';
     echo '<h2>';
     echo common::Link('Special_Galleries', gpOutput::ReturnText('galleries'));
     echo ' &#187; ' . $langmessage['administration'];
     echo '</h2>';
     echo '<p>';
     echo $langmessage['DRAG-N-DROP-DESC2'];
     echo '</p>';
     $this->EditableArea();
 }
Beispiel #6
0
 function GetContent()
 {
     $this->GetGpxContent();
     if (!empty($this->non_admin_content)) {
         echo '<div class="filetype-text cf">';
         //echo '<div id="gpx_content" class="filetype-text">'; //id="gpx_content" conflicts with admin content
         echo $this->non_admin_content;
         echo '</div>';
     }
     echo '<div id="gpAfterContent">';
     gpOutput::Get('AfterContent');
     gpPlugin::Action('GetContent_After');
     echo '</div>';
 }
Beispiel #7
0
 /**
  * Handle HTTP responses made with $_REQUEST['req'] = json (when <a ... data-cmd="gpajax">)
  * Sends JSON object to client
  *
  */
 static function Response()
 {
     global $page;
     if (!is_array($page->ajaxReplace)) {
         die;
     }
     if (!isset($_REQUEST['jsoncallback'])) {
         die('Invalid Request: jsoncallback not set');
     }
     //gadgets may be using gpajax/json request/responses
     gpOutput::TemplateSettings();
     gpOutput::PrepGadgetContent();
     echo gpAjax::Callback($_REQUEST['jsoncallback']);
     echo '([';
     //output content
     if (!empty($_REQUEST['gpx_content'])) {
         switch ($_REQUEST['gpx_content']) {
             case 'gpabox':
                 gpAjax::JsonDo('admin_box_data', '', $page->contentBuffer);
                 break;
         }
     } elseif (in_array('#gpx_content', $page->ajaxReplace)) {
         $replace_id = '#gpx_content';
         if (isset($_GET['gpreqarea'])) {
             $replace_id = '#' . $_GET['gpreqarea'];
         }
         ob_start();
         $page->GetGpxContent(true);
         $content = ob_get_clean();
         gpAjax::JsonDo('replace', $replace_id, $content);
     }
     //other areas
     foreach ($page->ajaxReplace as $arguments) {
         if (is_array($arguments)) {
             $arguments += array(0 => '', 1 => '', 2 => '');
             gpAjax::JsonDo($arguments[0], $arguments[1], $arguments[2]);
         }
     }
     //always send messages
     ob_start();
     echo GetMessages(false);
     $content = ob_get_clean();
     if (!empty($content)) {
         gpAjax::JsonDo('messages', '', $content);
     }
     echo ']);';
     die;
 }
Beispiel #8
0
 /**
  * @param string $current
  */
 function Heading($current)
 {
     global $langmessage;
     $options = array('Admin_Blog' => 'Posts', 'Admin_BlogConfig' => $langmessage['configuration'], 'Admin_BlogCategories' => 'Categories', 'Admin_BlogComments' => gpOutput::SelectText('Comments'));
     $links = array();
     foreach ($options as $slug => $label) {
         if ($slug == $current) {
             $links[] = $label;
         } else {
             $links[] = common::Link($slug, $label);
         }
     }
     echo common::Link('Admin_Blog', 'New Blog Post', 'cmd=new_form', ' class="gpsubmit" style="float:right"');
     echo '<h2 class="hmargin">';
     $label = gpOutput::SelectText('Blog');
     echo common::Link('Special_Blog', $label);
     echo ' &#187; ';
     echo implode('<span>|</span>', $links);
     echo '</h2>';
 }
Beispiel #9
0
 function special_map()
 {
     global $page, $langmessage, $config;
     /*
     An xml site map will not show any of the pages from dynamic add-ons
     ... which is precisely what the regular sitemap shows
     */
     if (isset($_GET['xml'])) {
         $this->xml();
         return;
     }
     $this->MultiSiteData();
     echo '<div class="sitemap_xml">';
     echo common::Link('Special_Site_Map', 'XML', 'xml');
     echo '</div>';
     echo '<h2>';
     echo gpOutput::ReturnText('site_map');
     echo '</h2>';
     gpOutput::GetFullMenu();
 }
Beispiel #10
0
 /**
  * Update the gp_index, gp_titles and menus so that special pages can be renamed
  *
  */
 function Upgrade_234()
 {
     global $gp_index, $gp_titles, $gp_menu, $config, $dataDir;
     includeFile('tool/gpOutput.php');
     $special_indexes = array();
     $new_index = array();
     $new_titles = array();
     foreach ($gp_index as $title => $index) {
         $info = $gp_titles[$index];
         $type = common::SpecialOrAdmin($title);
         if ($type === 'special') {
             $special_indexes[$index] = strtolower($title);
             $index = strtolower($title);
             $info['type'] = 'special';
             //some older versions didn't maintain this value well
         }
         $new_index[$title] = $index;
         $new_titles[$index] = $info;
     }
     $gp_titles = $new_titles;
     $gp_index = $new_index;
     //update gp_menu
     $gp_menu = $this->FixMenu($gp_menu, $special_indexes);
     //save pages
     if (!admin_tools::SavePagesPHP()) {
         return;
     }
     $config['gpversion'] = '2.3.4';
     admin_tools::SaveConfig();
     //update alt menus
     if (isset($config['menus']) && is_array($config['menus'])) {
         foreach ($config['menus'] as $key => $value) {
             $menu_file = $dataDir . '/data/_menus/' . $key . '.php';
             if (gpFiles::Exists($menu_file)) {
                 $menu = gpOutput::GetMenuArray($key);
                 $menu = $this->FixMenu($menu, $special_indexes);
                 gpFiles::SaveData($menu_file, 'menu', $menu);
             }
         }
     }
 }
Beispiel #11
0
 /**
  *  Print all archives and their contents on gadget
  *
  */
 function Run()
 {
     if (!count($this->archives)) {
         return;
     }
     echo '<div class="simple_blog_gadget"><div>';
     echo '<span class="simple_blog_gadget_label">';
     echo gpOutput::GetAddonText('Archives');
     echo '</span>';
     $prev_year = false;
     echo '<ul>';
     foreach ($this->archives as $ym => $posts) {
         $y = floor($ym / 100);
         $m = $ym % 100;
         if ($y != $prev_year) {
             if ($prev_year !== false) {
                 echo '</li>';
             }
             echo '<li><div class="simple_blog_gadget_year">' . $y . '</div>';
             $prev_year = $y;
         }
         $sum = count($posts);
         if (!$sum) {
             continue;
         }
         echo '<ul>';
         echo '<li><a class="blog_gadget_link">' . $this->months[$m - 1] . ' (' . $sum . ')</a>';
         echo '<ul class="simple_blog_category_posts nodisplay">';
         foreach ($posts as $post_index => $post_title) {
             echo '<li>';
             echo common::Link('Special_Blog', $post_title, 'id=' . $post_index);
             echo '</li>';
         }
         echo '</ul>';
         echo '</li>';
         echo '</ul>';
     }
     echo '</li></ul>';
     echo '</div></div>';
 }
 function ShowCategories()
 {
     echo '<h2>';
     echo gpOutput::GetAddonText('Categories');
     echo '</h2>';
     //$gadgetFile = $this->addonPathData.'/gadget_categories.php';
     echo '<ul>';
     foreach ($this->categories as $catindex => $catname) {
         //skip hidden categories
         if (SimpleBlogCommon::AStrValue('categories_hidden', $catindex)) {
             continue;
         }
         $cat_posts_str =& SimpleBlogCommon::$data['category_posts_' . $catindex];
         $count = substr_count($cat_posts_str, '>');
         if (!$count) {
             continue;
         }
         echo '<li>';
         echo SimpleBlogCommon::CategoryLink($catindex, $catname, $catname . ' (' . $count . ')');
         echo '</li>';
     }
     echo '</ul>';
 }
 function SimpleBlogCategories()
 {
     global $addonPathData;
     SimpleBlogCommon::AddCSS();
     $gadget_file = $addonPathData . '/gadget_categories.php';
     $content = '';
     if (file_exists($gadget_file)) {
         $content = file_get_contents($gadget_file);
     }
     //fix edit links
     if (strpos($content, 'simple_blog_gadget_label')) {
         new SimpleBlogCommon();
         $content = file_get_contents($gadget_file);
     }
     if (empty($content)) {
         return;
     }
     echo '<div class="simple_blog_gadget"><div>';
     echo '<span class="simple_blog_gadget_label">';
     echo gpOutput::GetAddonText('Categories');
     echo '</span>';
     echo $content;
     echo '</div></div>';
 }
Beispiel #14
0
 function GetAdminLink()
 {
     trigger_error('deprecated functions');
     gpOutput::GetAdminLink();
 }
Beispiel #15
0
 /**
  * Get an array of titles that is not represented in any of the menus
  *
  */
 function GetNoMenus()
 {
     global $gp_index;
     //first get all titles in a menu
     $menus = $this->GetAvailMenus('menu');
     $all_keys = array();
     foreach ($menus as $menu_id => $label) {
         $menu_array = gpOutput::GetMenuArray($menu_id);
         $keys = array_keys($menu_array);
         $all_keys = array_merge($all_keys, $keys);
     }
     $all_keys = array_unique($all_keys);
     //then check $gp_index agains $all_keys
     foreach ($gp_index as $title => $index) {
         if (in_array($index, $all_keys)) {
             continue;
         }
         $avail[] = $title;
     }
     return $avail;
 }
Beispiel #16
0
 static function ExecInfo($scriptinfo)
 {
     global $dataDir;
     ob_start();
     gpOutput::ExecInfo($scriptinfo);
     return ob_get_clean();
 }
Beispiel #17
0
 /**
  * Convert a .less file to .css and include it in the page
  * @param mixed $less_files A strin or array of less filesThe absolute or relative path of the .less file
  *
  */
 static function CacheLess($less_files)
 {
     global $dataDir;
     //generage the name of the css file from the modified times and content length of each imported less file
     $files_hash = common::ArrayHash($less_files);
     $list_file = $dataDir . '/data/_cache/less_' . $files_hash . '.list';
     if (file_exists($list_file)) {
         $list = explode("\n", file_get_contents($list_file));
         //pop the etag
         $etag = array_pop($list);
         if (!ctype_alnum($etag)) {
             $list[] = $etag;
             $etag = false;
         }
         // generate an etag if needed or if logged in
         if (!$etag || common::LoggedIn()) {
             $etag = common::FilesEtag($list);
         }
         $compiled_name = 'less_' . $files_hash . '_' . $etag . '.css';
         $compiled_file = '/data/_cache/' . $compiled_name;
         if (file_exists($dataDir . $compiled_file)) {
             //msg('not using cache');
             return $compiled_file;
         }
     }
     $less_files = (array) $less_files;
     $compiled = gpOutput::ParseLess($less_files, $files_hash);
     if (!$compiled) {
         return false;
     }
     // generate the file name
     $etag = common::FilesEtag($less_files);
     $compiled_name = 'less_' . $files_hash . '_' . $etag . '.css';
     $compiled_file = '/data/_cache/' . $compiled_name;
     // save the cache
     // use the last line for the etag
     $less_files[] = $etag;
     $cache = implode("\n", $less_files);
     if (!gpFiles::Save($list_file, $cache)) {
         return false;
     }
     //save the css
     if (file_put_contents($dataDir . $compiled_file, $compiled)) {
         return $compiled_file;
     }
     return false;
 }
Beispiel #18
0
 /**
  * Perform various section editing commands
  *
  */
 function SectionEdit($cmd)
 {
     global $page, $langmessage;
     if (empty($_REQUEST['file'])) {
         message($langmessage['OOPS']);
         return false;
     }
     $page->ajaxReplace = array();
     $file = gp_edit::CleanTitle($_REQUEST['file']);
     $data = gpOutput::ExtraContent($file, $file_stats);
     $page->file_sections = array($data);
     //hack so the SaveSection filter works
     $page->file_stats = $file_stats;
     if (!gp_edit::SectionEdit($cmd, $data, 0, '', $file_stats)) {
         return;
     }
     //save the new content
     $file_full = $this->folder . '/' . $file . '.php';
     if (!gpFiles::SaveData($file_full, 'extra_content', $data)) {
         message($langmessage['OOPS']);
         $this->EditExtra();
         return false;
     }
     $page->ajaxReplace[] = array('ck_saved', '', '');
     message($langmessage['SAVED']);
     $this->areas[$file] = $file;
     $this->EditExtra();
     return true;
 }
 /**
  * Insert new content into a layout
  *
  */
 function AddContent()
 {
     global $langmessage, $page;
     //for ajax responses
     $page->ajaxReplace = array();
     if (!isset($_REQUEST['where'])) {
         message($langmessage['OOPS']);
         return false;
     }
     //prep destination
     if (!$this->GetValues($_REQUEST['where'], $to_container, $to_gpOutCmd)) {
         message($langmessage['OOPS'] . ' (Insert location not found)');
         return false;
     }
     $handlers = $this->GetAllHandlers();
     $this->PrepContainerHandlers($handlers, $to_container, $to_gpOutCmd);
     //figure out what we're inserting
     $addtype =& $_REQUEST['addtype'];
     switch ($_REQUEST['addtype']) {
         case 'new_extra':
             $extra_name = $this->NewExtraArea();
             if ($extra_name === false) {
                 message($langmessage['OOPS'] . '(2)');
                 return false;
             }
             $insert = 'Extra:' . $extra_name;
             break;
         case 'custom_menu':
             $insert = $this->NewCustomMenu();
             break;
         case 'preset_menu':
             $insert = $this->NewPresetMenu();
             break;
         default:
             $insert = $_REQUEST['insert'];
             break;
     }
     if (!$insert) {
         message($langmessage['OOPS'] . ' (Nothing to insert)');
         return false;
     }
     //new info
     $new_gpOutInfo = gpOutput::GetgpOutInfo($insert);
     if (!$new_gpOutInfo) {
         message($langmessage['OOPS'] . ' (Nothing to insert)');
         return false;
     }
     $new_gpOutCmd = rtrim($new_gpOutInfo['key'] . ':' . $new_gpOutInfo['arg'], ':');
     if (!$this->AddToContainer($handlers[$to_container], $to_gpOutCmd, $new_gpOutCmd, false)) {
         return false;
     }
     $this->SaveHandlersNew($handlers);
     return true;
 }
Beispiel #20
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>';
 }
<?php

defined('is_running') or die('Not an entry point...');
$query = '';
if (isset($_GET['q'])) {
    $query = $_GET['q'];
}
echo '<h3>';
echo gpOutput::GetAddonText('Search');
echo '</h3>';
echo '<form action="' . common::GetUrl('Special_Search') . '" method="get">';
echo '<div>';
echo '<input name="q" type="text" class="text" value="' . htmlspecialchars($query) . '"/>';
echo '<input type="hidden" name="src" value="gadget" />';
$html = '<input type="submit" class="submit" name="" value="%s" />';
echo gpOutput::GetAddonText('Search', $html);
echo '</div>';
echo '</form>';
Beispiel #22
0
 static function PrepareLess()
 {
     global $dataDir;
     $less_files = $dataDir . '/include/css/admin.less';
     gpOutput::CacheLess($less_files);
 }
Beispiel #23
0
 function ShowResults()
 {
     global $langmessage;
     if (!count($this->results)) {
         echo '<p>';
         echo gpOutput::GetAddonText($langmessage['search_no_results']);
         echo '</p>';
         return;
     }
     usort($this->results, array('special_gpsearch', 'sort'));
     // remove duplicates
     $links = array();
     foreach ($this->results as $key => $result) {
         //$link = common::GetUrl( $result['slug'], $result['query'] );
         $link = isset($result['url']) ? $result['url'] : common::GetUrl($result['slug'], $result['query']);
         $link = mb_strtolower($link);
         if (in_array($link, $links)) {
             unset($this->results[$key]);
         } else {
             $links[] = $link;
         }
     }
     $total = count($this->results);
     $len = 20;
     $total_pages = ceil($total / $len);
     $current_page = 0;
     if (isset($_REQUEST['pg']) && is_numeric($_REQUEST['pg'])) {
         if ($_REQUEST['pg'] <= $total_pages) {
             $current_page = $_REQUEST['pg'];
         } else {
             $current_page = $total_pages - 1;
         }
     }
     $start = $current_page * $len;
     $end = min($start + $len, $total);
     $this->results = array_slice($this->results, $start, $len, true);
     echo '<p class="search_nav search_nav_top">';
     echo sprintf($langmessage['SHOWING'], $start + 1, $end, $total);
     echo '</p>';
     echo '<div class="result_list">';
     foreach ($this->results as $result) {
         echo '<div><h4>';
         //echo common::Link($result['slug'],$result['label'],$result['query']);
         echo isset($result['link']) ? $result['link'] : common::Link($result['slug'], $result['label'], $result['query']);
         echo '</h4>';
         echo $result['content'];
         if ($this->show_stats) {
             echo ' <span class="match_stats">';
             echo $result['matches'] . ' match(es) out of ' . $result['words'] . ' words ';
             echo ' </span>';
         }
         echo '</div>';
     }
     echo '</div>';
     if ($total_pages > 1) {
         echo '<ul class="search_nav search_nav_bottom pagination">';
         for ($i = 0; $i < $total_pages; $i++) {
             if ($i == $current_page) {
                 echo '<li><span>' . ($i + 1) . '</span></li> ';
                 continue;
             }
             $query = 'q=' . rawurlencode($_REQUEST['q']);
             if ($i > 0) {
                 $query .= '&pg=' . $i;
             }
             $attr = '';
             if ($this->gpabox) {
                 $attr = 'data-cmd="gpabox"';
             }
             echo '<li>' . common::Link('special_gpsearch', $i + 1, $query, $attr) . '</li>';
         }
         echo '</ul>';
     }
 }
Beispiel #24
0
 /**
  * Set global variables ( $gp_index, $gp_titles, $gp_menu and $gpLayouts ) from _site/pages.php
  *
  */
 static function GetPagesPHP()
 {
     global $gp_index, $gp_titles, $gp_menu, $gpLayouts, $config;
     $gp_index = array();
     $pages = gpFiles::Get('_site/pages');
     //update for < 2.0a3
     if (array_key_exists('gpmenu', $pages) && array_key_exists('gptitles', $pages) && !array_key_exists('gp_titles', $pages) && !array_key_exists('gp_menu', $pages)) {
         foreach ($pages['gptitles'] as $title => $info) {
             $index = common::NewFileIndex();
             $gp_index[$title] = $index;
             $gp_titles[$index] = $info;
         }
         foreach ($pages['gpmenu'] as $title => $level) {
             $index = $gp_index[$title];
             $gp_menu[$index] = array('level' => $level);
         }
         return;
     }
     $gpLayouts = $pages['gpLayouts'];
     $gp_index = $pages['gp_index'];
     $gp_titles = $pages['gp_titles'];
     $gp_menu = $pages['gp_menu'];
     if (!is_array($gp_menu)) {
         common::stop();
     }
     //update for 3.5,
     if (!isset($gp_titles['special_gpsearch'])) {
         $gp_titles['special_gpsearch'] = array();
         $gp_titles['special_gpsearch']['label'] = 'Search';
         $gp_titles['special_gpsearch']['type'] = 'special';
         $gp_index['Search'] = 'special_gpsearch';
         //may overwrite special_search settings
     }
     //fix the gpmenu
     if (version_compare(gpFiles::$last_version, '3.0b1', '<')) {
         $gp_menu = gpOutput::FixMenu($gp_menu);
         // fix gp_titles for gpEasy 3.0+
         // just make sure any ampersands in the label are escaped
         foreach ($gp_titles as $key => $value) {
             if (isset($gp_titles[$key]['label'])) {
                 $gp_titles[$key]['label'] = common::GetLabelIndex($key, true);
             }
         }
     }
     //title related configuration settings
     if (empty($config['homepath_key'])) {
         $config['homepath_key'] = key($gp_menu);
     }
     $config['homepath'] = common::IndexToTitle($config['homepath_key']);
 }
Beispiel #25
0
 /**
  * Determine if the page is in a menu
  *
  */
 public function InMenu($page_index)
 {
     global $gp_menu, $config;
     //show main menu
     if (isset($gp_menu[$page_index])) {
         return true;
     }
     foreach ($config['menus'] as $id => $menu_label) {
         $array = gpOutput::GetMenuArray($id);
         if (isset($array[$page_index])) {
             return true;
         }
     }
     return false;
 }
Beispiel #26
0
 /**
  * Potential method for allowing users to format the header area of their blog
  * However, this would make it more difficult for theme developers to design for the blog plugin
  *
  */
 function BlogHead($header, $post_index, $post, $cacheable = false)
 {
     $blog_info = '{empty_blog_piece}';
     if (!empty($post['subtitle'])) {
         $blog_info = '<span class="simple_blog_subtitle">';
         $blog_info .= $post['subtitle'];
         $blog_info .= '</span>';
     }
     $blog_date = '<span class="simple_blog_date">';
     $blog_date .= strftime($this->blogData['strftime_format'], $post['time']);
     $blog_date .= '</span>';
     $blog_comments = '{empty_blog_piece}';
     if ($this->blogData['allow_comments'] && isset($this->blogData['post_info'][$post_index]) && isset($this->blogData['post_info'][$post_index]['comments'])) {
         $blog_comments = '<span class="simple_blog_comments">';
         if ($cacheable) {
             $blog_comments .= gpOutput::SelectText('Comments');
         } else {
             $blog_comments .= gpOutput::GetAddonText('Comments');
         }
         $blog_comments .= ': ' . $this->blogData['post_info'][$post_index]['comments'];
         $blog_comments .= '</span>';
     }
     $format = '{header} <div class="simple_blog_info"> {blog_info} {separator} {blog_date} {separator} {blog_comments} </div>';
     $search = array('{header}', '{blog_info}', '{blog_date}', '{blog_comments}');
     $replace = array($header, $blog_info, $blog_date, $blog_comments);
     $result = str_replace($search, $replace, $format);
     $reg = '#\\{empty_blog_piece\\}(\\s*)\\{separator\\}#';
     $result = preg_replace($reg, '\\1', $result);
     $reg = '#\\{separator\\}(\\s*){empty_blog_piece\\}#';
     $result = preg_replace($reg, '\\1', $result);
     echo str_replace('{separator}', $this->blogData['subtitle_separator'], $result);
 }
Beispiel #27
0
 function ShowLayoutSortablePF($items)
 {
     //for section
     if ($this->is_sect == "yes") {
         if (isset($this->sect_options['datafilter']) and $this->sect_options['datafilter'] != "") {
             $this->datafilter = $this->sect_options['datafilter'];
         }
     }
     echo '<ul id="filter-list" class="clearfix">';
     echo '<li class="filter" data-filter="all">' . gpOutput::GetAddonText('All') . '</li>';
     if (isset($this->datafilter)) {
         $pieces = explode(",", $this->datafilter);
         foreach ($pieces as $piece) {
             echo ' <li class="filter" data-filter="' . $piece . '">' . $piece . '</li>';
         }
     }
     echo '</ul>';
     echo '<div class="container" style="width:100%;">';
     echo '<div id="EC_portfolio">';
     foreach ($items as $item) {
         echo '<div class="item ' . $item['datafilter'] . '" style="width: ' . $this->ItemW . '%;">';
         if ($this->Showtitle) {
             echo '<h3>' . $item['link'] . '</h3>';
         }
         echo $item['image'];
         if ($this->ShortInfo != "no") {
             echo '<div class="shortinfo" >' . $item['short_info'] . '</div>';
         }
         //echo '<div class="readmore_EC">'.$item['readmore'].'</div>';
         echo '</div>';
     }
     echo '</div>';
     echo '</div>';
 }
Beispiel #28
0
			<!-- Example row of columns -->
			<div class="row">
				<div class="col-lg-4">
					<?php 
gpOutput::Get('Extra', 'Side_Menu');
?>
				</div>
				<div class="col-lg-4">
					<?php 
gpOutput::Get('Extra', 'Footer');
?>
				</div>
				<div class="col-lg-4">
					<?php 
gpOutput::Get('Extra', 'Lorem');
?>
				</div>
			</div>

			<hr>

			<footer><p>
			<?php 
gpOutput::GetAdminLink();
?>
			</p></footer>
		</div> <!-- /container -->
	</body>
</html>

Beispiel #29
0
	color:#aaa;
}
.progress li{
	padding: 5px 20px 5px 0;
}

.formtable td, .formtable th{
	padding: 5px 20px 5px 0;
	text-align:left;
	vertical-align:top;
}

</style>

<?php 
gpOutput::getHead();
?>

</head>
<body>

<div class="wrapper">

<h1>gpEasy Updater</h1>


<?php 
$page->GetContent();
?>

</div>
Beispiel #30
0
 function __construct()
 {
     global $langmessage, $addonRelativeCode, $addonFolderName, $page;
     $this->Init();
     $this->categories = SimpleBlogCommon::AStrToArray('categories');
     $cmd = common::GetCommand();
     switch ($cmd) {
         //category commands
         case 'save_categories':
             $this->SaveCategories();
             break;
         case 'new_category':
             $this->NewCategory();
             return;
         case 'save_new_category':
             $this->SaveNewCategory();
             break;
         case 'delete_category':
             $this->DeleteCategory();
             break;
     }
     $page->css_admin[] = '/include/css/addons.css';
     //for hmargin css pre gpEasy 3.6
     $page->head_js[] = '/data/_addoncode/' . $addonFolderName . '/admin.js';
     $label = gpOutput::SelectText('Blog');
     echo '<h2 class="hmargin">';
     echo common::Link('Special_Blog', $label);
     echo ' &#187; ';
     echo common::Link('Admin_Blog', 'Configuration');
     echo ' <span>|</span> ';
     echo ' Categories ';
     echo ' <span>|</span> ';
     $comments = gpOutput::SelectText('Comments');
     echo common::Link('Admin_BlogComments', $comments);
     echo '</h2>';
     // print all categories and settings
     echo '<form name="categories" action="' . common::GetUrl('Admin_BlogCategories') . '" method="post">';
     echo '<table class="bordered">';
     echo '<tr><th>&nbsp;</th><th>Category</th><th>Number of Posts</th><th>Visible</th><th>Options</th></tr>';
     echo '<tbody class="sortable_table">';
     foreach ($this->categories as $catindex => $catname) {
         echo '<tr><td style="vertical-align:middle">';
         echo '<img src="' . $addonRelativeCode . '/grip.png" height="15" width="15" style="padding:2px;cursor:pointer;"/>';
         echo '</td><td>';
         echo '<input type="text" name="cattitle[' . $catindex . ']" value="' . $catname . '" class="gpinput" />';
         echo '</td><td>';
         $astr =& SimpleBlogCommon::$data['category_posts_' . $catindex];
         echo substr_count($astr, '>');
         echo '</td><td>';
         $checked = '';
         if (!SimpleBlogCommon::AStrValue('categories_hidden', $catindex)) {
             $checked = ' checked="checked"';
         }
         echo ' <input type="checkbox" name="catvis[' . $catindex . ']"' . $checked . '/> ';
         echo '</td><td>';
         echo common::Link('Admin_BlogCategories', $langmessage['delete'], 'cmd=delete_category&index=' . $catindex, ' name="postlink" class="gpconfirm" title="Delete this Category?" ');
         echo '</td></tr>';
     }
     echo '</tbody>';
     echo '</table>';
     echo '<p>';
     echo '<input type="hidden" name="cmd" value="save_categories" />';
     echo '<input type="submit" value="' . $langmessage['save_changes'] . '" class="gpsubmit"/>';
     echo ' &nbsp; ';
     echo common::Link('Admin_BlogCategories', 'Add New Category', 'cmd=new_category', ' name="gpabox" ');
     echo '</p>';
     echo '</form>';
     // print all posts
     /*
     if( count($this->itlist) ){
     	echo '<h3 onclick="$(this).next(\'form\').toggle()" style="cursor:pointer">All Blog Posts</h3>';
     	echo '<form name="allposts" action="'.common::GetUrl('Admin_BlogCategories').'" method="post" style="display:none">';
     	echo '<table style="width:100%">';
     	foreach( $this->itlist as $postindex => $postdata ){
     		echo '<tr><td>'.$postdata['title'].' ';
     		echo common::Link('Special_Blog','&#187;','id='.$postindex,'target="_blank"').'</td><td>';
     		echo '<select id="post'.$postindex.'" name="post'.$postindex.'[]" multiple="multiple" class="gpselect">';
     		foreach( $this->categories as $catindex => $catdata){
     			echo '<option value="'.$catindex.'" '.(isset($catdata[$postindex])? 'selected="selected"':'').'>'.$catdata['ct'].'</option>';
     		}
     		echo '</select>';
     		echo '</td></tr>';
     	}
     	echo '</table>';
     	echo '<input name="save_posts" type="submit" value="'.$langmessage['save'].'" class="gpsubmit" />';
     	echo '</form>';
     }
     */
 }