Example #1
0
    $membresRedmine[$mR['multipass_remote_uid']] = $mR;
}
foreach ($membresAfup as $mA) {
    $id = $mA['multipass_remote_uid'];
    if (array_key_exists($id, $membresRedmine)) {
        $mR = $membresRedmine[$id];
        // On teste les différences
        $diff = array_diff($mA, $mR);
        if (count($diff)) {
            $data = array();
            foreach ($diff as $k => $v) {
                $data[] = "{$k} = '" . mysqli_real_escape_string($bdd->getDbLink(), $v) . "'";
            }
            // On modifie l'utilisateur
            echo " - modification: {$id}\n";
            $redmine->executer("UPDATE users SET " . implode(', ', $data) . " WHERE multipass_remote_uid = '" . $id . "'");
        }
    } else {
        // On crée l'utilisateur
        echo " - creation: {$id}\n";
        $redmine->executer("INSERT INTO users VALUES(null,\n                                                     '" . mysql_real_escape_string($mA['login']) . "',\n                                                     sha1(concat('" . mysql_real_escape_string($mA['mail']) . "', now())),\n                                                     '" . mysql_real_escape_string($mA['firstname']) . "',\n                                                     '" . mysql_real_escape_string($mA['lastname']) . "',\n                                                     '" . mysql_real_escape_string($mA['mail']) . "',\n                                                     0, 0, 1, null,\n                                                     'fr', null, now(), now(),\n                                                     'User', null, {$id})");
    }
    // Utilisateur traité
    unset($membresRedmine[$id]);
}
// Ceux qui restent sont désactivés
foreach ($membresRedmine as $k => $mR) {
    echo " - desactivation: {$k}\n";
    $redmine->executer('UPDATE users SET status = 0 WHERE multipass_remote_uid=' . $mR['multipass_remote_uid']);
}
echo "Memoire maxi: " . sprintf("%0.1f", memory_get_peak_usage() / 1024 / 1024) . "Mo\n";
Example #2
0
 function supprimerEcriture($id)
 {
     $requete = 'DELETE FROM compta WHERE id=' . $id;
     return $this->_bdd->executer($requete);
 }
Example #3
0
$url = $_SERVER['REQUEST_URI'];
if (strrpos($url, '?') !== false) {
    $position = strrpos($url, '?');
    $url = substr($url, 0, $position);
}
$position = strrpos($url, '/');
$url = substr($_SERVER['REQUEST_URI'], 0, $position);
$parties = explode('/', $url);
$sous_site = array_pop($parties);
if (empty($sous_site) and strpos($_SERVER['HTTP_HOST'], "planete") !== false) {
    $sous_site = "planete";
    $serveur = "http://afup.org";
}
// Initialisation de Smarty
require_once dirname(__FILE__) . '/../../dependencies/smarty/Smarty.class.php';
$smarty = new Smarty();
$smarty->template_dir = array(dirname(__FILE__) . '/../../htdocs/templates/' . $sous_site . '/', dirname(__FILE__) . '/../../htdocs/templates/commun/');
$smarty->compile_dir = dirname(__FILE__) . '/../../htdocs/cache/templates';
$smarty->compile_id = $sous_site;
$smarty->use_sub_dirs = true;
$smarty->check_compile = true;
$smarty->php_handling = SMARTY_PHP_ALLOW;
$smarty->assign('url_base', 'http://' . $_SERVER['HTTP_HOST'] . '/');
$smarty->assign('chemin_template', $serveur . $conf->obtenir('web|path') . 'templates/' . $sous_site . '/');
$smarty->assign('chemin_javascript', $serveur . $conf->obtenir('web|path') . 'javascript/');
// Initialisation de la couche d'abstraction de la base de données
require_once dirname(__FILE__) . '/../../sources/Afup/AFUP_Base_De_Donnees.php';
$bdd = new AFUP_Base_De_Donnees($conf->obtenir('bdd|hote'), $conf->obtenir('bdd|base'), $conf->obtenir('bdd|utilisateur'), $conf->obtenir('bdd|mot_de_passe'));
$bdd->executer("SET NAMES 'utf8'");
// Inclusion de la classe permettant l envoi de mail
require_once dirname(__FILE__) . '/../../sources/Afup/AFUP_Mailing.php';