X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fgoogleapps.php;h=dd3e97ec81c8cf6b11eb44196a4f0095eb8a5da7;hb=0f8ca11e1375bbc76ba1da0b6d1b4448ab5cf70e;hp=f7796e2d6c45ae6b5021bf9e9c863199eb575085;hpb=89274a92006f2e3d3124667cd77525f7d01f8012;p=platal.git diff --git a/modules/googleapps.php b/modules/googleapps.php index f7796e2..dd3e97e 100644 --- a/modules/googleapps.php +++ b/modules/googleapps.php @@ -1,6 +1,6 @@ $this->make_hook('index', AUTH_MDP), - 'admin/googleapps' => $this->make_hook('admin', AUTH_MDP. 'admin'), - 'admin/googleapps/job' => $this->make_hook('admin_job', AUTH_MDP, 'admin'), + 'googleapps' => $this->make_hook('index', AUTH_MDP, 'mail'), + 'admin/googleapps' => $this->make_hook('admin', AUTH_MDP, 'admin'), + 'admin/googleapps/job' => $this->make_hook('admin_job', AUTH_MDP, 'admin'), 'admin/googleapps/user' => $this->make_hook('admin_user', AUTH_MDP, 'admin'), ); } - function handler_index(&$page, $action = null) + function handler_index($page, $action = null) { require_once("emails.inc.php"); require_once("googleapps.inc.php"); $page->changeTpl('googleapps/index.tpl'); - $page->addJsLink('motdepasse.js'); $page->setTitle('Compte Google Apps'); $user = S::user(); @@ -69,9 +68,9 @@ class GoogleAppsModule extends PLModule } else { $account->set_password_sync(false); } - } elseif ($action == 'password' && Post::has('response2') && !$account->sync_password) { + } elseif ($action == 'password' && Post::has('pwhash') && Post::t('pwhash') && !$account->sync_password) { S::assert_xsrf_token(); - $account->set_password(Post::v('response2')); + $account->set_password(Post::t('pwhash')); } if ($action == 'suspend' && Post::has('suspend') && $account->active()) { @@ -102,9 +101,9 @@ class GoogleAppsModule extends PLModule $password_sync = Post::b('password_sync'); $redirect_mails = Post::b('redirect_mails'); if ($password_sync) { - $password = S::v('password'); + $password = $user->password(); } else { - $password = Post::v('response2'); + $password = Post::t('pwhash'); } $account->create($password_sync, $password, $redirect_mails); @@ -115,7 +114,7 @@ class GoogleAppsModule extends PLModule $page->assign('account', $account); } - function handler_admin(&$page, $action = null) { + function handler_admin($page, $action = null) { require_once("googleapps.inc.php"); $page->changeTpl('googleapps/admin.tpl'); $page->setTitle('Administration Google Apps'); @@ -136,7 +135,7 @@ class GoogleAppsModule extends PLModule "SELECT q_id, q_recipient_id, a.alias, j_type, j_parameters, UNIX_TIMESTAMP(q.p_entry_date) AS p_entry_date FROM gapps_queue AS q - LEFT JOIN aliases AS a ON (a.id = q_recipient_id AND a.type = 'a_vie') + LEFT JOIN aliases AS a ON (a.uid = q_recipient_id AND a.type = 'a_vie') WHERE p_status IN ('idle', 'active', 'softfail') AND p_admin_request IS TRUE ORDER BY p_entry_date"); @@ -154,14 +153,14 @@ class GoogleAppsModule extends PLModule "SELECT q.q_id, q.q_recipient_id, a.alias, q.j_type, q.r_result, UNIX_TIMESTAMP(q.p_entry_date) AS p_entry_date FROM gapps_queue AS q - LEFT JOIN aliases AS a ON (a.id = q.q_recipient_id AND a.type = 'a_vie') + LEFT JOIN aliases AS a ON (a.uid = q.q_recipient_id AND a.type = 'a_vie') WHERE q.p_status = 'hardfail' ORDER BY p_entry_date DESC LIMIT 20"); $page->assign('failed_requests', $res); } - function handler_admin_job(&$page, $job = null) { + function handler_admin_job($page, $job = null) { require_once("googleapps.inc.php"); $page->changeTpl('googleapps/admin.job.tpl'); $page->setTitle('Administration Google Apps'); @@ -171,8 +170,8 @@ class GoogleAppsModule extends PLModule $res = XDB::query( "SELECT q.*, ao.alias AS q_owner, ar.alias AS q_recipient FROM gapps_queue AS q - LEFT JOIN aliases AS ao ON (ao.id = q.q_owner_id AND ao.type = 'a_vie') - LEFT JOIN aliases AS ar ON (ar.id = q.q_recipient_id AND ar.type = 'a_vie') + LEFT JOIN aliases AS ao ON (ao.uid = q.q_owner_id AND ao.type = 'a_vie') + LEFT JOIN aliases AS ar ON (ar.uid = q.q_recipient_id AND ar.type = 'a_vie') WHERE q_id = {?}", $job); $sql_job = $res->fetchOneAssoc(); $sql_job['decoded_parameters'] = var_export(json_decode($sql_job['j_parameters'], true), true); @@ -180,7 +179,7 @@ class GoogleAppsModule extends PLModule } } - function handler_admin_user(&$page, $user = null) { + function handler_admin_user($page, $user = null) { require_once("emails.inc.php"); require_once("googleapps.inc.php"); $page->changeTpl('googleapps/admin.user.tpl');