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