Example #1
0
 /**
  * Determine a user's language preference and redirect them to the appropriate homepage if necessary
  * How do we differentiate between a user requesting the home page (to get the default language content) and a request that should be redirected?
  * 	... don't create any empty links (set $config['homepath'] to false)
  * 	... redirect all empty paths?
  *
  */
 function WhichPage($path)
 {
     global $config;
     $home_title = $config['homepath'];
     $config['homepath_key'] = false;
     $config['homepath'] = false;
     //only if homepage
     if (!empty($path)) {
         return $path;
     }
     //only if the homepage is translated
     $list = $this->GetList($config['homepath_key']);
     if (!$list) {
         common::Redirect(common::GetUrl($home_title));
         //dies
     }
     //only if user has language settings
     if (empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
         common::Redirect(common::GetUrl($home_title));
         //dies
     }
     //check for appropriate translation
     $langs = $this->RequestLangs();
     foreach ($langs as $lang => $importance) {
         if (isset($list[$lang])) {
             $title = common::IndexToTitle($list[$lang]);
             common::Redirect(common::GetUrl($title));
             //dies
         }
     }
     common::Redirect(common::GetUrl($home_title));
 }
Example #2
0
 function ShowForm()
 {
     global $langmessage;
     if (count($_POST)) {
         $values = $_POST;
     } else {
         $values = $this->config;
     }
     echo '<h2>Syntax Highlighter Settings</h2>';
     echo '<form method="post" action="' . common::GetUrl('Admin_HighlighterSettings') . '">';
     echo '<table class="bordered">';
     echo '<tr><th>' . $langmessage['options'] . '</th><th>&nbsp;</th></tr>';
     echo '<tr><td>Color Theme</td><td>';
     echo '<select name="theme" id="syntaxhighlighter-theme">';
     foreach ($this->themes as $theme => $name) {
         $selected = '';
         if ($values['theme'] == $theme) {
             $selected = 'selected="selected"';
         }
         echo '<option value="' . htmlspecialchars($theme) . '" ' . $selected . '>' . htmlspecialchars($name) . "&nbsp;</option>\n";
     }
     echo '</select>';
     echo '</td></tr>';
     echo '<tr><td>';
     echo '</td><td>';
     echo '<input type="hidden" name="cmd" value="save" />';
     echo '<input type="submit" name="" value="' . $langmessage['save'] . '" class="gpsubmit" />';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
 }
Example #3
0
 function __construct()
 {
     $this->admin_link = common::GetUrl('Admin_Classes');
     $cmd = common::GetCommand();
     switch ($cmd) {
         case 'SaveClasses':
             $this->SaveClasses();
             break;
     }
     $this->ClassesForm();
 }
Example #4
0
 /**
  * Regenerate the atom.feed file
  *
  */
 static function GenFeed()
 {
     global $config, $addonFolderName, $dirPrefix;
     ob_start();
     $atomFormat = 'Y-m-d\\TH:i:s\\Z';
     $show_posts = SimpleBlogCommon::WhichPosts(0, SimpleBlogCommon::$data['feed_entries']);
     if (isset($_SERVER['HTTP_HOST'])) {
         $server = 'http://' . $_SERVER['HTTP_HOST'];
     } else {
         $server = 'http://' . $_SERVER['SERVER_NAME'];
     }
     $serverWithDir = $server . $dirPrefix;
     echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
     echo '<feed xmlns="http://www.w3.org/2005/Atom">' . "\n";
     echo '<title>' . $config['title'] . '</title>' . "\n";
     echo '<link href="' . $serverWithDir . '/data/_addondata/' . str_replace(' ', '%20', $addonFolderName) . '/feed.atom" rel="self" />' . "\n";
     echo '<link href="' . $server . common::GetUrl('Special_Blog') . '" />' . "\n";
     echo '<id>urn:uuid:' . self::uuid($serverWithDir) . '</id>' . "\n";
     echo '<updated>' . date($atomFormat, time()) . '</updated>' . "\n";
     echo '<author><name>' . $config['title'] . '</name></author>' . "\n";
     foreach ($show_posts as $post_index) {
         $post = SimpleBlogCommon::GetPostContent($post_index);
         if (!$post) {
             continue;
         }
         echo '<entry>' . "\n";
         echo '<title>' . SimpleBlogCommon::Underscores($post['title']) . '</title>' . "\n";
         echo '<link href="' . $server . SimpleBlogCommon::PostUrl($post_index) . '"></link>' . "\n";
         echo '<id>urn:uuid:' . self::uuid($post_index) . '</id>' . "\n";
         echo '<updated>' . date($atomFormat, $post['time']) . '</updated>' . "\n";
         $content =& $post['content'];
         if (SimpleBlogCommon::$data['feed_abbrev'] > 0 && mb_strlen($content) > SimpleBlogCommon::$data['feed_abbrev']) {
             $content = mb_substr($content, 0, SimpleBlogCommon::$data['feed_abbrev']) . ' ... ';
             $label = gpOutput::SelectText('Read More');
             $content .= '<a href="' . $server . SimpleBlogCommon::PostUrl($post_index, $label) . '">' . $label . '</a>';
         }
         //old images
         $replacement = $server . '/';
         $content = str_replace('src="/', 'src="' . $replacement, $content);
         //new images
         $content = str_replace('src="../', 'src="' . $serverWithDir, $content);
         //images without /index.php/
         $content = str_replace('src="./', 'src="' . $serverWithDir, $content);
         //href
         SimpleBlogCommon::FixLinks($content, $server, 0);
         echo '<summary type="html"><![CDATA[' . $content . ']]></summary>' . "\n";
         echo '</entry>' . "\n";
     }
     echo '</feed>' . "\n";
     $feed = ob_get_clean();
     $feedFile = SimpleBlogCommon::$data_dir . '/feed.atom';
     gpFiles::Save($feedFile, $feed);
 }
Example #5
0
 function elFinderPrep()
 {
     global $page, $gpAdmin, $GP_INLINE_VARS;
     $el_opts['url'] = common::GetUrl('Admin_Finder');
     $el_opts['lang'] = 'en';
     $el_opts['getFileCallback'] = true;
     $page->head_script .= "\n" . 'var elfinder_opts = ' . json_encode($el_opts) . ';';
     $page->head .= '<style type="text/css">';
     $page->head .= 'html,body{padding:0;margin:0;background-color:#ededed !important;background-image:none !important;border:0 none !important;}';
     $page->head .= '#gp_admin_html{padding:5px 0 !important;}';
     $page->head .= '</style>';
 }
Example #6
0
 function EditContent()
 {
     global $langmessage;
     $content = $this->config['content'];
     if (!empty($_POST['content'])) {
         $content = $_POST['content'];
     }
     echo '<form method="post" action="' . common::GetUrl('Admin_Protect') . '">';
     echo '<input type="hidden" name="cmd" value="savecontent"/>';
     common::UseCK($content, 'content');
     echo '<input type="submit" value="' . $langmessage['save'] . '" class="gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="gpcancel" />';
     echo '</form>';
 }
 public function WhichPage($path)
 {
     global $config;
     $home_title = $config['homepath'];
     $home_key = $config['homepath_key'];
     $config['homepath_key'] = false;
     $config['homepath'] = false;
     //only if homepage
     if (!empty($path) && $path !== $home_title) {
         return $path;
     }
     $translated_key = $this->WhichTranslation($home_key);
     if (!is_null($translated_key)) {
         $home_title = common::IndexToTitle($translated_key);
     }
     //redirect if needed
     if ($home_title != $path) {
         common::Redirect(common::GetUrl($home_title));
     }
 }
Example #8
0
 private function showSettings()
 {
     global $langmessage;
     echo '<h2>Settings</h2>';
     echo '<form action="' . common::GetUrl('Admin_EasyMark') . '" method="post">';
     $this->putField('checkbox', 'wysiwygEnabled', 'WYSIWYG feature enabled', 'true', $this->settings['wysiwygEnabled']);
     $this->putField('text', 'wysiwygDelay', 'WYSIWYG feature refresh delay in seconds', isset($this->settings['wysiwygDelay']) ? $this->settings['wysiwygDelay'] : $this->defaults['wysiwygDelay']);
     $this->putField('checkbox', 'markupEscaped', 'Parsedown: markup escaped', 'true', $this->settings['markupEscaped']);
     $this->putField('checkbox', 'breaksEnabled', 'Parsedown: breaks enabled', 'true', $this->settings['breaksEnabled']);
     $this->putField('checkbox', 'urlsLinked', 'Parsedown: URLs linked', 'true', $this->settings['urlsLinked']);
     echo '<input type="hidden" name="cmd" value="saveSettings" />';
     echo '<input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" />';
     echo '<input type="submit" name="" value="' . $langmessage['save'] . '" />';
     echo '</form>';
     echo '<div><h2>Acknowledgements</h2><p>Heartful thanks for making this small thing posssible:<ul>';
     echo '<li><strong><a href="https://github.com/oyejorge">Josh Schmidt</a></strong>: for GpEasy/Typesetter, and fixing my first issue</li>';
     echo '<li><strong><a href="https://github.com/erusev">Emanuil Rusev</a></strong>: for ParseDown and ParseDown Extra</li>';
     echo '<li><strong><a href="https://github.com/juek">Jürgen Krausz</a></strong>: for spotting and fixing incompatibility with PHP 5.3</li>';
     echo '</ul></p></div>';
 }
Example #9
0
 function xml()
 {
     global $gp_menu;
     header('Content-Type: text/xml; charset=UTF-8');
     echo '<?xml version="1.0" encoding="UTF-8"?>';
     echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
     foreach ($gp_menu as $key => $info) {
         $title = common::IndexToTitle($key);
         if (isset($info['level'])) {
             echo "\n";
             echo '<url>';
             echo '<loc>';
             echo isset($info['url']) ? $info['url'] : 'http://' . $_SERVER['SERVER_NAME'] . common::GetUrl($title);
             echo '</loc>';
             echo '</url>';
         }
     }
     echo '</urlset>';
     die;
 }
Example #10
0
 /**
  * Run commands
  *
  */
 public function PostCommands()
 {
     global $page;
     $cmd = common::GetCommand();
     if (empty($cmd)) {
         //redirect to correct url if needed
         SimpleBlogCommon::UrlQuery($this->post_id, $expected_url, $query);
         $expected_url = str_replace('&amp;', '&', $expected_url);
         //because of htmlspecialchars($cattitle)
         if ($page->requested != $expected_url) {
             $expected_url = common::GetUrl($expected_url, $query, false);
             common::Redirect($expected_url);
         }
         return;
     }
     switch ($cmd) {
         case 'Add Comment':
             $this->AddComment();
             break;
     }
 }
 function FindForm()
 {
     global $langmessage;
     $_GET += array('q' => '');
     echo '<div class="gp_find_form">';
     echo '<form action="' . common::GetUrl($this->browser_path) . '" method="get">';
     echo '<input type="hidden" name="cmd" value="remote" />';
     echo '<input type="text" name="q" value="' . htmlspecialchars($_GET['q']) . '" size="15" class="gpinput" /> ';
     echo '<input type="submit" name="" value="' . $langmessage['Search'] . '" class="gpbutton" />';
     echo '</form>';
     echo '</div>';
 }
Example #12
0
 static function CheckStatus()
 {
     switch (self::$update_status) {
         case 'embedcheck':
             $img_path = common::GetUrl('Admin', 'cmd=embededcheck');
             common::IdReq($img_path);
             break;
         case 'checkincompat':
             $img_path = common::IdUrl('ci');
             //check in
             common::IdReq($img_path);
             break;
     }
 }
Example #13
0
 /**
  * Display the permission options for a file
  *
  */
 function FilePermissions()
 {
     global $gp_titles, $langmessage;
     $indexes = $this->RequestedIndexes();
     if (!$indexes) {
         return;
     }
     $count = count($indexes);
     $first_index = $indexes[0];
     echo '<div class="inline_box">';
     echo '<form action="' . common::GetUrl('Admin_Users') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="save_file_permissions">';
     echo '<input type="hidden" name="index" value="' . htmlspecialchars($_REQUEST['index']) . '">';
     //heading
     echo '<h2>' . common::Link('Admin_Users', $langmessage['user_permissions']) . ' &#187; <i>';
     if ($count > 1) {
         echo sprintf($langmessage['%s Pages'], $count);
     } else {
         echo strip_tags(common::GetLabelIndex($indexes[0]));
     }
     echo '</i></h2>';
     //list of files
     if ($count > 1) {
         $labels = array();
         foreach ($indexes as $index) {
             $labels[] = strip_tags(common::GetLabelIndex($index));
         }
         echo '<p>';
         echo implode(', ', $labels);
         echo '</p>';
     }
     //list of users
     echo '<div class="all_checkboxes">';
     foreach ($this->users as $username => $userinfo) {
         $attr = '';
         if ($userinfo['editing'] == 'all') {
             $attr = ' checked="checked" disabled="disabled"';
         } elseif (strpos($userinfo['editing'], ',' . $first_index . ',') !== false) {
             $attr = ' checked="checked"';
         }
         echo '<label class="all_checkbox">';
         echo '<input type="checkbox" name="users[' . htmlspecialchars($username) . ']" value="' . htmlspecialchars($username) . '" ' . $attr . '/>';
         echo $username;
         echo '</label> ';
     }
     echo '</div>';
     echo '<p>';
     echo '<input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpabox gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
Example #14
0
 function Form_Entry()
 {
     global $langmessage;
     //echo '<h3>'.$langmessage['configuration'].'</h3>';
     //echo '<h3>'.$langmessage['User Details'].'</h3>';
     echo '<form action="' . common::GetUrl('') . '" method="post">';
     echo '<table class="styledtable">';
     Install_Tools::Form_UserDetails();
     Install_Tools::Form_Configuration();
     echo '</table>';
     echo '<p>';
     echo '<input type="hidden" name="cmd" value="Install" />';
     echo '<input type="submit" class="submit install_button" name="aaa" value="' . $langmessage['Install'] . '" />';
     echo '</p>';
     echo '</form>';
 }
 function DeleteTheme()
 {
     global $langmessage, $dataDir;
     echo '<div class="inline_box">';
     echo '<form action="' . common::GetUrl('Admin_Theme_Content') . '" method="post">';
     $can_delete = true;
     $theme_folder_name =& $_GET['folder'];
     $theme_folder = $dataDir . '/data/_themes/' . $theme_folder_name;
     if (empty($theme_folder_name) || !ctype_alnum($theme_folder_name) || empty($_GET['label'])) {
         echo $langmessage['OOPS'];
         $can_delete = false;
     }
     if (!$this->CanDeleteTheme($theme_folder_name, $message)) {
         echo $message;
         $can_delete = false;
     }
     if ($can_delete) {
         $label = htmlspecialchars($_GET['label']);
         echo '<input type="hidden" name="cmd" value="delete_theme_confirmed" />';
         echo '<input type="hidden" name="folder" value="' . htmlspecialchars($theme_folder_name) . '" />';
         echo sprintf($langmessage['generic_delete_confirm'], '<i>' . $label . '</i>');
     }
     echo '<p>';
     echo ' <input type="submit" name="" value="' . $langmessage['continue'] . '" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close" />';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
 function EditText()
 {
     global $config, $langmessage, $page;
     if (!isset($_GET['key'])) {
         message($langmessage['OOPS'] . ' (0)');
         return;
     }
     $default = $value = $key = $_GET['key'];
     if (isset($langmessage[$key])) {
         $default = $value = $langmessage[$key];
     }
     if (isset($config['customlang'][$key])) {
         $value = $config['customlang'][$key];
     }
     echo '<div class="inline_box">';
     echo '<form action="' . common::GetUrl('Admin_Theme_Content') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="savetext" />';
     echo '<input type="hidden" name="key" value="' . htmlspecialchars($key) . '" />';
     echo '<input type="hidden" name="return" value="" />';
     //will be populated by javascript
     echo '<table class="bordered">';
     echo '<tr>';
     echo '<th>';
     echo $langmessage['default'];
     echo '</th>';
     echo '<th>';
     echo '</th>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>';
     echo $default;
     echo '</td>';
     echo '<td>';
     //$value is already escaped using htmlspecialchars()
     echo '<input type="text" name="value" value="' . $value . '" class="gpinput"/>';
     echo '<p>';
     echo ' <input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpsubmit"/>';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</p>';
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     echo '</form>';
     echo '</div>';
 }
 function showForm()
 {
     global $langmessage;
     $possible_values = $this->getPossible();
     $array = $this->getValues();
     echo '<form action="' . common::GetUrl('Admin_Configuration') . '" method="post">';
     echo '<div class="collapsible">';
     //order by the possible values
     $openbody = false;
     foreach ($possible_values as $key => $possible_value) {
         if ($possible_value === false) {
             $class = $style = '';
             if ($openbody) {
                 echo '</table>';
                 echo '</div>';
                 $class = ' gp_collapsed';
                 $style = ' nodisplay';
             }
             echo '<h4 class="head' . $class . ' one">';
             echo '<a data-cmd="collapsible">';
             if (isset($langmessage[$key])) {
                 echo $langmessage[$key];
             } else {
                 echo str_replace('_', ' ', $key);
             }
             echo '</a>';
             echo '</h4>';
             //start new
             echo '<div class="collapsearea' . $style . '">';
             echo '<table class="bordered configuration">';
             $openbody = true;
             continue;
         }
         if (isset($array[$key])) {
             $value = $array[$key];
         } else {
             $value = '';
         }
         echo "\n\n";
         echo '<tr><td style="white-space:nowrap">';
         if (isset($langmessage[$key])) {
             echo $langmessage[$key];
         } else {
             echo str_replace('_', ' ', $key);
         }
         echo '</td>';
         echo '<td>';
         if (is_array($possible_value)) {
             self::formSelect($key, $possible_value, $value);
         } else {
             switch ($possible_value) {
                 case 'boolean':
                     $this->formCheckbox($key, $value);
                     break;
                 case 'textarea':
                     $this->formTextarea($key, $value);
                     break;
                 default:
                     $this->formInput($key, $value, $possible_value);
                     break;
             }
         }
         if (isset($langmessage['about_config'][$key])) {
             echo $langmessage['about_config'][$key];
         }
         echo '</td></tr>';
     }
     echo '</table>';
     echo '</div>';
     echo '</div>';
     //end collapsible
     echo '<div style="margin:1em 0">';
     echo '<input type="hidden" name="cmd" value="save_config" />';
     if (isset($_GET['gpreq']) && $_GET['gpreq'] == 'json') {
         echo '<input value="' . $langmessage['save'] . '" type="submit" name="aaa" accesskey="s" class="gppost gpsubmit" />';
     } else {
         echo '<input value="' . $langmessage['save'] . '" type="submit" name="aaa" accesskey="s" class="gpsubmit"/>';
     }
     echo ' <input type="button" class="admin_box_close gpcancel" name="" value="' . $langmessage['cancel'] . '" />';
     echo '</div>';
     echo '<p class="admin_note">';
     echo '<b>';
     echo $langmessage['see_also'];
     echo '</b> ';
     echo common::Link('Admin_Preferences', $langmessage['Preferences'], '', 'data-cmd="gpabox"');
     echo '</p>';
     echo '</form>';
 }
Example #18
0
 /**
  * Output a navigation menu
  * @static
  */
 static function OutputMenu($menu, $start_level, $source_menu = false)
 {
     global $page, $gp_menu, $gp_titles, $GP_MENU_LINKS, $GP_MENU_CLASS, $GP_MENU_CLASSES;
     //source menu
     if ($source_menu === false) {
         $source_menu =& $gp_menu;
     }
     self::PrepMenuOutput();
     $clean_attributes = array('attr' => '', 'class' => array(), 'id' => '');
     $clean_attributes_a = array('href' => '', 'attr' => '', 'value' => '', 'title' => '', 'class' => array());
     // opening ul
     $attributes_ul = $clean_attributes;
     $attributes_ul['class']['menu_top'] = $GP_MENU_CLASSES['menu_top'];
     if (self::$edit_area_id) {
         $attributes_ul['id'] = self::$edit_area_id;
         $attributes_ul['class']['editable_area'] = 'editable_area';
     }
     if (!count($menu)) {
         //$attributes_ul['class']['empty_menu'] = 'empty_menu';
         //self::FormatMenuElement('div',$attributes_ul).'</div>'; //an empty <ul> is not valid xhtml
         return;
     }
     $prev_level = $start_level;
     $page_title_full = common::GetUrl($page->title);
     $open = false;
     $li_count = array();
     //get parent page
     $parent_page = false;
     $parents = common::Parents($page->gp_index, $source_menu);
     if (count($parents)) {
         $parent_page = $parents[0];
     }
     //output
     self::FormatMenuElement('ul', $attributes_ul);
     $menu = array_keys($menu);
     foreach ($menu as $menu_index => $menu_key) {
         $menu_info = $source_menu[$menu_key];
         $this_level = $menu_info['level'];
         //the next entry
         $next_info = false;
         $next_index = $menu_index + 1;
         if (array_key_exists($next_index, $menu)) {
             $next_index = $menu[$next_index];
             $next_info = $source_menu[$next_index];
         }
         $attributes_a = $clean_attributes_a;
         $attributes_li = $attributes_ul = $clean_attributes;
         //ordered or "indexed" classes
         if ($page->menu_css_ordered) {
             for ($i = $prev_level; $i > $this_level; $i--) {
                 unset($li_count[$i]);
             }
             if (!isset($li_count[$this_level])) {
                 $li_count[$this_level] = 0;
             } else {
                 $li_count[$this_level]++;
             }
             if (!empty($GP_MENU_CLASSES['li_'])) {
                 $attributes_li['class']['li_'] = $GP_MENU_CLASSES['li_'] . $li_count[$this_level];
             }
         }
         if ($page->menu_css_indexed && !empty($GP_MENU_CLASSES['li_title_'])) {
             $attributes_li['class']['li_title_'] = $GP_MENU_CLASSES['li_title_'] . $menu_key;
         }
         //selected classes
         if ($this_level < $next_info['level']) {
             $attributes_a['class']['haschildren'] = $GP_MENU_CLASSES['haschildren'];
             $attributes_li['class']['haschildren_li'] = $GP_MENU_CLASSES['haschildren_li'];
         }
         if (isset($menu_info['url']) && ($menu_info['url'] == $page->title || $menu_info['url'] == $page_title_full)) {
             $attributes_a['class']['selected'] = $GP_MENU_CLASSES['selected'];
             $attributes_li['class']['selected_li'] = $GP_MENU_CLASSES['selected_li'];
         } elseif ($menu_key == $page->gp_index) {
             $attributes_a['class']['selected'] = $GP_MENU_CLASSES['selected'];
             $attributes_li['class']['selected_li'] = $GP_MENU_CLASSES['selected_li'];
         } elseif (in_array($menu_key, $parents)) {
             $attributes_a['class']['childselected'] = $GP_MENU_CLASSES['childselected'];
             $attributes_li['class']['childselected_li'] = $GP_MENU_CLASSES['childselected_li'];
         }
         //current is a child of the previous
         if ($this_level > $prev_level) {
             if ($menu_index === 0) {
                 //only needed if the menu starts below the start_level
                 self::FormatMenuElement('li', $attributes_li);
             }
             if (!empty($GP_MENU_CLASSES['child_ul'])) {
                 $attributes_ul['class'][] = $GP_MENU_CLASSES['child_ul'];
             }
             if ($this_level > $prev_level) {
                 $open_loops = $this_level - $prev_level;
                 for ($i = 0; $i < $open_loops; $i++) {
                     self::FormatMenuElement('ul', $attributes_ul);
                     if ($i < $open_loops - 1) {
                         echo '<li>';
                     }
                     $prev_level++;
                     $attributes_ul = $clean_attributes;
                 }
             }
             //current is higher than the previous
         } elseif ($this_level < $prev_level) {
             while ($this_level < $prev_level) {
                 echo '</li></ul>';
                 $prev_level--;
             }
             if ($open) {
                 echo '</li>';
             }
         } elseif ($open) {
             echo '</li>';
         }
         //external
         if (isset($menu_info['url'])) {
             if (empty($menu_info['title_attr'])) {
                 $menu_info['title_attr'] = strip_tags($menu_info['label']);
             }
             $attributes_a['href'] = $menu_info['url'];
             $attributes_a['value'] = $menu_info['label'];
             $attributes_a['title'] = $menu_info['title_attr'];
             if (isset($menu_info['new_win'])) {
                 $attributes_a['target'] = '_blank';
             }
             //internal link
         } else {
             $title = common::IndexToTitle($menu_key);
             $attributes_a['href'] = common::GetUrl($title);
             $attributes_a['value'] = common::GetLabel($title);
             $attributes_a['title'] = common::GetBrowserTitle($title);
             //get valid rel attr
             if (!empty($gp_titles[$menu_key]['rel'])) {
                 $rel = explode(',', $gp_titles[$menu_key]['rel']);
                 $attributes_a['rel'] = array_intersect(array('alternate', 'author', 'bookmark', 'help', 'icon', 'license', 'next', 'nofollow', 'noreferrer', 'prefetch', 'prev', 'search', 'stylesheet', 'tag'), $rel);
             }
         }
         self::FormatMenuElement('li', $attributes_li);
         self::FormatMenuElement('a', $attributes_a);
         $prev_level = $this_level;
         $open = true;
     }
     while ($start_level <= $prev_level) {
         echo '</li></ul>';
         $prev_level--;
     }
 }
Example #19
0
 /**
  * Display custom_config form
  *
  */
 function CustomConfigForm()
 {
     global $page;
     echo '<form method="post" action="' . common::GetUrl($page->requested) . '">';
     $placeholder = '{  "example_key":   "example_value"  }';
     echo '<textarea name="custom_config" class="custom_config" placeholder="' . htmlspecialchars($placeholder) . '">';
     if (isset($_POST['custom_config'])) {
         echo htmlspecialchars($_POST['custom_config']);
     } elseif (!empty($this->cke_config['custom_config'])) {
         echo htmlspecialchars(self::ReadableJson($this->cke_config['custom_config']));
     }
     echo '</textarea>';
     echo '<div>';
     echo '<input type="hidden" name="cmd" value="save_custom_config" />';
     echo '<input type="submit" value="Save" data-cmd="gpajax" />';
     echo '</div>';
     echo '</form>';
 }
Example #20
0
 function ExportForm()
 {
     global $langmessage;
     echo '<form action="' . common::GetUrl('Admin_Port') . '" method="post">';
     echo '<p>';
     foreach ($this->export_fields as $info) {
         $this->Checkbox_Export($info['name'], $info['label']);
         echo ' &nbsp; ';
     }
     echo '</p>';
     echo '<p>';
     echo '<input type="hidden" name="cmd" value="do_export" />';
     echo $langmessage['Compression'] . ': ';
     echo ' <select name="compression" class="gpselect">';
     foreach ($this->avail_compress as $ext => $disp) {
         echo '<option value="' . $ext . '">' . $disp . '</option>';
     }
     echo '<option value="">' . $langmessage['None'] . '</option>';
     echo '</select>';
     echo ' &nbsp; <input type="submit" name="" value="' . $langmessage['Export'] . '" class="gpsubmit" />';
     echo '</p>';
     echo '</form>';
 }
Example #21
0
				</div>
				<div class="collapse navbar-collapse">
					<?php 
$GP_ARRANGE = false;
$GP_MENU_CLASSES = array('menu_top' => 'nav navbar-nav', 'selected' => '', 'selected_li' => 'active', 'childselected' => '', 'childselected_li' => '', 'li_' => '', 'li_title' => '', 'haschildren' => 'dropdown-toggle', 'haschildren_li' => 'dropdown', 'child_ul' => 'dropdown-menu');
gpOutput::Get('TopTwoMenu');
//top two levels
?>

					<?php 
//search form
global $langmessage;
$_GET += array('q' => '');
?>
					<form class="navbar-form navbar-right" action="<?php 
echo common::GetUrl('special_gpsearch');
?>
" method="get">
						<div class="form-group">
							<input name="q" type="text" class="form-control" value="<?php 
echo htmlspecialchars($_GET['q']);
?>
" placeholder="<?php 
echo $langmessage['Search'];
?>
">
						</div>
					</form>

				</div><!--/.nav-collapse -->
			</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>';
Example #23
0
 /**
  * Language selection popup
  *
  */
 public function TitleSettings($args = array())
 {
     global $gp_titles, $langmessage, $langmessage, $gp_index;
     $args += array('to_lang' => '', 'to_slug' => '');
     $page_index = $_REQUEST['index'];
     if (!isset($gp_titles[$page_index])) {
         echo $langmessage['OOPS'] . ' (Invalid Title - 3)';
         return;
     }
     $list = $this->GetList($page_index);
     echo '<div>';
     echo '<form method="post" action="' . common::GetUrl('Admin_MultiLang') . '">';
     echo '<input type="hidden" name="cmd" value="TitleSettingsSave" />';
     echo '<input type="hidden" name="index" value="' . $page_index . '" />';
     echo '<h3>Page Settings</h3>';
     echo '<table class="bordered"><tr><th>Language</th><th>Title</th><th>Options</th></tr>';
     //not set yet
     if (!$list) {
         $in_menu = $this->InMenu($page_index);
         echo '<tr><td>';
         if ($in_menu) {
             echo $this->language;
         } else {
             $this->Select('from_lang', '#lang_data');
         }
         echo '</td><td>';
         $title = common::IndexToTitle($page_index);
         echo common::Link_Page($title);
         echo '</td><td>';
         echo '</td></tr>';
     }
     //current settings
     foreach ($this->avail_langs as $lang => $language) {
         if (!isset($list[$lang])) {
             continue;
         }
         $index = $list[$lang];
         echo '<tr><td>';
         echo $language . ' (' . $lang . ')';
         echo '</td><td>';
         $title = common::IndexToTitle($index);
         echo common::Link_Page($title);
         echo '</td><td>';
         echo common::Link('Admin_MultiLang', 'Remove', 'cmd=RemoveTitle&index=' . $page_index . '&rmindex=' . $index, 'name="gpabox" class="gpconfirm" title="Remove this entry?"');
         echo '</td></tr>';
     }
     //option to add another title
     echo '<tr><td>';
     $this->Select('to_lang', '#lang_data', $args['to_lang']);
     echo '</td><td>';
     $this->Select('to_slug', '#lang_titles', $args['to_slug']);
     echo '</td><td>';
     echo '<input type="submit" value="' . $langmessage['save'] . '" class="gpabox gpbutton" /> ';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     $this->SmLinks();
     //add languages as json
     $data = array();
     foreach ($this->langs as $code => $label) {
         $data[] = array($label, $code);
     }
     echo "\n";
     echo '<span id="lang_data" data-json=\'' . htmlspecialchars(json_encode($data), ENT_QUOTES & ~ENT_COMPAT) . '\'></span>';
     //add titles as json
     $data = array();
     foreach ($gp_index as $slug => $index) {
         $label = common::GetLabelIndex($index);
         $data[] = array($slug, common::LabelSpecialChars($label));
     }
     echo "\n";
     echo '<span id="lang_titles" data-json=\'' . htmlspecialchars(json_encode($data), ENT_QUOTES & ~ENT_COMPAT, 'UTF-8', false) . '\'></span>';
     echo '</div>';
 }
Example #24
0
 /**
  *
  * @static
  */
 static function GetScriptInfo(&$requested, $redirect = true)
 {
     global $dataDir, $gp_index, $gp_titles;
     $scripts['special_site_map']['script'] = '/include/special/special_map.php';
     $scripts['special_site_map']['class'] = 'special_map';
     $scripts['special_galleries']['script'] = '/include/special/special_galleries.php';
     $scripts['special_galleries']['class'] = 'special_galleries';
     $scripts['special_contact']['script'] = '/include/special/special_contact.php';
     $scripts['special_contact']['class'] = 'special_contact';
     $scripts['special_missing']['script'] = '/include/special/special_missing.php';
     $scripts['special_missing']['class'] = 'special_missing';
     $scripts['special_gpsearch']['script'] = '/include/special/special_search.php';
     $scripts['special_gpsearch']['class'] = 'special_gpsearch';
     //check for use of a index instead of a page title
     $translated = common::SpecialHref($requested);
     if ($translated != $requested) {
         $requested = $translated;
         if ($redirect) {
             $title = common::GetUrl($requested, http_build_query($_GET), false);
             common::Redirect($title);
         }
     }
     //get the script info
     $parts = explode('/', $requested);
     do {
         $requested = implode('/', $parts);
         if (isset($gp_index[$requested])) {
             $index = $gp_index[$requested];
             // Merge page data & script data if both exist
             if (isset($scripts[$index]) && isset($gp_titles[$index])) {
                 return array_merge($scripts[$index], $gp_titles[$index]);
             }
             if (isset($scripts[$index])) {
                 return $scripts[$index];
             }
             if (isset($gp_titles[$index])) {
                 return $gp_titles[$index];
             }
         }
         array_pop($parts);
     } while (count($parts));
     return false;
 }
Example #25
0
 function Config($array = array())
 {
     global $langmessage, $addonFolderName, $gp_index;
     echo '<h2>Search Configuration</h2>';
     echo '<form class="renameform" action="' . common::GetUrl('Special_Search') . '" method="post">';
     echo '<table style="width:100%" class="bordered">';
     echo '<tr>';
     echo '<th>';
     echo 'Option';
     echo '</th>';
     echo '<th>';
     echo 'Value';
     echo '</th>';
     echo '<th>';
     echo 'Default';
     echo '</th>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>';
     echo 'Search Hidden';
     echo '</td>';
     echo '<td>';
     if (isset($array['search_hidden']) && $array['search_hidden']) {
         echo '<input type="checkbox" name="search_hidden" checked="checked" value="true" />';
     } else {
         echo '<input type="checkbox" name="search_hidden" value="true" />';
     }
     echo '</td>';
     echo '<td>';
     echo 'false';
     echo '</td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>';
     echo 'Search Blog';
     echo '</td>';
     echo '<td>';
     $disabled = ' disabled="disabled"';
     if (SimpleSearch::BlogInstalled()) {
         $disabled = '';
     }
     if (isset($array['search_blog']) && $array['search_blog']) {
         echo '<input type="checkbox" name="search_blog" checked="checked" value="true" ' . $disabled . '/>';
     } else {
         echo '<input type="checkbox" name="search_blog" value="true" ' . $disabled . '/>';
     }
     echo '</td>';
     echo '<td>';
     echo 'true';
     echo '</td>';
     echo '</tr>';
     echo '<tr>';
     echo '<td>';
     echo '</td>';
     echo '<td>';
     echo '<input type="hidden" name="cmd" value="save_config" />';
     echo '<input type="submit" name="" value="' . $langmessage['save'] . '" /> ';
     echo '<input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" /> ';
     echo '</td>';
     echo '<td>';
     echo '</td>';
     echo '</tr>';
     echo '</table>';
     echo common::Link('Admin_Theme_Content', $langmessage['editable_text'], 'cmd=addontext&addon=' . urlencode($addonFolderName), ' title="' . urlencode($langmessage['editable_text']) . '" name="gpabox" ');
     echo '</form>';
     echo '<p>';
 }
Example #26
0
 /**
  * Display a form for copying a page
  *
  */
 function CopyForm()
 {
     global $langmessage, $gp_index, $page;
     $from_title = $_REQUEST['title'];
     if (!isset($gp_index[$from_title])) {
         message($langmessage['OOPS_TITLE']);
         return false;
     }
     $from_label = common::GetLabel($from_title);
     $from_label = common::LabelSpecialChars($from_label);
     echo '<div class="inline_box">';
     echo '<form method="post" action="' . common::GetUrl('Admin_Menu') . '">';
     if (isset($_REQUEST['redir'])) {
         echo '<input type="hidden" name="redir" value="redir"/> ';
     }
     echo '<input type="hidden" name="from_title" value="' . htmlspecialchars($from_title) . '"/> ';
     echo '<table class="bordered full_width" id="gp_rename_table">';
     echo '<thead><tr><th colspan="2">';
     echo $langmessage['Copy'];
     echo '</th></tr></thead>';
     echo '<tr class="line_row"><td>';
     echo $langmessage['from'];
     echo '</td><td>';
     echo $from_label;
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['to'];
     echo '</td><td>';
     echo '<input type="text" name="title" maxlength="100" size="50" value="' . $from_label . '" class="gpinput" />';
     echo '</td></tr>';
     echo '</table>';
     echo '<p>';
     echo '<input type="hidden" name="cmd" value="copyit"/> ';
     echo '<input type="submit" name="" value="' . $langmessage['continue'] . '" class="gppost gpsubmit"/>';
     echo '<input type="button" class="admin_box_close gpcancel" name="" value="' . $langmessage['cancel'] . '" />';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
Example #27
0
 function ShowOptions()
 {
     //$pagedata=self::LoadData();
     global $page, $config, $langmessage, $addonRelativeCode, $dirPrefix, $dataDir;
     if (!isset($_REQUEST['index'])) {
         msg($langmessage['OOPS'] . ' - no index passed!');
     }
     $index = $_REQUEST['index'];
     echo '<div class="inline_box">';
     echo '<form id="menu_appearance_form" action="' . common::GetUrl('Admin_Menu') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="menu_ec_save" />';
     echo '<input type="hidden" name="index" value="' . $index . '" />';
     $temp = new Catalog_Easy();
     $temp->getConfig();
     //omg lazy to change
     if (array_key_exists($index, $temp->pagedata)) {
         if (array_key_exists('image_url', $temp->pagedata[$index])) {
             if ($temp->pagedata[$index]['image_url'] != "") {
                 $image_url = urldecode($temp->pagedata[$index]['image_url']);
             } else {
                 $image_url = $addonRelativeCode . '/img/default_thumb.jpg';
             }
         } else {
             $image_url = $addonRelativeCode . '/img/default_thumb.jpg';
         }
     } else {
         $image_url = $addonRelativeCode . '/img/default_thumb.jpg';
     }
     echo '<h3>';
     echo 'Catalog Easy';
     echo '</h3>';
     //img
     echo '<p>Image for page to display in Easy Catalog <br>(if not set, first image from page content will be used)</p>';
     echo '<div id="img_container">';
     echo '<img style="width:100px;" src="' . $image_url . '"/>';
     echo '<img id="del_img_EC" style="cursor:pointer;" src="' . $addonRelativeCode . '/img/delete.png' . '" />';
     echo '</div>';
     echo '<p>';
     echo ' <button class="EC_browse_files gpbutton">' . $langmessage['Select Image'] . '</button>';
     echo '</p>';
     if ($image_url == $addonRelativeCode . '/img/default_thumb.jpg') {
         $image_url = "";
     }
     echo '<input id="EC_custom_img" name="custom_img" type="hidden" value="' . $image_url . '" />';
     echo '<h5>';
     echo 'Define Sortable portfolio categories for this page';
     echo '</h5>';
     if (isset($temp->datafilter) and $temp->datafilter != "") {
         $pieces = explode(",", $temp->datafilter);
         foreach ($pieces as $piece) {
             if (isset($temp->pagedata[$index]) and $temp->pagedata[$index] != "") {
                 $pieces2 = explode(",", $temp->pagedata[$index]['datafilter']);
                 $echo = false;
                 foreach ($pieces2 as $flag) {
                     if ($flag == $piece) {
                         echo ' <input type="checkbox" name="datafilter[]" value=' . $piece . ' checked>' . $piece . '<br />';
                         $echo = true;
                     }
                 }
                 if (!$echo) {
                     echo ' <input type="checkbox" name="datafilter[]" value=' . $piece . '>' . $piece . '<br />';
                 }
             } else {
                 echo ' <input type="checkbox" name="datafilter[]" value=' . $piece . '>' . $piece . '<br />';
             }
         }
     } else {
         echo 'You need to enter some categoties on ' . common::Link('Admin_Catalog_Easy', 'Plugin Catalog Easy Admin page');
     }
     //added opts for future extensions
     if ($temp->addlay_folder != "") {
         foreach ($temp->addlay_folder as $folder) {
             $template = $dataDir . $folder . "/tmpls_options/ec_options.php";
             if (file_exists($template)) {
                 include $template;
             }
         }
     }
     echo '<p style="clear:both">';
     echo '<input type="submit" name="aa" value="' . htmlspecialchars($langmessage['save']) . '" class="gpsubmit" data-cmd="gppost" />';
     echo ' <input type="submit" value="' . htmlspecialchars($langmessage['cancel']) . '" class="admin_box_close gpcancel" /> ';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
Example #28
0
 function ChangeInstallType(&$addonName)
 {
     global $langmessage;
     $message = '';
     $message .= '<form action="' . common::GetUrl('Admin_Addons') . '" method="post">';
     $message .= '<input type="hidden" name="cmd" value="changeinstall_confirmed" />';
     $message .= 'Are you sure you want to change the install type? ';
     //$message .= ' <input type="submit" name="cmd" value="'.$langmessage['cancel'].'" />';
     $message .= ' <input type="submit" name="aaa" value="' . $langmessage['continue'] . '" />';
     $message .= '</form>';
     message($message);
 }
Example #29
0
 /**
  * Prompt user to create a new category
  *
  */
 function NewCategory()
 {
     global $langmessage;
     echo '<div class="inline_box">';
     echo '<h3>Add New Category</h3>';
     echo '<form name="addcategory" action="' . common::GetUrl('Admin_BlogCategories') . '" method="post">';
     echo '<p>';
     echo '<input type="hidden" name="cmd" value="save_new_category" />';
     echo 'Title: <input type="text" name="new_category" value="" class="gpinput" />';
     echo '</p>';
     echo '<p>';
     echo ' <input type="submit" value="' . $langmessage['save'] . '" class="gppost gpsubmit"/>';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel"/>';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
Example #30
0
<?php

defined('is_running') or die('Not an entry point...');
global $addonRelativeData, $page;
$url = common::GetUrl('Special_Blog_Feed');
$page->head .= '<link rel="alternate" type="application/atom+xml" href="' . $url . '" />';