The best way to learn how to use the WebCore is by example. See the documentation for more information.
The requested URL is always shown first; if a page uses one or more WebCore templates, those are shown afterwards.
Source for: https://www.earthli.com/news/set_option.php
Uses WebCore template(s):
00 <?php
01
02 /****************************************************************************
03
04 Copyright (c) 2002-2014 Marco Von Ballmoos
05
06 This file is part of earthli News.
07
08 earthli News is free software; you can redistribute it and/or modify
09 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 earthli News is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with earthli News; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 For more information about the earthli News, visit:
23
24 http://www.earthli.com/software/webcore/news
25
26 ****************************************************************************/
27
28 require_once ('news/start.php');
29 require_once ($App->page_template_for ('webcore/pages/set_option.php'));
30 ?>
31
Source for template: webcore/pages/set_option.php
00 <?php
01
02 /****************************************************************************
03
04 Copyright (c) 2002-2014 Marco Von Ballmoos
05
06 This file is part of earthli WebCore.
07
08 earthli WebCore is free software; you can redistribute it and/or modify
09 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 earthli WebCore is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with earthli WebCore; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
22 For more information about the earthli WebCore, visit:
23
24 http://www.earthli.com/software/webcore
25
26 ****************************************************************************/
27
28 $last_page = urldecode (read_array_index($_GET, 'last_page'));
29 $opt_name = read_array_index($_GET, 'opt_name');
30 $opt_value = read_array_index($_GET, 'opt_value');
31 $opt_page_context = read_array_index($_GET, 'opt_page_context');
32 $opt_duration = read_array_index($_GET, 'opt_duration');
33
34 if (isset ($App) && !$opt_page_context)
35 {
36 $context = $App;
37 }
38 else
39 {
40 $context = $Page;
41 }
42
43 if ($last_page && $opt_name)
44 {
45 if (is_numeric($opt_duration))
46 {
47 $context->storage->expire_in_n_days($opt_duration);
48 }
49 else
50 {
51 $context->storage->expire_in_n_days($context->storage_options->setting_duration);
52 }
53
54 $context->storage->set_value($opt_name, $opt_value);
55 $Env->redirect_root($last_page);
56 }
57 else
58 {
59 $Page->start_display();
60 echo "<div class=\"error\">Could not set [$opt_name] to [$opt_value].</div>";
61 $Page->finish_display();
62 }