Ejemplo n.º 1
0
 function GenerateOutput()
 {
     global $langmessage, $page;
     common::ShowingGallery();
     echo '<h2>';
     echo gpOutput::ReturnText('galleries');
     echo '</h2>';
     includeFile('admin/admin_tools.php');
     $wrap = admin_tools::CanEdit($page->gp_index);
     if ($wrap) {
         echo gpOutput::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 = gpOutput::ReturnText('image');
     $images_text = gpOutput::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'] . ' ' . gpOutput::ReturnText('image');
             } elseif ($info['count'] > 1) {
                 $count = $info['count'] . ' ' . gpOutput::ReturnText('images');
             }
         } else {
             $icon = $info;
         }
         if (empty($icon)) {
             continue;
         }
         $icon = rawurldecode($icon);
         //prevent double encoding
         if (strpos($icon, '/thumbnails/') === false) {
             $thumbPath = common::GetDir('/data/_uploaded/image/thumbnails' . $icon . '.jpg');
         } else {
             $thumbPath = common::GetDir('/data/_uploaded' . $icon);
         }
         $label = common::GetLabel($title);
         $title_attr = ' title="' . common::GetBrowserTitle($title) . '"';
         $label_img = ' <img src="' . $thumbPath . '" alt=""/>';
         $list .= '<li>' . common::Link($title, $label_img, '', $title_attr) . '<div>' . common::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();
 }
Ejemplo n.º 2
0
 static function ReturnTextWorker($key, $html, $query, $wrapper_class = '')
 {
     global $langmessage;
     $text = gpOutput::SelectText($key);
     $result = str_replace('%s', $text, $html);
     //in case there's more than one %s
     $editable = gpOutput::ShowEditLink('Admin_Theme_Content');
     if ($editable) {
         $title = htmlspecialchars(strip_tags($key));
         if (strlen($title) > 20) {
             $title = substr($title, 0, 20) . '...';
             //javscript may shorten it as well
         }
         gpOutput::$editlinks .= gpOutput::EditAreaLink($edit_index, 'Admin_Theme_Content', $langmessage['edit'], $query, ' title="' . $title . '" data-cmd="gpabox" ');
         return '<span class="editable_area ' . $wrapper_class . '" id="ExtraEditArea' . $edit_index . '">' . $result . '</span>';
     }
     if ($wrapper_class) {
         return '<span class="' . $wrapper_class . '">' . $result . '</span>';
     }
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Get the edit links for the post
  *
  * @param string $class
  * @param string $id
  */
 public static function EditLinks($post_index, &$class, &$id)
 {
     global $langmessage;
     $query = 'du';
     //dummy parameter
     SimpleBlogCommon::UrlQuery($post_index, $url, $query);
     $edit_link = gpOutput::EditAreaLink($edit_index, $url, $langmessage['edit'] . ' (TWYSIWYG)', $query, 'name="inline_edit_generic" rel="text_inline_edit"');
     $class = ' editable_area';
     $id = 'id="ExtraEditArea' . $edit_index . '"';
     echo '<span style="display:none;" id="ExtraEditLnks' . $edit_index . '">';
     echo $edit_link;
     echo common::Link('Admin_Blog/' . $post_index, $langmessage['edit'] . ' (All)', 'cmd=edit_post', ' style="display:none"');
     echo common::Link('Special_Blog', $langmessage['delete'], 'cmd=deleteentry&del_id=' . $post_index, array('class' => 'delete gpconfirm', 'data-cmd' => 'cnreq', 'title' => $langmessage['delete_confirm']));
     if (SimpleBlogCommon::$data['allow_comments']) {
         $comments_closed = SimpleBlogCommon::AStrGet('comments_closed', $post_index);
         if ($comments_closed) {
             $label = gpOutput::SelectText('Open Comments');
             echo SimpleBlogCommon::PostLink($post_index, $label, 'cmd=opencomments', 'name="cnreq" style="display:none"');
         } else {
             $label = gpOutput::SelectText('Close Comments');
             echo SimpleBlogCommon::PostLink($post_index, $label, 'cmd=closecomments', 'name="cnreq" style="display:none"');
         }
     }
     echo common::Link('Admin_Blog', 'New Blog Post', 'cmd=new_form', ' style="display:none"');
     echo common::Link('Admin_Blog', $langmessage['administration'], '', ' style="display:none"');
     echo '</span>';
 }
Ejemplo n.º 4
0
 function ReturnTextWorker($key, $html, $query)
 {
     global $langmessage;
     $result = '';
     $wrap = gpOutput::ShowEditLink('Admin_Theme_Content');
     if ($wrap) {
         $title = htmlspecialchars(strip_tags($key));
         if (strlen($title) > 20) {
             $title = substr($title, 0, 20) . '...';
             //javscript may shorten it as well
         }
         echo gpOutput::EditAreaLink($edit_index, 'Admin_Theme_Content', $langmessage['edit'], $query, ' title="' . $title . '" name="gpabox" ');
         $result .= '<span class="editable_area" id="ExtraEditArea' . $edit_index . '">';
         // class="edit_area" added by javascript
     }
     $text = gpOutput::SelectText($key);
     $result .= str_replace('%s', $text, $html);
     //in case there's more than one %s
     if ($wrap) {
         $result .= '</span>';
     }
     return $result;
 }
Ejemplo n.º 5
0
 function GetSection(&$section_num)
 {
     global $langmessage, $GP_NESTED_EDIT;
     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];
     $section_data += array('attributes' => array(), 'type' => 'text');
     $section_data['attributes'] += array('class' => '');
     $orig_attrs = json_encode($section_data['attributes']);
     $section_data['attributes']['data-gp-section'] = $curr_section_num;
     $section_types = section_content::GetTypes();
     if (gpOutput::ShowEditLink() && 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 = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num . '&amp;revision=' . $this->fileModTime, $attrs);
         //section control links
         if ($section_data['type'] != 'wrapper_section') {
             ob_start();
             echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             echo $link;
             echo common::Link($this->title, $langmessage['Manage Sections'] . '...', 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '</span>';
             gpOutput::$editlinks .= ob_get_clean();
         }
         $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index;
         $section_data['attributes']['class'] .= ' editable_area';
         // class="edit_area" added by javascript
         //$section_data['attributes']['data-gp-editarea']	= $edit_index;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= "\n" . '<div' . section_content::SectionAttributes($section_data['attributes'], $section_data['type']) . ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'>';
     } else {
         $content .= "\n" . '<' . $section_data['nodeName'] . section_content::SectionAttributes($section_data['attributes'], $section_data['type']) . ' data-gp-attrs=\'' . htmlspecialchars($orig_attrs, ENT_QUOTES & ~ENT_COMPAT) . '\'>';
     }
     if ($section_data['type'] == 'wrapper_section') {
         for ($cc = 0; $cc < $section_data['contains_sections']; $cc++) {
             $content .= $this->GetSection($section_num);
         }
     } else {
         $GP_NESTED_EDIT = true;
         $content .= section_content::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats);
         $GP_NESTED_EDIT = false;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
     } else {
         $content .= '</' . $section_data['nodeName'] . '>';
     }
     return $content;
 }
Ejemplo n.º 6
0
 /**
  * Display the html for a single blog post
  *
  */
 function ShowPostContent(&$post, &$post_index, $limit = 0)
 {
     global $langmessage;
     if (!common::LoggedIn() && SimpleBlogCommon::AStrValue('drafts', $post_index)) {
         return false;
         //How to make 404 page?
     }
     //If user enter random Blog url, he didn't see any 404, but nothng.
     $id = $class = '';
     if (common::LoggedIn()) {
         $query = 'du';
         //dummy parameter
         SimpleBlogCommon::UrlQuery($post_index, $url, $query);
         $edit_link = gpOutput::EditAreaLink($edit_index, $url, $langmessage['edit'] . ' (TWYSIWYG)', $query, 'name="inline_edit_generic" rel="text_inline_edit"');
         echo '<span style="display:none;" id="ExtraEditLnks' . $edit_index . '">';
         echo $edit_link;
         echo SimpleBlogCommon::PostLink($post_index, $langmessage['edit'] . ' (All)', 'cmd=edit_post', ' style="display:none"');
         echo common::Link('Special_Blog', $langmessage['delete'], 'cmd=deleteentry&del_id=' . $post_index, array('class' => 'delete gpconfirm', 'data-cmd' => 'cnreq', 'title' => $langmessage['delete_confirm']));
         if (SimpleBlogCommon::$data['allow_comments']) {
             $comments_closed = SimpleBlogCommon::AStrValue('comments_closed', $post_index);
             if ($comments_closed) {
                 $label = gpOutput::SelectText('Open Comments');
                 echo SimpleBlogCommon::PostLink($post_index, $label, 'cmd=opencomments', 'name="creq" style="display:none"');
             } else {
                 $label = gpOutput::SelectText('Close Comments');
                 echo SimpleBlogCommon::PostLink($post_index, $label, 'cmd=closecomments', 'name="creq" style="display:none"');
             }
         }
         echo common::Link('Special_Blog', 'New Blog Post', 'cmd=new_form', ' style="display:none"');
         echo common::Link('Admin_Blog', $langmessage['configuration'], '', ' style="display:none"');
         echo '</span>';
         $class .= ' editable_area';
         $id = 'id="ExtraEditArea' . $edit_index . '"';
     }
     $isDraft = '';
     if (SimpleBlogCommon::AStrValue('drafts', $post_index)) {
         $isDraft = '<span style="opacity:0.3;">';
         $isDraft .= gpOutput::SelectText('Draft');
         $isDraft .= '</span> ';
     }
     echo '<div class="blog_post' . $class . '" ' . $id . '>';
     $header = '<h2 id="blog_post_' . $post_index . '">';
     $header .= $isDraft;
     $label = SimpleBlogCommon::Underscores($post['title']);
     $header .= SimpleBlogCommon::PostLink($post_index, $label);
     $header .= '</h2>';
     $this->BlogHead($header, $post_index, $post);
     echo '<div class="twysiwygr">';
     echo $this->AbbrevContent($post['content'], $post_index, $limit);
     echo '</div>';
     echo '</div>';
     echo '<br/>';
     echo '<div class="clear"></div>';
 }
Ejemplo n.º 7
0
 function GenerateContent_Admin()
 {
     global $langmessage, $GP_NESTED_EDIT;
     //add to all pages in case a user adds a gallery
     gpPlugin::Action('GenerateContent_Admin');
     common::ShowingGallery();
     $content = '';
     $section_num = 0;
     foreach ($this->file_sections as $section_key => $section_data) {
         $content .= "\n";
         $type = isset($section_data['type']) ? $section_data['type'] : 'text';
         if (gpOutput::ShowEditLink() && admin_tools::CanEdit($this->gp_index)) {
             $link_name = 'inline_edit_generic';
             $link_rel = $type . '_inline_edit';
             $title_attr = sprintf($langmessage['Section %s'], $section_key + 1);
             $link = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $section_key, ' title="' . $title_attr . '" name="' . $link_name . '" rel="' . $link_rel . '"');
             //section control links
             $content .= '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             $content .= $link;
             if ($section_num > 0) {
                 $content .= common::Link($this->title, $langmessage['move_up'], 'cmd=move_up&section=' . $section_key, ' name="creq"', 'move_up' . $section_key);
             }
             $content .= common::Link($this->title, $langmessage['New Section'], 'cmd=new_section&section=' . $section_key, ' name="gpabox"');
             $q = 'cmd=add_section&copy=copy&section=' . $section_key . '&last_mod=' . rawurlencode($this->fileModTime);
             $content .= common::Link($this->title, $langmessage['Copy'], $q, ' name="creq"');
             //remove section link
             if (count($this->file_sections) > 1) {
                 $title_attr = $langmessage['rm_section_confirm'];
                 if ($type != 'include') {
                     $title_attr .= "\n\n" . $langmessage['rm_section_confirm_deleting'];
                 }
                 $content .= common::Link($this->title, $langmessage['Remove Section'], 'cmd=rm_section&section=' . $section_key . '&total=' . count($this->file_sections), ' title="' . $title_attr . '" name="creq" class="gpconfirm"');
             }
             $content .= '</span>';
             $content .= '<div class="editable_area GPAREA filetype-' . $type . '" id="ExtraEditArea' . $edit_index . '">';
             // class="edit_area" added by javascript
         } else {
             $content .= '<div class="GPAREA filetype-' . $type . '">';
         }
         $GP_NESTED_EDIT = true;
         $content .= $this->SectionToContent($section_data, $section_num);
         $GP_NESTED_EDIT = false;
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
         $section_num++;
     }
     return $content;
 }
Ejemplo n.º 8
0
 function ShowForm()
 {
     global $page, $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="' . common::GetUrl($page->title) . '" method="post">';
     //nonce fields
     echo '<div style="display:none !important">';
     echo '<input type="hidden" name="contact_nonce" value="' . htmlspecialchars(common::new_nonce('contact_post', true)) . '" />';
     echo '<input type="text" name="contact_void" value="" />';
     echo '</div>';
     echo '<label for="contact_name"><span class="title">';
     echo gpOutput::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 gpOutput::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 gpOutput::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 gpOutput::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>';
     gpPlugin::Action('contact_form_pre_captcha');
     if (!$this->sent && gp_recaptcha::isActive()) {
         echo '<div class="captchaForm">';
         echo gpOutput::ReturnText('captcha');
         gp_recaptcha::Form();
         echo '</div>';
     }
     if ($this->sent) {
         echo gpOutput::ReturnText('message_sent', '%s', 'message_sent');
     } else {
         echo '<input type="hidden" name="cmd" value="gp_send_message" />';
         $key = 'send_message';
         $text = gpOutput::SelectText($key);
         if (gpOutput::ShowEditLink('Admin_Theme_Content')) {
             $query = 'cmd=edittext&key=' . urlencode($key);
             echo gpOutput::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>';
 }
Ejemplo n.º 9
0
 function Get404()
 {
     global $langmessage, $page;
     gpOutput::AddHeader('Not Found', true, 404);
     $page->head .= '<meta name="robots" content="noindex,nofollow" />';
     //this isn't getting to the template because $page isn't available yet
     //message for admins
     if (common::LoggedIn()) {
         if ($this->requested && !common::SpecialOrAdmin($this->requested)) {
             $with_spaces = htmlspecialchars($this->requested);
             $link = common::GetUrl('Admin_Menu', 'cmd=add_hidden&redir=redir&title=' . rawurlencode($this->requested)) . '" title="' . $langmessage['create_new_file'] . '" data-cmd="gpabox';
             $message = sprintf($langmessage['DOESNT_EXIST'], $with_spaces, $link);
             msg($message);
         }
     }
     //Contents of 404 page
     $wrap = gpOutput::ShowEditLink('Admin_Missing');
     if ($wrap) {
         echo gpOutput::EditAreaLink($edit_index, 'Admin_Missing', $langmessage['edit'], 'cmd=edit404', ' title="' . $langmessage['404_Page'] . '" ');
         echo '<div class="editable_area" id="ExtraEditArea' . $edit_index . '">';
         // class="edit_area" added by javascript
     }
     echo special_missing::Get404Output();
     if ($wrap) {
         echo '</div>';
     }
 }
Ejemplo n.º 10
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 = section_content::GetTypes();
     if (gpOutput::ShowEditLink() && 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 = gpOutput::EditAreaLink($edit_index, $this->title, $langmessage['edit'], 'section=' . $curr_section_num . '&amp;revision=' . $this->fileModTime, $attrs);
         //section control links
         if ($section_data['type'] != 'wrapper_section') {
             ob_start();
             echo '<span class="nodisplay" id="ExtraEditLnks' . $edit_index . '">';
             echo $link;
             echo common::Link($this->title, $langmessage['Manage Sections'], 'cmd=ManageSections', array('class' => 'manage_sections', 'data-cmd' => 'inline_edit_generic', 'data-arg' => 'manage_sections'));
             echo '<hr/>';
             echo common::Link($this->title, $langmessage['rename/details'], 'cmd=renameform', 'data-cmd="gpajax"');
             echo common::Link($this->title, $langmessage['Revision History'], 'cmd=ViewHistory', array('data-cmd' => 'gpabox'));
             echo '</span>';
             gpOutput::$editlinks .= ob_get_clean();
         }
         $section_data['attributes']['id'] = 'ExtraEditArea' . $edit_index;
         $section_data['attributes']['class'] .= ' editable_area';
         // class="edit_area" added by javascript
     }
     $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 {
         gpOutput::$nested_edit = true;
         $content .= section_content::RenderSection($section_data, $curr_section_num, $this->title, $this->file_stats);
         gpOutput::$nested_edit = false;
     }
     if (!isset($section_data['nodeName'])) {
         $content .= '<div class="gpclear"></div>';
         $content .= '</div>';
     } else {
         $content .= section_content::EndTag($section_data['nodeName']);
     }
     return $content;
 }