warning removed
[mirrors/Kyberia-bloodline.git] / cron / ejabberd_sync.php
CommitLineData
5ba5b4a2
H
1#!/usr/bin/php
2<?php
3/*
4 * Script that synchronizes ejabberd users with kyberia
5 * Call as needed
6 */
7
bcfeedf1 8$echo='echo '; //Test only...
5ba5b4a2
H
9$jabber_domain=escapeshellarg('kyberia.cz');
10
11// Use relative address of config file
12// Change this, if you move you cron directory.
13$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
14require($dir.'/../wwwroot/config/config.inc');
15
16//require(INCLUDE_DIR.'/log.inc');
17require(INCLUDE_DIR.'/database.inc');
18//require(INCLUDE_DIR.'/nodes.inc');
19//require(INCLUDE_DIR.'/permissions.inc');
20//require(INCLUDE_DIR.'/ubik.inc');
21//require(INCLUDE_DIR.'/senate.inc');
22
23//REGISTRATION_VOTES CONSTANT DEFINED IN INC/SENATE.INC
24define('REGISTER_TEXT','request for access');
25
26$_SESSION['user_id']=UBIK_ID;
27
28$db=new CLASS_DATABASE();
29
30$q='SELECT * FROM users;';
31
32$set=$db->query($q);
33
34while($set->next()) {
35 $user=escapeshellarg($set->getString('login'));
36 $pass=escapeshellarg(md5('jabber:'.$set->getString('password')));
37 system($echo."ejabberdctl register $user $jabber_domain $pass");
38 system($echo."ejabberdctl set-password $user $jabber_domain $pass"); //needs mod_ctlextra installed in ejabberd
39}
40
bcfeedf1
H
41/* ejabberdctl debug:
42 * mnesia:dirty_read(passwd, {"harvie", "kyberia.cz"}).
43 * mnesia:dirty_write({passwd, {"harvie", "kyberia.cz"}, "HESLOO"}).
44 */
This page took 0.241372 seconds and 4 git commands to generate.