Added first version of cron script for automatic registering of jabber users
authorHarvie <tomas@mudrunka.cz>
Sat, 8 Jan 2011 22:43:49 +0000 (23:43 +0100)
committerHarvie <tomas@mudrunka.cz>
Sat, 8 Jan 2011 22:43:49 +0000 (23:43 +0100)
cron/ejabberd_sync.php [new file with mode: 0755]

diff --git a/cron/ejabberd_sync.php b/cron/ejabberd_sync.php
new file mode 100755 (executable)
index 0000000..8bb6290
--- /dev/null
@@ -0,0 +1,40 @@
+#!/usr/bin/php
+<?php
+/*
+ * Script that synchronizes ejabberd users with kyberia
+ * Call as needed
+ */
+
+//$echo='echo '; //Test only...
+$jabber_domain=escapeshellarg('kyberia.cz');
+
+// Use relative address of config file
+// Change this, if you move you cron directory.
+$dir=substr(__FILE__, 0, strrpos(__FILE__, '/'));
+require($dir.'/../wwwroot/config/config.inc');
+
+//require(INCLUDE_DIR.'/log.inc');
+require(INCLUDE_DIR.'/database.inc');
+//require(INCLUDE_DIR.'/nodes.inc');
+//require(INCLUDE_DIR.'/permissions.inc');
+//require(INCLUDE_DIR.'/ubik.inc');
+//require(INCLUDE_DIR.'/senate.inc');
+
+//REGISTRATION_VOTES CONSTANT DEFINED IN INC/SENATE.INC
+define('REGISTER_TEXT','request for access');
+
+$_SESSION['user_id']=UBIK_ID;
+
+$db=new CLASS_DATABASE();
+
+$q='SELECT * FROM users;';
+
+$set=$db->query($q);
+
+while($set->next()) {
+       $user=escapeshellarg($set->getString('login'));
+       $pass=escapeshellarg(md5('jabber:'.$set->getString('password')));
+       system($echo."ejabberdctl register $user $jabber_domain $pass");
+       system($echo."ejabberdctl set-password $user $jabber_domain $pass"); //needs mod_ctlextra installed in ejabberd
+}
+
This page took 0.137951 seconds and 4 git commands to generate.