diff options
author | Maurice Svay <maurice@svay.com> | 2012-03-10 15:13:05 +0100 |
---|---|---|
committer | Maurice Svay <maurice@svay.com> | 2012-03-10 15:13:05 +0100 |
commit | c4ff5b85f0066a0db33a876bd85963e1fa04ce83 (patch) | |
tree | 5d88191a40380a45430f25dd9ae24a3b4b265a84 /admin | |
parent | 69bf1b314b84c979c220e26b931e722712b5d531 (diff) | |
parent | 926e36b8fdf8ceaf59ac72e1b28b862f42978b84 (diff) | |
download | planet-c4ff5b85f0066a0db33a876bd85963e1fa04ce83.tar planet-c4ff5b85f0066a0db33a876bd85963e1fa04ce83.tar.gz planet-c4ff5b85f0066a0db33a876bd85963e1fa04ce83.tar.bz2 planet-c4ff5b85f0066a0db33a876bd85963e1fa04ce83.tar.xz planet-c4ff5b85f0066a0db33a876bd85963e1fa04ce83.zip |
Merge branch 'cleanup' of https://github.com/pascalchevrel/moonmoon into pascalchevrel-cleanup
Conflicts:
admin/default.css
app/classes/Planet.class.php
Diffstat (limited to 'admin')
-rwxr-xr-x | admin/default.css | 466 | ||||
-rw-r--r-- | admin/inc/auth.inc.php | 4 | ||||
-rwxr-xr-x | admin/index.php | 272 |
3 files changed, 370 insertions, 372 deletions
diff --git a/admin/default.css b/admin/default.css index 5c954b0..50854c1 100755 --- a/admin/default.css +++ b/admin/default.css @@ -1,234 +1,232 @@ -html, body{
- margin: 0;
- padding: 0;
-}
-html{
- font-size: 62.5%;
-}
-body{
- background: #FFF;
- color: #333;
- font: 1.1em/1.6em "Lucida Grande", Tahoma, Arial, sans-serif;
-}
-
-
-fieldset{
- border: 0;
- padding: 0;
- margin: 1em 0;
-}
-input.text{
- border: 1px solid #BBB;
- padding: 4px;
-}
-input.submit{
- font-size: 1em;
- padding: 4px;
- background: #D1D1D1 url(img/button.png) repeat-x left center;
- border: 1px solid #FFF;
- border-bottom: 1px solid #CECECE;
- border-right: 1px solid #CECECE;
- cursor: pointer;
-}
-input.submit:hover{
- background: #D1D1D1 url(img/button-h.png) repeat-x left center;
- color: #000;
- border: 1px solid #FFF;
- border-bottom: 1px solid #C6C6C6;
- border-right: 1px solid #C6C6C6;
-}
-input.delete{
- margin-left: 1em;
-}
-input.delete:hover{
- background: #ffabab url(img/button-delete.png) repeat-x left center;
- color: #C00;
- border: 1px solid #FCC;
- border-bottom: 1px solid #F99;
- border-right: 1px solid #F99;
-}
-input.add{
- font-weight: bold;
-}
-input.add:hover{
- background: #65a5e1 url(img/button-add.png) repeat-x left center;
- color: #20466a;
- border: 1px solid #a6c7e5;
- border-bottom: 1px solid #4f90cd;
- border-right: 1px solid #4f90cd;
-}
-p.help{
- font-size: 0.8em;
- color: #999;
- margin: 0;
-}
-
-#page{
-}
-
- header{
- background: #E0E0E0 url(img/moonmoon.png) no-repeat right center;
- border-top: 5px solid #D0D0D0;
- margin: 0;
- padding: 10px;
- }
- header h1{
- display: none;
- margin: 0 0 0 20px;
- padding: 0;
- height: 14px;
- width: 95px;
- background: transparent url(img/moonmoon.png) no-repeat left center;
-
- overflow: hidden;
- text-indent: -1000em;
- }
- header p{
- margin: 0 0 0 20px;
- padding: 0;
- }
- header p a{
- color: #AAA;
- }
- header p a:hover{
- color: #111;
- }
-
-
- nav ul{
- margin: 20px 30px;
- padding: 0;
- list-style: none;
- }
- nav ul:after {content: "."; display: block; height: 0; clear: both; visibility: hidden; }
- nav ul {display: inline-table;}
- /* Hides from IE-mac \*/
- * html nav ul {height: 1%;}
- nav ul {display: block;}
- /* End hide from IE-mac */
-
- nav ul li{
- display: block;
- float: left;
- }
- nav ul li a{
- display: block;
- border: 1px solid #DDD;
- padding: 8px 8px 8px 36px;
- margin-right: 8px;
- text-decoration: none;
- color: #666;
- background-repeat: no-repeat;
- background-position: 6px center;
- }
- nav ul li a:hover,
- body#admin-feed #nav-feed a,
- body#admin-admin #nav-admin a {
- background-color: #f0f2f6;
- border-color: #AAA;
- color: #111;
- }
- #nav-feed a{
- background-image: url(img/nav-feed.png);
- }
- #nav-admin a{
- background-image: url(img/nav-admin.png);
- }
-
- #content{
- margin: 20px 30px;
- }
-
- .widget{
- margin: 20px 0;
- }
- .widget h3{
- background: #3e4350 url(img/h3.png) repeat-x left center;
- color: #FFF;
- text-transform: uppercase;
- margin: 0;
- padding: 10px;
- height: 20px;
- clear:both;
- }
- .widget form{
- padding: 10px;
- border: 1px solid #EEE;
- border-top: 0;
- }
-
- #feedmanage p.select{
- margin: 3px 0;
- }
- #feedmanage p.action span.count{
- float: right;
- padding-right: 10px;
- font-size: 1.3em;
- }
- #feedmanage table{
- width: 99%;
- border-collapse: collapse;
- border: 1px solid #f0f2f6;
- }
- #feedmanage thead th{
- background: #f0f2f6;
- text-align: left;
- padding: 6px;
- }
- #feedmanage thead span{
- display: none;
- }
- #feedmanage tr{
- border-bottom: 1px solid #e8ebf1;
- }
- #feedmanage tr.even td{
- background: #f0f2f6;
- width: auto;
- }
- #feedmanage .text{
- background: transparent;
- border: 1px solid #FFF;
- width: 90%;
- }
- #feedmanage tr.even td .text{
- border: 1px solid #f0f2f6;
- }
- #feedmanage tr td input.text:focus{
- background: #FFF;
- border: 1px solid #4392b7;
- }
-
- #feedmanage tr.selected td{
- background: #ffabab;
- background: #4392b7;
- color: #FFF;
- }
- #feedmanage tr.selected td .text{
- color: #FFF;
- border: 1px solid #4392b7;
- }
- #feedmanage tr td input.text:focus{
- background: #FFF;
- color: #000;
- border: 1px solid #4392b7;
- }
-
-/* Login form
-*******************************************************************************/
-form.login {
- width: 400px;
- margin: 0 auto;
-}
-form.login fieldset {
- border: 1px solid #CCC;
- text-align: center;
-}
-
-p.logout {
- float: right;
- margin: 20px 30px 0 0;
-}
- p.logout a {
- padding: 8px;
- display: block;
- }
+html, body{ + margin: 0; + padding: 0; +} +html{ + font-size: 62.5%; +} +body{ + background: #FFF; + color: #333; + font: 1.1em/1.6em "Lucida Grande", Tahoma, Arial, sans-serif; +} + + +fieldset{ + border: 0; + padding: 0; + margin: 1em 0; +} +input.text{ + border: 1px solid #BBB; + padding: 4px; +} +input.submit{ + font-size: 1em; + padding: 4px; + background: #D1D1D1 url(img/button.png) repeat-x left center; + border: 1px solid #FFF; + border-bottom: 1px solid #CECECE; + border-right: 1px solid #CECECE; + cursor: pointer; +} +input.submit:hover{ + background: #D1D1D1 url(img/button-h.png) repeat-x left center; + color: #000; + border: 1px solid #FFF; + border-bottom: 1px solid #C6C6C6; + border-right: 1px solid #C6C6C6; +} +input.delete{ + margin-left: 1em; +} +input.delete:hover{ + background: #ffabab url(img/button-delete.png) repeat-x left center; + color: #C00; + border: 1px solid #FCC; + border-bottom: 1px solid #F99; + border-right: 1px solid #F99; +} +input.add{ + font-weight: bold; +} +input.add:hover{ + background: #65a5e1 url(img/button-add.png) repeat-x left center; + color: #20466a; + border: 1px solid #a6c7e5; + border-bottom: 1px solid #4f90cd; + border-right: 1px solid #4f90cd; +} +p.help{ + font-size: 0.8em; + color: #999; + margin: 0; +} + +#page{ +} + + #header{ + background: #E0E0E0 url(img/moonmoon.png) no-repeat right center; + border-top: 5px solid #D0D0D0; + margin: 0; + padding: 10px; + } + #header h1{ + display: none; + margin: 0 0 0 20px; + padding: 0; + height: 14px; + width: 95px; + background: transparent url(img/moonmoon.png) no-repeat left center; + + overflow: hidden; + text-indent: -1000em; + } + #header p{ + margin: 0 0 0 20px; + padding: 0; + } + #header p a{ + color: #AAA; + } + #header p a:hover{ + color: #111; + } + + + ul#nav{ + margin: 20px 30px; + padding: 0; + list-style: none; + } + ul#nav:after {content: "."; display: block; height: 0; clear: both; visibility: hidden; } + ul#nav {display: inline-table;} + /* Hides from IE-mac \*/ + * html ul#nav {height: 1%;} + ul#nav {display: block;} + /* End hide from IE-mac */ + + ul#nav li{ + display: block; + float: left; + } + ul#nav li a{ + display: block; + border: 1px solid #DDD; + padding: 8px 8px 8px 36px; + margin-right: 8px; + text-decoration: none; + color: #666; + background-repeat: no-repeat; + background-position: 6px center; + } + ul#nav li a:hover, + body#admin-feed #nav-feed a, + body#admin-admin #nav-admin a { + background-color: #f0f2f6; + border-color: #AAA; + color: #111; + } + #nav-feed a{ + background-image: url(img/nav-feed.png); + } + #nav-admin a{ + background-image: url(img/nav-admin.png); + } + + #content{ + margin: 20px 30px; + } + + .widget{ + margin: 20px 0; + } + .widget h3{ + background: #3e4350 url(img/h3.png) repeat-x left center; + color: #FFF; + text-transform: uppercase; + margin: 0; + padding: 10px; + } + .widget form{ + padding: 10px; + border: 1px solid #EEE; + border-top: 0; + } + + #feedmanage p.select{ + margin: 3px 0; + } + #feedmanage p.action span.count{ + float: right; + padding-right: 10px; + font-size: 1.3em; + } + #feedmanage table{ + width: 99%; + border-collapse: collapse; + border: 1px solid #f0f2f6; + } + #feedmanage thead th{ + background: #f0f2f6; + text-align: left; + padding: 6px; + } + #feedmanage thead span{ + display: none; + } + #feedmanage tr{ + border-bottom: 1px solid #e8ebf1; + } + #feedmanage tr.even td{ + background: #f0f2f6; + width: auto; + } + #feedmanage .text{ + background: transparent; + border: 1px solid #FFF; + width: 90%; + } + #feedmanage tr.even td .text{ + border: 1px solid #f0f2f6; + } + #feedmanage tr td input.text:focus{ + background: #FFF; + border: 1px solid #4392b7; + } + + #feedmanage tr.selected td{ + background: #ffabab; + background: #4392b7; + color: #FFF; + } + #feedmanage tr.selected td .text{ + color: #FFF; + border: 1px solid #4392b7; + } + #feedmanage tr td input.text:focus{ + background: #FFF; + color: #000; + border: 1px solid #4392b7; + } + +/* Login form +*******************************************************************************/ +form.login { + width: 400px; + margin: 0 auto; +} +form.login fieldset { + border: 1px solid #CCC; + text-align: center; +} + +p.logout { + float: right; + margin: 20px 30px 0 0; +} + p.logout a { + padding: 8px; + display: block; + } diff --git a/admin/inc/auth.inc.php b/admin/inc/auth.inc.php index 0b70d05..d21467b 100644 --- a/admin/inc/auth.inc.php +++ b/admin/inc/auth.inc.php @@ -1,4 +1,4 @@ -<?php
+<?php include (dirname(__FILE__).'/pwd.inc.php'); if ( isset($_COOKIE['auth']) && $_COOKIE['auth'] == $password ) { @@ -7,5 +7,5 @@ if ( isset($_COOKIE['auth']) && $_COOKIE['auth'] == $password ) { setcookie('auth','', time()-3600); header('Location: login.php'); die; -}
+} ?>
\ No newline at end of file diff --git a/admin/index.php b/admin/index.php index 1a43020..4bffb15 100755 --- a/admin/index.php +++ b/admin/index.php @@ -1,136 +1,136 @@ -<?php
-
-require_once dirname(__FILE__) . '/inc/auth.inc.php';
-require_once dirname(__FILE__) . '/../app/app.php';
-
-//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
-$Planet = new Planet($PlanetConfig);
-
-//Load
-if (0 < $Planet->loadOpml(dirname(__FILE__) . '/../custom/people.opml')) {
- $Planet->loadFeeds();
- $items = $Planet->getItems();
-}
-
-$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');
- }
-
- var btSelectnone = document.getElementById('selectnone');
- btSelectnone.onclick = function(){
- allCheckboxes('');
- }
- }
- </script>
-FRAGMENT;
-
-ob_start();
-?>
-
- <div class="widget">
- <h3>Add a new feed</h3>
- <form action="subscriptions.php" method="post" id="feedimport">
- <fieldset>
- <label for="url">Link:</label>
- <input type="text" class="text" name="url" id="url" value="http://" class="text" size="50" />
- <input type="submit" class="submit add" name="add" value="Add feed" />
- </fieldset>
- <p class="help">Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed.</p>
- </form>
- </div>
-
- <div class="widget">
- <h3>Manage existing feeds</h3>
- <form action="subscriptions.php" method="post" id="feedmanage">
- <p class="action">
- <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>
- <p class="select">Select : <a href="javascript:void(0);" id="selectall">All</a>, <a href="javascript:void(0);" id="selectnone">None</a></p>
- <table>
- <thead>
- <tr>
- <th><span>Selection</span></th>
- <th>Name</th>
- <th>Last entry</th>
- <th>Website link</th>
- <th>Feed link</th>
- </tr>
- </thead>
- <tbody>
- <?php
- $i = 0;
- foreach ($everyone as $opml_person){
- $i++;
- ?>
- <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
- $items = $opml_person->get_items();
- if (count($items) > 0) {
- echo $items[0]->get_date();
- } else {
- echo "Not in cache";
- }
- ?>
- </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>
-<?php
-$page_content = ob_get_contents();
-ob_end_clean();
-
-$admin_access = 1;
-require_once dirname(__FILE__) . '/template.php';
+<?php + +require_once dirname(__FILE__) . '/inc/auth.inc.php'; +require_once dirname(__FILE__) . '/../app/app.php'; + +//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 +$Planet = new Planet($PlanetConfig); + +//Load +if (0 < $Planet->loadOpml(dirname(__FILE__) . '/../custom/people.opml')) { + $Planet->loadFeeds(); + $items = $Planet->getItems(); +} + +$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'); + } + + var btSelectnone = document.getElementById('selectnone'); + btSelectnone.onclick = function(){ + allCheckboxes(''); + } + } + </script> +FRAGMENT; + +ob_start(); +?> + + <div class="widget"> + <h3>Add a new feed</h3> + <form action="subscriptions.php" method="post" id="feedimport"> + <fieldset> + <label for="url">Link:</label> + <input type="text" class="text" name="url" id="url" value="http://" class="text" size="50" /> + <input type="submit" class="submit add" name="add" value="Add feed" /> + </fieldset> + <p class="help">Accepted formats are RSS and ATOM. If the link is not a feed, moonmoon will try to autodiscover the feed.</p> + </form> + </div> + + <div class="widget"> + <h3>Manage existing feeds</h3> + <form action="subscriptions.php" method="post" id="feedmanage"> + <p class="action"> + <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> + <p class="select">Select : <a href="javascript:void(0);" id="selectall">All</a>, <a href="javascript:void(0);" id="selectnone">None</a></p> + <table> + <thead> + <tr> + <th><span>Selection</span></th> + <th>Name</th> + <th>Last entry</th> + <th>Website link</th> + <th>Feed link</th> + </tr> + </thead> + <tbody> + <?php + $i = 0; + foreach ($everyone as $opml_person){ + $i++; + ?> + <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 + $items = $opml_person->get_items(); + if (count($items) > 0) { + echo $items[0]->get_date(); + } else { + echo "Not in cache"; + } + ?> + </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> +<?php +$page_content = ob_get_contents(); +ob_end_clean(); + +$admin_access = 1; +require_once dirname(__FILE__) . '/template.php'; |