Example #1
0
 public function GetContent()
 {
     $this->GetGpxContent();
     if (!empty($this->non_admin_content)) {
         echo '<div class="filetype-text cf">';
         //echo '<div id="gpx_content" class="filetype-text">'; //id="gpx_content" conflicts with admin content
         echo $this->non_admin_content;
         echo '</div>';
     }
     echo '<div id="gpAfterContent">';
     \gp\tool\Output::Get('AfterContent');
     \gp\tool\Plugins::Action('GetContent_After');
     echo '</div>';
 }
Example #2
0
 /**
  * Edit layout properties
  * 		Layout Identification
  * 		Content Arrangement
  * 		Gadget Visibility
  *
  */
 public function EditLayout()
 {
     $GLOBALS['GP_ARRANGE_CONTENT'] = true;
     $this->layout_slug = 'Admin_Theme_Content/Edit/' . rawurlencode($this->curr_layout);
     $this->cmds['ShowThemeImages'] = '';
     $this->cmds['SelectContent'] = '';
     $this->cmds['LayoutMenu'] = '';
     $this->cmds['LayoutMenuSave'] = 'ReturnHeader';
     //show the layout (displayed within an iframe)
     $this->cmds['SaveCSS'] = 'ShowInIframe';
     $this->cmds['PreviewCSS'] = 'ShowInIframe';
     $this->cmds['addcontent'] = 'ShowInIframe';
     $this->cmds['RemoveArea'] = 'ShowInIframe';
     $this->cmds['DragArea'] = 'ShowInIframe';
     $this->cmds['in_iframe'] = 'ShowInIframe';
     \gp\tool\Plugins::Action('edit_layout_cmd', array($this->curr_layout));
     $cmd = \gp\tool::GetCommand();
     $this->LayoutCommands($cmd);
     $this->RunCommands($cmd);
 }
Example #3
0
 function GetContent()
 {
     $this->GetGpxContent();
     echo '<div id="gpAfterContent">';
     \gp\tool\Output::Get('AfterContent');
     \gp\tool\Plugins::Action('GetContent_After');
     echo '</div>';
 }
Example #4
0
 /**
  * Move To Trash
  * Hide special pages
  *
  */
 public function MoveToTrash()
 {
     global $gp_titles, $gp_index, $langmessage, $gp_menu, $config, $dataDir;
     $this->CacheSettings();
     $_POST += array('index' => '');
     $indexes = explode(',', $_POST['index']);
     $trash_data = array();
     foreach ($indexes as $index) {
         $title = \gp\tool::IndexToTitle($index);
         // Create file in trash
         if ($title) {
             if (!\gp\admin\Content\Trash::MoveToTrash_File($title, $index, $trash_data)) {
                 msg($langmessage['OOPS'] . ' (Not Moved)');
                 $this->RestoreSettings();
                 return false;
             }
         }
         // Remove from menu
         if (isset($gp_menu[$index])) {
             if (count($gp_menu) == 1) {
                 continue;
             }
             if (!$this->RmFromMenu($index, false)) {
                 msg($langmessage['OOPS']);
                 $this->RestoreSettings();
                 return false;
             }
         }
         unset($gp_titles[$index]);
         unset($gp_index[$title]);
     }
     \gp\admin\Menu\Tools::ResetHomepage();
     if (!\gp\admin\Tools::SaveAllConfig()) {
         $this->RestoreSettings();
         return false;
     }
     $link = \gp\tool::GetUrl('Admin/Trash');
     msg(sprintf($langmessage['MOVED_TO_TRASH'], $link));
     \gp\tool\Plugins::Action('MenuPageTrashed', array($indexes));
     return true;
 }
Example #5
0
 private static function RenameFileWorker($title)
 {
     global $langmessage, $dataDir, $gp_index;
     //use new_label or new_title
     if (isset($_POST['new_title'])) {
         $new_title = \gp\admin\Tools::PostedSlug($_POST['new_title']);
     } else {
         $new_title = \gp\admin\Tools::LabelToSlug($_POST['new_label']);
     }
     //title unchanged
     if ($new_title == $title) {
         return $title;
     }
     $special_file = false;
     if (\gp\tool::SpecialOrAdmin($title) !== false) {
         $special_file = true;
     }
     if (!\gp\admin\Tools::CheckTitle($new_title, $message)) {
         msg($message);
         return false;
     }
     $old_gp_index = $gp_index;
     //re-index: make the new title point to the same data index
     $old_file = \gp\tool\Files::PageFile($title);
     $file_index = $gp_index[$title];
     unset($gp_index[$title]);
     $gp_index[$new_title] = $file_index;
     //rename the php file
     if (!$special_file) {
         $new_file = \gp\tool\Files::PageFile($new_title);
         //if the file being renamed doesn't use the index naming convention, then we'll still need to rename it
         if ($new_file != $old_file) {
             $new_dir = dirname($new_file);
             $old_dir = dirname($old_file);
             if (!\gp\tool\Files::Rename($old_dir, $new_dir)) {
                 msg($langmessage['OOPS'] . ' (N3)');
                 $gp_index = $old_gp_index;
                 return false;
             }
         }
         //gallery rename
         \gp\special\Galleries::RenamedGallery($title, $new_title);
     }
     //create a 301 redirect
     if (isset($_POST['add_redirect']) && $_POST['add_redirect'] == 'add') {
         \gp\admin\Settings\Missing::AddRedirect($title, $new_title);
     }
     \gp\tool\Plugins::Action('RenameFileDone', array($file_index, $title, $new_title));
     return $new_title;
 }
Example #6
0
 /**
  * Display after commands have been executed
  *
  */
 public function DefaultDisplay()
 {
     //add to all pages in case a user adds a gallery
     \gp\tool\Plugins::Action('GenerateContent_Admin');
     \gp\tool::ShowingGallery();
     $sections_count = count($this->file_sections);
     $this->file_sections = array_values($this->file_sections);
     $section_num = 0;
     while ($section_num < $sections_count) {
         echo $this->GetSection($section_num);
     }
 }
Example #7
0
 /**
  * Get the output formatting data for
  *
  */
 public function GetReplaceData($title, $layout_info, $menu_key, $menu_value = array())
 {
     global $langmessage, $gp_titles;
     $isSpecialLink = \gp\tool::SpecialOrAdmin($title);
     //get the data for this title
     $data = array('key' => $menu_key, 'url' => \gp\tool::GetUrl($title), 'title' => $title, 'special' => $isSpecialLink, 'has_layout' => !empty($gp_titles[$menu_key]['gpLayout']), 'layout_color' => $layout_info['color'], 'layout_label' => $layout_info['label'], 'types' => $gp_titles[$menu_key]['type'], 'opts' => '', 'size' => '', 'mtime' => '');
     if (isset($menu_value['level'])) {
         $data['level'] = $menu_value['level'];
     }
     if ($isSpecialLink === false) {
         $file = \gp\tool\Files::PageFile($title);
         $stats = @stat($file);
         if ($stats) {
             $data['size'] = \gp\admin\Tools::FormatBytes($stats['size']);
             $data['time'] = \gp\tool::date($langmessage['strftime_datetime'], $stats['mtime']);
         }
     }
     ob_start();
     \gp\tool\Plugins::Action('MenuPageOptions', array($title, $menu_key, $menu_value, $layout_info));
     $menu_options = ob_get_clean();
     if ($menu_options) {
         $data['opts'] = $menu_options;
     }
     return $data;
 }
Example #8
0
 public function ShowForm()
 {
     global $langmessage, $config;
     $attr = '';
     if ($this->sent) {
         $attr = ' readonly="readonly" ';
     }
     $_GET += array('name' => '', 'email' => '', 'subject' => '', 'message' => '');
     $_POST += array('name' => $_GET['name'], 'email' => $_GET['email'], 'subject' => $_GET['subject'], 'message' => $_GET['message']);
     $require_email =& $config['require_email'];
     echo '<form class="contactform" action="' . \gp\tool::GetUrl($this->page->title) . '" method="post">';
     //nonce fields
     echo '<div style="display:none !important">';
     echo '<input type="hidden" name="contact_nonce" value="' . htmlspecialchars(\gp\tool::new_nonce('contact_post', true)) . '" />';
     echo '<input type="text" name="contact_void" value="" />';
     echo '</div>';
     echo '<label for="contact_name"><span class="title">';
     echo \gp\tool\Output::ReturnText('your_name');
     echo '</span><input id="contact_name" class="input text" type="text" name="name" value="' . htmlspecialchars($_POST['name']) . '" ' . $attr . ' />';
     echo '</label>';
     echo '<label for="contact_email"><span class="title">';
     echo \gp\tool\Output::ReturnText('your_email');
     if (strpos($require_email, 'email') !== false) {
         echo '*';
     }
     echo '</span><input id="contact_email" class="input text" type="text" name="email" value="' . htmlspecialchars($_POST['email']) . '" ' . $attr . '/>';
     echo '</label>';
     echo '<label for="contact_subject"><span class="title">';
     echo \gp\tool\Output::ReturnText('subject');
     if (strpos($require_email, 'none') === false) {
         echo '*';
     }
     echo '</span><input id="contact_subject" class="input text" type="text" name="subject" value="' . htmlspecialchars($_POST['subject']) . '" ' . $attr . '/>';
     echo '</label>';
     echo '<label for="contact_message">';
     echo \gp\tool\Output::ReturnText('message');
     if (strpos($require_email, 'none') === false) {
         echo '*';
     }
     echo '</label>';
     echo '<textarea id="contact_message" name="message" ' . $attr . ' rows="10" cols="10">';
     echo htmlspecialchars($_POST['message']);
     echo '</textarea>';
     \gp\tool\Plugins::Action('contact_form_pre_captcha');
     if (!$this->sent && \gp\tool\Recaptcha::isActive()) {
         echo '<div class="captchaForm">';
         echo \gp\tool\Output::ReturnText('captcha');
         \gp\tool\Recaptcha::Form();
         echo '</div>';
     }
     if ($this->sent) {
         echo \gp\tool\Output::ReturnText('message_sent', '%s', 'message_sent');
     } else {
         echo '<input type="hidden" name="cmd" value="gp_send_message" />';
         $key = 'send_message';
         $text = \gp\tool\Output::SelectText($key);
         if (\gp\tool\Output::ShowEditLink('Admin_Theme_Content')) {
             $query = 'cmd=EditText&key=' . urlencode($key);
             echo \gp\tool\Output::EditAreaLink($edit_index, 'Admin_Theme_Content', $langmessage['edit'], $query, ' title="' . $key . '" data-cmd="gpabox" ');
             echo '<input type="submit" class="submit editable_area" id="ExtraEditArea' . $edit_index . '" name="aaa" value="' . $text . '" />';
         } else {
             echo '<input type="submit" class="submit" name="aaa" value="' . $text . '" />';
         }
     }
     echo '</form>';
 }
Example #9
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();
 }
Example #10
0
 public function RunQuery()
 {
     if (!empty($_REQUEST['q'])) {
         $this->SearchPattern();
         $this->SearchPages();
         \gp\tool\Plugins::Action('Search', array($this));
     }
     $this->ShowResults();
 }
Example #11
0
 /**
  * Call Actions on the finder result
  *
  */
 protected static function FinderActions($result, $key, $action)
 {
     if (isset($result[$key]) && count($result[$key]) > 0) {
         foreach ($result[$key] as $changed) {
             \gp\tool\Plugins::Action($action, $changed['realpath']);
             self::CreateThumbnail($changed['realpath']);
         }
     }
 }