Esempio n. 1
0
 /**
  * Show files in the cache
  *
  */
 protected function ShowFiles()
 {
     global $langmessage;
     $this->page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
     $this->page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
     if (!$this->all_files) {
         return;
     }
     echo '<p>';
     echo \gp\tool::Link('Admin/Cache', 'Empty Cache', 'cmd=EmptyResourceCache', array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => 'Empty the resource cache?'));
     echo '</p>';
     echo '<table class="bordered tablesorter full_width">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['file_name'];
     echo '</th><th>';
     echo $langmessage['File Size'];
     echo '</th><th>';
     echo 'Touched';
     echo '</th><th>';
     echo $langmessage['options'];
     echo '</th></tr>';
     echo '</thead>';
     $total_size = 0;
     echo '<tbody>';
     foreach ($this->all_files as $file) {
         $full = $this->cache_dir . '/' . $file;
         echo '<tr><td>';
         echo '<a href="?cmd=ViewFile&amp;file=' . rawurlencode($file) . '">';
         echo $file;
         echo '</a>';
         echo '</td><td>';
         $size = filesize($full);
         echo '<span style="display:none">' . $size . '</span>';
         echo \gp\admin\Tools::FormatBytes($size);
         $total_size += $size;
         echo '</td><td>';
         $elapsed = \gp\admin\Tools::Elapsed(time() - filemtime($full));
         echo sprintf($langmessage['_ago'], $elapsed);
         echo '</td><td>';
         echo \gp\tool::Link('Admin/Cache', $langmessage['delete'], 'cmd=DeleteFile&amp;file=' . rawurlencode($file), array('data-cmd' => 'cnreq', 'class' => 'gpconfirm', 'title' => $langmessage['delete_confirm']));
         echo '</tr>';
     }
     echo '</tbody>';
     //totals
     echo '<tfoot>';
     echo '<tr><td>';
     echo number_format(count($this->all_files)) . ' Files';
     echo '</td><td>';
     echo \gp\admin\Tools::FormatBytes($total_size);
     echo '</td><td>';
     echo '</tr>';
     echo '</table>';
 }
Esempio n. 2
0
 function __construct($args)
 {
     global $langmessage, $config;
     parent::__construct($args);
     /*
     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 \gp\tool::Link('Special_Site_Map', 'XML', 'xml');
     echo '</div>';
     echo '<h2>';
     echo \gp\tool\Output::ReturnText('site_map');
     echo '</h2>';
     \gp\tool\Output::GetFullMenu();
 }
Esempio n. 3
0
 public function GalleryEditBox($title, $info)
 {
     if (is_array($info)) {
         $icon = $info['icon'];
     } else {
         $icon = $info;
     }
     if (empty($icon)) {
         $thumbPath = \gp\tool::GetDir('/include/imgs/blank.gif');
     } elseif (strpos($icon, '/thumbnails/') === false) {
         $thumbPath = \gp\tool::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg');
     } else {
         $thumbPath = \gp\tool::GetDir('/data/_uploaded' . $icon);
     }
     echo '<div class="draggable">';
     echo \gp\tool::Link('Special_Galleries', htmlspecialchars($title), 'cmd=drag&to=%s&title=' . urlencode($title), 'data-cmd="gpajax" class="dragdroplink nodisplay" ');
     echo '<input type="hidden" name="title" value="' . htmlspecialchars($title) . '" class="title" />';
     echo ' <img src="' . $thumbPath . '" alt="" class="icon"/>';
     echo '<div class="caption">';
     echo str_replace('_', ' ', $title);
     echo '</div>';
     echo '</div>';
 }
Esempio n. 4
0
 /**
  * Output content for use with the inline image editor
  *
  */
 public static function ImageEditor($obj)
 {
     global $langmessage, $page;
     //image options
     ob_start();
     //edit current image
     echo '<div id="gp_current_image" class="inline_edit_area" title="' . $langmessage['edit'] . '">';
     echo '<span id="gp_image_wrap"><img/></span>';
     echo '<table>';
     echo '<tr><td>' . $langmessage['Width'] . '</td><td><input type="text" name="width" class="ck_input"/></td>';
     echo '<td>' . $langmessage['Height'] . '</td><td><input type="text" name="height" class="ck_input"/></td>';
     echo '</tr>';
     echo '<tr><td>' . $langmessage['Left'] . '</td><td><input type="text" name="left" class="ck_input" value="0"/></td>';
     echo '<td>' . $langmessage['Top'] . '</td><td><input type="text" name="top" class="ck_input" value="0"/></td>';
     echo '</tr>';
     echo '<tr><td><a data-cmd="deafult_sizes" class="ckeditor_control ck_reset_size" title="' . $langmessage['Theme_default_sizes'] . '">&#10226;</a></td></tr>';
     echo '</table>';
     echo '</div>';
     //select image
     echo '<div id="gp_source_options" class="inline_edit_area" style="display:none" title="' . $langmessage['Select Image'] . '">';
     if (property_exists($obj, 'curr_layout')) {
         echo \gp\tool::Link('Admin_Theme_Content/Image/' . rawurlencode($obj->curr_layout), $langmessage['Theme Images'] . '..', 'cmd=ShowThemeImages', ' data-cmd="gpajax" class="ckeditor_control half_width" ');
         echo '<a class="ckeditor_control half_width" data-cmd="show_uploaded_images">' . $langmessage['uploaded_files'] . '</a>';
     }
     echo '<div id="gp_image_area"></div><div id="gp_upload_queue"></div>';
     echo '<div id="gp_folder_options"></div>';
     echo '</div>';
     $content = ob_get_clean();
     $page->ajaxReplace = array();
     $page->ajaxReplace[] = array('inner', '#ckeditor_top', $content);
     $page->ajaxReplace[] = array('image_options_loaded', '', '');
     //tell the script the images have been loaded
 }
Esempio n. 5
0
 /**
  * Display the permission options for a file
  *
  */
 public 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="' . \gp\tool::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>' . \gp\tool::Link('Admin/Users', $langmessage['user_permissions']) . ' &#187; <i>';
     if ($count > 1) {
         echo sprintf($langmessage['%s Pages'], $count);
     } else {
         echo strip_tags(\gp\tool::GetLabelIndex($indexes[0]));
     }
     echo '</i></h2>';
     //list of files
     if ($count > 1) {
         $labels = array();
         foreach ($indexes as $index) {
             $labels[] = strip_tags(\gp\tool::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 '<span>' . $username . '</span>';
         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>';
 }
Esempio n. 6
0
 private function BreadCrumbs()
 {
     global $langmessage;
     echo '<div id="admin_breadcrumbs" class="cf">';
     echo \gp\tool::Link('', $langmessage['Homepage']);
     echo ' &#187; ';
     echo \gp\tool::Link('Admin', $langmessage['administration']);
     $crumbs = array();
     $request_string = str_replace('_', '/', $this->requested);
     $parts = explode('/', $request_string);
     do {
         $request_string = implode('/', $parts);
         $scriptinfo = $this->GetScriptInfo($request_string);
         if (is_array($scriptinfo) && isset($scriptinfo['label'])) {
             $crumbs[$request_string] = $scriptinfo['label'];
         }
     } while (array_pop($parts));
     //page label
     $this->label = implode('  &#171; ', $crumbs);
     //add to breadcrumbs
     $crumbs = array_reverse($crumbs);
     foreach ($crumbs as $slug => $label) {
         echo ' &#187; ';
         echo \gp\tool::Link($slug, $label);
     }
     echo '</div>';
 }
Esempio n. 7
0
 public function LoginForm()
 {
     global $langmessage;
     $_REQUEST += array('file' => '');
     echo '<div id="loginform">';
     echo '<div id="login_timeout" class="nodisplay">Log in Timeout: ' . \gp\tool::Link('Admin', 'Reload to continue...') . '</div>';
     echo '<form action="' . \gp\tool::GetUrl('Admin') . '" method="post" id="login_form">';
     echo '<input type="hidden" name="file" value="' . htmlspecialchars($_REQUEST['file']) . '">';
     //for redirection
     echo '<div>';
     echo '<input type="hidden" name="cmd" value="login" />';
     echo '<input type="hidden" name="login_nonce" value="' . htmlspecialchars(\gp\tool::new_nonce('login_nonce', true, 300)) . '" />';
     echo '</div>';
     echo '<p class="login_text">';
     echo '<input type="text" name="username" value="' . htmlspecialchars($_POST['username']) . '" placeholder="' . htmlspecialchars($langmessage['username']) . '" />';
     echo '<input type="hidden" name="user_sha" value="" />';
     echo '</p>';
     echo '<p class="login_text">';
     echo '<input type="password" class="password" name="password" value="" placeholder="' . htmlspecialchars($langmessage['password']) . '"/>';
     echo '<input type="hidden" name="pass_md5" value="" />';
     echo '<input type="hidden" name="pass_sha" value="" />';
     echo '<input type="hidden" name="pass_sha512" value="" />';
     echo '</p>';
     echo '<p>';
     echo '<input type="submit" class="login_submit" value="' . $langmessage['login'] . '" />';
     echo ' &nbsp; ';
     echo \gp\tool::Link('', $langmessage['cancel']);
     echo '</p>';
     echo '<p>';
     echo '<label>';
     echo '<input type="checkbox" name="remember" ' . $this->checked('remember') . '/> ';
     echo '<span>' . $langmessage['remember_me'] . '</span>';
     echo '</label> ';
     echo '<label>';
     echo '<input type="checkbox" name="encrypted" ' . $this->checked('encrypted') . '/> ';
     echo '<span>' . $langmessage['send_encrypted'] . '</span>';
     echo '</label>';
     echo '</p>';
     echo '<div>';
     echo '<label>';
     $url = \gp\tool::GetUrl('Admin', 'cmd=forgotten');
     echo sprintf($langmessage['forgotten_password'], $url);
     echo '</label>';
     echo '</div>';
     echo '</form>';
     echo '</div>';
 }
Esempio n. 8
0
 /**
  * Show images available in themes
  *
  */
 public function ShowThemeImages()
 {
     global $langmessage;
     $this->page->ajaxReplace = array();
     $current_theme = false;
     //which theme folder
     if (isset($_REQUEST['theme']) && isset($this->avail_addons[$_REQUEST['theme']])) {
         $current_theme = $_REQUEST['theme'];
         $current_info = $this->avail_addons[$current_theme];
         $current_label = $current_info['name'];
         $current_dir = $current_info['full_dir'];
         $current_url = \gp\tool::GetDir($current_info['rel']);
         //current layout
     } else {
         $layout_info = \gp\tool::LayoutInfo($this->curr_layout, false);
         $current_label = $layout_info['theme_name'];
         $current_dir = $layout_info['dir'];
         $current_url = \gp\tool::GetDir(dirname($layout_info['path']));
     }
     //list of themes
     ob_start();
     echo '<div class="gp_edit_select ckeditor_control">';
     echo '<a class="gp_selected_folder"><span class="folder"></span>';
     echo $current_label;
     echo '</a>';
     echo '<div class="gp_edit_select_options">';
     foreach ($this->avail_addons as $theme_id => $info) {
         $slug = 'Admin_Theme_Content/Image/' . rawurlencode($this->curr_layout);
         echo \gp\tool::Link($slug, '<span class="folder"></span>' . $info['name'], 'cmd=ShowThemeImages&theme=' . rawurlencode($theme_id), ' data-cmd="gpajax" class="gp_gallery_folder" ');
     }
     echo '</div>';
     echo '</div>';
     $gp_option_area = ob_get_clean();
     //images in theme
     $images = array();
     self::GetAvailThemeImages($current_dir, $current_url, $images);
     ob_start();
     foreach ($images as $image) {
         echo '<span class="expand_child">' . '<a href="' . $image['url'] . '" data-cmd="gp_gallery_add" data-width="' . $image['width'] . '" data-height="' . $image['height'] . '">' . '<img src="' . $image['url'] . '" alt=""/>' . '</a></span>';
     }
     $gp_gallery_avail_imgs = ob_get_clean();
     if ($current_theme) {
         $this->page->ajaxReplace[] = array('inner', '#gp_option_area', $gp_option_area);
         $this->page->ajaxReplace[] = array('inner', '#gp_gallery_avail_imgs', $gp_gallery_avail_imgs);
     } else {
         $content = '<div id="gp_option_area">' . $gp_option_area . '</div>' . '<div id="gp_gallery_avail_imgs">' . $gp_gallery_avail_imgs . '</div>';
         $this->page->ajaxReplace[] = array('inner', '#gp_image_area', $content);
     }
     $this->page->ajaxReplace[] = array('inner', '#gp_folder_options', '');
     //remove upload button
 }
Esempio n. 9
0
 function GetSiteLabelLink()
 {
     global $config;
     echo \gp\tool::Link('', $config['title']);
 }
Esempio n. 10
0
 /**
  * Display Save buttons
  *
  */
 protected function SaveButtons()
 {
     global $langmessage;
     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 '</div>';
     echo '<p class="admin_note">';
     echo '<b>';
     echo $langmessage['see_also'];
     echo '</b> ';
     echo \gp\tool::Link('Admin/Preferences', $langmessage['Preferences'], '', 'data-cmd="gpabox"');
     echo '</p>';
 }
Esempio n. 11
0
 public function LayoutLink($layout, $label, $query, $attr)
 {
     $url = $this->LayoutUrl($layout, $query);
     return \gp\tool::Link($url, $label, $query, $attr);
 }
Esempio n. 12
0
 function ShowRedirection()
 {
     global $langmessage, $gp_index, $config;
     $this->page->head_js[] = '/include/thirdparty/tablesorter/tablesorter.js';
     $this->page->jQueryCode .= '$("table.tablesorter").tablesorter({cssHeader:"gp_header",cssAsc:"gp_header_asc",cssDesc:"gp_header_desc"});';
     echo '<p>' . $langmessage['About_Redirection'] . '</p>';
     echo \gp\tool::Link('Admin/Missing', $langmessage['New Redirection'], 'cmd=newform', array('data-cmd' => 'gpabox'));
     if (empty($this->error_data['redirects'])) {
         return;
     }
     echo '<table class="bordered tablesorter full_width">';
     echo '<thead>';
     echo '<tr><th>';
     echo $langmessage['Source URL'];
     echo '</th><th>';
     echo $langmessage['Target URL'];
     echo '</th><th>';
     echo $langmessage['Similarity'];
     echo '</th><th>';
     echo $langmessage['Method'];
     echo '</th><th>';
     echo $langmessage['options'];
     echo '</th></tr>';
     echo '</thead>';
     echo '<tbody>';
     $has_invalid_target = false;
     $admin_urls = \gp\admin\Tools::AdminScripts();
     foreach ($this->error_data['redirects'] as $source => $data) {
         echo '<tr><td>';
         $raw_source = $source;
         if (!empty($data['raw_source'])) {
             $raw_source = $data['raw_source'];
         }
         echo htmlspecialchars($raw_source);
         echo '</td><td>';
         $target_show = $data['target'];
         if (strlen($target_show) > 40) {
             $target_show = substr($target_show, 0, 15) . ' ... ' . substr($target_show, -15);
         }
         $full_target = $this->GetTarget($data['target'], false);
         echo '<a href="' . htmlspecialchars($full_target) . '">' . str_replace(' ', '&nbsp;', htmlspecialchars($target_show)) . '</a>';
         $is_gplink = $this->isGPLink($data['target']);
         if (!empty($data['target']) && $is_gplink) {
             if (!isset($gp_index[$data['target']]) && !isset($admin_urls[$data['target']])) {
                 $has_invalid_target = true;
                 echo ' <img src="' . \gp\tool::GetDir('/include/imgs/error.png') . '" alt="" height="16" width="16" style="vertical-align:middle" title="' . $langmessage['Target URL Invalid'] . '"/> ';
             }
         }
         echo '</td><td>';
         if ($is_gplink) {
             $lower_source = strtolower($raw_source);
             $lower_target = strtolower($target_show);
             similar_text($lower_source, $lower_target, $percent);
             if ($config['auto_redir'] > 0 && $percent >= $config['auto_redir']) {
                 //echo '<span style="color:orange">'.number_format($percent,1).'%</span>';
                 echo number_format($percent, 1) . '%';
             } else {
                 echo number_format($percent, 1) . '%';
             }
         } else {
             echo '&nbsp;';
         }
         echo '</td><td>';
         echo $this->GetCodeLanguage($data['code']);
         echo '</td><td>';
         echo \gp\tool::Link('Admin/Missing', $langmessage['edit'], 'cmd=editredir&source=' . urlencode($source), array('data-cmd' => 'gpabox'));
         echo ' &nbsp; ';
         echo \gp\tool::Link($source, $langmessage['Test']);
         echo ' &nbsp; ';
         $title = sprintf($langmessage['generic_delete_confirm'], $source);
         echo \gp\tool::Link('Admin/Missing', $langmessage['delete'], 'cmd=rmredir&link=' . urlencode($source), array('data-cmd' => 'postlink', 'title' => $title, 'class' => 'gpconfirm'));
         echo '</td></tr>';
     }
     echo '</tbody>';
     echo '</table>';
     echo '<p>';
     echo \gp\tool::Link('Admin/Missing', $langmessage['New Redirection'], 'cmd=newform', array('data-cmd' => 'gpabox'));
     echo '</p>';
     if ($has_invalid_target) {
         echo '<p>';
         echo ' <img src="' . \gp\tool::GetDir('/include/imgs/error.png') . '" alt="" height="16" width="16" style="vertical-align:middle" title="' . $langmessage['Target URL Invalid'] . '"/> ';
         echo $langmessage['Target URL Invalid'];
         echo '</p>';
     }
 }
Esempio n. 13
0
 /**
  * Return a formatted list of links associated with $addon
  * @return string
  */
 public static function GetAddonSubLinks($addon = false)
 {
     global $config;
     $special_links = self::GetAddonTitles($addon);
     $admin_links = self::GetAddonComponents($config['admin_links'], $addon);
     $result = '';
     foreach ($special_links as $linkName => $linkInfo) {
         $result .= '<li>';
         $result .= \gp\tool::Link($linkName, $linkInfo['label']);
         $result .= '</li>';
     }
     foreach ($admin_links as $linkName => $linkInfo) {
         if (self::HasPermission($linkName)) {
             $result .= '<li>';
             $result .= \gp\tool::Link($linkName, $linkInfo['label']);
             $result .= '</li>';
         }
     }
     return $result;
 }
Esempio n. 14
0
 public function AdminLinkList($links, $label, $format)
 {
     $_links = array();
     foreach ($links as $linkName => $linkInfo) {
         $_links[] = \gp\tool::Link($linkName, $linkInfo['label']);
     }
     $this->FormatList($_links, $label, $format);
 }
Esempio n. 15
0
 /**
  * Preview a theme and give users the option of creating a new layout
  *
  */
 public function PreviewTheme($theme, $theme_info)
 {
     global $langmessage, $config;
     $theme_id = dirname($theme);
     $color = $theme_info['color'];
     $_REQUEST += array('gpreq' => 'body');
     //force showing only the body as a complete html document
     $this->page->get_theme_css = false;
     $this->page->head_js[] = '/include/js/auto_width.js';
     $this->page->head_js[] = '/include/js/theme_content_outer.js';
     $this->page->css_admin[] = '/include/css/theme_content_outer.scss';
     //show site in iframe
     echo '<div id="gp_iframe_wrap">';
     $url = \gp\tool::GetUrl('Admin_Theme_Content/Available', 'cmd=preview_iframe&theme=' . rawurlencode($theme));
     echo '<iframe src="' . $url . '" id="gp_layout_iframe" name="gp_layout_iframe"></iframe>';
     echo '</div>';
     ob_start();
     //new
     echo '<div id="theme_editor">';
     echo '<div class="gp_scroll_area">';
     echo '<div>';
     echo \gp\tool::Link('Admin_Theme_Content/Available', '&#171; ' . $langmessage['available_themes']);
     echo \gp\tool::Link('Admin_Theme_Content/Available', $langmessage['use_this_theme'], 'cmd=newlayout&theme=' . rawurlencode($theme), 'data-cmd="gpabox" class="add_layout"');
     echo '</div>';
     echo '<div class="separator"></div>';
     echo '<div id="available_wrap"><div>';
     $this->searchUrl = 'Admin_Theme_Content/Available';
     $this->AvailableList(false);
     //search options
     $this->searchQuery .= '&cmd=preview&theme=' . rawurlencode($theme);
     $this->SearchOptions(false);
     echo '</div></div>';
     echo '</div>';
     echo '</div>';
     $this->page->admin_html = ob_get_clean();
     return true;
 }
Esempio n. 16
0
 /**
  * Display current layout, list of available layouts and list of titles affected by the layout setting for $title
  *
  */
 public function SelectLayout($url, $query_string)
 {
     global $gp_titles, $gpLayouts, $langmessage, $config, $gp_index;
     $index = $_REQUEST['index'];
     $title = \gp\tool::IndexToTitle($index);
     if (!$title) {
         echo $langmessage['OOPS'];
         return;
     }
     $this->title = $title;
     $Inherit_Info = \gp\admin\Menu\Tools::Inheritance_Info();
     $curr_layout = \gp\admin\Menu\Tools::CurrentLayout($index);
     $curr_info = $gpLayouts[$curr_layout];
     echo '<div class="inline_box">';
     echo '<h3>';
     echo $langmessage['current_layout'] . ': &nbsp; ';
     echo '<span class="layout_color_id" style="background-color:' . $curr_info['color'] . ';" title="' . $curr_info['color'] . '"></span> &nbsp; ';
     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 \gp\tool::Link($url, $span . $parent_info['label'], $query_string . 'cmd=restorelayout&index=' . urlencode($index), array('data-cmd' => 'postlink', 'title' => $langmessage['restore']), 'restore');
         echo '</p>';
     }
     echo '<table class="bordered full_width">';
     echo '<tr><th>';
     echo $langmessage['available_layouts'];
     echo '</th><th>';
     echo $langmessage['theme'];
     echo '</th></tr>';
     if (count($gpLayouts) < 2) {
         echo '<tr><td colspan="2">';
         echo $langmessage['Empty'];
         echo '</td></tr>';
         echo '</table>';
         echo \gp\tool::Link('Admin_Theme_Content', $langmessage['new_layout']);
         echo '</div>';
         return;
     }
     foreach ($gpLayouts as $layout => $info) {
         if ($layout == $curr_layout) {
             continue;
         }
         echo '<tr><td>';
         echo '<span class="layout_color_id" style="background-color:' . $info['color'] . ';" title="' . $info['color'] . '">';
         echo '</span> ';
         if ($layout != $curr_layout) {
             echo \gp\tool::Link($url, $info['label'], $query_string . 'cmd=uselayout&index=' . urlencode($index) . '&layout=' . urlencode($layout), array('data-cmd' => 'postlink'), 'use_' . $layout);
         }
         echo '</td><td>';
         echo $info['theme'];
         echo '</td></tr>';
     }
     echo '</table>';
     //show affected pages
     $affected = self::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 = \gp\tool::GetLabelIndex($index, false);
     echo \gp\tool::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 \gp\tool::Link('Admin_Theme_Content', $langmessage['layouts']);
     echo '</p>';
     echo '</div>';
 }
Esempio n. 17
0
 /**
  * Display the current homepage setting
  *
  */
 public function HomepageDisplay()
 {
     global $langmessage, $config;
     $label = \gp\tool::GetLabelIndex($config['homepath_key']);
     echo '<span class="fa fa-home"></span> ';
     echo $langmessage['Homepage'] . ': ';
     echo \gp\tool::Link('Admin/Menu/Ajax', $label, 'cmd=HomepageSelect', 'data-cmd="gpabox"');
 }
Esempio n. 18
0
 public function GetSection(&$section_num)
 {
     global $langmessage;
     if (!isset($this->file_sections[$section_num])) {
         trigger_error('invalid section number');
         return;
     }
     $curr_section_num = $section_num;
     $section_num++;
     $content = '';
     $section_data = $this->file_sections[$curr_section_num];
     //make sure section_data is an array
     $type = gettype($section_data);
     if ($type !== 'array') {
         trigger_error('$section_data is ' . $type . '. Array expected');
         return;
     }
     $section_data += array('attributes' => array(), 'type' => 'text');
     $section_data['attributes'] += array('class' => '');
     $orig_attrs = $section_data['attributes'];
     $section_data['attributes']['data-gp-section'] = $curr_section_num;
     $section_types = \gp\tool\Output\Sections::GetTypes();
     if (\gp\tool\Output::ShowEditLink() && \gp\admin\Tools::CanEdit($this->gp_index)) {
         if (isset($section_types[$section_data['type']])) {
             $title_attr = $section_types[$section_data['type']]['label'];
         } else {
             $title_attr = sprintf($langmessage['Section %s'], $curr_section_num + 1);
         }
         $attrs = array('title' => $title_attr, 'data-cmd' => 'inline_edit_generic', 'data-arg' => $section_data['type'] . '_inline_edit');
         $link = \gp\tool\Output::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num, $attrs);
         $section_data['attributes']['data-gp-area-id'] = $edit_index;
         //section control links
         if ($section_data['type'] != 'wrapper_section') {
             ob_start();
             echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             echo $link;
             echo \gp\tool::Link($this->title, $langmessage['Manage Sections'], 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '<span class="gp_separator"></span>';
             echo \gp\tool::Link($this->title, $langmessage['rename/details'], 'cmd=renameform&index=' . urlencode($this->gp_index), 'data-cmd="gpajax"');
             echo \gp\tool::Link($this->title, $langmessage['Revision History'], 'cmd=ViewHistory', array('data-cmd' => 'gpabox'));
             echo '<span class="gp_separator"></span>';
             echo \gp\tool::Link('Admin/Menu', $langmessage['file_manager']);
             echo '</span>';
             \gp\tool\Output::$editlinks .= ob_get_clean();
         }
         $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index;
     }
     $content .= $this->SectionNode($section_data, $orig_attrs);
     if ($section_data['type'] == 'wrapper_section') {
         for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) {
             $content .= $this->GetSection($section_num);
         }
     } else {
         \gp\tool\Output::$nested_edit = true;
         $content .= \gp\tool\Output\Sections::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats);
         \gp\tool\Output::$nested_edit = false;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
     } else {
         $content .= \gp\tool\Output\Sections::EndTag($section_data['nodeName']);
     }
     return $content;
 }
Esempio n. 19
0
 public function Form()
 {
     global $langmessage, $gpAdmin;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $array = $_POST;
     } else {
         $array = $this->user_info + $gpAdmin;
     }
     $array += array('email' => '');
     echo '<h2>' . $langmessage['Preferences'] . '</h2>';
     echo '<form action="' . \gp\tool::GetUrl('Admin/Preferences') . '" method="post">';
     echo '<table class="bordered full_width">';
     echo '<tr><th colspan="2">' . $langmessage['general_settings'] . '</th></tr>';
     //email
     echo '<tr><td>';
     echo $langmessage['email_address'];
     echo '</td><td>';
     echo '<input type="text" name="email" value="' . htmlspecialchars($array['email']) . '" class="gpinput"/>';
     echo '</td></tr>';
     echo '<tr><th colspan="2">' . $langmessage['change_password'] . '</th></tr>';
     echo '<tr><td>';
     echo $langmessage['old_password'];
     echo '</td><td>';
     echo '<input type="password" name="oldpassword" value="" class="gpinput"/>';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['new_password'];
     echo '</td><td>';
     echo '<input type="password" name="password" value="" class="gpinput"/>';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['repeat_password'];
     echo '</td><td>';
     echo '<input type="password" name="password1" value="" class="gpinput"/>';
     echo '</td></tr>';
     $this->AlgoSelect();
     echo '</table>';
     echo '<div style="margin:1em 0">';
     echo '<input type="hidden" name="cmd" value="changeprefs" />';
     echo ' <input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpsubmit"/>';
     echo ' <input type="button" name="" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel"/>';
     echo '</div>';
     echo '<p class="admin_note">';
     echo '<b>';
     echo $langmessage['see_also'];
     echo '</b> ';
     echo \gp\tool::Link('Admin_Configuration', $langmessage['configuration'], '', 'data-cmd="gpabox"');
     echo '</p>';
     echo '</div>';
     echo '</form>';
 }
Esempio n. 20
0
 public static function PaginationLink($slug, $label, $query, $page_key, $attr, $page)
 {
     if ($page > 0) {
         $query .= '&' . $page_key . '=' . $page;
     }
     echo '<li>' . \gp\tool::Link($slug, $label, $query, $attr) . '</li>';
 }
Esempio n. 21
0
 /**
  * Display a form for uploading CKEditor plugins
  *
  */
 function PluginForm()
 {
     global $langmessage;
     echo '<form method="post" action="' . \gp\tool::GetUrl($this->page->requested) . '" enctype="multipart/form-data">';
     echo '<table class="bordered"><tr><th>' . $langmessage['name'] . '</th><th>' . $langmessage['Modified'] . '</th><th>' . $langmessage['options'] . '</th></tr>';
     if (count($this->cke_config['plugins'])) {
         foreach ($this->cke_config['plugins'] as $plugin_name => $plugin_info) {
             echo '<tr><td>';
             echo $plugin_name;
             echo '</td><td>';
             echo \gp\tool::date($langmessage['strftime_datetime'], $plugin_info['updated']);
             echo '</td><td>';
             $attr = array('data-cmd' => 'postlink', 'class' => 'gpconfirm', 'title' => sprintf($langmessage['generic_delete_confirm'], $plugin_name));
             echo \gp\tool::Link($this->page->requested, $langmessage['delete'], 'cmd=rmplugin&plugin=' . rawurlencode($plugin_name), $attr);
             echo '</td></tr>';
         }
     }
     echo '<tr><td>';
     echo '<input type="hidden" name="cmd" value="upload_plugin" />';
     echo '<input type="file" name="plugin" />';
     echo '</td><td>&nbsp;';
     echo '</td><td>';
     echo ' <input type="submit" value="Install Plugin" />';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     //$this->build_config
     if ($this->build_config && isset($this->build_config['plugins'])) {
         $ordered = array();
         $count = 0;
         foreach ($this->build_config['plugins'] as $plugin => $status) {
             if (!$status) {
                 continue;
             }
             $char = strtoupper($plugin[0]);
             $ordered[$char][] = '<a href="http://ckeditor.com/addon/' . $plugin . '" target="_blank">' . ucfirst($plugin) . '</a>';
             $count++;
         }
         //echo '<h3>'.$langmessage['Installed'].'</h3>';
         echo '<p><br/></p>';
         echo '<table class="bordered">';
         echo '<tr><th colspan="2">' . $langmessage['Installed'] . ' (' . $count . ')</th></tr>';
         foreach ($ordered as $char => $plugins) {
             echo '<tr><td>';
             echo '<b>' . $char . '</b>';
             echo '</td><td>';
             echo implode(', ', $plugins);
             echo '</td></tr>';
         }
         echo '</table>';
     }
 }
Esempio n. 22
0
 public function Exported()
 {
     global $langmessage;
     if (count($this->exported) == 0) {
         return;
     }
     echo '<table class="bordered full_width">';
     echo '<tr><th>';
     echo $langmessage['Previous Exports'];
     echo '</th><th> &nbsp; </th><th>';
     echo $langmessage['File Size'];
     echo '</th><th>';
     echo $langmessage['options'];
     echo '</th></tr>';
     $total_size = 0;
     $total_count = 0;
     foreach ($this->exported as $file) {
         $info = $this->FileInfo($file);
         if (!$info) {
             continue;
         }
         $full_path = $this->export_dir . '/' . $file;
         echo '<tr><td>';
         echo str_replace(' ', '&nbsp;', $info['time']);
         echo '</td><td>';
         echo implode(', ', $info['exported']);
         echo '</td><td>';
         $size = filesize($full_path);
         echo \gp\admin\Tools::FormatBytes($size);
         echo ' ';
         echo $info['ext'];
         echo '</td><td>';
         echo '<a href="' . \gp\tool::GetDir('/data/_exports/' . $file) . '">' . $langmessage['Download'] . '</a>';
         echo '&nbsp;&nbsp;';
         if ($this->CanRevert($info['bits'])) {
             echo \gp\tool::Link('Admin/Port', $langmessage['Revert'], 'cmd=revert&archive=' . rawurlencode($file), '', $file);
         } else {
             echo $langmessage['Revert'];
         }
         echo '&nbsp;&nbsp;';
         echo \gp\tool::Link('Admin/Port', $langmessage['delete'], 'cmd=delete&file=' . rawurlencode($file), array('data-cmd' => 'postlink', 'title' => $langmessage['delete_confirm'], 'class' => 'gpconfirm'), $file);
         echo '</td></tr>';
         $total_count++;
         $total_size += $size;
     }
     //totals
     echo '<tr><th>';
     echo $langmessage['Total'];
     echo ': ';
     echo $total_count;
     echo '</th><th>&nbsp;</th><th>';
     echo \gp\admin\Tools::FormatBytes($total_size);
     echo '</th><th>&nbsp;</th></tr>';
     echo '</table>';
 }
Esempio n. 23
0
 /**
  * Plugin option links
  *
  */
 function OptionLinks($addon_key, $addon_config, $format = false)
 {
     global $langmessage, $gpLayouts;
     $list = array();
     if (!isset($addon_config['is_theme']) || !$addon_config['is_theme']) {
         //editable text
         if (isset($addon_config['editable_text']) && \gp\admin\Tools::HasPermission('Admin_Theme_Content')) {
             $list[] = \gp\tool::Link('Admin_Theme_Content/Text', $langmessage['editable_text'], 'cmd=AddonTextForm&addon=' . urlencode($addon_key), array('title' => urlencode($langmessage['editable_text']), 'data-cmd' => 'gpabox'));
         }
         //upgrade link
         if (isset($addon_config['upgrade_from'])) {
             $list[] = '<a href="?cmd=LocalInstall&source=' . rawurlencode($addon_config['upgrade_from']) . '" data-cmd="cnreq">' . $langmessage['upgrade'] . '</a>';
         }
         //uninstall
         $list[] = \gp\tool::Link('Admin/Addons', $langmessage['uninstall'], 'cmd=uninstall&addon=' . rawurlencode($addon_key), 'data-cmd="gpabox"');
         //version
         if (!empty($addon_config['version'])) {
             $list[] = '<a>' . $langmessage['Your_version'] . ' ' . $addon_config['version'] . '</a>';
         }
         //rating
         if (isset($addon_config['id']) && is_numeric($addon_config['id'])) {
             $id = $addon_config['id'];
             $rating = 5;
             if (isset($this->addonReviews[$id])) {
                 $rating = $this->addonReviews[$id]['rating'];
             }
             $label = $langmessage['rate_this_addon'] . ' ' . $this->ShowRating($id, $rating);
             $list[] = '<span>' . $label . '</span>';
         }
         echo $this->FormatList($list, $langmessage['options'], $format);
         return;
     }
     //show list of themes using these addons
     foreach ($gpLayouts as $layout_id => $layout_info) {
         if (!isset($layout_info['addon_key']) || $layout_info['addon_key'] !== $addon_key) {
             continue;
         }
         $item = '<span><span class="layout_color_id" style="background:' . $layout_info['color'] . '"></span> ';
         $item .= \gp\tool::Link('Admin_Theme_Content', $layout_info['label']);
         $item .= ' ( ';
         $item .= \gp\tool::Link('Admin_Theme_Content/Edit/' . $layout_id, $langmessage['edit']);
         $item .= ' )</span>';
         $list[] = $item;
     }
     echo $this->FormatList($list, $langmessage['layouts'], $format);
 }
Esempio n. 24
0
 /**
  * Outputs the sitemap link, admin login/logout link, powered by link, admin html and messages
  * @static
  */
 public static function GetAdminLink()
 {
     global $config, $langmessage, $page;
     if (!isset($config['showsitemap']) || $config['showsitemap']) {
         echo ' <span class="sitemap_link">';
         echo \gp\tool::Link('Special_Site_Map', $langmessage['site_map']);
         echo '</span>';
     }
     if (!isset($config['showlogin']) || $config['showlogin']) {
         echo ' <span class="login_link">';
         if (\gp\tool::LoggedIn()) {
             echo \gp\tool::Link($page->title, $langmessage['logout'], 'cmd=logout', array('data-cmd' => 'creq', 'rel' => 'nofollow'));
         } else {
             echo \gp\tool::Link('Admin', $langmessage['login'], 'file=' . rawurlencode($page->title), ' rel="nofollow" data-cmd="login"');
         }
         echo '</span>';
     }
     if (!isset($config['showgplink']) || $config['showgplink']) {
         if (self::is_front_page()) {
             echo ' <span id="powered_by_link">';
             echo 'Powered by <a href="' . CMS_DOMAIN . '" target="_blank">' . CMS_NAME . '</a>';
             echo '</span>';
         }
     }
     \gp\tool\Plugins::Action('GetAdminLink');
     echo GetMessages();
 }
Esempio n. 25
0
 /**
  * View the contents of a trash file
  *
  */
 public function ViewTrashFile($trash_index)
 {
     global $dataDir, $langmessage, $trash_file;
     $title_info = self::GetInfo($trash_index);
     //delete / restore links
     echo '<div class="pull-right">';
     echo \gp\tool::Link('Admin/Trash', $langmessage['restore'], 'cmd=RestoreDeleted&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo ' &nbsp; ';
     echo \gp\tool::Link('Admin/Trash', $langmessage['delete'], 'cmd=DeleteFromTrash&titles[]=' . rawurlencode($trash_index), array('data-cmd' => 'cnreq', 'class' => 'gpsubmit'));
     echo '</div>';
     echo '<h2 class="hmargin">';
     echo \gp\tool::Link('Admin/Trash', $langmessage['trash']);
     echo ' &#187; ';
     echo htmlspecialchars($title_info['title']);
     echo '</h2>';
     echo '<hr>';
     //get file sections
     $file_sections = \gp\tool\Files::Get($title_info['page_file'], 'file_sections');
     if ($file_sections) {
         echo \gp\tool\Output\Sections::Render($file_sections, $title_info['title']);
     } else {
         echo '<p>This page no longer has any content</p>';
     }
 }
Esempio n. 26
0
 /**
  * Notify the admin if there have been any fatal errors
  *
  */
 public static function FatalNotices()
 {
     global $dataDir, $page;
     if (!\gp\admin\Tools::HasPermission('Admin_Errors')) {
         return;
     }
     if (is_object($page) && property_exists($page, 'requested') && strpos($page->requested, 'Admin/Errors') !== false) {
         return;
     }
     $dir = $dataDir . '/data/_site';
     $files = scandir($dir);
     $has_fatal = false;
     foreach ($files as $file) {
         if (strpos($file, 'fatal_') === false) {
             continue;
         }
         $has_fatal = true;
     }
     if (!$has_fatal) {
         return;
     }
     $msg = 'Warning: One or more components have caused fatal errors and have been disabled. ' . \gp\tool::Link('Admin/Errors', 'More Information', '', 'style="white-space:nowrap"') . ' &nbsp; ' . \gp\tool::Link($page->title, 'Clear All Errors', 'cmd=ClearErrors', '', 'ClearErrors');
     //cannot be creq
     msg($msg);
 }
Esempio n. 27
0
 public function GenerateOutput()
 {
     global $langmessage;
     \gp\tool::ShowingGallery();
     echo '<h2>';
     echo \gp\tool\Output::ReturnText('galleries');
     echo '</h2>';
     $wrap = \gp\admin\Tools::CanEdit($this->page->gp_index);
     if ($wrap) {
         echo \gp\tool\Output::EditAreaLink($edit_index, 'Admin/Galleries', $langmessage['edit']);
         echo '<div class="editable_area cf" id="ExtraEditArea' . $edit_index . '">';
         // class="edit_area" added by javascript
     }
     $image_text = \gp\tool\Output::ReturnText('image');
     $images_text = \gp\tool\Output::ReturnText('images');
     $list = '';
     $shown = 0;
     foreach ($this->galleries as $title => $info) {
         //page is hidden
         if (!$this->GalleryVisible($title, $info)) {
             continue;
         }
         $count = '';
         if (is_array($info)) {
             $icon = $info['icon'];
             if ($info['count'] == 1) {
                 $count = $info['count'] . ' ' . \gp\tool\Output::ReturnText('image');
             } elseif ($info['count'] > 1) {
                 $count = $info['count'] . ' ' . \gp\tool\Output::ReturnText('images');
             }
         } else {
             $icon = $info;
         }
         if (empty($icon)) {
             continue;
         }
         $icon = rawurldecode($icon);
         //prevent double encoding
         if (strpos($icon, '/thumbnails/') === false) {
             $thumbPath = \gp\tool::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg');
         } else {
             $thumbPath = \gp\tool::GetDir('/data/_uploaded' . $icon);
         }
         $label = \gp\tool::GetLabel($title);
         $title_attr = ' title="' . \gp\tool::GetBrowserTitle($title) . '"';
         $label_img = ' <img src="' . $thumbPath . '" alt=""/>';
         $list .= '<li>' . \gp\tool::Link($title, $label_img, '', $title_attr) . '<div>' . \gp\tool::Link($title, $label, '', $title_attr) . '<p>' . $count . '</p>' . '</div>' . '</li>';
     }
     if (!empty($list)) {
         echo '<ul class="gp_gallery gp_galleries">';
         echo $list;
         echo '</ul>';
     }
     if ($wrap) {
         echo '</div>';
     }
     $this->PostSave();
 }
Esempio n. 28
0
 /**
  * Preview
  *
  */
 public function PreviewText()
 {
     global $langmessage;
     echo '<h2>';
     echo \gp\tool::Link('Admin/Extra', $langmessage['theme_content']);
     echo ' &#187; ' . str_replace('_', ' ', $this->title) . '</h2>';
     echo '</h2>';
     echo '<hr/>';
     echo \gp\tool\Output\Sections::RenderSection($this->file_sections[0], 0, '', $this->file_stats);
     echo '<hr/>';
 }
Esempio n. 29
0
 public function Installed()
 {
     global $langmessage;
     echo '<h4>' . $langmessage['Installation_Was_Successfull'] . '</h4>';
     echo '<h2>';
     echo \gp\tool::Link('', $langmessage['View_your_web_site']);
     echo '</h2>';
     echo '</ul>';
     echo '<p>';
     echo 'For added security, you may delete the /include/install/install.php file from your server.';
     echo '</p>';
 }
Esempio n. 30
0
 /**
  * Display the error log
  *
  */
 function ErrorLog()
 {
     global $langmessage;
     $error_log = ini_get('error_log');
     echo '<h2 class="hmargin">';
     echo \gp\tool::Link('Admin/Errors', 'Fatal Errors');
     echo ' <span> | </span>';
     echo ' Error Log';
     echo '</h2>';
     if (!self::ReadableLog()) {
         echo '<p>Sorry, an error log could not be found or could not be read.</p>';
         echo '<p>Log File: ' . $error_log . '</p>';
         return;
     }
     echo '<p><b>Please Note:</b> The following errors are not limited to your installation of ' . CMS_NAME . '.';
     echo '</p>';
     $lines = file($error_log);
     $lines = array_reverse($lines);
     $time = null;
     $displayed = array();
     foreach ($lines as $line) {
         $line = trim($line);
         if (empty($line)) {
             continue;
         }
         preg_match('#^\\[[a-zA-Z0-9:\\- ]*\\]#', $line, $date);
         if (count($date)) {
             $date = $date[0];
             $line = substr($line, strlen($date));
             $date = trim($date, '[]');
             $new_time = strtotime($date);
             if ($new_time !== $time) {
                 if ($time) {
                     echo '</pre>';
                 }
                 echo '<p>';
                 $elapsed = \gp\admin\Tools::Elapsed(time() - $new_time);
                 echo sprintf($langmessage['_ago'], $elapsed);
                 echo ' (' . $date . ')';
                 echo '</p>';
                 echo '<pre>';
                 $time = $new_time;
                 $displayed = array();
             }
         }
         $line_hash = md5($line);
         if (in_array($line_hash, $displayed)) {
             continue;
         }
         echo $line;
         $displayed[] = $line_hash;
         echo "\n";
     }
     echo '</pre>';
 }