Beispiel #1
0
 public function Finder()
 {
     global $config, $dataDir;
     $this->page->head .= "\n" . '<link rel="stylesheet" type="text/css" media="screen" href="' . \gp\tool::GetDir('/include/thirdparty/finder/css/finder.css') . '">';
     $this->page->head .= "\n" . '<link rel="stylesheet" type="text/css" media="screen" href="' . \gp\tool::GetDir('/include/thirdparty/finder/style.css') . '">';
     $this->page->head .= "\n" . '<script type="text/javascript" src="' . \gp\tool::GetDir('/include/thirdparty/finder/js/finder.js') . '"></script>';
     $this->page->head .= "\n" . '<script type="text/javascript" src="' . \gp\tool::GetDir('/include/thirdparty/finder/config.js') . '"></script>';
     echo '<div id="finder"></div>';
     \gp\tool::LoadComponents('selectable,draggable,droppable,resizable,dialog,slider,button');
     //get the finder language
     $language = $config['langeditor'];
     if ($language == 'inherit') {
         $language = $config['language'];
     }
     $lang_file = '/include/thirdparty/finder/js/i18n/' . $language . '.js';
     $lang_full = $dataDir . $lang_file;
     if (file_exists($lang_full)) {
         $this->page->head .= "\n" . '<script type="text/javascript" src="' . \gp\tool::GetDir($lang_file) . '"></script>';
     } else {
         $language = 'en';
     }
     $this->finder_opts['lang'] = $language;
     $this->finder_opts['customData']['verified'] = \gp\tool::new_nonce('post', true);
     $this->finder_opts['uiOptions'] = array('toolbar' => array(array('back', 'forward', 'up', 'reload'), array('home', 'netmount'), array('mkdir', 'upload'), array('open', 'download', 'getfile'), array('info'), array('quicklook'), array('copy', 'cut', 'paste'), array('rm'), array('duplicate', 'rename', 'edit', 'resize'), array('extract', 'archive'), array('search'), array('view', 'sort'), array('help')), 'tree' => array('openRootOnLoad' => true, 'syncTree' => true), 'navbar' => array('minWidth' => 150, 'maxWidth' => 500), 'cwd' => array('oldSchool' => false));
     $this->FinderPrep();
     $this->finder_opts = \gp\tool\Plugins::Filter('FinderOptionsClient', array($this->finder_opts));
     gpSettingsOverride('finder_options_client', $this->finder_opts);
     $this->page->head_script .= "\n" . 'var finder_opts = ' . json_encode($this->finder_opts) . ';';
 }
Beispiel #2
0
 public function __construct($title)
 {
     \gp\tool::LoadComponents('gp-admin-css');
     $this->requested = str_replace(' ', '_', $title);
     $this->title = $title;
     $this->get_theme_css = false;
     $_REQUEST['gpreq'] = 'admin';
     $this->head .= "\n" . '<meta name="robots" content="noindex,nofollow" />';
     @header('X-Frame-Options: SAMEORIGIN');
 }
Beispiel #3
0
 public function __construct($args)
 {
     global $gpLayouts, $config;
     parent::__construct($args);
     $this->gpLayouts_before = $gpLayouts;
     $this->config_before = $config;
     $this->page->head_js[] = '/include/js/theme_content.js';
     $this->page->head_js[] = '/include/js/dragdrop.js';
     $this->page->css_admin[] = '/include/css/theme_content.scss';
     \gp\tool::LoadComponents('resizable');
     $this->GetPossible();
 }
Beispiel #4
0
<?php

namespace gp\admin;

defined('is_running') or die('Not an entry point...');
defined('gp_max_menu_level') or define('gp_max_menu_level', 6);
\gp\tool::LoadComponents('sortable');
class Menu extends \gp\special\Base
{
    public $cookie_settings = array();
    public $hidden_levels = array();
    public $search_page = 0;
    public $search_max_per_page = 20;
    public $query_string;
    public $avail_menus = array();
    public $curr_menu_id;
    public $curr_menu_array;
    protected $is_alt_menu = false;
    public $is_main_menu = false;
    public $max_level_index = 3;
    protected $settings_cache = array();
    protected $inherit_info;
    public $main_menu_count;
    public $list_displays = array('search' => true, 'all' => true, 'hidden' => true, 'nomenus' => true);
    public $section_types;
    protected $cmd;
    public function __construct($args)
    {
        global $langmessage, $config;
        parent::__construct($args);
        $this->section_types = \gp\tool\Output\Sections::GetTypes();
Beispiel #5
0
 /**
  * Use ckeditor for to edit content
  *
  *	configuration options
  * 	- http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html
  */
 public static function UseCK($contents, $name = 'gpcontent', $options = array())
 {
     global $page, $dataDir;
     $options += array('rows' => '20', 'cols' => '50');
     echo "\n\n";
     echo '<textarea name="' . $name . '" style="width:90%" rows="' . $options['rows'] . '" cols="' . $options['cols'] . '" class="CKEDITAREA">';
     echo htmlspecialchars($contents);
     echo '</textarea><br/>';
     $page->head .= "\n" . '<script type="text/javascript" src="' . \gp\tool::GetDir('/include/thirdparty/ckeditor_34/ckeditor.js') . '?' . rawurlencode(gpversion) . '"></script>';
     $page->head .= "\n" . '<script type="text/javascript" src="' . \gp\tool::GetDir('/include/js/ckeditor_config.js') . '?' . rawurlencode(gpversion) . '"></script>';
     \gp\tool::LoadComponents('autocomplete');
     $page->head_script .= self::AutoCompleteValues(true);
     ob_start();
     echo "\n\n";
     // extra plugins
     $config = self::CKConfig($options, 'json', $plugins);
     foreach ($plugins as $plugin => $plugin_path) {
         echo 'CKEDITOR.plugins.addExternal(' . json_encode($plugin) . ',' . json_encode($plugin_path) . ');';
         echo "\n";
     }
     echo '$(".CKEDITAREA").each(function(){';
     echo 'CKEDITOR.replace( this, ' . $config . ' );';
     echo '});';
     echo "\n\n";
     $page->jQueryCode .= ob_get_clean();
 }
Beispiel #6
0
 /**
  * Determine if $session_id represents a valid session and if so start the session
  *
  */
 public static function start($session_id, $sessions = false)
 {
     global $langmessage, $dataDir, $wbMessageBuffer;
     static $locked_message = false;
     //get the session file
     if (!$sessions) {
         $sessions = self::GetSessionIds();
         if (!isset($sessions[$session_id])) {
             self::cookie(gp_session_cookie);
             //make sure the cookie is deleted
             msg($langmessage['Session Expired'] . ' (timeout)');
             return false;
         }
     }
     $sess_info = $sessions[$session_id];
     //check ~ip, ~user agent ...
     if (gp_browser_auth && !empty($sess_info['uid'])) {
         $auth_uid = self::auth_browseruid();
         $auth_uid_legacy = self::auth_browseruid(true);
         //legacy option added to prevent logging users out, added 2.0b2
         if ($sess_info['uid'] != $auth_uid && $sess_info['uid'] != $auth_uid_legacy) {
             self::cookie(gp_session_cookie);
             //make sure the cookie is deleted
             msg($langmessage['Session Expired'] . ' (browser auth)');
             return false;
         }
     }
     $session_file = $dataDir . '/data/_sessions/' . $sess_info['file_name'];
     if ($session_file === false || !\gp\tool\Files::Exists($session_file)) {
         self::cookie(gp_session_cookie);
         //make sure the cookie is deleted
         msg($langmessage['Session Expired'] . ' (invalid)');
         return false;
     }
     //prevent browser caching when editing
     Header('Last-Modified: ' . gmdate('D, j M Y H:i:s') . ' GMT');
     Header('Expires: ' . gmdate('D, j M Y H:i:s', time()) . ' GMT');
     Header('Cache-Control: no-store, no-cache, must-revalidate');
     // HTTP/1.1
     Header('Cache-Control: post-check=0, pre-check=0', false);
     Header('Pragma: no-cache');
     // HTTP/1.0
     $GLOBALS['gpAdmin'] = self::SessionData($session_file, $checksum);
     //lock to prevent conflicting edits
     if (gp_lock_time > 0 && (!empty($GLOBALS['gpAdmin']['editing']) || !empty($GLOBALS['gpAdmin']['granted']))) {
         $expires = gp_lock_time;
         if (!\gp\tool\Files::Lock('admin', sha1(sha1($session_id)), $expires)) {
             msg($langmessage['site_locked'] . ' ' . sprintf($langmessage['lock_expires_in'], ceil($expires / 60)));
             $locked_message = true;
             $GLOBALS['gpAdmin']['locked'] = true;
         } else {
             unset($GLOBALS['gpAdmin']['locked']);
         }
     }
     //extend cookie?
     if (isset($GLOBALS['gpAdmin']['remember'])) {
         $elapsed = time() - $GLOBALS['gpAdmin']['remember'];
         if ($elapsed > 604800) {
             //7 days
             $GLOBALS['gpAdmin']['remember'] = time();
             self::cookie(gp_session_cookie, $session_id);
         }
     }
     register_shutdown_function(array('\\gp\\tool\\Session', 'close'), $session_file, $checksum);
     self::SaveSetting();
     //make sure forms have admin nonce
     ob_start(array('\\gp\\tool\\Session', 'AdminBuffer'));
     \gp\tool\Output::$lang_values += array('cancel' => 'ca', 'update' => 'up', 'caption' => 'cp', 'Width' => 'Width', 'Height' => 'Height', 'save' => 'Save', 'Saved' => 'Saved', 'Saving' => 'Saving', 'Close' => 'Close', 'Page' => 'Page', 'theme_content' => 'Extra', 'Publish Draft' => 'Draft', 'Publish' => 'Publish');
     \gp\tool::LoadComponents('sortable,autocomplete,gp-admin,gp-admin-css');
     \gp\admin\Tools::VersionsAndCheckTime();
     \gp\tool\Output::$inline_vars += array('gpRem' => \gp\admin\Tools::CanRemoteInstall());
     //prepend messages from message buffer
     if (isset($GLOBALS['gpAdmin']['message_buffer']) && count($GLOBALS['gpAdmin']['message_buffer'])) {
         $wbMessageBuffer = array_merge($GLOBALS['gpAdmin']['message_buffer'], $wbMessageBuffer);
         unset($GLOBALS['gpAdmin']['message_buffer']);
     }
     //alias
     if (isset($_COOKIE['gp_alias'])) {
         $GLOBALS['gpAdmin']['useralias'] = $_COOKIE['gp_alias'];
     } else {
         $GLOBALS['gpAdmin']['useralias'] = $GLOBALS['gpAdmin']['username'];
     }
     return true;
 }
Beispiel #7
0
 public static function HeadContent()
 {
     global $config, $page, $wbMessageBuffer;
     //before ob_start() so plugins can get buffer content
     \gp\tool\Plugins::Action('HeadContent');
     ob_start();
     if (\gp\tool::LoggedIn()) {
         \gp\tool::AddColorBox();
     }
     //always include javascript when there are messages
     if ($page->admin_js || !empty($page->jQueryCode) || !empty($wbMessageBuffer) || isset($_COOKIE['cookie_cmd'])) {
         \gp\tool::LoadComponents('gp-main');
     }
     //defaults
     \gp\tool::LoadComponents('jquery,gp-additional,fontawesome');
     //get css and js info
     $scripts = \gp\tool\Output\Combine::ScriptInfo(self::$components);
     self::GetHead_TKD();
     self::GetHead_CSS($scripts['css']);
     //css before js so it's available to scripts
     self::$head_content = ob_get_clean();
     //javascript
     ob_start();
     self::GetHead_Lang();
     self::GetHead_JS($scripts['js']);
     self::GetHead_InlineJS();
     self::$head_js = ob_get_clean();
     //gadget info
     if (isset($config['addons'])) {
         foreach ($config['addons'] as $addon_info) {
             if (!empty($addon_info['html_head'])) {
                 self::MoveScript($addon_info['html_head']);
             }
         }
     }
     if (!empty($page->head)) {
         self::MoveScript($page->head);
     }
 }