Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalNOIRCi committed Mar 3, 2012
0 parents commit 8652312
Show file tree
Hide file tree
Showing 165 changed files with 19,967 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
@@ -0,0 +1,8 @@
.DS_Store
*~
*.swp
test.php
test-exec.php
admin/config.ini
admin/.htpasswd
uploads/
4 changes: 4 additions & 0 deletions .htaccess
@@ -0,0 +1,4 @@
# FORCE HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
661 changes: 661 additions & 0 deletions COPYING

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions DOCUMENTATION
@@ -0,0 +1,12 @@
// HTML5
// PHP5
// PDO
// jquery
// vim

// Licence Affero GPL v3

// For PDF creation, we use fpdf http://www.fpdf.org
// Accounts
- Passwords are salted with a random salt, stored in SQL with the sha-512 hash.
- Password forgotten => reset pass with password sent to email.
40 changes: 40 additions & 0 deletions INSTALL
@@ -0,0 +1,40 @@
Thank you for choosing eLabFTW as a lab manager.

Here is what you need in order to install it :

- a server running GNU/Linux (although a Mac OS X or Windows server might work too, but I wouldn't recommand it)
- with PHP5, MySQL5 (other relational database might work, as it uses PDO), Apache (other http servers might work)
- basic knowledge of server administration, command line work
- root access to the server ^^

Have everything ?
Now, let's begin :


INSTALL
*********************

Connect to your server via SSH and fireup tmux (or screen).
If you don't know what is SSH, maybe it's not a good idea to try and install eLabFTW.

As root, cd to your public directory (/var/www generally) and enter these commands :

PHP part
*********

(If you are behind a proxy :
# export http_proxy=proxy-adress.company.org:3128
)
Get latest version
# wget http://www.elabftw.net/downloads/latest.zip
Extract it in the public folder
# unzip latest.zip
Now you have all the php files, we just need to add a library so the mails can be sent
# pear channel-discover pear.swiftmailer.org
# pear install swift/swift

SQL part
***********

# mysql -uroot -ppassword < create_tables.sql

3 changes: 3 additions & 0 deletions PASTIE
@@ -0,0 +1,3 @@

<!-- Redirect the user to the index after 2 secs -->
<script>setTimeout('top.location = \'index.php\'', 2000);</script>
52 changes: 52 additions & 0 deletions TODO
@@ -0,0 +1,52 @@
/////// Priority
* search : selector should stay what it was
* search : multiple critères( has file attached ?)
* $_SESSION['groups']
with array of groups ?
* put images in themes
* most used protocoles get first in selecta !
* remove "experiment" in zip file from prot
* todo list on the side : with priorities (+/-)
* templates for Exp (with blocks ?)
* export by date range / tag
* journal club : see past JC with papers
* offline version !!

** register
* ask admin to validate new accounts
* profile seeable by others
* skype, tel, telperso, url
* list protocols in exp to link them

////// Features
* dans ucp : tu choisis tes templates ! et tu choisis celle qui est créée par défaut, ensuite dans la page createXP, tu peux loader des templates
* autosuggest on tags
* announce birthday date of a team mb to other team mb
* choose from tagcloud (need ajax for addtag, deltag)
* statistics : make pie chart by tag
* news feature, anyone can put a news up for evereybody to see
* tree feature, tree in left pane, and manips related in right pane.
* journal club
* when click on file div, change file (with ajax ?)
* add real calendar

///// Osef
* It's impossible to make a date before 2010 or after 2099
* outcome is not kept if error
* if two file field and file is only on the second one (first is empty) no file uploaded
///// Longterm
* un gestionnaire de musique à la ledjam
* i18n

///// SECURITY
* check for flood register/login

INSTALL
put php files on server
go to install.php
asked for admin password
admin password is generated and put inside sql file
admin password for admin/.htpasswd
sql create database
import tables
all running !
76 changes: 76 additions & 0 deletions add_tag.php
@@ -0,0 +1,76 @@
<?php
/********************************************************************************
* *
* Copyright 2012 Nicolas CARPi (nicolas.carpi@gmail.com) *
* http://www.elabftw.net/ *
* *
********************************************************************************/

/********************************************************************************
* This file is part of eLabFTW. *
* *
* eLabFTW is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version. *
* *
* eLabFTW is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *
* PURPOSE. See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public *
* License along with eLabFTW. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
/* addtag.php - for adding tags */
require_once("inc/auth.php");
require_once("inc/connect.php");

// Check expid is valid and assign it to $expid
if (filter_var($_POST['item_id'], FILTER_VALIDATE_INT)) {
$item_id = $_POST['item_id'];
} else {
die("The experiment id parameter in the URL isn't a valid experiment ID");
}
// Sanitize tag
$tag = filter_var($_POST['tag'], FILTER_SANITIZE_STRING);

// Tag for experiment or protocol ?
if ($_POST['type'] == 'exp' ){

// Check expid is owned by connected user
$sql = "SELECT userid FROM experiments WHERE id = ".$item_id;
$req = $bdd->prepare($sql);
$req->execute();
$data = $req->fetch();
if ($data['userid'] == $_SESSION['userid']) {
// SQL for addtag
$sql = "INSERT INTO experiments_tags (tag, item_id, userid) VALUES(:tag, :item_id, :userid)";
$req = $bdd->prepare($sql);
$result = $req->execute(array(
'tag' => $tag,
'item_id' => $item_id,
'userid' => $_SESSION['userid']
));
if ($result) {
header("location: experiments.php?mode=edit&id=$item_id&tagadded=1");
} else {
die('Something went wrong in the database query. Check the flux capacitor.');
}
}
}elseif ($_POST['type'] == 'prot'){
// SQL for add tag to protocol
$sql = "INSERT INTO protocols_tags (tag, item_id) VALUES(:tag, :item_id)";
$req = $bdd->prepare($sql);
$result = $req->execute(array(
'tag' => $tag,
'item_id' => $item_id));
if ($result) {
header("location: protocols.php?mode=edit&id=$item_id&tagadded=1");
} else {
die('Something went wrong in the database query. Check the flux capacitor.');
}
}else{
die('taggle');
}
58 changes: 58 additions & 0 deletions admin-exec.php
@@ -0,0 +1,58 @@
<?php
/********************************************************************************
* *
* Copyright 2012 Nicolas CARPi (nicolas.carpi@gmail.com) *
* http://www.elabftw.net/ *
* *
********************************************************************************/

/********************************************************************************
* This file is part of eLabFTW. *
* *
* eLabFTW is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version. *
* *
* eLabFTW is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *
* PURPOSE. See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public *
* License along with eLabFTW. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
/* admin-exec.php - for administration of the elab */
require_once('inc/common.php');
if ($_SESSION['is_admin'] != 1) {die('You are not admin !');}

// VALIDATE USERS
if (isset($_POST['validate'])) {
$msg_arr = array();
$sql = "UPDATE users SET validated = 1 WHERE userid = :userid";
$req = $bdd->prepare($sql);
foreach ($_POST['validate'] as $user) {
$req->execute(array(
'userid' => $user
));
$msg_arr[] = 'Validated user with user ID : '.$user;
}
$_SESSION['infos'] = $msg_arr;
header('Location: admin.php');
exit();
}

// MANAGE USERS
if (isset($_GET['deluser']) && filter_var($_GET['deluser'], FILTER_VALIDATE_INT)) {
$userid = $_GET['deluser'];
$msg_arr = array();
// DELETE USER
$sql = "DELETE FROM users WHERE userid = ".$userid;
$req = $bdd->prepare($sql);
$req->execute();
$msg_arr[] = 'Deleted user with user ID : '.$userid;
$_SESSION['infos'] = $msg_arr;
header('Location: admin.php');
exit();
}
68 changes: 68 additions & 0 deletions admin.php
@@ -0,0 +1,68 @@
<?php
/********************************************************************************
* *
* Copyright 2012 Nicolas CARPi (nicolas.carpi@gmail.com) *
* http://www.elabftw.net/ *
* *
********************************************************************************/

/********************************************************************************
* This file is part of eLabFTW. *
* *
* eLabFTW is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Affero General Public License as *
* published by the Free Software Foundation, either version 3 of *
* the License, or (at your option) any later version. *
* *
* eLabFTW is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR *
* PURPOSE. See the GNU Affero General Public License for more details. *
* *
* You should have received a copy of the GNU Affero General Public *
* License along with eLabFTW. If not, see <http://www.gnu.org/licenses/>. *
* *
********************************************************************************/
/* admin.php - for administration of the elab */
require_once('inc/common.php');
if ($_SESSION['is_admin'] != 1) {die('You are not admin !');}
$title = 'Admin Panel';
require_once('inc/head.php');
require_once('inc/menu.php');
require_once('inc/info_box.php');
?>
<h2>ADMIN PANEL</h2>
<?php
// SQL to get all unvalidated users
$sql = "SELECT userid, lastname, firstname, email FROM users WHERE validated = 0";
$req = $bdd->prepare($sql);
$req->execute();
$count = $req->rowCount();
// only show the frame if there is some users to validate
if ($count > 0) {
echo "
<section class='fail'>
<h3>USERS WAITING FOR VALIDATION</h3>";
echo "<form method='post' action='admin-exec.php'><ul>";
while ($data = $req->fetch()) {
echo "<li><input type='checkbox' name='validate[]' value='".$data['userid']."'> ".$data['firstname']." ".$data['lastname']." (".$data['email'].")</li>";
}
echo "</ul><input type='submit' name='submit' value='Validate users' /></form>";
echo "</section>";
}
?>

<section class='item'>
<h3>TEAM MEMBERS</h3>
<?php
// TODO different colors for different groups
// SQL to get all users
$sql = "SELECT userid, lastname, firstname, email FROM users WHERE validated = 1";
$req = $bdd->prepare($sql);
$req->execute();
echo "<form method='post' action='admin-exec.php'><ul>";
while ($data = $req->fetch()) {
echo "<li>".$data['firstname']." ".$data['lastname']." (".$data['email'].") :: <a href='admin-exec.php?deluser=".$data['userid']."'>delete</a> <a href='admin-exec.php?edituser=".$data['userid']."'>edit</a></li>";
}
echo "</section>";
require_once('inc/footer.php') ?>
4 changes: 4 additions & 0 deletions admin/.htaccess
@@ -0,0 +1,4 @@
AuthUserFile /Applications/MAMP/htdocs/admin/.htpasswd
AuthName "Are you admin ?"
AuthType Basic
Require user admin
2 changes: 2 additions & 0 deletions admin/version.ini
@@ -0,0 +1,2 @@
; Version file for eLabFTW
version = 0.5

0 comments on commit 8652312

Please sign in to comment.