function CommentRow($page_index, $comment) { global $gp_index, $gp_titles, $langmessage; $key =& $comment['key']; echo '<tr class="easy_comment_' . $page_index . '_' . $key . '">'; echo '<td>'; $title = common::IndexToTitle($page_index); $label = common::GetLabelIndex($page_index); echo common::Link($title, $label); echo '</td>'; echo '<td>'; echo date('D, j M Y H:i', $comment['time']); echo '</td>'; echo '<td>'; if (!empty($comment['website'])) { echo '<b><a href="' . $comment['website'] . '">' . $comment['name'] . '</a></b>'; } else { echo 'no website'; echo $comment['name']; } echo '</td>'; echo '<td>'; echo $comment['abbr']; echo '</td>'; echo '<td>'; echo common::Link('Admin_Easy_Comments', $langmessage['delete'], 'cmd=easy_admin_rm&pg=' . $page_index . '&i=' . $key, ' name="gpajax"'); echo '</td>'; echo '</tr>'; }
function AdminProtect() { global $gp_menu; $this->PageProtect(); echo '<h2>'; echo common::Link('Admin_Protect', 'Protected Pages'); echo '</h2>'; $cmd = common::GetCommand(); switch ($cmd) { case 'savecontent': $this->SaveContent(); case 'editcontent': $this->EditContent(); return; } echo '<p>'; echo '<b>' . common::Link('Admin_Protect', 'Protected Content', 'cmd=editcontent') . '</b> '; echo 'Edit the content users will see if they navigate to a protected page and aren\'t logged in.'; echo '</p>'; if (!count($this->config['pages'])) { echo '<p>There aren\'t any protected pages.</p>'; return; } echo '<table class="bordered">'; echo '<tr><th>Pages</th><th>Child Pages</th></tr>'; foreach ($this->config['pages'] as $page_index => $bool) { $title = common::IndexToTitle($page_index); //may be deleted if (!$title) { continue; } echo '<tr>'; echo '<td>'; echo common::Link_Page($title); echo '</td>'; echo '<td>'; $affected = common::Descendants($page_index, $gp_menu); $titles = array(); foreach ($affected as $temp_index) { $title = common::IndexToTitle($temp_index); $titles[] = common::Link_Page($title); } echo implode(', ', $titles); echo '</td>'; echo '</tr>'; } echo '</table>'; }
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; }
function Show($indexofparent) { global $addonRelativeCode; if ($this->nav_style == 0) { $next = gpOutput::SelectText('Next'); $back = gpOutput::SelectText('Previous'); } elseif ($this->nav_style == 1) { $back = '<img src="' . $addonRelativeCode . '/img/arrow1-back.png' . '" />'; $next = '<img src="' . $addonRelativeCode . '/img/arrow1-next.png ' . '" />'; } elseif ($this->nav_style == 2) { $back = '<img src="' . $addonRelativeCode . '/img/arrow2-back.png' . '" />'; $next = '<img src="' . $addonRelativeCode . '/img/arrow2-next.png ' . '" />'; } elseif ($this->nav_style == 3) { $back = '<img src="' . $addonRelativeCode . '/img/arrow3-back.png' . '" />'; $next = '<img src="' . $addonRelativeCode . '/img/arrow3-next.png ' . '" />'; } if ($this->nav_buttons == 1) { $nav_style = "sides"; } else { $nav_style = ""; } echo '<p class="EC_nav_links' . $nav_style . '">'; if ($this->nav_parent) { $pl = common::GetLabelIndex($indexofparent); $pt = common::IndexToTitle($indexofparent); echo '<a class="EC_home" href="' . common::GetUrl($pt) . '">' . $pl . '</a>'; echo ' '; } if ($this->PrevUrl) { echo '<a class="EC_newer" href="' . $this->PrevUrl . '">' . $back . '</a>'; echo ' '; } if ($this->NextUrl) { echo '<a class="EC_older" href="' . $this->NextUrl . '">' . $next . '</a>'; } echo '</p>'; }
/** * Save the posted page as the homepage * */ function HomepageSave() { global $langmessage, $config, $gp_index, $gp_titles, $page; $homepage = $_POST['homepage']; $homepage_key = false; if (isset($gp_index[$homepage])) { $homepage_key = $gp_index[$homepage]; } else { foreach ($gp_titles as $index => $title) { if ($title['label'] === $homepage) { $homepage_key = $index; break; } } if (!$homepage_key) { message($langmessage['OOPS']); return; } } $config['homepath_key'] = $homepage_key; $config['homepath'] = common::IndexToTitle($config['homepath_key']); if (!admin_tools::SaveConfig()) { message($langmessage['OOPS']); return; } //update the display ob_start(); $this->HomepageDisplay(); $content = ob_get_clean(); $page->ajaxReplace[] = array('inner', '.homepage_setting', $content); }
/** * 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']); }
/** * 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); } }
/** * View all pages of the requested language * */ public function AllTitles() { global $langmessage; echo '<h2>' . $langmessage['Pages'] . '</h2>'; $lang_lists = array(); foreach ($this->lists as $list_index => $list) { foreach ($list as $lang => $index) { $lang_lists[$lang][] = $index; } } foreach ($lang_lists as $lang => $indexes) { echo '<div class="ml_stats"><div>'; echo '<table class="bordered striped">'; echo '<thead><tr><th>' . $this->avail_langs[$lang] . '</th><th>' . $langmessage['options'] . '</th></tr>'; echo '<tbody>'; foreach ($indexes as $index) { echo '<tr><td>'; $title = common::IndexToTitle($index); echo common::Link_Page($title); echo '</td><td>'; echo common::Link('Admin_MultiLang', $langmessage['options'], 'cmd=TitleSettings&index=' . $index, ' name="gpabox"'); echo '</td></tr>'; } echo '</tbody>'; echo '</table>'; echo '</div></div>'; } }
function Confirm_Uninstall() { global $config, $langmessage, $dataDir, $gp_titles, $gp_menu, $gp_index; $addon =& $_POST['addon']; if (!isset($config['addons'][$addon])) { message($langmessage['OOPS']); return; } $order = false; if (isset($config['addons'][$addon]['order'])) { $order = $config['addons'][$addon]['order']; } //tracking $history = array(); $history['name'] = $config['addons'][$addon]['name']; $history['action'] = 'uninstalled'; if (isset($config['addons'][$addon]['id'])) { $history['id'] = $config['addons'][$addon]['id']; } unset($config['addons'][$addon]); //remove links $installedGadgets = $this->GetInstalledComponents($config['gadgets'], $addon); $this->RemoveFromHandlers($installedGadgets); //remove from gp_index, gp_menu $installedLinks = $this->GetInstalledComponents($gp_titles, $addon); foreach ($installedLinks as $index) { if (isset($gp_menu[$index])) { unset($gp_menu[$index]); } $title = common::IndexToTitle($index); if ($title) { unset($gp_index[$title]); } } $this->RemoveFromConfig($config['gadgets'], $addon); $this->RemoveFromConfig($config['admin_links'], $addon); $this->RemoveFromConfig($gp_titles, $addon); $this->CleanHooks($addon); if (!admin_tools::SaveAllConfig()) { message($langmessage['OOPS']); $this->Uninstall(); return false; } /* * Delete the data folders */ $installFolder = $dataDir . '/data/_addoncode/' . $addon; if (file_exists($installFolder)) { gpFiles::RmAll($installFolder); } $data_folder_name = gpPlugin::GetDataFolder($addon); $dataFolder = $dataDir . '/data/_addondata/' . $data_folder_name; if (file_exists($dataFolder)) { gpFiles::RmAll($dataFolder); } /* * Record the history */ $history['time'] = time(); $this->addonHistory[] = $history; $this->SaveAddonData(); if ($order) { $img_path = common::IdUrl('ci'); common::IdReq($img_path); } message($langmessage['SAVED']); }
/** * Display current layout, list of available layouts and list of titles affected by the layout setting for $title * */ function SelectLayout($url, $query_string) { global $gp_titles, $gpLayouts, $langmessage, $config, $gp_index; $index = $_REQUEST['index']; $title = common::IndexToTitle($index); if (!$title) { echo $langmessage['OOPS']; return; } $this->title = $title; $Inherit_Info = admin_menu_tools::Inheritance_Info(); $curr_layout = admin_menu_tools::CurrentLayout($index); $curr_info = $gpLayouts[$curr_layout]; echo '<div class="inline_box">'; echo '<h3>'; echo $langmessage['current_layout'] . ': '; echo '<span class="layout_color_id" style="background-color:' . $curr_info['color'] . ';" title="' . $curr_info['color'] . '"></span> '; echo str_replace('_', ' ', $curr_info['label']); echo '</h3>'; if (!empty($gp_titles[$index]['gpLayout'])) { echo '<p>'; if (isset($Inherit_Info[$index]['parent_layout'])) { $parent_layout = $Inherit_Info[$index]['parent_layout']; } else { $parent_layout = $config['gpLayout']; } $parent_info = $gpLayouts[$parent_layout]; echo $langmessage['restore'] . ': '; $span = '<span class="layout_color_id" style="background-color:' . $parent_info['color'] . ';" title="' . $parent_info['color'] . '"></span> '; echo common::Link($url, $span . $parent_info['label'], $query_string . 'cmd=restorelayout&index=' . urlencode($index), ' title="' . $langmessage['restore'] . '" name="postlink" ', 'restore'); echo '</p>'; } echo '<table class="bordered full_width">'; echo '<tr>'; echo '<th>'; echo $langmessage['available_layouts']; echo '</th>'; echo '<th>'; echo $langmessage['theme']; echo '</th>'; echo '</tr>'; if (count($gpLayouts) < 2) { echo '<tr><td colspan="2">'; echo $langmessage['Empty']; echo '</td></tr>'; echo '</table>'; echo common::Link('Admin_Theme_Content', $langmessage['new_layout']); echo '</div>'; return; } foreach ($gpLayouts as $layout => $info) { if ($layout == $curr_layout) { continue; } echo '<tr>'; echo '<td>'; echo '<span class="layout_color_id" style="background-color:' . $info['color'] . ';" title="' . $info['color'] . '">'; echo '</span> '; if ($layout != $curr_layout) { echo common::Link($url, $info['label'], $query_string . 'cmd=uselayout&index=' . urlencode($index) . '&layout=' . urlencode($layout), 'name="postlink"', 'use_' . $layout); } echo '</td>'; echo '<td>'; echo $info['theme']; echo '</td>'; echo '</tr>'; } echo '</table>'; //show affected pages $affected = page_layout::GetAffectedFiles($index); echo '<br/>'; echo '<table class="bordered full_width">'; echo '<tr><th>' . $langmessage['affected_files'] . '</th></tr></table>'; echo '<p class="sm">' . $langmessage['about_layout_change'] . '</p>'; echo '<p class="admin_note" style="width:35em">'; $label = common::GetLabelIndex($index, false); echo common::LabelSpecialChars($label); $i = 0; foreach ($affected as $affected_label) { $i++; echo ', ' . $affected_label; } echo '</p>'; echo '<p>'; echo ' <input type="submit" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" /> '; echo '</p>'; echo '<p class="admin_note">'; echo '<b>' . $langmessage['see_also'] . '</b> '; echo common::Link('Admin_Theme_Content', $langmessage['layouts']); echo '</p>'; echo '</div>'; }
/** * * @static */ function GetScriptInfo(&$requested) { 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'; if (isset($gp_index[$requested])) { $index = $gp_index[$requested]; if (isset($scripts[$index])) { return $scripts[$index]; } if (isset($gp_titles[$index])) { return $gp_titles[$index]; } } //resolve if the requested path matches a data index $title = common::IndexToTitle(strtolower($requested)); if ($title) { $title = common::GetUrl($title, '', false); common::Redirect($title); } return false; }
/** * Give users the option of removing the settings for a page * */ function ListSettings($page_index) { global $langmessage, $ml_languages; $list = $this->GetList($page_index); echo '<div>'; echo '<form method="post" action="' . common::GetUrl('Admin_MultiLang') . '">'; echo '<input type="hidden" name="cmd" value="title_settings_add" />'; echo '<input type="hidden" name="index" value="' . $page_index . '" />'; echo '<h3>Settings</h3>'; echo '<p>This page has been associated with the following list of pages.</p>'; echo '<table class="bordered"><tr><th>Language</th><th>Title</th><th>Options</th></tr>'; //current settings foreach ($ml_languages 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=rmtitle&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->LanguageSelect('ml_lang', false, $this->lang); echo '</td><td>'; $this->TitleSelect(false, $list); echo '</td><td>'; echo '<input type="submit" value="' . $langmessage['save'] . '" class="gpabox gpbutton" /> '; echo '</td></tr>'; echo '</table>'; echo '</form>'; $this->SmLinks(); echo '</div>'; }
/** * Set the $config array from /data/_site/config.php * */ function GetConfig() { global $config, $gp_index, $dataDir, $gp_menu; require $dataDir . '/data/_site/config.php'; if (!is_array($config)) { common::stop(); } $GLOBALS['fileModTimes']['config.php'] = $fileModTime; common::GetPagesPHP(); if (!is_array($gp_menu)) { common::stop(); } //remove old values if (isset($config['linkto'])) { unset($config['linkto']); } if (isset($config['menu_levels'])) { unset($config['menu_levels']); } //2.3.2 if (isset($config['hidegplink'])) { //2.4RC2 if ($config['hidegplink'] === 'hide') { $config['showgplink'] = false; } unset($config['hidegplink']); } //set values $config += common::ConfigDefaults(); if (isset($GLOBALS['dirPrefix'])) { $config['dirPrefix'] = $GLOBALS['dirPrefix']; // deprecated 2.4b4 $config['dirPrefix'], $GLOBALS['dirPrefix'] won't always be set (example: cron jobs) } $config['homepath_key'] = key($gp_menu); $config['homepath'] = common::IndexToTitle($config['homepath_key']); if (!isset($config['gadgets']['Contact'])) { $config['gadgets']['Contact'] = array('script' => '/include/special/special_contact.php', 'class' => 'special_contact_gadget'); } gp_defined('gp_session_cookie', common::SessionCookie($config['gpuniq'])); //get language file common::GetLangFile(); //upgrade? if (version_compare($config['gpversion'], '2.3.4', '<')) { includeFile('tool/upgrade.php'); new gpupgrade(); } }
/** * Gadget Function * Show related titles * */ function Gadget() { global $page, $ml_languages, $config, $addonRelativeCode; if ($page->pagetype == 'display') { $page->admin_links[] = common::Link('Admin_MultiLang', 'Multi Language', 'cmd=title_settings&index=' . $page->gp_index, ' name="gpabox"'); } $page->head_js[] = $addonRelativeCode . '/script.js'; //needed for admin pages as well $page->css_admin[] = $addonRelativeCode . '/admin.css'; $list = $this->GetList($page->gp_index); //admin and special pages cannot be translated if ($page->pagetype != 'display') { return; } if (!$list && !common::loggedIn()) { return; } //show the list echo '<div class="multi_lang_select"><div>'; echo '<b>Languages</b>'; echo '<ul>'; foreach ($ml_languages as $lang_code => $lang_label) { if (!isset($list[$lang_code])) { continue; } $index = $list[$lang_code]; if ($index == $page->gp_index) { continue; } $title = common::IndexToTitle($index); echo '<li>'; echo common::Link($title, $lang_label); echo '</li>'; } if (common::loggedIn()) { echo '<li>'; echo common::Link('Admin_MultiLang', 'Add Language', 'cmd=title_settings&index=' . $page->gp_index, ' name="gpabox"'); echo '</li>'; } echo '</ul>'; echo '</div></div>'; }
public function Gadget() { global $page; $this->AddResources(); //admin and special pages cannot be translated if ($page->pagetype != 'display') { return; } $list = $this->GetList($page->gp_index); if (!$list && !common::loggedIn()) { return; } $current_page_lang = array_search($page->gp_index, $list); //show the list echo '<div class="multi_lang_select"><div>'; echo '<b>Languages</b>'; $links = array(); foreach ($this->avail_langs as $lang_code => $lang_label) { if (!isset($list[$lang_code])) { continue; } if ($lang_code == $current_page_lang) { continue; } $index = $list[$lang_code]; $title = common::IndexToTitle($index); $links[] = common::Link($title, $lang_label); } if ($links) { echo '<ul><li>'; echo implode('</li><li>', $links); echo '</li></ul>'; } if (common::loggedIn()) { echo '<p>Admin: '; echo common::Link('Admin_MultiLang', 'Add Translation', 'cmd=TitleSettings&index=' . $page->gp_index, ' name="gpabox"'); echo '</p>'; } echo '</div></div>'; }
/** * Show details about the selected layout * */ function ShowDetails($layout, $layout_info, $handlers_count) { global $langmessage, $config; echo '<h3>' . $langmessage['details'] . '</h3>'; //layout options echo '<table class="bordered full_width">'; echo '<tr><th colspan="2">'; echo $langmessage['layout']; echo '</th></tr>'; echo '<tr><td style="width:40%">'; echo $langmessage['label']; echo '</td><td>'; echo '<a name="layout_id" title="' . $layout_info['color'] . '" rel="' . $layout_info['color'] . '">'; echo '<input type="hidden" name="layout" value="' . htmlspecialchars($layout) . '" /> '; echo '<input type="hidden" name="layout_label" value="' . $layout_info['label'] . '" /> '; echo '<span class="layout_color_id" style="background-color:' . $layout_info['color'] . ';"></span>'; echo ' '; echo $layout_info['label']; echo '</a>'; echo '</td></tr>'; echo '<tr><td>'; echo $langmessage['theme']; echo '</td><td>'; echo $layout_info['theme_name']; echo '</td></tr>'; echo '<tr><td>'; echo $langmessage['usage']; echo '</td><td>'; if ($config['gpLayout'] == $layout) { echo $langmessage['default']; } elseif (!isset($_GET['show'])) { echo common::Link('Admin_Theme_Content/' . rawurlencode($layout), str_replace(' ', ' ', $langmessage['make_default']), 'cmd=makedefault', ' name="gpabox" title="' . htmlspecialchars($langmessage['make_default']) . '" '); } else { echo common::Link('Admin_Theme_Content', str_replace(' ', ' ', $langmessage['default']), 'cmd=makedefault&layout_id=' . rawurlencode($layout), ' name="creq" title="' . htmlspecialchars($langmessage['make_default']) . '" '); } echo ' '; $titles_count = $this->TitlesCount($layout); echo sprintf($langmessage['%s Pages'], $titles_count); echo '</td></tr>'; $theme_colors = $this->GetThemeColors($layout_info['dir']); echo '<tr><td>'; echo $langmessage['style']; echo '</td><td>'; if (!isset($_GET['show'])) { echo '<form action="' . common::GetUrl('Admin_Theme_Content/' . rawurlencode($layout)) . '" method="post">'; } else { echo '<form action="' . common::GetUrl('Admin_Theme_Content') . '" method="post">'; echo '<input type="hidden" name="layout" value="' . $layout . '" />'; } echo '<select name="color" class="gpselect">'; foreach ($theme_colors as $color) { if ($color == $layout_info['theme_color']) { echo '<option value="' . htmlspecialchars($color) . '" selected="selected">'; } else { echo '<option value="' . htmlspecialchars($color) . '">'; } echo $color; echo '</option>'; } echo '</select>'; echo ' <input type="hidden" name="cmd" value="change_layout_color" />'; echo ' <input type="submit" name="" value="' . htmlspecialchars($langmessage['save']) . '" class="gpbutton" />'; echo '</form>'; echo '</td></tr>'; echo '<tr><td>'; echo $langmessage['content_arrangement']; echo '</td><td>'; if ($handlers_count > 0) { if (!isset($_GET['show'])) { echo common::Link('Admin_Theme_Content/' . rawurlencode($layout), $langmessage['restore_defaults'], 'cmd=restore', ' name="creq" '); } else { echo common::Link('Admin_Theme_Content', $langmessage['restore_defaults'], 'cmd=restore&layout=' . rawurlencode($layout), ' name="creq" '); } } else { echo $langmessage['default']; } echo '</td></tr>'; echo '</table>'; // gadgets echo '<br/>'; echo '<table class="bordered full_width">'; $gadget_info = gpOutput::WhichGadgets($this->curr_layout); echo '<tr><th style="width:40%">'; echo $langmessage['gadgets']; echo '</th><th> </th></tr>'; if (!isset($config['gadgets']) || count($config['gadgets']) == 0) { echo '<tr><td colspan="2">'; echo $langmessage['Empty']; echo '</td></tr>'; } else { foreach ($config['gadgets'] as $gadget => $temp) { echo '<tr><td>'; echo str_replace('_', ' ', $gadget); echo '</td><td>'; if (isset($gadget_info[$gadget])) { if (!isset($_GET['show'])) { echo common::Link('Admin_Theme_Content/' . rawurlencode($layout), $langmessage['remove'], 'cmd=rmgadget&gadget=' . urlencode($gadget), ' name="creq" '); } else { echo common::Link('Admin_Theme_Content', $langmessage['remove'], 'cmd=rmgadget&gadget=' . urlencode($gadget) . '&layout=' . rawurlencode($layout), ' name="creq" '); } } else { echo $langmessage['disabled']; } echo '</td></tr>'; } } echo '</table>'; //CSS options echo '<br/>'; if (!isset($_GET['show'])) { echo '<form action="' . common::GetUrl('Admin_Theme_Content/' . rawurlencode($layout)) . '" method="post">'; } else { echo '<form action="' . common::GetUrl('Admin_Theme_Content') . '" method="post">'; echo '<input type="hidden" name="layout" value="' . $layout . '" />'; } echo '<input type="hidden" name="cmd" value="css_preferences" />'; echo '<table class="bordered full_width">'; echo '<tr><th style="width:40%">CSS</th><th> </th></tr>'; echo '<tr><td>'; echo 'Name Based Menu Classes'; echo '</td><td>'; $checked = ''; if (!isset($layout_info['menu_css_ordered'])) { $checked = 'checked="checked"'; } echo '<input type="checkbox" name="menu_css_ordered" value="on" ' . $checked . ' />'; echo '</td></tr>'; echo '<tr><td>'; echo 'Ordered Menu Classes'; echo '</td><td>'; $checked = ''; if (!isset($layout_info['menu_css_indexed'])) { $checked = 'checked="checked"'; } echo '<input type="checkbox" name="menu_css_indexed" value="on" ' . $checked . ' />'; echo '</td></tr>'; echo '<tr><td>'; echo ' '; echo '</td><td>'; echo ' <input type="submit" name="" value="' . htmlspecialchars($langmessage['save']) . '" class="gpbutton" />'; echo '</td></tr>'; echo '</table>'; echo '</form>'; //affected titles $titles_count = $this->TitlesCount($layout); echo '<br/>'; echo '<table class="bordered full_width">'; echo '<tr><th colspan="2">'; echo $langmessage['titles_using_layout']; echo ': ' . $titles_count; echo '</th></tr>'; echo '<tr><td colspan="2">'; if ($titles_count > 0) { echo '<ul class="titles_using">'; foreach ($this->LayoutArray as $index => $layout_comparison) { if ($layout == $layout_comparison) { $title = common::IndexToTitle($index); if (empty($title)) { continue; //may be external link } echo "\n<li>"; $label = common::GetLabel($title); $label = common::LabelSpecialChars($label); echo common::Link($title, $label); echo '</li>'; } } echo '</ul>'; echo '<div class="clear"></div>'; } echo '</td></tr>'; echo '</table>'; }
/** * 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--; } }
/** * Output a navigation menu * @static */ function OutputMenu($menu, $start_level, $source_menu = false) { global $page, $GP_MENU_LINKS, $GP_MENU_CLASS, $gp_menu, $gp_titles; if ($source_menu === false) { $source_menu =& $gp_menu; } $search = array('{$href_text}', '{$attr}', '{$label}', '{$title}'); $replace = array(); if (count($menu) == 0) { echo '<div class="emtpy_menu"></div>'; //an empty <ul> is not valid xhtml gpOutput::ResetMenuGlobals(); return; } //$GP_MENU_LINKS = '<a href="{$href_text}" {$attr}><span class="sub-t">{$label}</span></a>'; //<a href="/rocky/index.php/Misson_&_Principles" title="Misson & Principles" >Misson & Principles</a> $link_format = '<a href="{$href_text}" title="{$title}"{$attr}>{$label}</a>'; if (!empty($GP_MENU_LINKS)) { $link_format = $GP_MENU_LINKS; } $result = array(); $prev_level = $start_level; $page_title_full = common::GetUrl($page->title); $source_keys = array_keys($source_menu); $source_values = array_values($source_menu); $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]; } $class = 'menu_top'; if (!empty($GP_MENU_CLASS)) { $class = $GP_MENU_CLASS; } $result[] = '<ul class="' . $class . '">'; foreach ($source_keys as $source_index => $menu_key) { $attr = $class = $attr_li = $class_li = ''; $menu_info = $source_values[$source_index]; $this_level = $menu_info['level']; //the next entry $next_info = false; if (isset($source_values[$source_index + 1])) { $next_info = $source_values[$source_index + 1]; } //create link if in $menu if (isset($menu[$menu_key])) { //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]++; } $class_li = 'li_' . $li_count[$this_level]; } if ($page->menu_css_indexed) { $class_li .= ' li_title_' . $menu_key; } //selected classes if ($this_level < $next_info['level']) { $class .= ' haschildren'; } if (isset($menu_info['url']) && ($menu_info['url'] == $page->title || $menu_info['url'] == $page_title_full)) { $class .= ' selected'; $class_li .= ' selected_li'; } elseif ($menu_key == $page->gp_index) { $class .= ' selected'; $class_li .= ' selected_li'; } elseif (in_array($menu_key, $parents)) { $class .= ' childselected'; $class_li .= ' childselected_li'; } if (!empty($class)) { $attr = ' class="' . trim($class) . '"'; } if (!empty($class_li)) { $attr_li = ' class="' . trim($class_li) . '"'; } //current is a child of the previous if ($this_level > $prev_level) { if (!$open) { $result[] = '<li' . $attr_li . '>'; //only needed if the menu starts below the start_level } while ($this_level > $prev_level) { $result[] = '<ul>'; $result[] = '<li>'; $prev_level++; } array_pop($result); //remove the last <li> //current is higher than the previous } elseif ($this_level < $prev_level) { while ($this_level < $prev_level) { $result[] = '</li>'; $result[] = '</ul>'; $prev_level--; } if ($open) { $result[] = '</li>'; } } elseif ($open) { $result[] = '</li>'; } $replace = array(); //external if (isset($menu_info['url'])) { if (empty($menu_info['title_attr'])) { $menu_info['title_attr'] = strip_tags($menu_info['label']); } if (isset($menu_info['new_win'])) { $attr .= ' target="_blank"'; } $replace[] = $menu_info['url']; $replace[] = $attr; $replace[] = $menu_info['label']; $replace[] = $menu_info['title_attr']; //internal link } else { if (!empty($gp_titles[$menu_key]['rel'])) { $attr .= ' rel="' . $gp_titles[$menu_key]['rel'] . '"'; } $title = common::IndexToTitle($menu_key); $replace[] = common::GetUrl($title); $replace[] = $attr; $replace[] = common::GetLabel($title); $replace[] = common::GetBrowserTitle($title); } $result[] = '<li' . $attr_li . '>' . str_replace($search, $replace, $link_format); $prev_level = $this_level; $open = true; } } while ($start_level <= $prev_level) { $result[] = '</li>'; $result[] = '</ul>'; $prev_level--; } //$test = implode("\n",$result); //$test = htmlspecialchars($test); //echo nl2br($test); //echo '<hr/>'; echo implode('', $result); //don't separate by spaces so css inline can be more functional gpOutput::ResetMenuGlobals(); return; }
function NewHiddenFile_Redir() { global $page; $new_index = $this->NewHiddenFile(); if ($new_index === false) { return; } $title = common::IndexToTitle($new_index); //redirect to title $url = common::AbsoluteUrl($title, '', true, false); $page->ajaxReplace[] = array('eval', '', 'window.location="' . $url . '";'); }
/** * Language selection popup * */ function TitleSettings($args = array()) { global $gp_titles, $langmessage, $langmessage, $ml_languages, $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="title_settings_add" />'; 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->LanguageSelect('from_lang'); } echo '</td><td>'; $title = common::IndexToTitle($page_index); echo common::Link_Page($title); echo '</td><td>'; echo '</td></tr>'; } //current settings foreach ($ml_languages 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=rmtitle&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->LanguageSelect('to_lang', $args['to_lang'], $this->lang); echo '</td><td>'; $this->TitleSelect($args['to_slug'], $list); 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>'; }
/** * Add an addon's special links to the configuration * */ function UpdateSpecialLinks($Special_Links) { global $gp_index, $gp_titles, $gp_menu, $langmessage; $lower_links = array_change_key_case($Special_Links, CASE_LOWER); //purge links no longer defined ... similar to PurgeExisting() foreach ($gp_index as $linkName => $index) { $linkInfo = $gp_titles[$index]; if (!isset($linkInfo['addon'])) { continue; } if ($linkInfo['addon'] !== $this->install_folder_name) { continue; } if (isset($lower_links[$index])) { continue; } unset($gp_index[$linkName]); unset($gp_titles[$index]); if (isset($gp_menu[$index])) { unset($gp_menu[$index]); } } //prepare a list with all titles converted to lower case $lower_titles = array_keys($gp_index); $lower_titles = array_combine($lower_titles, $lower_titles); $lower_titles = array_change_key_case($lower_titles, CASE_LOWER); //add new links ... similar to AddToConfig() foreach ($Special_Links as $new_title => $linkInfo) { $index = strtolower($new_title); $title = common::IndexToTitle($index); //if the title already exists, see if we need to update it if ($title) { $addlink = true; $curr_info = $gp_titles[$index]; if (!isset($curr_info['addon']) || $this->install_folder_name === false) { $addlink = false; } elseif ($curr_info['addon'] != $this->install_folder_name) { $addlink = false; } if (!$addlink) { echo '<p class="gp_notice">'; echo sprintf($langmessage['addon_key_defined'], ' <em>Special_Link: ' . $new_title . '</em>'); echo '<p>'; continue; } //this will overwrite things like label which are at times editable by users //$AddTo[$new_title] = $linkInfo + $AddTo[$new_title]; // if it doesn't exist, just add it } else { // we don't need the Special_ prefix, but we don't want duplicates $temp = $new_title = substr($new_title, 8); $temp_lower = $new_lower = strtolower($new_title); $i = 1; while (isset($lower_titles[$new_lower])) { $new_lower = $temp_lower . '_' . $i; $new_title = $temp . '_' . $i; $i++; } $gp_index[$new_title] = $index; $gp_titles[$index] = $linkInfo; } $this->UpdateLinkInfo($gp_titles[$index], $linkInfo); } }
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 ' » '; echo common::Link('Admin_Main', $langmessage['administration']); if (!empty($page->title) && !empty($page->label) && $page->title != 'Admin_Main') { echo ' » '; echo common::Link($page->title, $page->label); } echo '</div>'; }
/** * Display a list of all the titles using the current layout * */ function ShowTitles() { global $langmessage; //affected titles $titles_count = $this->TitlesCount($this->curr_layout); echo '<h2>' . $langmessage['titles_using_layout']; echo ': ' . $titles_count; echo '</h2>'; if ($titles_count > 0) { echo '<ul class="titles_using">'; foreach ($this->LayoutArray as $index => $layout_comparison) { if ($this->curr_layout == $layout_comparison) { $title = common::IndexToTitle($index); if (empty($title)) { continue; //may be external link } echo "\n<li>"; $label = common::GetLabel($title); $label = common::LabelSpecialChars($label); echo common::Link($title, $label); echo '</li>'; } } echo '</ul>'; echo '<div class="clear"></div>'; } }
static function RenameForm($index, $action) { global $langmessage, $page, $gp_index, $gp_titles; $label = common::GetLabelIndex($index); $title = common::IndexToTitle($index); $title_info = $gp_titles[$index]; if (empty($_REQUEST['new_title'])) { $new_title = common::LabelSpecialChars($label); } else { $new_title = htmlspecialchars($_REQUEST['new_title']); } $new_title = str_replace('_', ' ', $new_title); //show more options? $hidden_rows = false; ob_start(); echo '<div class="inline_box">'; echo '<form action="' . $action . '" method="post" id="gp_rename_form">'; echo '<input type="hidden" name="old_title" value="' . htmlspecialchars(str_replace('_', ' ', $title)) . '" />'; echo '<h2>' . $langmessage['rename/details'] . '</h2>'; echo '<input type="hidden" name="title" value="' . htmlspecialchars($title) . '" />'; echo '<table class="bordered full_width" id="gp_rename_table">'; echo '<thead>'; echo '<tr>'; echo '<th colspan="2">'; echo $langmessage['options']; echo '</th>'; echo '</tr>'; echo '</thead>'; //label echo '<tbody>'; echo '<tr><td class="formlabel">' . $langmessage['label'] . '</td>'; echo '<td><input type="text" class="title_label gpinput" name="new_label" maxlength="100" size="50" value="' . $new_title . '" />'; echo '</td></tr>'; //slug $attr = ''; $class = 'new_title'; $editable = true; if ($title == admin_tools::LabelToSlug($label)) { $attr = 'disabled="disabled" '; $class .= ' sync_label'; } echo '<tr><td class="formlabel">' . $langmessage['Slug/URL'] . '</td>'; echo '<td><input type="text" class="' . $class . ' gpinput" name="new_title" maxlength="100" size="50" value="' . htmlspecialchars($title) . '" ' . $attr . '/>'; if ($editable) { echo ' <div class="label_synchronize">'; if (empty($attr)) { echo '<a href="#">' . $langmessage['sync_with_label'] . '</a>'; echo '<a href="#" class="slug_edit nodisplay">' . $langmessage['edit'] . '</a>'; } else { echo '<a href="#" class="nodisplay">' . $langmessage['sync_with_label'] . '</a>'; echo '<a href="#" class="slug_edit">' . $langmessage['edit'] . '</a>'; } echo '</div>'; } echo '</td>'; echo '</tr>'; //browser title defaults to label $attr = ''; $class = 'browser_title'; if (isset($title_info['browser_title'])) { echo '<tr>'; $browser_title = $title_info['browser_title']; } else { echo '<tr class="nodisplay">'; $hidden_rows = true; $browser_title = $label; $attr = 'disabled="disabled" '; $class .= ' sync_label'; } echo '<td class="formlabel">'; echo $langmessage['browser_title']; echo '</td>'; echo '<td>'; echo '<input type="text" class="' . $class . ' gpinput" size="50" name="browser_title" value="' . $browser_title . '" ' . $attr . '/>'; echo ' <div class="label_synchronize">'; if (empty($attr)) { echo '<a href="#">' . $langmessage['sync_with_label'] . '</a>'; echo '<a href="#" class="slug_edit nodisplay">' . $langmessage['edit'] . '</a>'; } else { echo '<a href="#" class="nodisplay">' . $langmessage['sync_with_label'] . '</a>'; echo '<a href="#" class="slug_edit">' . $langmessage['edit'] . '</a>'; } echo '</div>'; echo '</td>'; echo '</tr>'; //meta keywords $keywords = ''; if (isset($title_info['keywords'])) { echo '<tr>'; $keywords = $title_info['keywords']; } else { echo '<tr class="nodisplay">'; $hidden_rows = true; } echo '<td class="formlabel">'; echo $langmessage['keywords']; echo '</td>'; echo '<td>'; echo '<input type="text" class="gpinput" size="50" name="keywords" value="' . $keywords . '" />'; echo '</td>'; echo '</tr>'; //meta description $description = ''; if (isset($title_info['description'])) { echo '<tr>'; $description = $title_info['description']; } else { echo '<tr class="nodisplay">'; $hidden_rows = true; } echo '<td class="formlabel">'; echo $langmessage['description']; echo '</td>'; echo '<td>'; //echo '<input type="text" class="gpinput" size="50" name="description" value="'.$description.'" />'; echo '<textarea class="gptextarea show_character_count" rows="2" cols="50" name="description">' . $description . '</textarea>'; $count_label = sprintf($langmessage['_characters'], '<span>' . strlen($description) . '</span>'); echo '<div class="character_count">' . $count_label . '</div>'; echo '</td>'; echo '</tr>'; //robots $rel = ''; if (isset($title_info['rel'])) { echo '<tr>'; $rel = $title_info['rel']; } else { echo '<tr class="nodisplay">'; $hidden_rows = true; } echo '<td class="formlabel">'; echo $langmessage['robots']; echo '</td>'; echo '<td>'; echo '<label>'; $checked = strpos($rel, 'nofollow') !== false ? 'checked="checked"' : ''; echo '<input type="checkbox" name="nofollow" value="nofollow" ' . $checked . '/> '; echo ' Nofollow '; echo '</label>'; echo '<label>'; $checked = strpos($rel, 'noindex') !== false ? 'checked="checked"' : ''; echo '<input type="checkbox" name="noindex" value="noindex" ' . $checked . '/> '; echo ' Noindex'; echo '</label>'; echo '</td>'; echo '</tr>'; echo '</tbody>'; echo '</table>'; //redirection echo '<p id="gp_rename_redirect" class="nodisplay">'; echo '<label>'; echo '<input type="checkbox" name="add_redirect" value="add" /> '; echo sprintf($langmessage['Auto Redirect'], '"' . $title . '"'); echo '</label>'; echo '</p>'; echo '<p>'; if ($hidden_rows) { echo ' <a data-cmd="showmore" >+ ' . $langmessage['more_options'] . '</a>'; } echo '</p>'; echo '<p>'; echo '<input type="hidden" name="cmd" value="renameit"/> '; echo '<input type="submit" name="" value="' . $langmessage['save_changes'] . '...' . '" class="gpsubmit" data-cmd="gppost"/>'; echo '<input type="button" class="admin_box_close gpcancel" name="" value="' . $langmessage['cancel'] . '" />'; echo '</p>'; echo '</form>'; echo '</div>'; $content = ob_get_clean(); $page->ajaxReplace = array(); $array = array(); $array[0] = 'admin_box_data'; $array[1] = ''; $array[2] = $content; $page->ajaxReplace[] = $array; //call renameprep function after admin_box $array = array(); $array[0] = 'renameprep'; $array[1] = ''; $array[2] = ''; $page->ajaxReplace[] = $array; }