Project

General

Profile

1
<?php
2
/**
3
 *
4
 * @category        modules
5
 * @package         news
6
 * @author          WebsiteBaker Project
7
 * @copyright       WebsiteBaker Org. e.V.
8
 * @link            http://websitebaker.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.3
11
 * @requirements    PHP 5.3.6 and higher
12
 * @version         $Id: modify_settings.php 2 2017-07-02 15:14:29Z Manuela $
13
 * @filesource      $HeadURL: svn://isteam.dynxs.de/wb/2.10.x/branches/main/modules/news/modify_settings.php $
14
 * @lastmodified    $Date: 2017-07-02 17:14:29 +0200 (Sun, 02 Jul 2017) $
15
 *
16
 */
17

    
18
if ( !defined( 'WB_PATH' ) ){ require( dirname(dirname((__DIR__))).'/config.php' ); }
19

    
20
// suppress to print the header, so no new FTAN will be set
21
//$admin_header = false;
22
// Tells script to update when this page was last updated
23
$update_when_modified = false;
24
// show the info banner
25
$print_info_banner = true;
26
// Include WB admin wrapper script
27
require(WB_PATH.'/modules/admin.php');
28

    
29
if(!$admin->checkFTAN('GET')) {
30
    $admin->print_error($MESSAGE['GENERIC_SECURITY_ACCESS'], ADMIN_URL.'/pages/modify.php?page_id='.$page_id);
31
}
32

    
33
// include core functions of WB 2.7 to edit the optional module CSS files (frontend.css, backend.css)
34
@include_once(WB_PATH .'/framework/module.functions.php');
35

    
36
// check if module language file exists for the language set by the user (e.g. DE, EN)
37
$sAddonName = basename(__DIR__);
38
require(WB_PATH .'/modules/'.$sAddonName.'/languages/EN.php');
39
if(file_exists(WB_PATH .'/modules/'.$sAddonName.'/languages/'.LANGUAGE .'.php')) {
40
    require(WB_PATH .'/modules/'.$sAddonName.'/languages/'.LANGUAGE .'.php');
41
}
42

    
43
// Get header and footer
44
$sql  = 'SELECT * FROM '.TABLE_PREFIX.'mod_news_settings '
45
      . 'WHERE section_id = '.$database->escapeString($section_id);
46
$query_content = $database->query( $sql );
47
$fetch_content = $query_content->fetchRow( MYSQLI_ASSOC );
48

    
49
// Set raw html <'s and >'s to be replace by friendly html code
50
$raw = array('<', '>');
51
$friendly = array('&lt;', '&gt;');
52
?>
53
<?php
54
if ($print_info_banner) {
55
?>
56
    </div><!--end class="block-outer" -->
57
<?php } ?>
58
<h2><?php echo $MOD_NEWS['SETTINGS']; ?></h2>
59
<?php
60
// include the button to edit the optional module CSS files (function added with WB 2.7)
61
// Note: CSS styles for the button are defined in backend.css (div class="mod_moduledirectory_edit_css")
62
// Place this call outside of any <form></form> construct!!!
63
?>
64
<div class="news">
65
<?php
66
if(function_exists('edit_module_css')){ edit_module_css('news');}
67
?><form name="modify" action="<?php echo WB_URL; ?>/modules/news/save_settings.php" method="post" style="margin: 0;">
68

    
69
   <input type="hidden" name="section_id" value="<?php echo $section_id; ?>" />
70
   <input type="hidden" name="page_id" value="<?php echo $page_id; ?>" />
71
   <?php echo $admin->getFTAN(); ?>
72
<div class="news block-outer">
73
    <table class="news">
74
      <caption class="news-header">
75
      <?php echo $HEADING['GENERAL_SETTINGS']; ?>
76
      </caption>
77
      </tbody>
78
      <tr>
79
         <td class="setting_name"><?php echo $TEXT['HEADER']; ?>:</td>
80
         <td class="setting_value">
81
            <textarea name="header" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo ($fetch_content['header']); ?></textarea>
82
         </td>
83
      </tr>
84
      <tr>
85
         <td class="setting_name"><?php echo $TEXT['POST'].' '.$TEXT['LOOP']; ?>:</td>
86
         <td class="setting_value">
87
            <textarea name="post_loop" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo ($fetch_content['post_loop']); ?></textarea>
88
         </td>
89
      </tr>
90
      <tr>
91
         <td class="setting_name"><?php echo $TEXT['FOOTER']; ?>:</td>
92
         <td class="setting_value">
93
            <textarea name="footer" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['footer'])); ?></textarea>
94
         </td>
95
      </tr>
96
      <tr>
97
         <td class="setting_name"><?php echo $TEXT['POST_HEADER']; ?>:</td>
98
         <td class="setting_value">
99
            <textarea name="post_header" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_header'])); ?></textarea>
100
         </td>
101
      </tr>
102
      <tr>
103
         <td class="setting_name"><?php echo $TEXT['POST_FOOTER']; ?>:</td>
104
         <td class="setting_value">
105
            <textarea name="post_footer" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['post_footer'])); ?></textarea>
106
         </td>
107
      </tr>
108
      <tr>
109
         <td class="setting_name"><?php echo $TEXT['POSTS_PER_PAGE']; ?>:</td>
110
         <td class="setting_value">
111
            <select name="posts_per_page">
112
               <option value="0"><?php echo $TEXT['UNLIMITED']; ?></option>
113
               <?php
114
               for($i = 1; $i <= 20; $i++) {
115
                  if($fetch_content['posts_per_page'] == ($i*5)) { $selected = ' selected="selected"'; } else { $selected = ''; }
116
                  echo '<option value="'.($i*5).'"'.$selected.'>'.($i*5).'</option>';
117
               }
118
               ?>
119
            </select>
120
         </td>
121
      </tr>
122
      </tbody>
123
    </table>
124
    </div>
125
    <div class="news block-outer" style="margin-top: 2.225em;">
126
     <table class="news file-ext">
127
      <caption class="news-header">
128
      <?php echo $TEXT['COMMENTS']; ?>
129
      </caption>
130
        <tbody>
131
        <tr>
132
           <td class="setting_name"><?php echo $TEXT['COMMENTING']; ?>:</td>
133
           <td class="setting_value">
134
              <select name="commenting">
135
                 <option value="none"><?php echo $TEXT['DISABLED']; ?></option>
136
                 <option value="public" <?php if($fetch_content['commenting'] == 'public') { echo ' selected="selected"'; } ?>><?php echo $TEXT['PUBLIC']; ?></option>
137
                 <option value="private" <?php if($fetch_content['commenting'] == 'private') { echo 'selected="selected"'; } ?>><?php echo $TEXT['PRIVATE']; ?></option>
138
              </select>
139
           </td>
140
        </tr>
141
        <tr>
142
           <td class="setting_name"><?php echo $TEXT['CAPTCHA_VERIFICATION']; ?>:</td>
143
           <td>
144
              <input type="radio" name="use_captcha" id="use_captcha_true" value="1"<?php if($fetch_content['use_captcha'] == true) { echo ' checked="checked"'; } ?> />
145
              <label for="use_captcha_true"><?php echo $TEXT['ENABLED']; ?></label>
146
              <input type="radio" name="use_captcha" id="use_captcha_false" value="0"<?php if($fetch_content['use_captcha'] == false) { echo ' checked="checked"'; } ?> />
147
              <label for="use_captcha_false"><?php echo $TEXT['DISABLED']; ?></label>
148
           </td>
149
        </tr>
150
        <?php if(extension_loaded('gd') AND function_exists('imageCreateFromJpeg')) { /* Make's sure GD library is installed */ ?>
151
        <tr>
152
           <td class="setting_name"><?php echo $TEXT['RESIZE_IMAGE_TO']; ?>:</td>
153
           <td class="setting_value">
154
              <select name="resize" >
155
                 <option value="0"><?php echo $TEXT['NONE']; ?></option>
156
                 <?php
157
                 $SIZES['50']  = '50x50px';
158
                 $SIZES['75']  = '75x75px';
159
                 $SIZES['100'] = '100x100px';
160
                 $SIZES['125'] = '125x125px';
161
                 $SIZES['150'] = '150x150px';
162
                 foreach($SIZES AS $size => $size_name) {
163
                    if($fetch_content['resize'] == $size) { $selected = ' selected="selected"'; } else { $selected = ''; }
164
                    echo '<option value="'.$size.'"'.$selected.'>'.$size_name.'</option>';
165
                 }
166
                 ?>
167
              </select>
168
           </td>
169
        </tr>
170
        <?php } ?>
171
        <tr>
172
           <td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['HEADER']; ?>:</td>
173
           <td class="setting_value">
174
              <textarea name="comments_header" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_header'])); ?></textarea>
175
           </td>
176
        </tr>
177
        <tr>
178
           <td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['LOOP']; ?>:</td>
179
           <td class="setting_value">
180
              <textarea name="comments_loop" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_loop'])); ?></textarea>
181
           </td>
182
        </tr>
183
        <tr>
184
           <td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['FOOTER']; ?>:</td>
185
           <td class="setting_value">
186
              <textarea name="comments_footer" rows="10" cols="1" style="width: 98%; height: 60px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_footer'])); ?></textarea>
187
           </td>
188
        </tr>
189
        <tr>
190
           <td class="setting_name"><?php echo $TEXT['COMMENTS'].' '.$TEXT['PAGE']; ?>:</td>
191
           <td class="setting_value">
192
              <textarea name="comments_page" rows="10" cols="1" style="width: 98%; height: 80px;"><?php echo str_replace($raw, $friendly, ($fetch_content['comments_page'])); ?></textarea>
193
           </td>
194
        </tr>
195
        </tbody>
196
     </table>
197
    </div><!--  -->
198
    <table class="news">
199
      <tbody>
200
      <tr>
201
         <td class="left">
202
            <input name="save" type="submit" value="<?php echo $TEXT['SAVE']; ?>" class="btn btn-default w3-blue-wb w3-round-small w3-hover-green w3-medium w3-padding-4" style="width: 25%; margin-top: 5px;" />
203
         </td>
204
         <td class="right">
205
            <input type="button" value="<?php echo $TEXT['CANCEL']; ?>" onclick="window.location = '<?php echo ADMIN_URL; ?>/pages/modify.php?page_id=<?php echo $page_id; ?>';" class="btn btn-default w3-blue-wb w3-round-small w3-hover-green w3-medium w3-padding-4" style="width: 25%; margin-top: 5px;" />
206
         </td>
207
      </tr>
208
      </tbody>
209
    </table>
210
</form>
211
</div><!--end class="news" -->
212

    
213
<?php
214
if ($print_info_banner) { ?>
215
    </div><!--end class="block-outer" -->
216
<?php
217
}
218
// Print admin footer
219
$admin->print_footer();
(22-22/36)