示例#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) . ';';
 }
示例#2
0
 public function LoginForm()
 {
     global $langmessage;
     $_REQUEST += array('file' => '');
     echo '<div id="loginform">';
     echo '<div id="login_timeout" class="nodisplay">Log in Timeout: ' . \gp\tool::Link('Admin', 'Reload to continue...') . '</div>';
     echo '<form action="' . \gp\tool::GetUrl('Admin') . '" method="post" id="login_form">';
     echo '<input type="hidden" name="file" value="' . htmlspecialchars($_REQUEST['file']) . '">';
     //for redirection
     echo '<div>';
     echo '<input type="hidden" name="cmd" value="login" />';
     echo '<input type="hidden" name="login_nonce" value="' . htmlspecialchars(\gp\tool::new_nonce('login_nonce', true, 300)) . '" />';
     echo '</div>';
     echo '<p class="login_text">';
     echo '<input type="text" name="username" value="' . htmlspecialchars($_POST['username']) . '" placeholder="' . htmlspecialchars($langmessage['username']) . '" />';
     echo '<input type="hidden" name="user_sha" value="" />';
     echo '</p>';
     echo '<p class="login_text">';
     echo '<input type="password" class="password" name="password" value="" placeholder="' . htmlspecialchars($langmessage['password']) . '"/>';
     echo '<input type="hidden" name="pass_md5" value="" />';
     echo '<input type="hidden" name="pass_sha" value="" />';
     echo '<input type="hidden" name="pass_sha512" value="" />';
     echo '</p>';
     echo '<p>';
     echo '<input type="submit" class="login_submit" value="' . $langmessage['login'] . '" />';
     echo ' &nbsp; ';
     echo \gp\tool::Link('', $langmessage['cancel']);
     echo '</p>';
     echo '<p>';
     echo '<label>';
     echo '<input type="checkbox" name="remember" ' . $this->checked('remember') . '/> ';
     echo '<span>' . $langmessage['remember_me'] . '</span>';
     echo '</label> ';
     echo '<label>';
     echo '<input type="checkbox" name="encrypted" ' . $this->checked('encrypted') . '/> ';
     echo '<span>' . $langmessage['send_encrypted'] . '</span>';
     echo '</label>';
     echo '</p>';
     echo '<div>';
     echo '<label>';
     $url = \gp\tool::GetUrl('Admin', 'cmd=forgotten');
     echo sprintf($langmessage['forgotten_password'], $url);
     echo '</label>';
     echo '</div>';
     echo '</form>';
     echo '</div>';
 }
示例#3
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>';
 }
示例#4
0
 /**
  * Perform admin only changes to the content buffer
  * This will happen before \gp\tool\Output::BufferOut()
  *
  */
 public static function AdminBuffer($buffer)
 {
     global $wbErrorBuffer, $gp_admin_html;
     //add $gp_admin_html to the document
     if (strpos($buffer, '<!-- get_head_placeholder ' . gp_random . ' -->') !== false) {
         $buffer = \gp\tool\Output::AddToBody($buffer, '<div id="gp_admin_html">' . $gp_admin_html . \gp\tool\Output::$editlinks . '</div><div id="gp_admin_fixed"></div>');
     }
     // Add a generic admin nonce field to each post form
     // Admin nonces are also added with javascript if needed
     $count = preg_match_all('#<form[^<>]*method=[\'"]post[\'"][^<>]*>#i', $buffer, $matches);
     if ($count) {
         $nonce = \gp\tool::new_nonce('post', true);
         $matches[0] = array_unique($matches[0]);
         foreach ($matches[0] as $match) {
             //make sure it's a local action
             if (preg_match('#action=[\'"]([^\'"]+)[\'"]#i', $match, $sub_matches)) {
                 $action = $sub_matches[1];
                 if (substr($action, 0, 2) === '//') {
                     continue;
                 } elseif (strpos($action, '://')) {
                     continue;
                 }
             }
             $replacement = '<span class="nodisplay"><input type="hidden" name="verified" value="' . $nonce . '"/></span>';
             $pos = strpos($buffer, $match) + strlen($match);
             $buffer = substr_replace($buffer, $replacement, $pos, 0);
         }
     }
     return $buffer;
 }