X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fuser.func.inc.php;h=20cabe294a4ca033e2a8158b732a3fa24be7ca8e;hb=a87530eada179ec7a5eea8a6238ede8c1d442e52;hp=7e98747d79b68b7f21505d032f1ed1248e480db0;hpb=b00527ff4a4883f2bd8bdfcceb6d4123f19ef785;p=platal.git diff --git a/include/user.func.inc.php b/include/user.func.inc.php index 7e98747..20cabe2 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -1,6 +1,6 @@ forlifeEmail()); // TODO: clear profile. - $tables_to_clear = array('uid' => array('competences_ins', 'profile_job', 'langues_ins', 'profile_mentor_country', + $tables_to_clear = array('uid' => array('profile_skills', 'profile_job', 'profile_langskills', 'profile_mentor_country', 'profile_mentor_sector', 'profile_mentor', 'perte_pass', 'watch_sub'), 'user_id' => array('requests', 'user_changes')); if ($really_del) { - array_push($tables_to_clear['uid'], 'emails', 'groupex.membres', 'contacts', 'adresses', 'profile_phones', - 'photo', 'perte_pass', 'langues_ins', 'forum_subs', 'forum_profiles'); - array_push($tables_to_clear['user_id'], 'newsletter_ins', 'binets_ins'); + array_push($tables_to_clear['uid'], 'emails', 'group_members', 'contacts', 'adresses', 'profile_phones', + 'photo', 'perte_pass', 'profile_langskills', 'forum_subs', 'forum_profiles'); + array_push($tables_to_clear['user_id'], 'newsletter_ins', 'profile_binets'); $tables_to_clear['id'] = array('aliases'); $tables_to_clear['contact'] = array('contacts'); XDB::execute("UPDATE accounts @@ -84,67 +84,6 @@ function user_clear_all_subs($user_id, $really_del=true) } // }}} -// {{{ function _user_reindex - -function _user_reindex($uid, $keys) -{ - foreach ($keys as $i => $key) { - if ($key['name'] == '') { - continue; - } - $toks = preg_split('/[ \'\-]+/', $key['name']); - $token = ""; - $first = 5; - while ($toks) { - $token = strtolower(replace_accent(array_pop($toks) . $token)); - $score = ($toks ? 0 : 10 + $first) * ($key['score'] / 10); - XDB::execute("REPLACE INTO search_name (token, uid, soundex, score, flags) - VALUES ({?}, {?}, {?}, {?}, {?})", - $token, $uid, soundex_fr($token), $score, $key['public']); - $first = 0; - } - } -} - -// }}} -// {{{ function user_reindex - -function user_reindex($uid) { - XDB::execute("DELETE FROM search_name - WHERE uid = {?}", - $uid); - $res = XDB::iterator("SELECT CONCAT(n.particle, n.name) AS name, e.score, - FIND_IN_SET('public', e.flags) AS public - FROM profile_name AS n - INNER JOIN profile_name_enum AS e ON (n.typeid = e.id) - WHERE n.pid = {?}", - $uid); - _user_reindex($uid, $res); -} - -// }}} -// {{{ function get_X_mat -function get_X_mat($ourmat) -{ - if (!preg_match('/^[0-9]{8}$/', $ourmat)) { - // le matricule de notre base doit comporter 8 chiffres - return 0; - } - - $year = intval(substr($ourmat, 0, 4)); - $rang = intval(substr($ourmat, 5, 3)); - if ($year < 1996) { - return; - } elseif ($year < 2000) { - $year = intval(substr(1900 - $year, 1, 3)); - return sprintf('%02u0%03u', $year, $rang); - } else { - $year = intval(substr(1900 - $year, 1, 3)); - return sprintf('%03u%03u', $year, $rang); - } -} - -// }}} // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: