summaryrefslogtreecommitdiffstats
path: root/admin/index.php
diff options
context:
space:
mode:
authorPascal Chevrel <pascal@chevrel.org>2012-03-08 13:50:12 +0100
committerPascal Chevrel <pascal@chevrel.org>2012-03-08 13:50:12 +0100
commit781e77848b95e81c9865212385bab22f3013061e (patch)
tree537418ccbda4d78eb3312795b84d92b43aaeab3c /admin/index.php
parentf9c924b70c2722fd6b4b559ce623c4a83c056418 (diff)
parent60b537a088b2052896447a078948748ea43084a6 (diff)
downloadplanet-781e77848b95e81c9865212385bab22f3013061e.tar
planet-781e77848b95e81c9865212385bab22f3013061e.tar.gz
planet-781e77848b95e81c9865212385bab22f3013061e.tar.bz2
planet-781e77848b95e81c9865212385bab22f3013061e.tar.xz
planet-781e77848b95e81c9865212385bab22f3013061e.zip
Merge branch 'master' into ConvertPHP4code
Diffstat (limited to 'admin/index.php')
-rwxr-xr-x[-rw-r--r--]admin/index.php163
1 files changed, 74 insertions, 89 deletions
diff --git a/admin/index.php b/admin/index.php
index feee813..1a43020 100644..100755
--- a/admin/index.php
+++ b/admin/index.php
@@ -1,52 +1,75 @@
<?php
-require_once dirname(__FILE__).'/inc/auth.inc.php';
-include_once(dirname(__FILE__).'/../app/classes/Planet.class.php');
+require_once dirname(__FILE__) . '/inc/auth.inc.php';
+require_once dirname(__FILE__) . '/../app/app.php';
-//Load configuration
-if (is_file(dirname(__FILE__).'/../custom/config.yml')){
- $conf = Spyc::YAMLLoad(dirname(__FILE__).'/../custom/config.yml');
- $PlanetConfig = new PlanetConfig($conf);
-} else {
- die('Config file (custom/config.yml) is missing.');
+//Load configuration
+$config_file = dirname(__FILE__) . '/../custom/config.yml';
+
+if (is_file($config_file)){
+ $conf = Spyc::YAMLLoad($config_file);
+ $PlanetConfig = new PlanetConfig($conf);
+} else {
+ die('Config file (custom/config.yml) is missing.');
}
-//Instantiate app
+//Instantiate app
$Planet = new Planet($PlanetConfig);
-
+
//Load
-if (0 < $Planet->loadOpml(dirname(__FILE__).'/../custom/people.opml')) {
- $Planet->loadFeeds();
- $items = $Planet->getItems();
+if (0 < $Planet->loadOpml(dirname(__FILE__) . '/../custom/people.opml')) {
+ $Planet->loadFeeds();
+ $items = $Planet->getItems();
}
-
-$everyone = $Planet->getPeople();
-header('Content-type: text/HTML; charset=UTF-8');
-?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="Content-Type" content="text/HTML; charset=UTF-8" />
- <meta http-equiv="Content-Script-Type" content="text/javascript" />
- <meta http-equiv="Content-Style-Type" content="text/css" />
- <meta http-equiv="Content-Language" content="en" />
+$everyone = $Planet->getPeople();
+$count_feeds = count($everyone);
+$page_id = 'admin-feed';
+$footer_extra = <<<FRAGMENT
+ <script>
+ var allCheckboxes = function(status){
+ var form = document.getElementById('feedmanage');
+ var selectboxes = form.getElementsByTagName('input');
+ for (var i=0; i<selectboxes.length; i++){
+ if ('checkbox' == selectboxes[i].type){
+ selectboxes[i].checked = status;
+ }
+ }
+ }
+
+ window.onload = function(){
+ //Select/unselect rows
+ var form = document.getElementById('feedmanage');
+ var selectboxes = form.getElementsByTagName('input');
+ for (var i=0; i<selectboxes.length; i++){
+ if ('checkbox' == selectboxes[i].type) {
+ selectboxes[i].onchange = function() {
+ var tr = this.parentNode.parentNode;
+ if (this.checked) {
+ tr.className += ' selected';
+ } else {
+ tr.className = tr.className.replace('selected','');
+ }
+ }
+ }
+ }
+
+ var btSelectall = document.getElementById('selectall');
+ btSelectall.onclick = function(){
+ allCheckboxes('checked');
+ }
- <title>moonmoon administration</title>
- <link rel="stylesheet" media="screen" type="text/css" href="default.css" />
-</head>
+ var btSelectnone = document.getElementById('selectnone');
+ btSelectnone.onclick = function(){
+ allCheckboxes('');
+ }
+ }
+ </script>
+FRAGMENT;
-<body id="admin-feed">
- <div id="page">
- <div id="header">
- <h1>moonmoon</h1>
- <p><a href="../">Back to main page</a></p>
- </div>
-
- <?php readfile("inc/nav.inc.php"); ?>
+ob_start();
+?>
- <div id="content">
<div class="widget">
<h3>Add a new feed</h3>
<form action="subscriptions.php" method="post" id="feedimport">
@@ -63,7 +86,7 @@ header('Content-type: text/HTML; charset=UTF-8');
<h3>Manage existing feeds</h3>
<form action="subscriptions.php" method="post" id="feedmanage">
<p class="action">
- <span class="count">Number of feeds: <?php echo count($everyone); ?></span>
+ <span class="count">Number of feeds: <?=$count_feeds?></span>
<input type="submit" class="submit save" name="save" id="save" value="Save changes" />
<input type="submit" class="submit delete" name="delete" id="delete" value="Delete selected" />
</p>
@@ -79,16 +102,16 @@ header('Content-type: text/HTML; charset=UTF-8');
</tr>
</thead>
<tbody>
- <?php
+ <?php
$i = 0;
foreach ($everyone as $opml_person){
$i++;
?>
- <tr class="<?php echo ($i%2)?'odd':'even'; ?>">
- <td><input type="checkbox" class="checkbox" name="opml[<?php echo $i; ?>][delete]" /></td>
- <td><input type="text" size="10" class="text" name="opml[<?php echo $i; ?>][name]" value="<?php echo $opml_person->getName(); ?>" /></td>
+ <tr class="<?=($i%2)?'odd':'even'; ?>">
+ <td><input type="checkbox" class="checkbox" name="opml[<?=$i; ?>][delete]" /></td>
+ <td><input type="text" size="10" class="text" name="opml[<?=$i; ?>][name]" value="<?=$opml_person->getName(); ?>" /></td>
<td>
- <?php
+ <?php
$items = $opml_person->get_items();
if (count($items) > 0) {
echo $items[0]->get_date();
@@ -97,55 +120,17 @@ header('Content-type: text/HTML; charset=UTF-8');
}
?>
</td>
- <td><input type="text" size="30" class="text" name="opml[<?php echo $i; ?>][website]" value="<?php echo $opml_person->getWebsite(); ?>" /></td>
- <td><input type="text" size="30" class="text" name="opml[<?php echo $i; ?>][feed]" value="<?php echo $opml_person->getFeed(); ?>" /></td>
+ <td><input type="text" size="30" class="text" name="opml[<?=$i; ?>][website]" value="<?=$opml_person->getWebsite(); ?>" /></td>
+ <td><input type="text" size="30" class="text" name="opml[<?=$i; ?>][feed]" value="<?=$opml_person->getFeed(); ?>" /></td>
</tr>
<?php } ?>
</tbody>
</table>
</form>
</div>
- </div>
- </div>
-
- <script>
- var allCheckboxes = function(status){
- var form = document.getElementById('feedmanage');
- var selectboxes = form.getElementsByTagName('input');
- for (var i=0; i<selectboxes.length; i++){
- if ('checkbox' == selectboxes[i].type){
- selectboxes[i].checked = status;
- }
- }
- }
-
- window.onload = function(){
- //Select/unselect rows
- var form = document.getElementById('feedmanage');
- var selectboxes = form.getElementsByTagName('input');
- for (var i=0; i<selectboxes.length; i++){
- if ('checkbox' == selectboxes[i].type) {
- selectboxes[i].onchange = function() {
- var tr = this.parentNode.parentNode;
- if (this.checked) {
- tr.className += ' selected';
- } else {
- tr.className = tr.className.replace('selected','');
- }
- }
- }
- }
-
- var btSelectall = document.getElementById('selectall');
- btSelectall.onclick = function(){
- allCheckboxes('checked');
- }
-
- var btSelectnone = document.getElementById('selectnone');
- btSelectnone.onclick = function(){
- allCheckboxes('');
- }
- }
- </script>
-</body>
-</html>
+<?php
+$page_content = ob_get_contents();
+ob_end_clean();
+
+$admin_access = 1;
+require_once dirname(__FILE__) . '/template.php';