Esempio n. 1
0
 public function RunScript()
 {
     global $gp_index, $langmessage;
     $scriptinfo = self::GetScriptInfo($this->title);
     if ($scriptinfo === false) {
         switch ($this->title) {
             case 'Special_ExtraJS':
                 $this->ExtraJS();
                 //dies
         }
         $this->Error_404($this->title);
         return;
     }
     $this->gp_index = $gp_index[$this->title];
     $this->TitleInfo = $scriptinfo;
     if (!$this->CheckVisibility()) {
         return false;
     }
     //allow addons to affect page actions and how a page is displayed
     $cmd = \gp\tool::GetCommand();
     $cmd_after = \gp\tool\Plugins::Filter('PageRunScript', array($cmd));
     if ($cmd !== $cmd_after) {
         $cmd = $cmd_after;
         if ($cmd === 'return') {
             return;
         }
     }
     if (\gp\tool::LoggedIn() && \gp\admin\Tools::HasPermission('Admin_Menu')) {
         $this->cmds['RenameForm'] = '\\gp\\Page\\Rename::RenameForm';
         $this->cmds['RenameFile'] = '\\gp\\Page\\Rename::RenamePage';
         $this->cmds['ToggleVisibility'] = array('\\gp\\Page\\Visibility::TogglePage', 'DefaultDisplay');
         $this->cmds['ManageSections'] = '\\gp\\Page\\Edit::ManageSections';
     }
     $this->RunCommands($cmd);
 }
Esempio n. 2
0
 public function __construct($text)
 {
     parent::__construct($text);
     $this->dom_array = \gp\tool\Plugins::Filter('Html_Output', array($this->dom_array));
     $this->Clean();
     $this->Rebuild();
 }
Esempio n. 3
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>';
 }
Esempio n. 4
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);
 }
Esempio n. 5
0
 /**
  * Verify the user submitted form by checking anti-spam hooks and/or recaptcha if they exist
  * @static
  *
  */
 public static function Check()
 {
     global $page, $langmessage, $config, $dataDir;
     // if hooks return false, stop
     if (!\gp\tool\Plugins::Filter('AntiSpam_Check', array(true))) {
         return false;
     }
     // if recaptcha inactive, stop
     if (!self::hasRecaptcha()) {
         return true;
     }
     if (empty($_POST['g-recaptcha-response'])) {
         return false;
     }
     require_once $dataDir . '/include/thirdparty/recaptcha/autoload.php';
     if (!ini_get('allow_url_fopen')) {
         // allow_url_fopen = Off
         $recaptcha = new \ReCaptcha\ReCaptcha($config['recaptcha_private'], new \ReCaptcha\RequestMethod\SocketPost());
     } else {
         // allow_url_fopen = On
         $recaptcha = new \ReCaptcha\ReCaptcha($config['recaptcha_private']);
     }
     if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
         $ip = $_SERVER['HTTP_CLIENT_IP'];
     } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
         $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
     } else {
         $ip = $_SERVER['REMOTE_ADDR'];
     }
     $resp = $recaptcha->verify($_POST['g-recaptcha-response'], $ip);
     if (!$resp->isSuccess()) {
         //$error_codes = $resp->getErrorCodes();
         //error_log();
         msg($langmessage['INCORRECT_CAPTCHA']);
         return false;
     }
     return true;
 }
Esempio n. 6
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();
 }
Esempio n. 7
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;
 }
Esempio n. 8
0
 public function GetAddonTexts($addon)
 {
     global $langmessage, $config;
     $addon_config = \gp\tool\Plugins::GetAddonConfig($addon);
     $addonDir = $addon_config['code_folder_full'];
     if (!is_dir($addonDir)) {
         return false;
     }
     //not set up correctly
     if (!isset($config['addons'][$addon]['editable_text'])) {
         return false;
     }
     $file = $addonDir . '/' . $config['addons'][$addon]['editable_text'];
     if (!file_exists($file)) {
         return false;
     }
     $texts = array();
     include $file;
     if (empty($texts)) {
         return false;
     }
     return $texts;
 }
Esempio n. 9
0
 /**
  * Return a list of section types
  *
  */
 public static function NewSections($checkboxes = false)
 {
     $types_with_imgs = array('text', 'image', 'gallery');
     $section_types = \gp\tool\Output\Sections::GetTypes();
     $links = array();
     foreach ($section_types as $type => $type_info) {
         $img = '';
         if (in_array($type, $types_with_imgs)) {
             $img = \gp\tool::GetDir('/include/imgs/section-' . $type . '.png');
         }
         $links[] = array($type, $img);
     }
     $links[] = array(array('text.gpCol-6', 'image.gpCol-6'), \gp\tool::GetDir('/include/imgs/section-combo-text-image.png'));
     $links[] = array(array('text.gpCol-6', 'gallery.gpCol-6'), \gp\tool::GetDir('/include/imgs/section-combo-text-gallery.png'));
     //section combo: text & gallery
     $links = \gp\tool\Plugins::Filter('NewSections', array($links));
     foreach ($links as $link) {
         $link += array('', '', 'gpRow');
         echo self::NewSectionLink($link[0], $link[1], $link[2], $checkboxes);
     }
 }
Esempio n. 10
0
 /**
  * Remove an addon from the site configuration
  * Delete code folders if needed
  *
  */
 public function Uninstall($addon)
 {
     global $config, $langmessage, $gp_titles, $gp_menu, $gp_index;
     $this->GetAddonData();
     $addon_config = \gp\tool\Plugins::GetAddonConfig($addon);
     if (!$addon_config) {
         $this->message($langmessage['OOPS'] . ' (Already uninstalled)');
         return;
     }
     unset($config['addons'][$addon]);
     //remove links
     $installedGadgets = $this->GetInstalledComponents($config['gadgets'], $addon);
     $this->RemoveFromHandlers($installedGadgets);
     //remove from gp_index, gp_menu
     $installedLinks = $this->GetInstalledComponents($gp_titles, $addon);
     foreach ($installedLinks as $index) {
         if (isset($gp_menu[$index])) {
             unset($gp_menu[$index]);
         }
         $title = \gp\tool::IndexToTitle($index);
         if ($title) {
             unset($gp_index[$title]);
         }
     }
     $this->RemoveFromConfig($config['gadgets'], $addon);
     $this->RemoveFromConfig($config['admin_links'], $addon);
     $this->RemoveFromConfig($gp_titles, $addon);
     $this->CleanHooks($addon);
     if (!\gp\admin\Tools::SaveAllConfig()) {
         $this->message($langmessage['OOPS']);
         return false;
     }
     $this->RemoveFolders($addon_config);
     //Record the history
     $this->addonHistory[] = $this->UninstallHistory($addon_config);
     $this->SaveAddonData();
     if ($addon_config['order']) {
         $img_path = \gp\tool::IdUrl('ci');
         \gp\tool::IdReq($img_path);
     }
     $this->message($langmessage['SAVED']);
     return true;
 }
Esempio n. 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']);
         }
     }
 }
Esempio n. 12
0
 /**
  * Clean a slug posted by the user
  * @param string $slug The slug provided by the user
  * @return string
  * @since 2.4b5
  */
 public static function PostedSlug($string, $from_label = false)
 {
     global $config;
     $orig_string = $string;
     // Remove control characters
     $string = preg_replace('#[[:cntrl:]]#u', '', $string);
     // 	[\x00-\x1F\x7F]
     //illegal characters
     $string = str_replace(array('?', '*', ':', '|'), array('', '', '', ''), $string);
     //change known entities to their character equivalent
     $string = \gp\tool\Strings::entity_unescape($string);
     //if it's from a label, remove any html
     if ($from_label) {
         $string = self::LabelHtml($string);
         $string = strip_tags($string);
         //after removing tags, unescape special characters
         $string = str_replace(array('&lt;', '&gt;', '&quot;', '&#39;', '&amp;'), array('<', '>', '"', "'", '&'), $string);
     }
     // # character after unescape for entities and unescape of special chacters when $from_label is true
     $string = str_replace('#', '', $string);
     //slashes
     $string = self::SlugSlashes($string);
     $string = str_replace(' ', $config['space_char'], $string);
     return \gp\tool\Plugins::Filter('PostedSlug', array($string, $orig_string, $from_label));
 }
Esempio n. 13
0
 /**
  * Return formatted content for the $section_data
  * @return string
  *
  */
 static function SectionToContent($section_data, $section_num)
 {
     $section_data = \gp\tool\Plugins::Filter('SectionToContent', array($section_data, $section_num));
     switch ($section_data['type']) {
         case 'text':
             return self::TextContent($section_data['content']);
         case 'include':
             return self::IncludeContent($section_data);
         case 'gallery':
             \gp\tool::ShowingGallery();
             return $section_data['content'];
     }
     return $section_data['content'];
 }
Esempio n. 14
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;
 }
Esempio n. 15
0
 function PluginPanelGroup($addon_key, $info)
 {
     global $langmessage, $gpLayouts;
     $addon_config = \gp\tool\Plugins::GetAddonConfig($addon_key);
     $addon_config += $info;
     //merge the upgrade info
     echo '<div class="panelgroup" id="panelgroup_' . md5($addon_key) . '">';
     echo '<h3>';
     echo \gp\tool::Link('Admin/Addons/' . \gp\admin\Tools::encode64($addon_key), $addon_config['name']);
     echo '</h3>';
     echo '<div class="panelgroup2">';
     echo '<ul class="submenu">';
     $this->AddonPanelGroup($addon_key);
     $this->OptionLinks($addon_key, $addon_config);
     echo '</ul>';
     $this->UpgradeLinks($addon_config);
     echo '</div>';
     echo '</div>';
 }
Esempio n. 16
0
 /**
  * Make sure the file is a css or js file and that it exists
  * @static
  */
 public static function CheckFile(&$file)
 {
     global $dataDir;
     $comment_start = '<!--';
     $comment_end = '-->';
     $file = self::TrimQuery($file);
     if (empty($file)) {
         return false;
     }
     //translate addon paths
     $pos = strpos($file, '/data/_addoncode/');
     if ($pos !== false) {
         $file_parts = substr($file, $pos + 17);
         $file_parts = explode('/', $file_parts);
         $addon_key = array_shift($file_parts);
         $addon_config = \gp\tool\Plugins::GetAddonConfig($addon_key);
         if ($addon_config) {
             $file = $addon_config['code_folder_rel'] . '/' . implode('/', $file_parts);
         }
     }
     //remove null charachters
     $file = \gp\tool\Files::NoNull($file);
     //require .js or .css
     $ext = \gp\tool::Ext($file);
     if ($ext !== 'js' && $ext !== 'css' && $ext !== 'less' && $ext !== 'scss') {
         echo "\n{$comment_start} File Not CSS, LESS or JS {$file} {$comment_end}\n";
         return false;
     }
     //paths that have been urlencoded
     if (strpos($file, '%') !== false) {
         $decoded_file = rawurldecode($file);
         if ($full_path = self::CheckFileSub($decoded_file)) {
             $file = $decoded_file;
             return $full_path;
         }
     }
     //paths that have not been encoded
     if ($full_path = self::CheckFileSub($file)) {
         return $full_path;
     }
     echo "\n{$comment_start} File Not Found {$dataDir}{$file} {$comment_end}\n";
     return false;
 }
Esempio n. 17
0
 /**
  * Output addon information about a layout
  *
  */
 public function LayoutDivAddon($layout_info)
 {
     global $langmessage;
     // layouts with hooks
     ob_start();
     $addon_config = false;
     if (isset($layout_info['addon_key'])) {
         $addon_key = $layout_info['addon_key'];
         $addon_config = \gp\tool\Plugins::GetAddonConfig($addon_key);
         echo '<li>';
         echo \gp\tool::link('Admin/Addons/' . \gp\admin\Tools::encode64($addon_key), '<i class="fa fa-plug"></i> ' . $addon_config['name']);
         echo '</li>';
         //hooks
         $this->AddonPanelGroup($addon_key, false);
     }
     //version
     if (!empty($layout_info['version'])) {
         echo '<li><a>' . $langmessage['Your_version'] . ' ' . $layout_info['version'] . '</a></li>';
     } elseif ($addon_config && !empty($addon_config['version'])) {
         echo '<li><a>' . $langmessage['Your_version'] . ' ' . $addon_config['version'] . '</a></li>';
     }
     //upgrade
     if ($addon_config !== false) {
         echo '<li>';
         if ($layout_info['is_addon']) {
             $source = $layout_info['name'] . '(remote)/' . $layout_info['theme_color'];
         } else {
             $source = $layout_info['theme_name'] . '(local)/' . $layout_info['theme_color'];
         }
         echo \gp\tool::Link('Admin_Theme_Content', $langmessage['upgrade'], 'cmd=UpgradeTheme&source=' . rawurlencode($source), array('data-cmd' => 'creq'));
         echo '</li>';
     }
     $options = ob_get_clean();
     if (!empty($options)) {
         echo '<li class="expand_child_click">';
         echo '<a>' . $langmessage['options'] . '</a>';
         echo '<ul>';
         echo $options;
         echo '</ul></li>';
     }
 }
Esempio n. 18
0
 public function RunQuery()
 {
     if (!empty($_REQUEST['q'])) {
         $this->SearchPattern();
         $this->SearchPages();
         \gp\tool\Plugins::Action('Search', array($this));
     }
     $this->ShowResults();
 }
Esempio n. 19
0
 /**
  * Clean a string of html that may be used as file content
  *
  * @param string $text The string to be cleansed. Passed by reference
  */
 public static function CleanText(&$text)
 {
     \gp\tool\Editing::tidyFix($text);
     self::rmPHP($text);
     self::FixTags($text);
     $text = \gp\tool\Plugins::Filter('CleanText', array($text));
 }
Esempio n. 20
0
    return $args;
}
function rename_check($event, $args, $finder)
{
    $name = $args['name'];
    if (gp_restrict_uploads && !\gp\admin\Content\Uploaded::AllowedExtension($name)) {
        return false;
    }
    $args['name'] = $name;
    return $args;
}
function SaveFinderData($data)
{
    global $config;
    $config['finder_data'] = $data;
    \gp\admin\Tools::SaveConfig();
}
function ReturnFinderData()
{
    global $config;
    if (isset($config['finder_data'])) {
        return $config['finder_data'];
    }
    return false;
}
$opts = array('debug' => gpdebug, 'saveData' => 'SaveFinderData', 'returnData' => 'ReturnFinderData', 'roots' => array(array('driver' => 'LocalFileSystem', 'path' => $dataDir . '/data/_uploaded/', 'URL' => \gp\tool::GetDir('data/_uploaded'), 'accessControl' => 'access', 'tmbPath' => $dataDir . '/data/_elthumbs', 'tmbURL' => \gp\tool::GetDir('data/_elthumbs'), 'separator' => '/', 'tmbBgColor' => 'transparent', 'copyOverwrite' => false, 'uploadOverwrite' => false, 'tmbPathMode' => gp_chmod_dir, 'dirMode' => gp_chmod_dir, 'fileMode' => gp_chmod_file)), 'bind' => array('duplicate upload rename rm paste resize' => array('\\gp\\admin\\Content\\Uploaded', 'FinderChange'), 'upload-before' => 'upload_check', 'rename-before' => 'rename_check'));
$opts = \gp\tool\Plugins::Filter('FinderOptionsServer', array($opts));
gpSettingsOverride('finder_options_server', $opts);
// run Finder
$connector = new Finder($opts);
$connector->run();
Esempio n. 21
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>';
 }
Esempio n. 22
0
 /**
  * Return the data for the requested menu, return the main menu if the requested menu doesn't exist
  * @param string $id String identifying the requested menu
  * @return array menu data
  */
 public function GetMenuArray($id)
 {
     global $dataDir, $gp_menu;
     $menu_file = $dataDir . '/data/_menus/' . $id . '.php';
     if (empty($id) || !\gp\tool\Files::Exists($menu_file)) {
         return \gp\tool\Plugins::Filter('GetMenuArray', array($gp_menu));
     }
     $menu = \gp\tool\Files::Get('_menus/' . $id, 'menu');
     if (\gp\tool\Files::$last_version && version_compare(\gp\tool\Files::$last_version, '3.0b1', '<')) {
         $menu = $this->FixMenu($menu);
     }
     return \gp\tool\Plugins::Filter('GetMenuArray', array($menu));
 }
Esempio n. 23
0
 /**
  * Return an array
  *
  */
 public static function SectionFromPost(&$existing_section, $section_num, $title, $file_stats)
 {
     global $page, $gpAdmin;
     $section_before = $existing_section;
     $type = $existing_section['type'];
     $save_this = false;
     switch ($type) {
         case 'text':
             $save_this = true;
             self::SectionFromPost_Text($existing_section);
             break;
         case 'gallery':
             $save_this = true;
             self::SectionFromPost_Gallery($existing_section);
             break;
         case 'include':
             $save_this = self::SectionFromPost_Include($existing_section, $section_num, $title, $file_stats);
             break;
         case 'image':
             $save_this = self::SectionFromPost_Image($existing_section);
             break;
     }
     //make sure $existing_section is still an array
     $type_check = gettype($existing_section);
     if ($type_check !== 'array') {
         trigger_error('$existing_section is ' . $type_check . '. Array expected');
         return false;
     }
     // Hack: SaveSection used $page->file_sections
     $page->file_sections[$section_num] = $existing_section;
     $save_this = \gp\tool\Plugins::Filter('SaveSection', array($save_this, $section_num, $type));
     $existing_section = $page->file_sections[$section_num];
     if (!$save_this) {
         $page->file_sections[$section_num] = $existing_section = $section_before;
     }
     $page->file_sections[$section_num]['modified'] = time();
     $page->file_sections[$section_num]['modified_by'] = $gpAdmin['username'];
     return $save_this;
 }
Esempio n. 24
0
 function GetContent()
 {
     $this->GetGpxContent();
     echo '<div id="gpAfterContent">';
     \gp\tool\Output::Get('AfterContent');
     \gp\tool\Plugins::Action('GetContent_After');
     echo '</div>';
 }
Esempio n. 25
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;
 }
Esempio n. 26
0
 /**
  * Return true if an administrator is logged in
  * @return bool
  */
 public static function LoggedIn()
 {
     global $gpAdmin;
     $loggedin = false;
     if (isset($gpAdmin) && is_array($gpAdmin)) {
         $loggedin = true;
     }
     return \gp\tool\Plugins::Filter('LoggedIn', array($loggedin));
 }
Esempio n. 27
0
 static function InlineEdit($section_data)
 {
     $section_data += array('type' => '', 'content' => '');
     $scripts = array();
     $scripts[] = array('object' => 'gp_editing', 'file' => '/include/js/inline_edit/inline_editing.js');
     $type = 'text';
     if (!empty($section_data['type'])) {
         $type = $section_data['type'];
     }
     switch ($type) {
         case 'gallery':
             $scripts = self::InlineEdit_Gallery($scripts);
             break;
         case 'include':
             $scripts = self::InlineEdit_Include($scripts);
             break;
         case 'text':
             $scripts = self::InlineEdit_Text($scripts);
             break;
         case 'image':
             echo 'var gp_blank_img = ' . self::quote(\gp\tool::GetDir('/include/imgs/blank.gif')) . ';';
             $scripts[] = '/include/js/jquery.auto_upload.js';
             $scripts[] = '/include/js/inline_edit/image_common.js';
             $scripts[] = '/include/js/inline_edit/image_edit.js';
             break;
     }
     $scripts = \gp\tool\Plugins::Filter('InlineEdit_Scripts', array($scripts, $type));
     self::SendScripts($scripts);
     //replace resized images with their originals
     if (isset($section_data['resized_imgs']) && is_array($section_data['resized_imgs']) && count($section_data['resized_imgs'])) {
         $section_data['content'] = \gp\tool\Editing::RestoreImages($section_data['content'], $section_data['resized_imgs']);
     }
     //create the section object that will be passed to gp_init_inline_edit
     $section_object = \gp\tool::JsonEncode($section_data);
     //send call to gp_init_inline_edit()
     echo ';if( typeof(gp_init_inline_edit) == "function" ){';
     echo 'gp_init_inline_edit(';
     echo self::quote($_GET['area_id']);
     echo ',' . $section_object;
     echo ');';
     echo '}else{alert("gp_init_inline_edit() is not defined");}';
 }