Beispiel #1
0
 public function __construct()
 {
     global $langmessage;
     $cmd = \gp\tool::GetCommand();
     switch ($cmd) {
         case 'continue':
             $this->uninstall();
             break;
         case 'restore':
             $this->restore();
             break;
     }
     echo '<h2>Uninstall Preparation</h2>';
     echo '<form class="renameform" action="' . \gp\tool::GetUrl('Admin/Uninstall') . '" method="post">';
     echo '<p>';
     echo 'For some installations, you won\'t be able to delete ' . CMS_NAME . '\'s data files from your server untill the access permissions have been changed. ';
     echo ' This script will change file permissions for files and folders in the /data directory to 0777.';
     echo ' <br/><em>You should not continue unless you plan on deleting all ' . CMS_NAME . ' files from your server.</em>';
     echo '<input type="hidden" name="cmd" value="continue" />';
     echo ' <input type="submit" name="aaa" value="' . $langmessage['continue'] . '" class="gpsubmit"/>';
     //echo ' <input type="submit" name="cmd" value="'.$langmessage['cancel'].'" />';
     echo '</p>';
     echo '</form>';
     echo '<h2>Change Your Mind?</h2>';
     echo '<form class="renameform" action="' . \gp\tool::GetUrl('Admin/Uninstall') . '" method="post">';
     echo 'You can restore the file permissions for added security here: ';
     echo '<input type="hidden" name="cmd" value="restore" />';
     echo '<input type="submit" name="aaa" value="' . $langmessage['restore'] . '" class="gpsubmit"/>';
     echo '</form>';
 }
Beispiel #2
0
 function __construct($args)
 {
     parent::__construct($args);
     $this->admin_link = \gp\tool::GetUrl('Admin/Classes');
     $cmd = \gp\tool::GetCommand();
     switch ($cmd) {
         case 'SaveClasses':
             $this->SaveClasses();
             break;
     }
     $this->ClassesForm();
 }
Beispiel #3
0
 function xml()
 {
     global $gp_menu;
     header('Content-Type: text/xml; charset=UTF-8');
     echo '<?xml version="1.0" encoding="UTF-8"?>';
     echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
     foreach ($gp_menu as $key => $info) {
         $title = \gp\tool::IndexToTitle($key);
         if (isset($info['level'])) {
             echo "\n";
             echo '<url>';
             echo '<loc>';
             echo isset($info['url']) ? $info['url'] : 'http://' . $_SERVER['SERVER_NAME'] . \gp\tool::GetUrl($title);
             echo '</loc>';
             echo '</url>';
         }
     }
     echo '</urlset>';
     die;
 }
Beispiel #4
0
 /**
  * Show CDN Options
  *
  */
 protected function ShowForm()
 {
     global $config;
     $possible = $this->getPossible();
     echo '<form action="' . \gp\tool::GetUrl($this->page->requested) . '" method="post">';
     echo '<h2>CDN</h2>';
     echo '<table class="bordered"><tr><td></td>';
     foreach ($possible['cdn'] as $cdn_val => $cdn) {
         $checked = $cdn_val === $config['cdn'] ? 'checked' : '';
         echo '<td>';
         echo '<label class="all_checkbox">';
         echo '<input type="radio" name="cdn" value="' . $cdn_val . '" ' . $checked . '/>';
         echo '<span>' . $cdn . '</span>';
         echo '</label> ';
         echo '</td>';
     }
     echo '</tr>';
     //display which scripts can be served bythe cdn
     foreach (\gp\tool\Output\Combine::$scripts as $key => $script_info) {
         if (!isset($script_info['cdn']) || !isset($script_info['label'])) {
             continue;
         }
         $config_key = 'cdn_' . $key;
         $code = '\\gp\\tool::LoadComponents(\'' . $key . '\');';
         echo '<tr><td title="' . htmlspecialchars($code) . '">';
         echo $script_info['label'];
         echo '</td>';
         foreach ($possible['cdn'] as $cdn) {
             echo '<td class="text-center">';
             if (isset($script_info['cdn'][$cdn])) {
                 echo '<i class="fa fa-check"></i>';
             }
             echo '</td>';
         }
         echo '</div></td></tr>';
     }
     echo '</table>';
     $this->SaveButtons();
     echo '</form>';
 }
Beispiel #5
0
 public function EditText()
 {
     global $config, $langmessage, $page;
     if (!isset($_GET['key'])) {
         message($langmessage['OOPS'] . ' (0)');
         return;
     }
     $default = $value = $key = $_GET['key'];
     if (isset($langmessage[$key])) {
         $default = $value = $langmessage[$key];
     }
     if (isset($config['customlang'][$key])) {
         $value = $config['customlang'][$key];
     }
     echo '<div class="inline_box">';
     echo '<form action="' . \gp\tool::GetUrl('Admin_Theme_Content/Text') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="savetext" />';
     echo '<input type="hidden" name="key" value="' . htmlspecialchars($key) . '" />';
     echo '<input type="hidden" name="return" value="" />';
     //will be populated by javascript
     echo '<table class="bordered">';
     echo '<tr><th>';
     echo $langmessage['default'];
     echo '</th><th>';
     echo '</th></tr>';
     echo '<tr><td>';
     echo $default;
     echo '</td><td>';
     //$value is already escaped using htmlspecialchars()
     echo '<input type="text" name="value" value="' . $value . '" class="gpinput"/>';
     echo '<p>';
     echo ' <input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpsubmit"/>';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</p>';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     echo '</div>';
 }
Beispiel #6
0
 function FinderPrep()
 {
     $this->finder_opts['url'] = \gp\tool::GetUrl('Admin_Finder');
     $this->finder_opts['getFileCallback'] = true;
     $this->finder_opts['resizable'] = false;
 }
 public function CompleteForm($args = false, $action = '')
 {
     global $langmessage;
     echo '<p>';
     echo $langmessage['supply_ftp_values'];
     echo '</p>';
     if ($action === false) {
         echo '<form method="post" action="">';
     } else {
         echo '<form method="post" action="' . \gp\tool::GetUrl($action) . '">';
     }
     //include the current request's query so that we continue the same action after the login form is submitted
     $this->ArrayToForm($_REQUEST);
     echo '<table>';
     $this->connectForm($args);
     echo '</table>';
     echo '<input type="submit" name="" value="' . $langmessage['continue'] . '..." class="gpsubmit"/>';
     echo '</form>';
 }
Beispiel #8
0
 public function ReviewAddonForm()
 {
     global $config, $dirPrefix, $langmessage;
     if (!$this->CanRate()) {
         return;
     }
     $this->page->head_js[] = '/include/js/rate.js';
     //get appropriate variables
     $id = $this->addon_info['id'];
     if (isset($_REQUEST['rating'])) {
         $rating = $_REQUEST['rating'];
     } elseif (isset($this->addonReviews[$id])) {
         $rating = $this->addonReviews[$id]['rating'];
     } else {
         $rating = 5;
     }
     if (isset($_REQUEST['review'])) {
         $review = $_REQUEST['review'];
     } elseif (isset($this->addonReviews[$id])) {
         $review = $this->addonReviews[$id]['review'];
     } else {
         $review = '';
     }
     echo '<h2>';
     echo $this->addon_info['name'] . ' &#187; ' . 'Rate';
     echo '</h2>';
     if (isset($this->addonReviews[$id])) {
         echo 'You posted the following review on ' . \gp\tool::date($langmessage['strftime_date'], $this->addonReviews[$id]['time']);
     }
     //echo '<form action="'.\gp\tool::GetUrl($this->scriptUrl,'cmd=rate&arg='.$this->addon_info['pass_arg']).'" method="post">';
     echo '<form action="' . \gp\tool::GetUrl($this->scriptUrl) . '" method="post">';
     echo '<input type="hidden" name="arg" value="' . $this->addon_info['pass_arg'] . '"/>';
     echo '<table class="rating_table">';
     echo '<tr><td>Rating</td><td>';
     echo '<span class="rating">';
     for ($i = 1; $i < 6; $i++) {
         $class = '';
         if ($i > $rating) {
             $class = ' class="unset"';
         }
         echo '<a data-rating="' . $i . '"' . $class . '></a>';
     }
     echo '<input type="hidden" name="rating" value="' . htmlspecialchars($rating) . '" />';
     echo '</span> ';
     echo '</td></tr>';
     echo '<tr><td>Review</td><td>';
     echo '<textarea name="review" cols="50" rows="7" class="gptextarea">';
     echo htmlspecialchars($review);
     echo '</textarea>';
     echo '</td></tr>';
     echo '<tr><td>From</td><td>';
     $host = $_SERVER['HTTP_HOST'] . $dirPrefix;
     echo '<input type="text" name="host"  size="50" value="' . htmlspecialchars($host) . '" readonly="readonly" class="gpinput gpreadonly" />';
     echo '<br/>';
     echo '<input type="checkbox" name="show_site" value="hidden" /> Click to hide your site information on ' . CMS_READABLE_DOMAIN . '.';
     echo '</td></tr>';
     echo '<tr><td></td><td>';
     if (isset($this->addonReviews[$id])) {
         echo '<button type="submit" name="cmd" value="SendAddonReview" class="gppost gpsubmit">Update Review</button>';
     } else {
         echo '<button type="submit" name="cmd" value="SendAddonReview" class="gppost gpsubmit">Send Review</button>';
     }
     echo ' ';
     echo '<input type="submit" name="cmd" value="Cancel" class="admin_box_close gpcancel"/>';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     return true;
 }
Beispiel #9
0
 /**
  * Display custom_config form
  *
  */
 function CustomConfigForm()
 {
     echo '<form method="post" action="' . \gp\tool::GetUrl($this->page->requested) . '">';
     $placeholder = '{  "example_key":   "example_value"  }';
     echo '<p>';
     echo '<textarea name="custom_config" class="custom_config full_width" placeholder="' . htmlspecialchars($placeholder) . '">';
     if (isset($_POST['custom_config'])) {
         echo htmlspecialchars($_POST['custom_config']);
     } elseif (!empty($this->cke_config['custom_config'])) {
         echo htmlspecialchars(self::ReadableJson($this->cke_config['custom_config']));
     }
     echo '</textarea>';
     echo '</p>';
     echo '<p>';
     echo '<input type="hidden" name="cmd" value="save_custom_config"/>';
     echo '<input type="submit" value="Save" data-cmd="gpajax"  class="gpsubmit" />';
     echo '</p>';
     echo '</form>';
 }
Beispiel #10
0
 /**
  * Display a form for selecting the homepage
  *
  */
 public function HomepageSelect()
 {
     global $langmessage;
     echo '<div class="inline_box">';
     echo '<form action="' . \gp\tool::GetUrl('Admin/Menu/Ajax') . '" method="post">';
     echo '<h3><i class="fa fa-home"></i> ';
     echo $langmessage['Homepage'];
     echo '</h3>';
     echo '<p class="homepage_setting">';
     echo '<input type="text" class="title-autocomplete gpinput" name="homepage" />';
     echo '</p>';
     echo '<p>';
     echo '<button type="submit" name="cmd" value="HomepageSave" class="gpsubmit" data-cmd="gppost">' . htmlspecialchars($langmessage['save']) . '</button> ';
     echo '<button type="submit" class="admin_box_close gpcancel">' . htmlspecialchars($langmessage['cancel']) . '</button>';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
Beispiel #11
0
 /**
  * View all files in the trash
  *
  */
 public function Trash()
 {
     global $dataDir, $langmessage;
     $this->section_types = \gp\tool\Output\Sections::GetTypes();
     echo '<h2>' . $langmessage['trash'] . '</h2>';
     if (count($this->trash_files) == 0) {
         echo '<ul><li>' . $langmessage['TRASH_IS_EMPTY'] . '</li></ul>';
         return false;
     }
     echo '<form action="' . \gp\tool::GetUrl('Admin/Trash') . '" method="post">';
     echo '<table class="bordered striped full_width">';
     ob_start();
     echo '<tr><th colspan="3">';
     echo '<input type="checkbox" name="" class="check_all"/>';
     echo '</th><th>';
     echo '<button type="submit" name="cmd" value="RestoreDeleted" class="gppost gpsubmit">' . $langmessage['restore'] . '</button> ';
     echo '<button type="submit" name="cmd" value="DeleteFromTrash" class="gppost gpsubmit">' . $langmessage['delete'] . '</button>';
     echo '</th></tr>';
     $heading = ob_get_clean();
     echo $heading;
     // non-orphaned
     $orphaned = array();
     foreach ($this->trash_files as $trash_index => $info) {
         if (isset($info['orphaned'])) {
             $orphaned[$trash_index] = $info;
         } else {
             $this->TrashRow($trash_index, $info);
         }
     }
     // orphaned files
     if ($orphaned) {
         echo '<tr><td colspan="3">';
         echo '<input type="checkbox" style="visibility:hidden"> &nbsp; ';
         echo count($orphaned) . ' Orphaned Files Found';
         echo '</td><td>';
         echo '<a class="nowrap" data-cmd="ViewOrphaned">' . $langmessage['View'] . '</a> &nbsp; ';
         $q = array();
         $q['titles'] = array_keys($orphaned);
         $q = 'cmd=DeleteFromTrash&' . http_build_query($q);
         echo \gp\tool::Link('Admin/Trash', $langmessage['delete'], $q, array('data-cmd' => 'postlink'));
         echo '</td></tr>';
         foreach ($orphaned as $trash_index => $info) {
             $this->TrashRow($trash_index, $info);
         }
     }
     echo $heading;
     echo '</table>';
     echo '</form>';
 }
Beispiel #12
0
 public function EditExtra()
 {
     global $langmessage;
     echo '<h2>';
     echo \gp\tool::Link('Admin/Extra', $langmessage['theme_content']);
     echo ' &#187; ' . str_replace('_', ' ', $this->title) . '</h2>';
     echo '<form action="' . \gp\tool::GetUrl('Admin/Extra', 'file=' . $this->title) . '" method="post">';
     echo '<input type="hidden" name="cmd" value="SaveText" />';
     \gp\tool\Editing::UseCK($this->file_sections[0]['content']);
     echo '<input type="submit" name="" value="' . $langmessage['save'] . '" class="gpsubmit" />';
     echo '<input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="gpcancel"/>';
     echo '</form>';
 }
Beispiel #13
0
 /**
  * Display a form for creating a new directory
  *
  */
 public static function NewDirForm()
 {
     global $langmessage, $page;
     ob_start();
     echo '<div class="inline_box">';
     echo '<h2><i class="fa fa-folder-o"></i> ' . $langmessage['create_dir'] . '</h2>';
     echo '<form action="' . \gp\tool::GetUrl($page->title) . '" method="post" >';
     echo '<p>';
     echo htmlspecialchars($_GET['dir']) . '/';
     echo ' <input type="text" class="gpinput" name="newdir" size="30" />';
     echo '</p>';
     echo '<p>';
     if (!empty($_GET['dir'])) {
         echo ' <input type="hidden" name="dir" value="' . htmlspecialchars($_GET['dir']) . '" />';
     }
     echo '<input type="submit" name="aaa" value="' . $langmessage['create_dir'] . '" class="gp_gallery_folder_add gpsubmit"/>';
     echo ' <input type="submit" name="" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel"/>';
     echo '</p>';
     echo '</form>';
     echo '</div>';
     return ob_get_clean();
 }
Beispiel #14
0
 /**
  * Re-enable components that were disabled because of fatal errors
  *
  */
 public static function ClearErrors()
 {
     \gp\admin\Tools\Errors::ClearAll();
     $title = \gp\tool::WhichPage();
     \gp\tool::Redirect(\gp\tool::GetUrl($title, '', false));
 }
 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>';
 }
Beispiel #16
0
/**
 * Output the message buffer
 *
 */
function GetMessages($wrap = true)
{
    global $wbMessageBuffer, $gp_not_writable, $langmessage;
    if (\gp\tool::loggedIn() && count($gp_not_writable) > 0) {
        $files = '<ul><li>' . implode('</li><li>', $gp_not_writable) . '</li></ul>';
        $message = sprintf($langmessage['not_writable'], \gp\tool::GetUrl('Admin/Status')) . $files;
        message($message);
        $gp_not_writable = array();
    }
    $result = $wrap_end = '';
    if ($wrap) {
        $result = "\n<!-- message_start " . gp_random . " -->";
        $wrap_end = "<!-- message_end -->\n";
    }
    if (!empty($wbMessageBuffer)) {
        if (gpdebug === false) {
            $wbMessageBuffer = array_unique($wbMessageBuffer);
        }
        $result .= '<div class="messages gp-fixed-adjust"><div>';
        $result .= '<a style="" href="#" class="req_script close_message" data-cmd="close_message"></a>';
        $result .= '<ul>';
        $result .= implode('', $wbMessageBuffer);
        $result .= '</ul></div></div>';
    }
    return $result .= \gp\tool::ErrorBuffer() . $wrap_end;
}
Beispiel #17
0
 public function ExportForm()
 {
     global $langmessage;
     echo '<form action="' . \gp\tool::GetUrl('Admin/Port') . '" method="post">';
     echo '<p>';
     foreach ($this->export_fields as $info) {
         $this->Checkbox_Export($info['name'], $info['label']);
         echo ' &nbsp; ';
     }
     echo '</p>';
     echo '<p>';
     echo '<input type="hidden" name="cmd" value="do_export" />';
     echo $langmessage['Compression'] . ': ';
     echo ' <select name="compression" class="gpselect">';
     foreach ($this->avail_compress as $ext => $disp) {
         echo '<option value="' . $ext . '">' . $disp . '</option>';
     }
     echo '</select>';
     echo ' &nbsp; <input type="submit" name="" value="' . $langmessage['Export'] . '" class="gpsubmit" />';
     echo '</p>';
     echo '</form>';
 }
Beispiel #18
0
 public function Form()
 {
     global $langmessage, $gpAdmin;
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $array = $_POST;
     } else {
         $array = $this->user_info + $gpAdmin;
     }
     $array += array('email' => '');
     echo '<h2>' . $langmessage['Preferences'] . '</h2>';
     echo '<form action="' . \gp\tool::GetUrl('Admin/Preferences') . '" method="post">';
     echo '<table class="bordered full_width">';
     echo '<tr><th colspan="2">' . $langmessage['general_settings'] . '</th></tr>';
     //email
     echo '<tr><td>';
     echo $langmessage['email_address'];
     echo '</td><td>';
     echo '<input type="text" name="email" value="' . htmlspecialchars($array['email']) . '" class="gpinput"/>';
     echo '</td></tr>';
     echo '<tr><th colspan="2">' . $langmessage['change_password'] . '</th></tr>';
     echo '<tr><td>';
     echo $langmessage['old_password'];
     echo '</td><td>';
     echo '<input type="password" name="oldpassword" value="" class="gpinput"/>';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['new_password'];
     echo '</td><td>';
     echo '<input type="password" name="password" value="" class="gpinput"/>';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['repeat_password'];
     echo '</td><td>';
     echo '<input type="password" name="password1" value="" class="gpinput"/>';
     echo '</td></tr>';
     $this->AlgoSelect();
     echo '</table>';
     echo '<div style="margin:1em 0">';
     echo '<input type="hidden" name="cmd" value="changeprefs" />';
     echo ' <input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpsubmit"/>';
     echo ' <input type="button" name="" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel"/>';
     echo '</div>';
     echo '<p class="admin_note">';
     echo '<b>';
     echo $langmessage['see_also'];
     echo '</b> ';
     echo \gp\tool::Link('Admin_Configuration', $langmessage['configuration'], '', 'data-cmd="gpabox"');
     echo '</p>';
     echo '</div>';
     echo '</form>';
 }
Beispiel #19
0
 /**
  * Rename a page
  *
  */
 public static function RenamePage()
 {
     global $langmessage, $gp_index, $page;
     $new_title = self::RenameFile($page->title);
     if ($new_title !== false && $new_title != $page->title) {
         msg(sprintf($langmessage['will_redirect'], \gp\tool::Link_Page($new_title)));
         $page->head .= '<meta http-equiv="refresh" content="15;url=' . \gp\tool::GetUrl($new_title) . '">';
         $page->ajaxReplace[] = array('location', \gp\tool::GetUrl($new_title), 15000);
         return true;
     }
     return false;
 }
Beispiel #20
0
 public function __construct($title, $type)
 {
     $this->requested = $title;
     $this->title = $title;
     $this->head .= '<link rel="canonical" href="' . \gp\tool::GetUrl($title) . '" />' . "\n";
 }
Beispiel #21
0
 /**
  * Prompt User about uninstalling an addon
  */
 function Uninstall()
 {
     global $config, $langmessage;
     echo '<div class="inline_box">';
     echo '<h3>' . $langmessage['uninstall'] . '</h3>';
     echo '<form action="' . \gp\tool::GetUrl('Admin/Addons') . '" method="post">';
     $addon =& $_REQUEST['addon'];
     if (!isset($config['addons'][$addon])) {
         echo $langmessage['OOPS'];
         echo '<p>';
         echo ' <input type="submit" value="' . $langmessage['Close'] . '" class="admin_box_close" /> ';
         echo '</p>';
     } else {
         echo $langmessage['confirm_uninstall'];
         echo '<p>';
         echo '<input type="hidden" name="addon" value="' . htmlspecialchars($addon) . '" />';
         echo '<input type="hidden" name="cmd" value="confirm_uninstall" />';
         echo ' <input type="submit" name="aaa" value="' . $langmessage['continue'] . '" class="gpsubmit"/> ';
         echo ' <input type="submit" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" /> ';
         echo '</p>';
     }
     echo '</form>';
     echo '</div>';
 }
Beispiel #22
0
 public function Form_Entry()
 {
     global $langmessage;
     echo '<form action="' . \gp\tool::GetUrl('') . '" method="post">';
     echo '<table class="styledtable">';
     \gp\install\Tools::Form_UserDetails();
     \gp\install\Tools::Form_Configuration();
     echo '</table>';
     echo '<p>';
     echo '<input type="hidden" name="cmd" value="Install" />';
     echo '<input type="submit" class="submit install_button" name="aaa" value="' . $langmessage['Install'] . '" />';
     echo '</p>';
     echo '</form>';
 }
Beispiel #23
0
 /**
  * Start the link attributes array
  *
  */
 protected function MenuAttributesA()
 {
     global $gp_titles;
     $attributes = array('href' => '', 'attr' => '', 'value' => '', 'title' => '', 'class' => array());
     //external
     if (isset($this->curr_info['url'])) {
         if (empty($this->curr_info['title_attr'])) {
             $this->curr_info['title_attr'] = strip_tags($this->curr_info['label']);
         }
         $attributes['href'] = $this->curr_info['url'];
         $attributes['value'] = $this->curr_info['label'];
         $attributes['title'] = $this->curr_info['title_attr'];
         if (isset($this->curr_info['new_win'])) {
             $attributes['target'] = '_blank';
         }
         //internal link
     } else {
         $title = \gp\tool::IndexToTitle($this->curr_key);
         $attributes['href'] = \gp\tool::GetUrl($title);
         $attributes['value'] = \gp\tool::GetLabel($title);
         $attributes['title'] = \gp\tool::GetBrowserTitle($title);
         //get valid rel attr
         if (!empty($gp_titles[$this->curr_key]['rel'])) {
             $rel = explode(',', $gp_titles[$this->curr_key]['rel']);
             $attributes['rel'] = array_intersect(array('alternate', 'author', 'bookmark', 'help', 'icon', 'license', 'next', 'nofollow', 'noreferrer', 'prefetch', 'prev', 'search', 'stylesheet', 'tag'), $rel);
         }
     }
     return $attributes;
 }
Beispiel #24
0
 /**
  * Give users a few options before creating the new layout
  *
  */
 public function NewLayoutPrompt($theme, $theme_info)
 {
     global $langmessage;
     $label = substr($theme_info['name'] . '/' . $theme_info['color'], 0, 25);
     echo '<h2>' . $langmessage['new_layout'] . '</h2>';
     echo '<form action="' . \gp\tool::GetUrl('Admin_Theme_Content/Available') . '" method="post">';
     echo '<table class="bordered full_width">';
     echo '<tr><th colspan="2">';
     echo $langmessage['options'];
     echo '</th></tr>';
     echo '<tr><td>';
     echo $langmessage['label'];
     echo '</td><td>';
     echo '<input type="text" name="label" value="' . htmlspecialchars($label) . '" class="gpinput" />';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['make_default'];
     echo '</td><td>';
     echo '<input type="checkbox" name="default" value="default" />';
     echo '</td></tr>';
     echo '</table>';
     echo '<p>';
     echo '<input type="hidden" name="theme" value="' . htmlspecialchars($theme) . '" /> ';
     echo '<button type="submit" name="cmd" value="addlayout" class="gpsubmit">' . $langmessage['save'] . '</button> ';
     echo '<input type="button" name="" value="Cancel" class="admin_box_close gpcancel"/> ';
     echo '</p>';
     echo '</form>';
 }
Beispiel #25
0
 /**
  * Display the permission options for a file
  *
  */
 public function FilePermissions()
 {
     global $gp_titles, $langmessage;
     $indexes = $this->RequestedIndexes();
     if (!$indexes) {
         return;
     }
     $count = count($indexes);
     $first_index = $indexes[0];
     echo '<div class="inline_box">';
     echo '<form action="' . \gp\tool::GetUrl('Admin/Users') . '" method="post">';
     echo '<input type="hidden" name="cmd" value="save_file_permissions">';
     echo '<input type="hidden" name="index" value="' . htmlspecialchars($_REQUEST['index']) . '">';
     //heading
     echo '<h2>' . \gp\tool::Link('Admin/Users', $langmessage['user_permissions']) . ' &#187; <i>';
     if ($count > 1) {
         echo sprintf($langmessage['%s Pages'], $count);
     } else {
         echo strip_tags(\gp\tool::GetLabelIndex($indexes[0]));
     }
     echo '</i></h2>';
     //list of files
     if ($count > 1) {
         $labels = array();
         foreach ($indexes as $index) {
             $labels[] = strip_tags(\gp\tool::GetLabelIndex($index));
         }
         echo '<p>';
         echo implode(', ', $labels);
         echo '</p>';
     }
     //list of users
     echo '<div class="all_checkboxes">';
     foreach ($this->users as $username => $userinfo) {
         $attr = '';
         if ($userinfo['editing'] == 'all') {
             $attr = ' checked="checked" disabled="disabled"';
         } elseif (strpos($userinfo['editing'], ',' . $first_index . ',') !== false) {
             $attr = ' checked="checked"';
         }
         echo '<label class="all_checkbox">';
         echo '<input type="checkbox" name="users[' . htmlspecialchars($username) . ']" value="' . htmlspecialchars($username) . '" ' . $attr . '/>';
         echo '<span>' . $username . '</span>';
         echo '</label> ';
     }
     echo '</div>';
     echo '<p>';
     echo '<input type="submit" name="aaa" value="' . $langmessage['save'] . '" class="gpabox gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
Beispiel #26
0
 function RedirForm($values = array())
 {
     global $langmessage;
     $values += array('cmd' => 'saveredir', 'source' => '', 'target' => '', 'code' => '', 'orig_source' => '');
     $codes = array('301' => $langmessage['301 Moved Permanently'], '302' => $langmessage['302 Moved Temporarily']);
     echo '<div class="inline_box" id="gp_redir">';
     echo '<h2>' . $langmessage['New Redirection'] . '</h2>';
     echo '<form method="post" action="' . \gp\tool::GetUrl('Admin/Missing') . '">';
     echo '<input type="hidden" name="cmd" value="' . htmlspecialchars($values['cmd']) . '"/>';
     echo '<input type="hidden" name="orig_source" value="' . htmlspecialchars($values['orig_source']) . '"/>';
     echo '<table class="bordered">';
     echo '<tr><th colspan="2">' . $langmessage['options'] . '</th></tr>';
     echo '<tr><td>';
     echo $langmessage['Source URL'];
     echo '</td><td>';
     echo \gp\tool::GetUrl('');
     echo '<input type="text" name="source" value="' . htmlspecialchars($values['source']) . '" size="20" class="gpinput"/>';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['Target URL'];
     echo '</td><td>';
     echo '<input type="text" name="target" value="' . htmlspecialchars($values['target']) . '" class="title-autocomplete gpinput" size="40" />';
     echo '</td></tr>';
     echo '<tr><td>';
     echo $langmessage['Method'];
     echo '</td><td>';
     echo '<select name="code" class="gpselect">';
     foreach ($codes as $code_key => $code_value) {
         $selected = '';
         if ($code_key == $values['code']) {
             $selected = ' selected="selected"';
         }
         echo '<option value="' . $code_key . '"' . $selected . '>' . htmlspecialchars($code_value) . '</option>';
     }
     echo '</select>';
     echo '</td></tr>';
     echo '</table>';
     echo '<p>';
     echo '<input type="submit" name="" value="' . $langmessage['save_changes'] . '" class="gpsubmit" />';
     //not using gppost because of autocomplete
     echo ' <input type="button" name="" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</p>';
     echo '</form>';
     echo '</div>';
 }
Beispiel #27
0
 /**
  * Redirect admin request to the most similar page
  *
  */
 private function Redirect()
 {
     //find similar
     $scripts = $this->scripts;
     $scripts['Admin'] = array();
     $similar = array();
     $lower_req = strtolower($this->requested);
     foreach ($scripts as $key => $script_info) {
         $lower_key = strtolower($key);
         similar_text($lower_req, $lower_key, $percent);
         $similar[$key] = $percent;
     }
     arsort($similar);
     $redir_key = key($similar);
     $location = \gp\tool::GetUrl($redir_key, http_build_query($_GET), false);
     \gp\tool::Redirect($location);
 }
Beispiel #28
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;
 }
Beispiel #29
0
 /**
  * Output Javascript code to set variable defaults
  *
  */
 public static function JsStart()
 {
     global $linkPrefix;
     //default Variables
     \gp\tool\Output::$inline_vars['isadmin'] = false;
     \gp\tool\Output::$inline_vars['gpBase'] = rtrim(self::GetDir(''), '/');
     \gp\tool\Output::$inline_vars['post_nonce'] = '';
     \gp\tool\Output::$inline_vars['req_type'] = strtolower(htmlspecialchars($_SERVER['REQUEST_METHOD']));
     if (gpdebugjs) {
         if (is_string(gpdebugjs)) {
             \gp\tool\Output::$inline_vars['debugjs'] = 'send';
         } else {
             \gp\tool\Output::$inline_vars['debugjs'] = true;
         }
     }
     if (self::LoggedIn()) {
         \gp\tool\Output::$inline_vars['isadmin'] = true;
         \gp\tool\Output::$inline_vars['req_time'] = time();
         \gp\tool\Output::$inline_vars['gpBLink'] = self::HrefEncode($linkPrefix, false);
         \gp\tool\Output::$inline_vars['post_nonce'] = self::new_nonce('post', true);
         \gp\tool\Output::$inline_vars['gpFinderUrl'] = \gp\tool::GetUrl('Admin/Browser');
         \gp\tool\Session::GPUIVars();
     }
     echo 'var gplinks={},gpinputs={},gpresponse={}';
     foreach (\gp\tool\Output::$inline_vars as $key => $value) {
         echo ',' . $key . '=' . json_encode($value);
     }
     echo ';';
 }
 /**
  * Display configuration settings
  *
  */
 protected function showForm()
 {
     global $langmessage;
     $possible_values = $this->getPossible();
     $array = $this->getValues();
     echo '<form action="' . \gp\tool::GetUrl($this->page->requested) . '" method="post">';
     //order by the possible values
     $opened = false;
     foreach ($possible_values as $key => $possible_value) {
         if ($possible_value === false) {
             if ($opened) {
                 echo '</table><br/>';
             }
             echo '<h2>';
             if (isset($langmessage[$key])) {
                 echo $langmessage[$key];
             } else {
                 echo str_replace('_', ' ', $key);
             }
             echo '</h2>';
             echo '<table class="bordered configuration">';
             $opened = true;
             continue;
         }
         if (isset($array[$key])) {
             $value = $array[$key];
         } else {
             $value = '';
         }
         echo "\n\n";
         echo '<tr><td style="white-space:nowrap">';
         if (isset($langmessage[$key])) {
             echo $langmessage[$key];
         } else {
             echo str_replace('_', ' ', $key);
         }
         echo '</td><td>';
         if (is_array($possible_value)) {
             self::formSelect($key, $possible_value, $value);
         } else {
             switch ($possible_value) {
                 case 'boolean':
                     $this->formCheckbox($key, $value);
                     break;
                 case 'textarea':
                     $this->formTextarea($key, $value);
                     break;
                 default:
                     $this->formInput($key, $value, $possible_value);
                     break;
             }
         }
         if (isset($langmessage['about_config'][$key])) {
             echo $langmessage['about_config'][$key];
         }
         echo '</td></tr>';
     }
     echo '</table>';
     $this->SaveButtons();
     echo '</form>';
 }