Beispiel #1
0
 /**
  * Handle HTTP responses made with $_REQUEST['req'] = json (when <a ... data-cmd="gpajax">)
  * Sends JSON object to client
  *
  */
 static function Response()
 {
     global $page;
     if (!is_array($page->ajaxReplace)) {
         die;
     }
     if (!isset($_REQUEST['jsoncallback'])) {
         die('Invalid Request: jsoncallback not set');
     }
     //gadgets may be using gpajax/json request/responses
     gpOutput::TemplateSettings();
     gpOutput::PrepGadgetContent();
     echo gpAjax::Callback($_REQUEST['jsoncallback']);
     echo '([';
     //output content
     if (!empty($_REQUEST['gpx_content'])) {
         switch ($_REQUEST['gpx_content']) {
             case 'gpabox':
                 gpAjax::JsonDo('admin_box_data', '', $page->contentBuffer);
                 break;
         }
     } elseif (in_array('#gpx_content', $page->ajaxReplace)) {
         $replace_id = '#gpx_content';
         if (isset($_GET['gpreqarea'])) {
             $replace_id = '#' . $_GET['gpreqarea'];
         }
         ob_start();
         $page->GetGpxContent(true);
         $content = ob_get_clean();
         gpAjax::JsonDo('replace', $replace_id, $content);
     }
     //other areas
     foreach ($page->ajaxReplace as $arguments) {
         if (is_array($arguments)) {
             $arguments += array(0 => '', 1 => '', 2 => '');
             gpAjax::JsonDo($arguments[0], $arguments[1], $arguments[2]);
         }
     }
     //always send messages
     ob_start();
     echo GetMessages(false);
     $content = ob_get_clean();
     if (!empty($content)) {
         gpAjax::JsonDo('messages', '', $content);
     }
     echo ']);';
     die;
 }
 /**
  * Edit layout properties
  * 		Layout Identification
  * 		Content Arrangement
  * 		Gadget Visibility
  *
  */
 function EditLayout($layout, $cmd)
 {
     global $page, $gpLayouts, $langmessage, $config;
     $GLOBALS['GP_ARRANGE_CONTENT'] = true;
     $page->head_js[] = '/include/js/inline_edit/inline_editing.js';
     $this->curr_layout = $layout;
     $this->SetLayoutArray();
     $page->SetTheme($layout);
     $this->LoremIpsum();
     gpOutput::TemplateSettings();
     gpPlugin::Action('edit_layout_cmd', array($layout));
     switch ($cmd) {
         /**
          * Inline image editing
          *
          */
         case 'inlineedit':
             $this->InlineEdit();
             return;
         case 'gallery_folder':
         case 'gallery_images':
             $this->GalleryImages();
             return;
         case 'image_editor':
             includeFile('tool/editing.php');
             gp_edit::ImageEditor($this->curr_layout);
             return;
         case 'save_inline':
             $this->SaveHeaderImage();
             return;
         case 'theme_images':
             $this->ShowThemeImages();
             return;
         case 'drag_area':
             $this->Drag();
             break;
             //insert
         //insert
         case 'insert':
             $this->SelectContent();
             return;
         case 'addcontent':
             $this->AddContent();
             break;
             //remove
         //remove
         case 'rm_area':
             $this->RemoveArea();
             break;
     }
     if ($this->LayoutCommands($cmd)) {
         return;
     }
     //control what is displayed
     switch ($cmd) {
         //show the layout (displayed within an iframe)
         case 'save_css':
         case 'preview_css':
         case 'addcontent':
         case 'rm_area':
         case 'drag_area':
         case 'in_iframe':
             $this->ShowInIframe($cmd);
             return;
     }
     $layout_info = common::LayoutInfo($layout, false);
     $handlers_count = 0;
     if (isset($layout_info['handlers']) && is_array($layout_info['handlers'])) {
         foreach ($layout_info['handlers'] as $val) {
             $int = count($val);
             if ($int === 0) {
                 $handlers_count++;
             }
             $handlers_count += $int;
         }
     }
     $page->label = $langmessage['layouts'] . ' » ' . $layout_info['label'];
     $_REQUEST += array('gpreq' => 'body');
     //force showing only the body as a complete html document
     $page->get_theme_css = false;
     ob_start();
     $this->LayoutEditor($layout, $layout_info);
     $page->admin_html = ob_get_clean();
 }
Beispiel #3
0
 /**
  * Send all content according to the current layout
  * @static
  *
  */
 static function Template()
 {
     global $page, $GP_ARRANGE, $GP_STYLES, $get_all_gadgets_called, $addon_current_id, $GP_MENU_LINKS, $GP_MENU_CLASS, $GP_MENU_CLASSES, $GP_MENU_ELEMENTS;
     $get_all_gadgets_called = false;
     if (isset($page->theme_addon_id)) {
         $addon_current_id = $page->theme_addon_id;
     }
     gpOutput::TemplateSettings();
     self::StandardHeaders();
     $path = $page->theme_dir . '/template.php';
     $return = IncludeScript($path, 'require', array('page', 'GP_ARRANGE', 'GP_MENU_LINKS', 'GP_MENU_CLASS', 'GP_MENU_CLASSES', 'GP_MENU_ELEMENTS'));
     //return will be false if there's a fatal error with the template.php file
     if ($return === false) {
         gpOutput::BodyAsHtml();
     }
     gpPlugin::ClearDataFolder();
     gpOutput::HeadContent();
 }
 /**
  * Edit layout properties
  * 		Layout Identification
  * 		Content Arrangement
  * 		Gadget Visibility
  *
  */
 function EditLayout($layout, $cmd)
 {
     global $page, $gpLayouts, $langmessage, $config;
     if (!isset($gpLayouts[$layout])) {
         message($langmessage['OOPS'] . ' (Invalid Layout)');
         return false;
     }
     $GLOBALS['GP_ARRANGE_CONTENT'] = true;
     $page->head .= "\n" . '<script type="text/javascript">var gpLayouts=true;</script>';
     $page->head_js[] = '/include/js/inline_edit/inline_editing.js';
     $page->show_admin_content = false;
     $this->curr_layout = $layout;
     $page->SetTheme($layout);
     $this->LoremIpsum();
     gpOutput::TemplateSettings();
     gpPlugin::Action('edit_layout_cmd', array($layout));
     switch ($cmd) {
         case 'save_css':
             $this->SaveCSS();
             break;
         case 'css':
             $this->EditCSS();
             break;
         case 'makedefault':
             $this->MakeDefault($layout);
             break;
         case 'change_layout_color':
             $this->ChangeLayoutColor($layout);
             break;
         case 'css_preferences':
             $this->CSSPreferences($layout);
             break;
         case 'rmgadget':
             $this->RmGadget($layout);
             break;
         case 'layout_details':
             $this->LayoutDetails();
             break;
         case 'restore_drag':
         case 'restore':
             $this->Restore($layout);
             break;
         case 'drag':
             $this->Drag();
             break;
             //insert
         //insert
         case 'insert':
             $this->SelectContent();
             return true;
         case 'addcontent':
             $this->AddContent();
             break;
             //remove
         //remove
         case 'rm':
             $this->RemoveArea();
             break;
     }
     $layout_info = common::LayoutInfo($layout);
     $handlers_count = 0;
     if (isset($layout_info['handlers']) && is_array($layout_info['handlers'])) {
         foreach ($layout_info['handlers'] as $val) {
             $int = count($val);
             if ($int === 0) {
                 $handlers_count++;
             }
             $handlers_count += $int;
         }
     }
     $page->label = $langmessage['layouts'] . ' » ' . $layout_info['label'];
     //display options
     switch ($cmd) {
         case 'makedefault':
         case 'details':
             $this->ShowDetails($layout, $layout_info, $handlers_count);
             return true;
     }
     $this->PrepareCSS();
     $this->Toolbar($layout, $layout_info);
     return true;
 }
Beispiel #5
0
 /**
  * Send all content according to the current layout
  * @static
  */
 function Template()
 {
     global $page, $GP_ARRANGE, $GP_STYLES, $get_all_gadgets_called, $addon_current_id;
     $get_all_gadgets_called = false;
     if (isset($page->theme_addon_id)) {
         $addon_current_id = $page->theme_addon_id;
     }
     gpOutput::TemplateSettings();
     header('Content-Type: text/html; charset=utf-8');
     require $page->theme_dir . '/template.php';
     gpPlugin::ClearDataFolder();
     gpOutput::AllGadgetSetting();
     gpOutput::HeadContent();
 }