Skip to content

Commit

Permalink
V0.2:
Browse files Browse the repository at this point in the history
- bookmark done
- php file to convert bookmark cache from XDCCParser to a json file
  • Loading branch information
Kcchouette committed Sep 29, 2016
1 parent a96b814 commit 64e5f6a
Show file tree
Hide file tree
Showing 15 changed files with 396 additions and 147 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ You can see what this website do by watching the release list:

- Because [XDCCParser-global](https://github.com/nitmir/XDCCParser-global) is bugged
- Because [my fork](https://github.com/Kcchouette/XDCCParser) is less bugged; but isn't **responsive** (mobile) and use Text File from Iroffer
- Because [iroffer-state](https://github.com/dinoex/iroffer-state) use the `.state` file of the bot

This project uses:
- **XML file** from Iroffer
Expand Down
36 changes: 21 additions & 15 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,31 @@

## For v0.2

- [x] Import data.json
- [x] Export data.json
- [ ] Upload the XML file into cache
- [ ] Cache can be refreshed (automatic check?)
- [ ] Download the XML file (from URL)? into cache (use the `lastupdate` tag; an epoch time)
- [ ] View to show Bookmarks from JSON # using the search input
- [ ] ADD/REMOVE Bookmarks from JSON
- [x] Import JSON files
- [x] Export JSON files
- [x] View to show Bookmarks from JSON
- [x] ADD/REMOVE Bookmarks from JSON
- [x] A Search input (to search on one BOT)
- [x] A Search input (to search on all BOTs)
- [x] Atom feed based on `adddate` tag
- [ ] Choose the XML file location using a select tag in the ADMIN page if not using URL
- [ ] Possibility of reordering bots in the ADMIN page
- [x] Download a CSV file with the number of download for each bot
- [ ] When adding bot, ask if Website/IRC are the same than the main in the ADMIN page


## For v0.3

- [ ] Upload the XML file into cache (serialize it? download it?)
- [ ] Cache can be refreshed (automatic check?)
- [ ] Download the XML file (from URL)? into cache (use the `lastupdate` tag; an epoch time)
- [ ] Possibility of reordering bots/bookmarks in the ADMIN page
- [ ] Try to use the text file listing from iroffer
- [ ] Parse the cache boorkmark of XDCCParser-global
- [x] Do a file that parse the cache boorkmark of XDCCParser-global to a json file
- [ ] When adding bot, ask if Website/IRC are the same than the main in the ADMIN page

## For v0.4

## Improve
- [ ] **Try** to use the text file listing from iroffer
- [ ] When adding bot, ask if Website/IRC are the same than the main in the ADMIN page

## Improvement

- [ ] list for bot name (instead of a simple echo + br)?

Expand All @@ -33,5 +36,8 @@
- [ ] Display for example 50 number of file, else use a pagination? (cf datatables)
- [ ] Use Nick from xdcc list? # what in case multi-nick?
- [ ] Display if the bot support @find (and how many ?) # config of bot
- [ ] Possibility to edit the config.php and data.json?
- [ ] Choose the IRC adress by using a list of network provided by the ``network` tag
- [ ] Possibility to edit the config.php online
- [ ] Choose the IRC adress by using a list of network provided by the ``network` tag
- [ ] Select bot for bookmark with a select
- [ ] Choose the XML file location using a select tag in the ADMIN page if not using URL
- [ ] Allow to cache PHP file?
30 changes: 15 additions & 15 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
echo $_SESSION['message'];
unset($_SESSION['message']);
}
echo '<div class="omgcontainer90">';
echo '<div>';
echo '<section class="omggrid omg3columns">
<div class="omgblock">
<div class="omgborder">';
echo '<h3>' . $lang[$language]["Modify_Remove_h2"] . '</h3>';
echo '<h3>' . $lang[$language]["Modify_Remove_Bot_h2"] . '</h3>';
require_once 'xdcc.php';
$bots = getBotList();
echo '<table>';
foreach($bots as &$b) {
foreach($bots as $b) {
echo '<tr class="omgcenter">
<td>' . $b->getName() . '</td>
<td>
Expand Down Expand Up @@ -83,12 +83,12 @@
<input type="submit" value="' . $lang[$language]["Add_bot_but"] . '" >
</form>';
echo '<form method="post" action="update.php" enctype="multipart/form-data">
<input type="hidden" name="upload_json" value="true">
<input type="hidden" name="upload_bot_json" value="true">
<input type="file" id="uploadedfile" name="uploadedfile">
<input type="submit" value="' . $lang[$language]["Import_botJSON"] . '" >
</form>';
echo '<form method="post" action="update.php">
<input type="hidden" name="exp_json" value="true">
<input type="hidden" name="exp_bot_json" value="true">
<input type="submit" value="' . $lang[$language]["Export_botJSON"] . '" >
</form>';
echo '</div>';
Expand All @@ -98,22 +98,22 @@
echo '<section class="omggrid omg3columns">
<div class="omgblock">
<div class="omgborder">';
echo '<h3>Modify, Remove bookmark***</h3>';
echo '<h3>' . $lang[$language]["Modify_Remove_Bookmark_h2"] . '</h3>';
require_once 'xdcc.php';
$bookmarks = getBookmarkList();
echo '<table>';
foreach($bookmarks as &$b) {
foreach($bookmarks as $b) {
echo '<tr class="omgcenter">
<td>' . $b->getName() . '</td>
<td>
<form method="post" action="bot_admin.php">
<input type="hidden" name=" ***" value="' . $b->getName() . '">
<form method="post" action="bookmark_admin.php">
<input type="hidden" name="modifBookmark" value="' . $b->getName() . '">
<input type="image" class="icon" src="img/Edit_icon.svg" title="' . $lang[$language]["Modify_but"] . '" alt="' . $lang[$language]["Modify_but"] . '">
</form>
</td>
<td>
<form method="post" action="update.php">
<input type="hidden" name=" ***" value="' . $b->getName() . '">
<input type="hidden" name="rmBookmark" value="' . $b->getName() . '">
<input type="image" class="icon" src="img/remove_icon.svg" title="' . $lang[$language]["Remove_but"] . '" alt="' . $lang[$language]["Remove_but"] . '">
</form>
</td>
Expand All @@ -123,17 +123,17 @@
echo '</div>';
echo '</div>';
echo '<div class="omgblock omgblockof2 omgpullleft">';
echo '<form method="post" action="bot_admin.php">
<input type="hidden" name=" ***" value="true">
<input type="submit" value="****Add a bookmark" >
echo '<form method="post" action="bookmark_admin.php">
<input type="hidden" name="addBookmark" value="true">
<input type="submit" value="' . $lang[$language]["Add_bookmark_but"] . '" >
</form>';
echo '<form method="post" action="update.php" enctype="multipart/form-data">
<input type="hidden" name=" ***" value="true">
<input type="hidden" name="upload_bookmark_json" value="true">
<input type="file" id="uploadedfile" name="uploadedfile">
<input type="submit" value="' . $lang[$language]["Import_bookJSON"] . '" >
</form>';
echo '<form method="post" action="update.php">
<input type="hidden" name=" ***" value="true">
<input type="hidden" name="exp_bookmark_json" value="true">
<input type="submit" value="' . $lang[$language]["Export_bookJSON"] . '" >
</form>';
echo '</div>';
Expand Down
93 changes: 93 additions & 0 deletions bookmark_admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php //start before HTML code
session_start();

require_once 'config.php';
require_once 'xdcc.php';

if (isset($_SESSION['login']) && isset($_SESSION['pwd'])) {
echo '<!DOCTYPE html>
<html lang="' . $language . '">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>' . $title . ' - ' . $lang[$language]["Admin_page"] . '</title>
<link href="css/main.css" rel="stylesheet">
<link href="css/input.css" rel="stylesheet">
<!-- OMGCSS core CSS -->
<link href="https://cdn.rawgit.com/Kcchouette/omgcss/ef95db62775411425dfc2f0bcc6a8a43282efc83/dist/css/omg.css" rel="stylesheet">
</head>
<body class="omgcontainer90">
<div class="fixed730 omglowmargin">';

echo '<header>
<h1 class="omginline"><a class="omgtitle" href="#">' . $lang[$language]["Admin_page"] . '</a></h1>
<a href="#" onclick="toggleMenu(\'omgmenu1\')" class="menubtn">&#9776;</a>
<nav id="omgmenu1" class="omgmenu omginline omgpullright" style="display:none">
<ul class="omgpullright">
<li><a href="admin.php">' . $lang[$language]["Return_admin"] . '</a></li>
</ul>
</nav>
</header>';

if (isset($_POST["modifBookmark"])){
require_once 'xdcc.php';
$b = returnObject(getBookmarkList(), $_POST["modifBookmark"]);

echo '<h2>' . $lang[$language]["Modify_bookmark_h2"] . '</h2>';
echo '<div class="omgcenter">
<form method="post" action="update.php">
<input type="text" name="nameBookmark" placeholder="' . $lang[$language]["Bookmark_name"] . '" value="' . $b->getName() . '" required >
<input type="text" name="searchBookmark" placeholder="' . $lang[$language]["Bookmark_search"] . '" value="' . $b->getStringSearch() . '" required >
<input type="text" name="botBookmark" placeholder="' . $lang[$language]["Bookmark_bot"] . '" value="' . $b->getBotSearch() . '" >
<input type="hidden" name="isModifBookmark" value="' . $b->getName() . '">
<input type="submit" value="' . $lang[$language]["Modify_but"] . '">
</form>
</div>';
}
else if (isset($_POST["addBookmark"])) {
echo '<h2>' . $lang[$language]["Add_bookmark_but"] . '</h2>';
echo '<div class="omgcenter">
<form method="post" action="update.php">
<input type="text" name="nameBookmark" placeholder="' . $lang[$language]["Bookmark_name"] . '" required >
<input type="text" name="searchBookmark" placeholder="' . $lang[$language]["Bookmark_search"] . '" required >
<input type="text" name="botBookmark" placeholder="' . $lang[$language]["Bookmark_bot"] . '" >
<input type="hidden" name="isCreateBookmark" value="true">
<input type="submit" value="' . $lang[$language]["Add_but"] . '">
</form>
</div>';
}
else { //if no action
header ('location: admin.php');
}
}
else {
//go to login
header ('location: login.php');
}

?>

</div>

<footer class="omgcenter">
<?php
require_once 'config.php';
echo $lang[$language]["Powered"] . ' <a href="https://github.com/Kcchouette/XDCC-simple">XDCC Simple</a>';
?>
</footer>

<!-- OMGCSS small js -->
<script src="https://cdn.rawgit.com/Kcchouette/omgcss/ef95db62775411425dfc2f0bcc6a8a43282efc83/dist/js/omg.js"></script>

</body>

</html>
1 change: 0 additions & 1 deletion bookmarks.json

This file was deleted.

6 changes: 3 additions & 3 deletions bot_admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@

if (isset($_POST["modifBot"])){
require_once 'xdcc.php';
$b = returnBot(getBotList(), $_POST["modifBot"]);
$b = returnObject(getBotList(), $_POST["modifBot"]);

echo '<h2>' . $lang[$language]["Modify_h2"] . '</h2>';
echo '<h2>' . $lang[$language]["Modify_bot_h2"] . '</h2>';
echo '<div class="omgcenter">
<form method="post" action="update.php">
<input type="text" name="nameBot" placeholder="' . $lang[$language]["Bot_name"] . '" value="' . $b->getName() . '" required >
Expand All @@ -62,7 +62,7 @@
<input type="text" name="xmlBot" placeholder="' . $lang[$language]["Bot_xml"] . '" required >
<input type="url" name="websiteBot" placeholder="' . $lang[$language]["Bot_website"] . '" >
<input type="url" name="ircBot" placeholder="' . $lang[$language]["Bot_irc"] . '" >
<input type="hidden" name="isCreate" value="true">
<input type="hidden" name="isCreateBot" value="true">
<input type="submit" value="' . $lang[$language]["Add_but"] . '">
</form>
</div>';
Expand Down
36 changes: 24 additions & 12 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- true
- false
*/
$bookmark = false; //do not change
$bookmark = true; //do not change

/*
Can Search engines track this website?
Expand Down Expand Up @@ -65,7 +65,7 @@
* bookmarks.json for bookmarks
in the folder cache/
*/
$folder_json_files = '';
$folder_json_files = 'json/';
$bot_file = 'data.json';
$bookmarks_file = 'bookmarks.json';

Expand Down Expand Up @@ -95,13 +95,16 @@
"User" => "User",
"Password" => "Password",
"Powered" => "Powered by",
"bot_add" => "has been successfully added!",
"bot_modify" => "has been successfully modified!",
"bot_remove" => "has been successfully removed!",
"msg_add" => "has been successfully added!",
"msg_modify" => "has been successfully modified!",
"msg_remove" => "has been successfully removed!",
"Bot_name" => "Name of the bot",
"Bot_xml" => "XML of the bot",
"Bot_website" => "Website linked to the bot",
"Bot_irc" => "IRC linked to the bot",
"Bookmark_name" => "Name of the bookmark",
"Bookmark_search" => "Search query of the bookmark",
"Bookmark_bot" => "Bot linked to the bookmark",
"Add_but" => "Add it!",
"Modify_but" => "Modify it",
"Remove_but" => "Remove it",
Expand All @@ -110,8 +113,11 @@
"Bots" => "Bots",
"Bookmarks" => "Bookmarks",
"Add_bot_but" => "Add a bot",
"Modify_h2" => "Modify a bot",
"Modify_Remove_h2" => "Modify/Remove a bot",
"Modify_bot_h2" => "Modify a bot",
"Modify_bookmark_h2" => "Modify a bookmark",
"Modify_Remove_Bot_h2" => "Modify/Remove a bot",
"Modify_Remove_Bookmark_h2" => "Modify/Remove a bookmark",
"Add_bookmark_but" => "Add a bookmark",
"Login_page" => "Login Page",
"Admin_page" => "Admin Page",
"Disconnect_but" => "Disconnect",
Expand Down Expand Up @@ -154,13 +160,16 @@
"User" => "Utilisateur",
"Password" => "Mot de passe",
"Powered" => "Utilise",
"bot_add" => "a été ajouté !",
"bot_modify" => "a été modifié !",
"bot_remove" => "a été supprimé !",
"msg_add" => "a été ajouté !",
"msg_modify" => "a été modifié !",
"msg_remove" => "a été supprimé !",
"Bot_name" => "Nom du bot",
"Bot_xml" => "XML du bot",
"Bot_website" => "Site internet lié au bot",
"Bot_irc" => "IRC lié au bot",
"Bookmark_name" => "Nom du signet",
"Bookmark_search" => "Recherche du signet",
"Bookmark_bot" => "Bot du signet",
"Add_but" => "L'ajouter !",
"Modify_but" => "Modifier le bot",
"Remove_but" => "Supprimer le bot",
Expand All @@ -169,8 +178,11 @@
"Bots" => "Bots",
"Bookmarks" => "Signets",
"Add_bot_but" => "Ajouter un bot",
"Modify_h2" => "Modifier un bot",
"Modify_Remove_h2" => "Modifier/Supprimer un bot",
"Modify_bot_h2" => "Modifier un bot",
"Modify_bookmark_h2" => "Modifier un bookmark",
"Modify_Remove_Bot_h2" => "Modifier/Supprimer un bot",
"Modify_Remove_Bookmark_h2" => "Modifier/Supprimer un signet",
"Add_bookmark_but" => "Ajouter un signet",
"Login_page" => "Page de connexion",
"Admin_page" => "Page d'administration",
"Disconnect_but" => "Se déconnecter",
Expand Down
11 changes: 0 additions & 11 deletions data.json

This file was deleted.

4 changes: 2 additions & 2 deletions database.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@


// for BOOKMARK
function databaseBoookmarkNameFile() {
function databaseBookmarkNameFile() {
require 'config.php';
return $bookmarks_file;
}

function databaseBookmarkFullFile() {
require 'config.php';
return $folder_json_files . databaseBoookmarkNameFile();
return $folder_json_files . databaseBookmarkNameFile();
}

function saveBookmarkList($bookmarks) {
Expand Down
Loading

0 comments on commit 64e5f6a

Please sign in to comment.