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 . '&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; }
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; }
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; }
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§ion=' . $section_key, ' name="creq"', 'move_up' . $section_key); } $content .= common::Link($this->title, $langmessage['New Section'], 'cmd=new_section§ion=' . $section_key, ' name="gpabox"'); $q = 'cmd=add_section©=copy§ion=' . $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§ion=' . $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; }
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>'; }
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>'; } }
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 . '&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; }