Completed
Push — master ( 10ca4a...489916 )
by Cody
24s queued 12s
created

index.php (6 issues)

1
<?php
2
    if (file_exists("install") && !file_exists("config.php")) {
3
        header("Location: install/");
4
    }
5
6
    if (!file_exists("config.php")) {
7
        print "<b>Fatal Error</b>: You forgot to copy
8
		<b>config.php-dist</b> to <b>config.php</b> and edit it.\n";
9
        exit;
10
    }
11
12
    // we need a separate check here because functions.php might get parsed
13
    // incorrectly before 5.3 because of :: syntax.
14
    if (version_compare(PHP_VERSION, '5.6.0', '<')) {
15
        print "<b>Fatal Error</b>: PHP version 5.6.0 or newer required. You're using ".PHP_VERSION.".\n";
16
        exit;
17
    }
18
19
    set_include_path(dirname(__FILE__)."/include".PATH_SEPARATOR.
20
        get_include_path());
21
22
    require_once "autoload.php";
23
    require_once "sessions.php";
24
    require_once "functions.php";
25
    require_once "sanity_check.php";
26
    require_once "config.php";
27
    require_once "db-prefs.php";
28
29
    if (!init_plugins()) {
30
        return;
31
    }
32
33
    login_sequence();
34
35
    header('Content-Type: text/html; charset=utf-8');
36
37
?>
38
<!DOCTYPE html>
39
<html>
40
<head>
41
	<title>Tiny Tiny RSS</title>
42
    <meta name="viewport" content="initial-scale=1,width=device-width" />
43
44
	<?php if ($_SESSION["uid"]) {
45
        $theme = get_pref("USER_CSS_THEME", false, false);
46
        if ($theme && theme_exists("$theme")) {
47
            echo stylesheet_tag(get_theme_path($theme), 'theme_css');
48
        }
49
    }
50
51
    print_user_stylesheet()
52
53
    ?>
54
	<style type="text/css">
55
	<?php
56
        foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
57
            if (method_exists($p, "get_css")) {
58
                echo $p->get_css();
59
            }
60
        }
61
    ?>
62
	</style>
63
64
	<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
65
	<link rel="icon" type="image/png" sizes="72x72" href="images/favicon-72px.png" />
66
67
	<script>
68
		dojoConfig = {
69
			async: true,
70
			cacheBust: "<?php echo get_scripts_timestamp(); ?>",
71
			packages: [
72
				{ name: "fox", location: "../../js" },
73
			]
74
		};
75
	</script>
76
77
	<?php
78
    foreach (array("lib/prototype.js",
79
                "lib/scriptaculous/scriptaculous.js?load=effects,controls",
80
                "lib/dojo/dojo.js",
81
                "lib/dojo/tt-rss-layer.js",
82
                "js/tt-rss.js",
83
                "js/common.js",
84
                "errors.php?mode=js") as $jsfile) {
85
86
        echo javascript_tag($jsfile);
87
88
    } ?>
89
90
	<script type="text/javascript">
91
		require({cache:{}});
92
	</script>
93
94
	<script type="text/javascript">
95
	<?php
96
        foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
0 ignored issues
show
Comprehensibility Bug introduced by
$p is overwriting a variable from outer foreach loop.
Loading history...
Comprehensibility Bug introduced by
$n is overwriting a variable from outer foreach loop.
Loading history...
97
            if (method_exists($p, "get_js")) {
98
                $script = $p->get_js();
99
100
                if ($script) {
101
                    echo "try {
102
					    $script
103
					} catch (e) {
104
                        console.warn('failed to initialize plugin JS: $n', e);
105
                    }";
106
                }
107
            }
108
        }
109
110
        init_js_translations();
111
    ?>
112
	</script>
113
114
	<style type="text/css">
115
		@media (prefers-color-scheme: dark) {
116
			body {
117
				background : #303030;
118
			}
119
		}
120
121
		body.css_loading * {
122
			display : none;
123
		}
124
	</style>
125
126
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
127
	<meta name="referrer" content="no-referrer"/>
128
</head>
129
130
<body class="flat ttrss_main ttrss_index css_loading">
131
132
<div id="overlay" style="display : block">
133
	<div id="overlay_inner">
134
		<?php echo __("Loading, please wait...") ?>
135
		<div dojoType="dijit.ProgressBar" places="0" style="width : 300px" id="loading_bar"
136
	     progress="0" maximum="100">
137
		</div>
138
		<noscript><br/><?php print_error('Javascript is disabled. Please enable it.') ?></noscript>
139
	</div>
140
</div>
141
142
<div id="notify" class="notify"></div>
143
<div id="cmdline" style="display : none"></div>
144
145
<div id="main" dojoType="dijit.layout.BorderContainer">
146
    <div id="feeds-holder" dojoType="dijit.layout.ContentPane" region="leading" style="width : 20%" splitter="true">
147
        <div id="feedlistLoading">
148
            <img src='images/indicator_tiny.gif'/>
149
            <?php echo  __("Loading, please wait..."); ?></div>
150
        <?php
151
            foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_FEED_TREE) as $p) {
0 ignored issues
show
Comprehensibility Bug introduced by
$p is overwriting a variable from outer foreach loop.
Loading history...
152
            echo $p->hook_feed_tree();
153
            }
154
        ?>
155
        <div id="feedTree"></div>
156
    </div>
157
158
    <div dojoType="dijit.layout.BorderContainer" region="center" id="content-wrap">
159
        <div id="toolbar-frame" dojoType="dijit.layout.ContentPane" region="top">
160
            <div id="toolbar" dojoType="fox.Toolbar">
161
162
            <i class="material-icons net-alert" style="display : none"
163
                title="<?php echo __("Communication problem with server.") ?>">error_outline</i>
164
165
            <i class="material-icons log-alert" style="display : none"
166
                 title="<?php echo __("Recent entries found in event log.") ?>">warning</i>
167
168
            <i id="updates-available" class="material-icons icon-new-version" style="display : none"
169
               title="<?php echo __('Updates are available from Git.') ?>">new_releases</i>
170
171
            <?php
172
            foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_MAIN_TOOLBAR_BUTTON) as $p) {
0 ignored issues
show
Comprehensibility Bug introduced by
$p is overwriting a variable from outer foreach loop.
Loading history...
173
                echo $p->hook_main_toolbar_button();
174
            }
175
            ?>
176
177
            <form id="toolbar-headlines" action="" style="order : 10" onsubmit='return false'>
178
179
            </form>
180
181
            <form id="toolbar-main" action="" style="order : 20" onsubmit='return false'>
182
183
            <select name="view_mode" title="<?php echo __('Show articles') ?>"
184
                onchange="App.onViewModeChanged()"
185
                dojoType="fox.form.Select">
186
                <option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
187
                <option value="all_articles"><?php echo __('All Articles') ?></option>
188
                <option value="marked"><?php echo __('Starred') ?></option>
189
                <option value="published"><?php echo __('Published') ?></option>
190
                <option value="unread"><?php echo __('Unread') ?></option>
191
                <option value="has_note"><?php echo __('With Note') ?></option>
192
                <!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
193
            </select>
194
195
			<select title="<?php echo __('Sort articles') ?>"
196
                onchange="App.onViewModeChanged()"
197
                dojoType="fox.form.Select" name="order_by">
198
199
				<option selected="selected" value="default"><?php echo __('Default') ?></option>
200
                <option value="feed_dates"><?php echo __('Newest first') ?></option>
201
                <option value="date_reverse"><?php echo __('Oldest first') ?></option>
202
                <option value="title"><?php echo __('Title') ?></option>
203
            </select>
204
205
            <div dojoType="fox.form.ComboButton" onclick="Feeds.catchupCurrent()">
206
                <span><?php echo __('Mark as read') ?></span>
207
                <div dojoType="dijit.DropDownMenu">
208
                    <div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrent('1day')">
209
                        <?php echo __('Older than one day') ?>
210
                    </div>
211
                    <div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrent('1week')">
212
                        <?php echo __('Older than one week') ?>
213
                    </div>
214
                    <div dojoType="dijit.MenuItem" onclick="Feeds.catchupCurrent('2week')">
215
                        <?php echo __('Older than two weeks') ?>
216
                    </div>
217
                </div>
218
            </div>
219
220
            </form>
221
222
            <div class="action-chooser" style="order : 30">
223
224
                <?php
225
                    foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_TOOLBAR_BUTTON) as $p) {
0 ignored issues
show
Comprehensibility Bug introduced by
$p is overwriting a variable from outer foreach loop.
Loading history...
226
                            echo $p->hook_toolbar_button();
227
                    }
228
                ?>
229
230
                <div dojoType="fox.form.DropDownButton" class="action-button" title="<?php echo __('Actions...') ?>">
231
					<span><i class="material-icons">menu</i></span>
232
                    <div dojoType="dijit.Menu" style="display: none">
233
                        <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcPrefs')"><?php echo __('Preferences...') ?></div>
234
                        <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcSearch')"><?php echo __('Search...') ?></div>
235
                        <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Feed actions:') ?></div>
236
                        <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcAddFeed')"><?php echo __('Subscribe to feed...') ?></div>
237
                        <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcEditFeed')"><?php echo __('Edit this feed...') ?></div>
238
                        <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcRemoveFeed')"><?php echo __('Unsubscribe') ?></div>
239
                        <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('All feeds:') ?></div>
240
                        <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
241
                        <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
242
                        <div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
243
                        <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
244
                        <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
245
246
                        <?php
247
                            foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) {
0 ignored issues
show
Comprehensibility Bug introduced by
$p is overwriting a variable from outer foreach loop.
Loading history...
248
                                echo $p->hook_action_item();
249
                            }
250
                        ?>
251
252
                        <?php if (!$_SESSION["hide_logout"]) { ?>
253
                            <div dojoType="dijit.MenuItem" onclick="App.onActionSelected('qmcLogout')"><?php echo __('Logout') ?></div>
254
                        <?php } ?>
255
                    </div>
256
                </div>
257
            </div>
258
        </div> <!-- toolbar -->
259
        </div> <!-- toolbar pane -->
260
        <div id="headlines-wrap-inner" dojoType="dijit.layout.BorderContainer" region="center">
261
            <div id="floatingTitle" style="display : none"></div>
262
            <div id="headlines-frame" dojoType="dijit.layout.ContentPane" tabindex="0"
263
                    region="center">
264
                <div id="headlinesInnerContainer">
265
                    <div class="whiteBox"><?php echo __('Loading, please wait...') ?></div>
266
                </div>
267
            </div>
268
            <div id="content-insert" dojoType="dijit.layout.ContentPane" region="bottom"
269
                style="height : 50%" splitter="true"></div>
270
        </div>
271
    </div>
272
</div>
273
274
</body>
275
</html>
276