Пример #1
0
 function InlineEdit()
 {
     $title = gp_edit::CleanTitle($_REQUEST['file']);
     if (empty($title)) {
         echo 'false';
         return false;
     }
     $data = array();
     $data['type'] = 'text';
     $data['content'] = '';
     $file = $this->folder . '/' . $title . '.php';
     $content = '';
     if (file_exists($file)) {
         ob_start();
         include $file;
         $data['content'] = ob_get_clean();
     }
     includeFile('tool/ajax.php');
     gpAjax::InlineEdit($data);
 }
Пример #2
0
 /**
  * Load the inline editor for a theme image
  *
  */
 function InlineEdit()
 {
     $section = array();
     $section['type'] = 'image';
     includeFile('tool/ajax.php');
     gpAjax::InlineEdit($section);
     die;
 }
Пример #3
0
 static function RunOut()
 {
     global $page;
     $page->RunScript();
     //decide how to send the content
     self::Prep();
     switch (common::RequestType()) {
         // <a data-cmd="admin_box">
         case 'flush':
             self::Flush();
             break;
             // remote request
             // file browser
         // remote request
         // file browser
         case 'body':
             common::CheckTheme();
             self::BodyAsHTML();
             break;
         case 'admin':
             self::AdminHtml();
             break;
             // <a data-cmd="gpajax">
             // <a data-cmd="gpabox">
             // <input data-cmd="gpabox">
         // <a data-cmd="gpajax">
         // <a data-cmd="gpabox">
         // <input data-cmd="gpabox">
         case 'json':
             common::CheckTheme();
             includeFile('tool/ajax.php');
             gpAjax::Response();
             break;
         case 'content':
             self::Content();
             break;
         default:
             common::CheckTheme();
             self::Template();
             break;
     }
     //if logged in, prepare the admin content and don't send 304 response
     if (common::LoggedIn()) {
         admin_tools::AdminHtml();
         //empty edit links if there isn't a layout
         if (!$page->gpLayout) {
             self::$editlinks = '';
         }
         return;
     }
     /* attempt to send 304 response  */
     if ($page->fileModTime > 0) {
         global $wbMessageBuffer, $gp_head_content;
         $len = strlen($gp_head_content) + ob_get_length();
         if (count($wbMessageBuffer)) {
             $len += strlen(serialize($wbMessageBuffer));
         }
         common::Send304(common::GenEtag($page->fileModTime, $len));
     }
 }
Пример #4
0
 /**
  * Edit a post with inline editing
  *
  */
 function InlineEdit()
 {
     $post_index = (int) $_REQUEST['id'];
     $content = $this->GetPostContent($post_index);
     if (!$content) {
         echo 'false';
         return false;
     }
     $content += array('type' => 'text');
     includeFile('tool/ajax.php');
     gpAjax::InlineEdit($content);
 }
Пример #5
0
 /**
  * Save UI values for the current user
  *
  */
 function SaveGPUI()
 {
     global $gpAdmin;
     gpsession::SetGPUI();
     includeFile('tool/ajax.php');
     //send response so an error is not thrown
     echo gpAjax::Callback($_REQUEST['jsoncallback']) . '([]);';
     die;
     //for debugging
     die('debug: ' . showArray($_POST) . 'result: ' . showArray($gpAdmin));
 }
Пример #6
0
 static function InlineEdit_Text($scripts)
 {
     includeFile('tool/editing.php');
     // autocomplete
     echo gp_edit::AutoCompleteValues(true);
     // ckeditor basepath and configuration
     $options = array('extraPlugins' => 'sharedspace', 'sharedSpaces' => array('top' => 'ckeditor_top', 'bottom' => ' ckeditor_bottom'));
     $ckeditor_basepath = common::GetDir('/include/thirdparty/ckeditor_34/');
     echo 'CKEDITOR_BASEPATH = ' . gpAjax::quote($ckeditor_basepath) . ';';
     echo 'var gp_ckconfig = ' . gp_edit::CKConfig($options, 'json', $plugins) . ';';
     // extra plugins
     echo 'var gp_add_plugins = ' . json_encode($plugins) . ';';
     // scripts
     $scripts[] = '/include/thirdparty/ckeditor_34/ckeditor.js';
     $scripts[] = '/include/js/ckeditor_config.js';
     $scripts[] = '/include/js/inline_edit/inlineck.js';
     return $scripts;
 }
Пример #7
0
 /**
  * Perform various section editing commands
  *
  * @return bool true if $section should be saved
  *
  */
 static function SectionEdit($cmd, &$section, $section_num, $title, $file_stats)
 {
     global $langmessage;
     switch ($cmd) {
         case 'preview':
             self::PreviewSection($section, $section_num, $title, $file_stats);
             return false;
         case 'include_dialog':
             self::IncludeDialog($section);
             return false;
         case 'inlineedit':
             includeFile('tool/ajax.php');
             gpAjax::InlineEdit($section);
             die;
         case 'save':
             return gp_edit::SectionFromPost($section, $section_num, $title, $file_stats);
     }
     message($langmessage['OOPS'] . '(Uknown Command)');
     return false;
 }
Пример #8
0
 /**
  * Send js to client for managing content sections
  *
  */
 function ManageSections()
 {
     global $langmessage, $page;
     includeFile('tool/ajax.php');
     //output links
     ob_start();
     echo '<div id="new_section_links" style="display:none" class="inline_edit_area" title="Add">';
     self::NewSections();
     echo '</div>';
     echo 'var section_types = ' . json_encode(ob_get_clean()) . ';';
     $scripts = array();
     $scripts[] = '/include/thirdparty/js/nestedSortable.js';
     $scripts[] = '/include/js/inline_edit/inline_editing.js';
     $scripts[] = '/include/js/inline_edit/manage_sections.js';
     gpAjax::SendScripts($scripts);
     die;
 }
Пример #9
0
 function InlineEdit()
 {
     $section = $_REQUEST['section'];
     if (!is_numeric($section) || !isset($this->file_sections[$section])) {
         echo 'false';
         return false;
     }
     includeFile('tool/ajax.php');
     gpAjax::InlineEdit($this->file_sections[$section]);
 }
Пример #10
0
 function RunOut()
 {
     global $page, $gp_head_content;
     $page->RunScript();
     //decide how to send the content
     gpOutput::Prep();
     $req = '';
     if (isset($_REQUEST['gpreq'])) {
         $req = $_REQUEST['gpreq'];
     }
     switch ($req) {
         // <a name="admin_box">
         case 'flush':
             gpOutput::Flush();
             break;
             // remote request
             // file browser
         // remote request
         // file browser
         case 'body':
             common::CheckTheme();
             gpOutput::BodyAsHTML();
             break;
             // <a name="gpajax">
         // <a name="gpajax">
         case 'json':
             common::CheckTheme();
             includeFile('tool/ajax.php');
             gpAjax::Response();
             break;
         case 'content':
             gpOutput::Content();
             break;
         default:
             common::CheckTheme();
             gpOutput::Template();
             break;
     }
     //if logged in, prepare the admin content and don't send 304 response
     if (common::LoggedIn()) {
         admin_tools::AdminHtml();
         return;
     }
     /* attempt to send 304 response  */
     if ($page->fileModTime > 0) {
         $len = strlen($gp_head_content) + ob_get_length();
         common::Send304(common::GenEtag($page->fileModTime, $len));
     }
 }
Пример #11
0
 /**
  * Edit a post with inline editing
  *
  */
 function InlineEdit()
 {
     $content = $this->GetPostContent($this->post_id);
     if (!$content) {
         echo 'false';
         return false;
     }
     $content += array('type' => 'text');
     includeFile('tool/ajax.php');
     gpAjax::InlineEdit($content);
 }
Пример #12
0
 /**
  * Edit a post with inline editing
  *
  */
 function InlineEdit()
 {
     if (!$this->post) {
         echo 'false';
         return false;
     }
     $this->post += array('type' => 'text');
     includeFile('tool/ajax.php');
     gpAjax::InlineEdit($this->post);
 }
Пример #13
0
 /**
  * Send js to client for managing content sections
  *
  */
 function ManageSections()
 {
     global $langmessage;
     includeFile('tool/ajax.php');
     //section types
     $section_types = section_content::GetTypes();
     ob_start();
     echo '<form action="?">';
     echo '<table id="new_section_table"><tr><td>';
     echo '<select name="content_type" class="ckeditor_control">';
     foreach ($section_types as $type => $type_info) {
         echo '<option value="' . htmlspecialchars($type) . '">';
         echo htmlspecialchars($type_info['label']);
         echo '</option>';
     }
     echo '</select>';
     echo '</td><td>';
     echo '<button name="cmd" value="NewSectionContent" class="ckeditor_control" id="add_section" data-cmd="gppost">' . $langmessage['New Section'] . '</button>';
     echo '</table>';
     echo '</form>';
     echo 'var section_types = ' . json_encode(ob_get_clean()) . ';';
     $scripts = array();
     $scripts[] = '/include/thirdparty/js/nestedSortable.js';
     $scripts[] = '/include/js/inline_edit/inline_editing.js';
     $scripts[] = '/include/js/inline_edit/manage_sections.js';
     gpAjax::SendScripts($scripts);
     die;
 }
Пример #14
0
 function InlineEdit_Text($scripts)
 {
     includeFile('tool/editing.php');
     //autocomplete
     echo gp_edit::AutoCompleteValues(true);
     //ckeditor basepath and configuration
     $ckeditor_basepath = common::GetDir('/include/thirdparty/ckeditor_34/');
     echo 'CKEDITOR_BASEPATH = ' . gpAjax::quote($ckeditor_basepath) . ';';
     echo 'var gp_ckconfig = {};';
     //gp_ckconfig options
     $options = array();
     echo gp_edit::CKConfig($options, 'gp_ckconfig');
     $scripts[] = '/include/thirdparty/ckeditor_34/ckeditor.js';
     $scripts[] = '/include/js/inline_edit/inlineck.js';
     return $scripts;
 }