Qual: Supprime module qui n'a jamais fonctionn (pour cause il manque des tables).

This commit is contained in:
Laurent Destailleur 2008-01-20 18:56:34 +00:00
parent acd972fc94
commit 27ce609642
8 changed files with 7 additions and 413 deletions

View File

@ -1,161 +0,0 @@
<?php
/* Copyright (c) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/bookmark4u.class.php
\brief Fichier de la classe bookmark4u
\author Rodolphe Quiedeville
\version $Revision$
*/
class Bookmark4u
{
var $db;
var $id;
/**
* \brief Constructeur de la classe
* \param $DB handler accès base de données
* \param $id id de l'utilisateur (0 par défaut)
*/
function Bookmark4u(&$DB, $id=0)
{
$this->db = &$DB;
$this->id = $id;
return 1;
}
/**
*
*
*/
function get_bk4u_uid($user)
{
$sql = "SELECT bk4u_uid FROM ".MAIN_DB_PREFIX."bookmark4u_login";
$sql .= " WHERE fk_user =".$user->id;
if ($this->db->query($sql))
{
$num = $this->db->num_rows();
if ($num == 0)
{
$this->uid = 0;
return 0;
}
else
{
$row = $this->db->fetch_row();
$this->uid = $row[0];
return 0;
}
$this->db->free();
}
else
{
return 1;
}
}
/**
*
*
*
*/
function get_bk4u_login()
{
$sql = "SELECT user FROM bookmark4u.bk4u_passwd";
$sql .= " WHERE uid =".$this->uid;
if ($this->db->query($sql))
{
$num = $this->db->num_rows();
if ($num == 0)
{
return 0;
}
else
{
$row = $this->db->fetch_row();
$this->login = $row[0];
return 0;
}
$this->db->free();
}
else
{
return 1;
}
}
/**
* \brief Créé un compte bookmark4u
* \param user Objet du user
* \return int <0 si ko, >0 si ok
*/
function create_account_from_user($user)
{
global $langs;
// \todo rendre la base et la table générique
$sql = "INSERT INTO bookmark4u.bk4u_passwd (user, passwd, name, email, logincnt, rdate)";
$sql .= " VALUES ('$user->login',password('$user->pass'),'$user->fullname','$user->email',0,now());";
$resql=$this->db->query($sql);
if ($resql)
{
$this->uid = $this->db->last_insert_id("bookmark4u.bk4u_passwd");
$sql = "INSERT INTO ".MAIN_DB_PREFIX."bookmark4u_login";
$sql .= " (fk_user, bk4u_uid)";
$sql .= " VALUES ($user->id, $this->uid)";
$resql2=$this->db->query($sql);
if ($resql2)
{
return 1;
}
else
{
dolibarr_syslog("Bookmark4u::Create_account_from_user INSERT 2");
$this->error=$langs->trans("UnknownError");
return -2;
}
}
else
{
dolibarr_syslog("Bookmark4u::Create_account_from_user INSERT 1");
$this->error=$langs->trans("UnknownError");
return -1;
}
}
}
?>

View File

@ -154,9 +154,6 @@ class Conf
// Module agenda
$this->agenda->enabled=defined('MAIN_MODULE_AGENDA')?MAIN_MODULE_AGENDA:0;
// Module bookmark4u
$this->bookmark4u->enabled=defined('MAIN_MODULE_BOOKMARK4U')?MAIN_MODULE_BOOKMARK4U:0;
// Module bookmark
$this->bookmark->enabled=defined('MAIN_MODULE_BOOKMARK')?MAIN_MODULE_BOOKMARK:0;

View File

@ -1,108 +0,0 @@
<?php
/* Copyright (C) 2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2005-2007 Laurent Destailleur <eldy@users.sourceforge.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
*/
/**
\defgroup bookmark4u Module bookmark4u
\brief Module pour se synchroniser avec bookmark4u
*/
/**
\file htdocs/includes/modules/modBookmark4u.class.php
\ingroup bookmark4u
\brief Fichier de description et activation du module Bookmark4u
*/
include_once(DOL_DOCUMENT_ROOT ."/includes/modules/DolibarrModules.class.php");
/**
\class modBookmark4u
\brief Classe de description et activation du module Bookmark4u
*/
class modBookmark4u extends DolibarrModules
{
/**
* \brief Constructeur. Definit les noms, constantes et boites
* \param DB handler d'acc<EFBFBD>s base
*/
function modBookmark4u($DB)
{
$this->db = $DB ;
$this->numero = 59 ;
$this->family = "technic";
$this->name = "Bookmark4u";
$this->description = "Ajoute fonction pour g<>n<EFBFBD>rer un compte Bookmark4u depuis un compte Dolibarr";
$this->version = 'development'; // 'development' or 'experimental' or 'dolibarr' or version
$this->const_name = 'MAIN_MODULE_BOOKMARK4U';
$this->special = 1;
$this->picto='user';
// Dir
$this->dirs = array();
// D<>pendances
$this->depends = array();
$this->requiredby = array();
// Config pages
$this->config_page_url = array();
// Constantes
$this->const = array();
// Boites
$this->boxes = array();
// Permissions
$this->rights = array();
$this->rights_class = 'bookmark4u';
}
/**
* \brief Fonction appel<EFBFBD>e lors de l'activation du module. Ins<EFBFBD>re en base les constantes, boites, permissions du module.
* D<EFBFBD>finit <EFBFBD>galement les r<EFBFBD>pertoires de donn<EFBFBD>es <EFBFBD> cr<EFBFBD>er pour ce module.
*/
function init()
{
global $conf;
$sql = array();
return $this->_init($sql);
}
/**
* \brief Fonction appel<EFBFBD>e lors de la d<EFBFBD>sactivation d'un module.
* Supprime de la base les constantes, boites et permissions du module.
*/
function remove()
{
$sql = array();
return $this->_remove($sql);
}
}
?>

View File

@ -63,8 +63,8 @@ function user_prepare_head($user)
if ($conf->bookmark4u->enabled)
{
$head[$h][0] = DOL_URL_ROOT.'/user/addon.php?id='.$user->id;
$head[$h][1] = $langs->trans("Bookmark4u");
$head[$h][2] = 'bookmark4u';
$head[$h][1] = $langs->trans("Other");
$head[$h][2] = 'other';
$h++;
}

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,7 +17,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
@ -27,33 +26,12 @@
*/
require("./pre.inc.php");
require_once DOL_DOCUMENT_ROOT."/bookmark4u.class.php";
require_once(DOL_DOCUMENT_ROOT."/lib/usergroups.lib.php");
$langs->load("users");
$form = new Form($db);
if ($_GET["action"] == 'create_bk4u_login')
{
$edituser = new User($db, $_GET["id"]);
$edituser->fetch($_GET["id"]);
$bk4u = new Bookmark4u($db);
$bk4u->get_bk4u_uid($fuser);
$result=$bk4u->create_account_from_user($edituser);
if ($result > 0)
{
Header("Location: addon.php?id=".$_GET["id"]);
exit;
}
else
{
dolibarr_print_error($db,$bk4u->error);
exit;
}
}
llxHeader("","Addon Utilisateur");
@ -69,16 +47,13 @@ if ($_GET["id"])
$fuser = new User($db, $_GET["id"]);
$fuser->fetch();
$bk4u = new Bookmark4u($db);
$bk4u->get_bk4u_uid($fuser);
/*
* Affichage onglets
*/
$head = user_prepare_head($fuser);
dolibarr_fiche_head($head, 'bookmark4u', $langs->trans("User"));
dolibarr_fiche_head($head, 'other', $langs->trans("User"));
/*
@ -99,24 +74,8 @@ if ($_GET["id"])
print '<td class="valeur"><a href="mailto:'.$fuser->email.'">'.$fuser->email.'</a></td>';
print "</tr>\n";
print "<tr>".'<td width="25%" valign="top">'.$langs->trans("Login Bookmark4u").'</td>';
print '<td class="valeur">';
if ($bk4u->uid == 0)
{
print $langs->trans("NoLogin");
}
else
{
$bk4u->get_bk4u_login();
print $bk4u->login;
}
print '</td>';
print "</tr>\n";
//...
print "</table>\n";
print "</div>\n";
@ -130,7 +89,7 @@ if ($_GET["id"])
if ($user->admin)
{
print '<a class="butAction" href="addon.php?id='.$fuser->id.'&amp;action=create_bk4u_login">'.$langs->trans("Créer login Bookmark4u").'</a>';
// print '<a class="butAction" href="addon.php?id='.$fuser->id.'&amp;action=create_bk4u_login">'.$langs->trans("Créer login Bookmark4u").'</a>';
}
print "</div>\n";

View File

@ -1,31 +0,0 @@
-- ============================================================================
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General [public] License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program 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 General [public] License for more details.
--
-- You should have received a copy of the GNU General [public] License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
-- $Source$
--
-- ===========================================================================
create table llx_bookmark4u_login
(
rowid integer IDENTITY PRIMARY KEY,
fk_user integer,
bk4u_uid integer,
);
CREATE UNIQUE INDEX fk_user ON llx_bookmark4u_login(fk_user)

View File

@ -1,28 +0,0 @@
-- ============================================================================
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program 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 General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- $Id$
-- ===========================================================================
create table llx_bookmark4u_login
(
rowid integer AUTO_INCREMENT PRIMARY KEY,
fk_user integer,
bk4u_uid integer,
UNIQUE INDEX(fk_user)
)type=innodb;

View File

@ -1,34 +0,0 @@
-- Generated by dolibarr_mysql2pgsql
-- (c) 2004, PostgreSQL Inc.
-- (c) 2005, Laurent Destailleur.
-- ============================================================================
-- Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program 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 General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program; if not, write to the Free Software
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
--
-- Id: llx_bookmark4u_login.sql,v 1.2 2007/12/02 21:53:28 eldy Exp
-- ===========================================================================
create table llx_bookmark4u_login
(
rowid SERIAL PRIMARY KEY,
"fk_user" integer,
"bk4u_uid" integer,
UNIQUE(fk_user)
);
CREATE INDEX idx_llx_bookmark4u_login_fk_user ON llx_bookmark4u_login (fk_user);