コード例 #1
0
ファイル: admin.php プロジェクト: Eric-Piwigo/Register_FluxBB
  )
;';
    $result = pwg_query($query);
    Audit_PWG_FluxBB();
} else {
    if (isset($_GET['action']) and $_GET['action'] == 'link_del' and isset($_GET['pwg_id']) and isset($_GET['bb_id'])) {
        $query = '
DELETE FROM ' . Register_FluxBB_ID_TABLE . '
WHERE id_user_pwg = ' . $_GET['pwg_id'] . '
AND id_user_FluxBB = ' . $_GET['bb_id'] . '
;';
        $result = pwg_query($query);
        Audit_PWG_FluxBB();
    } else {
        if (isset($_GET['action']) and $_GET['action'] == 'new_link' and isset($_GET['pwg_id']) and isset($_GET['bb_id'])) {
            FluxBB_Linkuser($_GET['pwg_id'], $_GET['bb_id'], "NOK");
            Audit_PWG_FluxBB();
        } else {
            if (isset($_GET['action']) and $_GET['action'] == 'sync_user' and isset($_GET['username'])) {
                $query = '
SELECT id AS id_pwg, username, mail_address 
FROM ' . USERS_TABLE . '
WHERE BINARY username = BINARY "' . pwg_db_real_escape_string($_GET['username']) . '"
AND username NOT IN ("18","16")
LIMIT 1
;';
                $data = pwg_db_fetch_assoc(pwg_query($query));
                if (!empty($data)) {
                    Synch_FluxBB_Updateuser($data['id_pwg'], stripslashes($data['username']), $data['mail_address']);
                }
                Audit_PWG_FluxBB();
コード例 #2
0
/**
 * Update user information in FluxBB users table from audit/synch action
 * Standard FluxBB_Updateuser() function is not used because of existing password mismatch
 * To solve password synch problem, passwords are reset to NULL to force users to get a new password by using "forgotten password" function
 */
function Synch_FluxBB_Updateuser($pwg_id, $username, $adresse_mail)
{
    global $conf;
    include_once PHPWG_ROOT_PATH . 'include/common.inc.php';
    $conf_Register_FluxBB = unserialize($conf['Register_FluxBB']);
    $password = NULL;
    // Select users to update in ID link table
    $query = '
SELECT id_user_FluxBB as FluxBB_id
FROM ' . Register_FluxBB_ID_TABLE . '
WHERE id_user_pwg = ' . $pwg_id . '
;';
    $row = pwg_db_fetch_assoc(pwg_query($query));
    if (!empty($row)) {
        $query = '
UPDATE ' . FluxBB_USERS_TABLE . '
SET username = "******", email = "' . $adresse_mail . '", password = "******" 
WHERE id = ' . $row['FluxBB_id'] . '
AND "' . pwg_db_real_escape_string($username) . '" NOT IN ("18","16")
AND "' . pwg_db_real_escape_string($username) . '" <> "' . stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']) . '"
;';
        pwg_query($query);
        FluxBB_Linkuser($pwg_id, $row['FluxBB_id'], "NOK");
    } else {
        $query = '
SELECT id as FluxBB_id
FROM ' . FluxBB_USERS_TABLE . '
WHERE BINARY username = BINARY "' . pwg_db_real_escape_string($username) . '"
AND "' . pwg_db_real_escape_string($username) . '" <> "' . stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']) . '"
;';
        $row = pwg_db_fetch_assoc(pwg_query($query));
        if (!empty($row)) {
            $query = '
UPDATE ' . FluxBB_USERS_TABLE . '
SET username = "******", email = "' . $adresse_mail . '", password = "******" 
WHERE id = ' . $row['FluxBB_id'] . '
AND "' . pwg_db_real_escape_string($username) . '" NOT IN ("18","16")
AND "' . pwg_db_real_escape_string($username) . '" <> "' . stripslashes($conf_Register_FluxBB['FLUXBB_ADMIN']) . '"
;';
            pwg_query($query);
            FluxBB_Linkuser($pwg_id, $row['FluxBB_id'], "NOK");
        }
    }
}