예제 #1
0
 function html_make_settings_form($jo_settings)
 {
     $html_form = "";
     $suSU = new SettingsUtilities();
     $html_form .= '<h4>Settings</h4>';
     $html_form .= '<div class="alert alert-info">Only some settings can be edited at the moment, if you feel confident you can edit theme directly in the settings datastore.</div><hr/>';
     $html_form .= '<form role="form" method="post" action="index.php">';
     #
     # make tabs
     #
     # tab menu
     $html_form .= '<ul class="nav nav-tabs">';
     $html_form .= '<li class="active"><a href="#general" data-toggle="tab">General</a></li>';
     $html_form .= '<li><a href="#images" data-toggle="tab">Images</a></li>';
     $html_form .= '<li><a href="#flot" data-toggle="tab">Flot</a></li>';
     $html_form .= '</ul>';
     # tabs
     $html_form .= '<div class="tab-content">';
     #
     # general tab
     #
     $html_form .= '<div class="tab-pane active" id="general">';
     # upload dir
     $html_form .= '<div class="form-group"><label for="setting_upload_dir">Upload folder (file path, relative from root)</label><input type="text" class="form-control input-sm" id="setting_upload_dir" placeholder="relative upload directory" disabled value="' . $jo_settings->upload_dir . '"></div>';
     # website name
     $html_form .= '<div class="form-group"><label for="setting_website_name">Website name</label><input type="text" name="site_name" class="form-control input-sm" id="setting_website_name" placeholder="website name" value="' . $jo_settings->site_name . '"></div>';
     # template
     $html_form .= '<div class="form-group input-group-sm">';
     $html_form .= '<label for="setting_theme_name">Theme</label>';
     $html_form .= '<select name="theme" class="form-control" id="settings_theme">';
     $file_utility = new FileBrowser();
     $sa_dirs = $file_utility->sa_themes_available();
     foreach ($sa_dirs as $s_theme_dir) {
         $s_selected = '';
         if ($s_theme_dir === $jo_settings->theme) {
             $s_selected = 'selected ';
         }
         $html_form .= '<option ' . $s_selected . 'value="' . $s_theme_dir . '" >' . $s_theme_dir . '</option>';
     }
     $html_form .= '</select>';
     $html_form .= '</div>';
     $html_form .= '</div>';
     #
     # images tab
     #
     $html_form .= '<div class="tab-pane" id="images">';
     # thumbs
     $html_form .= '<h5>Thumbnail sizes</h5>';
     foreach ($jo_settings->thumb_sizes as $o_thumb_size) {
         $html_form .= '<div class="row form-group"><div class="col-xs-12"><label>' . $o_thumb_size->name . '</label><input type="text" class="form-control" placeholder="" value="' . $o_thumb_size->name . '" disabled></div></div><div class="row form-group"><div class="col-xs-12 col-sm-6"><label>max width (blank for none)</label><input type="text" class="form-control" placeholder="" value="' . $o_thumb_size->max_width . '" disabled></div><div class="col-xs-12 col-sm-6"><label>max height (blank for none)</label><input type="text" class="form-control" placeholder="" value="' . $o_thumb_size->max_height . '" disabled></div></div>';
     }
     $html_form .= '</div>';
     #
     # flot tab
     #
     $html_form .= '<div class="tab-pane" id="flot">';
     $html_form .= '<table class="table table-condensed"><thead><tr><th>Property</th><th>Value</th></tr></thead><tbody>';
     // flot version
     $html_form .= '<tr><td>flot version</td><td><span class="label label-primary">' . $suSU->s_literal_flot_version() . '</span></td></tr>';
     // max execution time
     $html_form .= '<tr><td>PHP max execution time (seconds)</td><td>' . $suSU->i_max_execution_time() . '</td></tr>';
     // max input post time
     $html_form .= '<tr><td>PHP max input time (seconds)</td><td>' . $suSU->i_max_input_time() . '</td></tr>';
     // post_max_size
     $html_form .= '<tr><td>PHP post max size</td><td>' . $suSU->i_post_max_size() . '</td></tr>';
     // upload_max_filesize
     $html_form .= '<tr><td>PHP upload max filesize</td><td>' . $suSU->i_upload_max_filesize() . '</td></tr>';
     // www write perms
     $b_write_perms = $suSU->b_root_write_permission();
     $s_write_perms = $b_write_perms ? '<i class="green glyphicon glyphicon-ok"></i>' : '<i class="red glyphicon glyphicon-remove"></i>';
     $html_form .= '<tr><td>www write permission</td><td>' . $s_write_perms . '</td></tr>';
     /*
     if(!$b_write_perms){
     	foreach ($suSU->sa_unwritable_dirs as $s_path) {
     		$html_form .= $s_path.'<br/>';
     	}				
     }
     */
     // mod_rewrite enabled
     $b_mod_rewrite = $suSU->b_mod_rewrite_enabled();
     $s_mod_rewrite = $b_mod_rewrite ? '<i class="green glyphicon glyphicon-ok"></i>' : '<i class="red glyphicon glyphicon-remove"></i>';
     $html_form .= '<tr><td>mod_rewrite enabled</td><td>' . $s_mod_rewrite . '</td></tr>';
     $html_form .= '</tbody></table>';
     $html_form .= '<hr/>';
     $s_update_enabled = $b_write_perms ? '' : ' disabled';
     $html_form .= '<a class="btn btn-info" href="' . S_BASE_EXTENSION . 'flot-admin/admin/update.php" target="_blank" ' . $s_update_enabled . '><i class="glyphicon glyphicon-cloud-download"></i> update flot</a>';
     $html_form .= '<hr/>';
     $html_form .= '</div>';
     $html_form .= '</div>';
     # save
     $html_form .= '<div class="form-group">';
     $html_form .= '<button type="submit" class="btn btn-success pull-right"><i class="glyphicon glyphicon-floppy-disk"></i> save</button>';
     $html_form .= '</div>';
     # hidden elements
     $html_form .= '<input type="hidden" name="section" value="settings">';
     $html_form .= '</form>';
     return $html_form;
 }