index.php 9.85 KB
Newer Older
1
<?php
2 3 4 5
	if (file_exists("install") && !file_exists("config.php")) {
		header("Location: install/");
	}

6 7 8 9 10 11
	if (!file_exists("config.php")) {
		print "<b>Fatal Error</b>: You forgot to copy
		<b>config.php-dist</b> to <b>config.php</b> and edit it.\n";
		exit;
	}

12 13
	// we need a separate check here because functions.php might get parsed
	// incorrectly before 5.3 because of :: syntax.
14
	if (version_compare(PHP_VERSION, '5.3.0', '<')) {
15 16 17 18
		print "<b>Fatal Error</b>: PHP version 5.3.0 or newer required.\n";
		exit;
	}

19 20
	set_include_path(dirname(__FILE__) ."/include" . PATH_SEPARATOR .
		get_include_path());
21

22
	require_once "autoload.php";
23
	require_once "sessions.php";
24
	require_once "functions.php";
25 26 27 28
	require_once "sanity_check.php";
	require_once "version.php";
	require_once "config.php";
	require_once "db-prefs.php";
29 30 31 32
	require_once "lib/Mobile_Detect.php";

	$mobile = new Mobile_Detect();

33
	if (!init_plugins()) return;
34

35
	if (!$_REQUEST['mobile']) {
36
		if ($mobile->isTablet() && PluginHost::getInstance()->get_plugin("digest")) {
37
			header('Location: backend.php?op=digest');
38
			exit;
39
		} else if ($mobile->isMobile() && PluginHost::getInstance()->get_plugin("mobile")) {
40 41
			header('Location: backend.php?op=mobile');
			exit;
42
		} else if ($mobile->isMobile() && PluginHost::getInstance()->get_plugin("digest")) {
43
			header('Location: backend.php?op=digest');
44 45 46
			exit;
		}
	}
47

48
	login_sequence();
49 50 51 52 53 54 55 56 57

	header('Content-Type: text/html; charset=utf-8');

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>Tiny Tiny RSS</title>
58

59
	<?php stylesheet_tag("lib/dijit/themes/claro/claro.css"); ?>
60
	<?php stylesheet_tag("css/layout.css"); ?>
61

62
	<?php if ($_SESSION["uid"]) {
63
		$theme = get_pref( "USER_CSS_THEME", $_SESSION["uid"], false);
64
		if ($theme && file_exists("themes/$theme")) {
65
			stylesheet_tag("themes/$theme");
66 67
		} else {
			stylesheet_tag("themes/default.css");
68 69 70 71
		}
	}
	?>

72
	<?php print_user_stylesheet() ?>
73

74 75
	<style type="text/css">
	<?php
76
		foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
77 78 79 80 81 82
			if (method_exists($p, "get_css")) {
				echo $p->get_css();
			}
		}
	?>
	</style>
83

84
	<link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
85 86 87 88 89 90 91 92
	<link rel="icon" type="image/png" sizes="72x72" href="images/favicon-72px.png" />

	<?php
	foreach (array("lib/prototype.js",
				"lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls",
				"lib/dojo/dojo.js",
				"lib/dojo/tt-rss-layer.js",
				"errors.php?mode=js") as $jsfile) {
93

94
		javascript_tag($jsfile);
95

96
	} ?>
97

98
	<script type="text/javascript">
99
		require({cache:{}});
100
	<?php
101
		require 'lib/jshrink/Minifier.php';
102

103
		print get_minified_js(array("tt-rss",
104
			"functions", "feedlist", "viewfeed", "FeedTree", "PluginHost"));
105

106
		foreach (PluginHost::getInstance()->get_plugins() as $n => $p) {
107
			if (method_exists($p, "get_js")) {
108
				echo JShrink\Minifier::minify($p->get_js());
109 110 111
			}
		}

112
		init_js_translations();
113 114 115
	?>
	</script>

116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

	<script type="text/javascript">
		Event.observe(window, 'load', function() {
			init();
		});
	</script>
</head>

<body id="ttrssMain" class="claro">

<div id="overlay" style="display : block">
	<div id="overlay_inner">
		<div class="insensitive"><?php echo __("Loading, please wait...") ?></div>
		<div dojoType="dijit.ProgressBar" places="0" style="width : 300px" id="loading_bar"
	     progress="0" maximum="100">
		</div>
		<noscript><br/><?php print_error('Javascript is disabled. Please enable it.') ?></noscript>
	</div>
</div>

137
<div id="notify" class="notify" style="display : none"></div>
138 139 140 141 142 143 144 145 146 147 148 149 150
<div id="cmdline" style="display : none"></div>
<div id="headlines-tmp" style="display : none"></div>

<div id="main" dojoType="dijit.layout.BorderContainer">

<div id="feeds-holder" dojoType="dijit.layout.ContentPane" region="leading" style="width : 20%" splitter="true">
	<div id="feedlistLoading">
		<img src='images/indicator_tiny.gif'/>
		<?php echo  __("Loading, please wait..."); ?></div>
	<div id="feedTree"></div>
</div>

<div dojoType="dijit.layout.BorderContainer" region="center" id="header-wrap" gutters="false">
151
<div dojoType="dijit.layout.BorderContainer" region="center" id="content-wrap">
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170

<div id="toolbar" dojoType="dijit.layout.ContentPane" region="top">
	<div id="main-toolbar" dojoType="dijit.Toolbar">

		<form id="main_toolbar_form" action="" onsubmit='return false'>

		<button dojoType="dijit.form.Button" id="collapse_feeds_btn"
			onclick="collapse_feedlist()"
			title="<?php echo __('Collapse feedlist') ?>" style="display : inline">
			&lt;&lt;</button>

		<select name="view_mode" title="<?php echo __('Show articles') ?>"
			onchange="viewModeChanged()"
			dojoType="dijit.form.Select">
			<option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
			<option value="all_articles"><?php echo __('All Articles') ?></option>
			<option value="marked"><?php echo __('Starred') ?></option>
			<option value="published"><?php echo __('Published') ?></option>
			<option value="unread"><?php echo __('Unread') ?></option>
171 172
			<option value="unread_first"><?php echo __('Unread First') ?></option>
			<option value="has_note"><?php echo __('With Note') ?></option>
173 174 175 176 177 178 179
			<!-- <option value="noscores"><?php echo __('Ignore Scoring') ?></option> -->
		</select>

		<select title="<?php echo __('Sort articles') ?>"
			onchange="viewModeChanged()"
			dojoType="dijit.form.Select" name="order_by">
			<option selected="selected" value="default"><?php echo __('Default') ?></option>
180 181
			<option value="feed_dates"><?php echo __('Newest first') ?></option>
			<option value="date_reverse"><?php echo __('Oldest first') ?></option>
182
			<option value="title"><?php echo __('Title') ?></option>
183 184
		</select>

185 186 187 188 189 190 191 192 193 194 195 196 197 198
		<div dojoType="dijit.form.ComboButton" onclick="catchupCurrentFeed()">
			<span><?php echo __('Mark as read') ?></span>
			<div dojoType="dijit.DropDownMenu">
				<div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('1day')">
					<?php echo __('Older than one day') ?>
				</div>
				<div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('1week')">
					<?php echo __('Older than one week') ?>
				</div>
				<div dojoType="dijit.MenuItem" onclick="catchupCurrentFeed('2week')">
					<?php echo __('Older than two weeks') ?>
				</div>
			</div>
		</div>
199 200 201 202

		</form>

		<div class="actionChooser">
203

204
			<?php
205
				foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_TOOLBAR_BUTTON) as $p) {
206 207 208 209
					 echo $p->hook_toolbar_button();
				}
			?>

210 211 212
			<button id="net-alert" dojoType="dijit.form.Button" style="display : none" disabled="true"
				title="<?php echo __("Communication problem with server.") ?>">
			<img
213
				src="images/alert.png" />
214 215 216 217
			</button>

			<button id="newVersionIcon" dojoType="dijit.form.Button" style="display : none">
			<img onclick="newVersionDlg()"
218
				src="images/new_version.png"
219 220 221 222
				title="<?php echo __('New version of Tiny Tiny RSS is available!') ?>" />
			</button>


223 224 225
			<div dojoType="dijit.form.DropDownButton">
				<span><?php echo __('Actions...') ?></span>
				<div dojoType="dijit.Menu" style="display: none">
226
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcPrefs')"><?php echo __('Preferences...') ?></div>
227 228 229 230
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcSearch')"><?php echo __('Search...') ?></div>
					<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Feed actions:') ?></div>
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFeed')"><?php echo __('Subscribe to feed...') ?></div>
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcEditFeed')"><?php echo __('Edit this feed...') ?></div>
231
					<!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRescoreFeed')"><?php echo __('Rescore feed') ?></div> -->
232 233 234 235 236
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcRemoveFeed')"><?php echo __('Unsubscribe') ?></div>
					<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('All feeds:') ?></div>
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcCatchupAll')"><?php echo __('Mark as read') ?></div>
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcShowOnlyUnread')"><?php echo __('(Un)hide read feeds') ?></div>
					<div dojoType="dijit.MenuItem" disabled="1"><?php echo __('Other actions:') ?></div>
237
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcToggleWidescreen')"><?php echo __('Toggle widescreen mode') ?></div>
238
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcTagSelect')"><?php echo __('Select by tags...') ?></div>
239 240
					<!-- <div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddLabel')"><?php echo __('Create label...') ?></div>
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcAddFilter')"><?php echo __('Create filter...') ?></div> -->
241
					<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcHKhelp')"><?php echo __('Keyboard shortcuts help') ?></div>
242 243

					<?php
244
						foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_ACTION_ITEM) as $p) {
245 246 247 248
						 echo $p->hook_action_item();
						}
					?>

249 250 251
					<?php if (!$_SESSION["hide_logout"]) { ?>
						<div dojoType="dijit.MenuItem" onclick="quickMenuGo('qmcLogout')"><?php echo __('Logout') ?></div>
					<?php } ?>
252 253 254 255 256 257 258 259 260 261 262
				</div>
			</div>
		</div>
	</div> <!-- toolbar -->
</div> <!-- toolbar pane -->

	<div id="headlines-wrap-inner" dojoType="dijit.layout.BorderContainer" region="center">

		<div id="headlines-toolbar" dojoType="dijit.layout.ContentPane" region="top">
		</div>

263 264
		<div id="floatingTitle" style="display : none"></div>

265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281
		<div id="headlines-frame" dojoType="dijit.layout.ContentPane"
				onscroll="headlines_scroll_handler(this)" region="center">
			<div id="headlinesInnerContainer">
				<div class="whiteBox"><?php echo __('Loading, please wait...') ?></div>
			</div>
		</div>

		<div id="content-insert" dojoType="dijit.layout.ContentPane" region="bottom"
			style="height : 50%" splitter="true"></div>

	</div>
</div>
</div>
</div>

</body>
</html>