コード例 #1
0
ファイル: Rename.php プロジェクト: Bouhnosaure/Typesetter
 /**
  * Display form in popup for renaming page given by $index
  *
  */
 public static function RenameForm()
 {
     global $langmessage, $page, $gp_index, $gp_titles, $config;
     $index = $_REQUEST['index'];
     if (!isset($gp_titles[$index])) {
         msg($langmessage['OOPS'] . ' (Invalid Request)');
         return;
     }
     $action = \gp\tool::GetUrl($page->requested);
     $label = \gp\tool::GetLabelIndex($index);
     $title = \gp\tool::IndexToTitle($index);
     $title_info = $gp_titles[$index];
     $title_info += array('browser_title' => '', 'keywords' => '', 'description' => '', 'rel' => '');
     if (empty($_REQUEST['new_title'])) {
         $new_title = \gp\tool::LabelSpecialChars($label);
     } else {
         $new_title = htmlspecialchars($_REQUEST['new_title']);
     }
     $new_title = str_replace('_', ' ', $new_title);
     ob_start();
     echo '<div class="inline_box">';
     echo '<form action="' . $action . '" method="post" id="gp_rename_form">';
     echo '<input type="hidden" name="title" id="old_title" value="' . htmlspecialchars($title) . '" />';
     echo '<input type="hidden" id="gp_space_char" value="' . htmlspecialchars($config['space_char']) . '" />';
     echo '<h2>' . $langmessage['rename/details'] . '</h2>';
     echo '<table class="bordered full_width" id="gp_rename_table">';
     echo '<thead>';
     echo '<tr><th colspan="2">';
     echo $langmessage['options'];
     echo '</th></tr>';
     echo '</thead>';
     echo '<tbody>';
     //label
     self::FormLabel('label');
     echo '<input type="text" class="title_label gpinput" name="new_label" maxlength="100" size="50" value="' . $new_title . '" />';
     echo '</td></tr>';
     //slug (title)
     $attr = '';
     $class = 'new_title';
     if ($title == \gp\admin\Tools::LabelToSlug($label)) {
         $attr = 'disabled="disabled" ';
         $class .= ' sync_label';
     }
     self::FormLabel('Slug/URL');
     echo '<input type="text" class="' . $class . ' gpinput" name="new_title" maxlength="100" size="50" value="' . htmlspecialchars($title) . '" ' . $attr . '/>';
     self::ToggleSync($attr);
     echo '</td></tr>';
     //browser title defaults to label
     $attr = '';
     $class = 'browser_title';
     $browser_title = $title_info['browser_title'];
     self::FormLabel('browser_title', $title_info['browser_title']);
     if (empty($title_info['browser_title'])) {
         $browser_title = htmlspecialchars($label);
         $attr = 'disabled="disabled" ';
         $class .= ' sync_label';
     }
     echo '<input type="text" class="' . $class . ' gpinput" size="50" name="browser_title" value="' . $browser_title . '" ' . $attr . '/>';
     self::ToggleSync($attr);
     echo '</td></tr>';
     //meta keywords
     self::FormLabel('keywords', $title_info['keywords']);
     echo '<input type="text" class="gpinput" size="50" name="keywords" value="' . $title_info['keywords'] . '" />';
     echo '</td></tr>';
     //meta description
     self::FormLabel('description', $title_info['description']);
     $count_label = sprintf($langmessage['_characters'], '<span>' . strlen($title_info['description']) . '</span>');
     echo '<span class="show_character_count gptextarea">';
     echo '<textarea rows="2" cols="50" name="description">' . $title_info['description'] . '</textarea>';
     echo '<span class="character_count">' . $count_label . '</span>';
     echo '</span>';
     echo '</td></tr>';
     //robots
     self::FormLabel('robots', $title_info['rel']);
     echo '<label>';
     $checked = strpos($title_info['rel'], 'nofollow') !== false ? 'checked="checked"' : '';
     echo '<input type="checkbox" name="nofollow" value="nofollow" ' . $checked . '/> ';
     echo '  Nofollow ';
     echo '</label>';
     echo '<label>';
     $checked = strpos($title_info['rel'], 'noindex') !== false ? 'checked="checked"' : '';
     echo '<input type="checkbox" name="noindex" value="noindex" ' . $checked . '/> ';
     echo ' Noindex';
     echo '</label>';
     echo '</td></tr>';
     echo '</tbody>';
     echo '</table>';
     //redirection
     echo '<p id="gp_rename_redirect" class="nodisplay">';
     echo '<label>';
     echo '<input type="checkbox" name="add_redirect" value="add" /> ';
     echo sprintf($langmessage['Auto Redirect'], '"' . $title . '"');
     echo '</label>';
     echo '</p>';
     echo '<p>';
     if (self::$hidden_rows) {
         echo ' &nbsp; <a data-cmd="showmore" >+ ' . $langmessage['more_options'] . '</a>';
     }
     echo '</p>';
     echo '<p>';
     echo '<input type="hidden" name="cmd" value="RenameFile"/> ';
     echo '<input type="submit" name="" value="' . $langmessage['save_changes'] . '...' . '" class="gpsubmit" data-cmd="gppost"/>';
     echo '<input type="button" class="admin_box_close gpcancel" name="" value="' . $langmessage['cancel'] . '" />';
     echo '</p>';
     echo '</form>';
     echo '</div>';
     $content = ob_get_clean();
     $page->ajaxReplace = array();
     $array = array();
     $array[0] = 'admin_box_data';
     $array[1] = '';
     $array[2] = $content;
     $page->ajaxReplace[] = $array;
     //call renameprep function after admin_box
     $array = array();
     $array[0] = 'renameprep';
     $array[1] = '';
     $array[2] = '';
     $page->ajaxReplace[] = $array;
 }
コード例 #2
0
ファイル: Users.php プロジェクト: Bouhnosaure/Typesetter
 /**
  * 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>';
 }
コード例 #3
0
ファイル: Menu.php プロジェクト: Bouhnosaure/Typesetter
 /**
  * Display the current homepage setting
  *
  */
 public function HomepageDisplay()
 {
     global $langmessage, $config;
     $label = \gp\tool::GetLabelIndex($config['homepath_key']);
     echo '<span class="fa fa-home"></span> ';
     echo $langmessage['Homepage'] . ': ';
     echo \gp\tool::Link('Admin/Menu/Ajax', $label, 'cmd=HomepageSelect', 'data-cmd="gpabox"');
 }
コード例 #4
0
ファイル: Layout.php プロジェクト: Bouhnosaure/Typesetter
 public function InheritingLayout($searchLevel, &$menu, &$result)
 {
     global $gp_titles;
     $children = true;
     do {
         $menu_key = key($menu);
         $info = current($menu);
         if (!isset($info['level'])) {
             break;
         }
         $level = $info['level'];
         if ($level < $searchLevel) {
             return;
         }
         if ($level > $searchLevel) {
             if ($children) {
                 self::InheritingLayout($level, $menu, $result);
             } else {
                 unset($menu[$menu_key]);
             }
             continue;
         }
         unset($menu[$menu_key]);
         if (!empty($gp_titles[$menu_key]['gpLayout'])) {
             $children = false;
             continue;
         }
         $children = true;
         //exclude external links
         if ($menu_key[0] == '_') {
             continue;
         }
         $label = \gp\tool::GetLabelIndex($menu_key, false);
         $result[] = \gp\tool::LabelSpecialChars($label);
     } while (count($menu) > 0);
 }