21 changed files with 617 additions and 260 deletions
-
14app/controllers/AccountnextController.php
-
9app/views/account.tpl
-
12app/views/accountnext.tpl
-
246app/widgets/Account/server-vcards.xml
-
87app/widgets/AccountError/AccountError.php
-
1app/widgets/AccountError/accounterror.tpl
-
239app/widgets/AccountNext/AccountNext.php
-
47app/widgets/AccountNext/_accountnext_form.tpl
-
1app/widgets/AccountNext/accountnext.css
-
1app/widgets/AccountNext/accountnext.js
-
12app/widgets/AccountNext/accountnext.tpl
-
1app/widgets/Login/Login.php
-
6app/widgets/Login/login.js
-
41app/widgets/Subscribe/Subscribe.php
-
57app/widgets/Subscribe/img/star.svg
-
40app/widgets/Subscribe/subscribe.css
-
35app/widgets/Subscribe/subscribe.tpl
-
7lib/XMPPtoForm.php
-
3system/Route.php
-
10themes/movim/css/forms.css
-
6themes/movim/css/style.css
@ -0,0 +1,14 @@ |
|||
<?php |
|||
|
|||
class AccountnextController extends BaseController { |
|||
function load() { |
|||
$this->session_only = false; |
|||
} |
|||
|
|||
function dispatch() { |
|||
$this->page->setTitle(t('%s - Account', APP_TITLE)); |
|||
|
|||
$this->page->menuAddLink(t('Home'), 'main'); |
|||
$this->page->menuAddLink(t('Account Creation'), 'account', true); |
|||
} |
|||
} |
|||
@ -1,4 +1,11 @@ |
|||
<?php /* -*- mode: html -*- */ |
|||
?> |
|||
<div id="main"> |
|||
<div id="left"> |
|||
</div> |
|||
<div id="center"> |
|||
<?php $this->widget('Subscribe');?> |
|||
</div> |
|||
</div> |
|||
|
|||
<?php $this->widget('Account');?> |
|||
<?php //$this->widget('Account');?> |
|||
@ -0,0 +1,12 @@ |
|||
<?php /* -*- mode: html -*- */ |
|||
?> |
|||
<div id="main"> |
|||
<div id="left"> |
|||
<?php $this->widget('AccountError');?> |
|||
</div> |
|||
<div id="center"> |
|||
<?php $this->widget('AccountNext');?> |
|||
</div> |
|||
</div> |
|||
|
|||
<?php //$this->widget('Account');?> |
|||
@ -1,246 +0,0 @@ |
|||
<vcards> |
|||
<vcard> |
|||
<fn> |
|||
<text>movim.eu</text> |
|||
</fn> |
|||
<kind> |
|||
<text>application</text> |
|||
</kind> |
|||
<url> |
|||
<uri>http://movim.eu/</uri> |
|||
</url> |
|||
<note> |
|||
<text>The Movim XMPP service.</text> |
|||
</note> |
|||
<registration xmlns="urn:xmpp:vcard:registration:1"> |
|||
<uri>xmpp:movim.eu</uri> |
|||
</registration> |
|||
<bday> |
|||
<date>2013</date> |
|||
</bday> |
|||
<adr> |
|||
<country>IE</country> |
|||
</adr> |
|||
<ca xmlns="urn:xmpp:vcard:ca:0"> |
|||
<name>CAcert</name> |
|||
<uri>http://www.cacert.org/</uri> |
|||
</ca> |
|||
<name xmlns="jabber:iq:version">Metronome</name> |
|||
<impp> |
|||
<uri>xmpp:edhelas@movim.eu</uri> |
|||
</impp> |
|||
<geo> |
|||
<uri>geo:53.06,-7.29</uri> |
|||
</geo> |
|||
</vcard> |
|||
<vcard> |
|||
<fn> |
|||
<text>jappix.com</text> |
|||
</fn> |
|||
<kind> |
|||
<text>application</text> |
|||
</kind> |
|||
<url> |
|||
<uri>http://jappix.com/</uri> |
|||
</url> |
|||
<note> |
|||
<text>The Jappix XMPP service.</text> |
|||
</note> |
|||
<registration xmlns="urn:xmpp:vcard:registration:1"> |
|||
<uri>xmpp:jappix.com</uri> |
|||
</registration> |
|||
<bday> |
|||
<date>2010</date> |
|||
</bday> |
|||
<adr> |
|||
<country>FR</country> |
|||
</adr> |
|||
<ca xmlns="urn:xmpp:vcard:ca:0"> |
|||
<name>CAcert</name> |
|||
<uri>http://www.cacert.org/</uri> |
|||
</ca> |
|||
<name xmlns="jabber:iq:version">Metronome</name> |
|||
<impp> |
|||
<uri>xmpp:vanaryon@jappix.com</uri> |
|||
</impp> |
|||
<geo> |
|||
<uri>geo:50.67,3.19</uri> |
|||
</geo> |
|||
</vcard> |
|||
<vcard> |
|||
<fn> |
|||
<text>tigase.im</text> |
|||
</fn> |
|||
<kind> |
|||
<text>application</text> |
|||
</kind> |
|||
<url> |
|||
<uri>http://www.tigase.im/</uri> |
|||
</url> |
|||
<note> |
|||
<text>The public Tigase service. - Also supports IPv6!</text> |
|||
</note> |
|||
<registration xmlns="urn:xmpp:vcard:registration:1"> |
|||
<uri>xmpp:tigase.im</uri> |
|||
</registration> |
|||
<bday> |
|||
<date>2010</date> |
|||
</bday> |
|||
<adr> |
|||
<country>EU</country> |
|||
</adr> |
|||
<ca xmlns="urn:xmpp:vcard:ca:0"> |
|||
<name>StartSSL</name> |
|||
<uri>http://www.startssl.com/</uri> |
|||
</ca> |
|||
<name xmlns="jabber:iq:version">Tigase</name> |
|||
<impp> |
|||
<uri>xmpp:admin@im.flosoft.biz</uri> |
|||
</impp> |
|||
<geo> |
|||
<uri>geo:50.69,3.19</uri> |
|||
</geo> |
|||
</vcard> |
|||
<vcard> |
|||
<fn> |
|||
<text>lightwitch.org</text> |
|||
</fn> |
|||
<kind> |
|||
<text>application</text> |
|||
</kind> |
|||
<url> |
|||
<uri>http://www.lightwitch.org/</uri> |
|||
</url> |
|||
<note> |
|||
<text>LW.Org XMPP Public Service.</text> |
|||
</note> |
|||
<registration> |
|||
<uri>xmpp:lightwitch.org</uri> |
|||
</registration> |
|||
<bday> |
|||
<date>2009</date> |
|||
</bday> |
|||
<adr> |
|||
<country>USA</country> |
|||
</adr> |
|||
<ca> |
|||
<name>StartSSL</name> |
|||
<uri>http://www.startssl.com/</uri> |
|||
</ca> |
|||
<name>Metronome</name> |
|||
<impp> |
|||
<uri>xmpp:maranda@lightwitch.org</uri> |
|||
</impp> |
|||
<geo> |
|||
<uri>geo:40.73,-74.17</uri> |
|||
</geo> |
|||
</vcard> |
|||
<vcard> |
|||
<fn> |
|||
<text>jabber.me</text> |
|||
</fn> |
|||
<kind> |
|||
<text>application</text> |
|||
</kind> |
|||
<url> |
|||
<uri>http://www.jabber.me/</uri> |
|||
</url> |
|||
<note> |
|||
<text>Just Jabber Me! - Also supports IPv6!</text> |
|||
</note> |
|||
<registration xmlns="urn:xmpp:vcard:registration:1"> |
|||
<uri>xmpp:jabber.me</uri> |
|||
</registration> |
|||
<bday> |
|||
<date>2010</date> |
|||
</bday> |
|||
<adr> |
|||
<country>EU</country> |
|||
</adr> |
|||
<ca xmlns="urn:xmpp:vcard:ca:0"> |
|||
<name>StartSSL</name> |
|||
<uri>http://www.startssl.com/</uri> |
|||
</ca> |
|||
<name xmlns="jabber:iq:version">Tigase</name> |
|||
<impp> |
|||
<uri>xmpp:admin@im.flosoft.biz</uri> |
|||
</impp> |
|||
<geo> |
|||
<uri>geo:50.69,3.19</uri> |
|||
</geo> |
|||
</vcard> |
|||
<vcard> |
|||
<fn> |
|||
<text>sure.im</text> |
|||
</fn> |
|||
<kind> |
|||
<text>application</text> |
|||
</kind> |
|||
<url> |
|||
<uri>http://www.sure.im/</uri> |
|||
</url> |
|||
<note> |
|||
<text>Just Sure Im! - Also supports IPv6!</text> |
|||
</note> |
|||
<registration xmlns="urn:xmpp:vcard:registration:1"> |
|||
<uri>xmpp:sure.im</uri> |
|||
</registration> |
|||
<bday> |
|||
<date>2010</date> |
|||
</bday> |
|||
<adr> |
|||
<country>EU</country> |
|||
</adr> |
|||
<ca xmlns="urn:xmpp:vcard:ca:0"> |
|||
<name>StartSSL</name> |
|||
<uri>http://www.startssl.com/</uri> |
|||
</ca> |
|||
<name xmlns="jabber:iq:version">Tigase</name> |
|||
<impp> |
|||
<uri>xmpp:admin@im.flosoft.biz</uri> |
|||
</impp> |
|||
<geo> |
|||
<uri>geo:50.69,3.19</uri> |
|||
</geo> |
|||
</vcard> |
|||
<vcard> |
|||
<fn> |
|||
<text>jabbim.cz</text> |
|||
</fn> |
|||
<kind> |
|||
<text>application</text> |
|||
</kind> |
|||
<url> |
|||
<uri>http://www.jabbim.cz/</uri> |
|||
</url> |
|||
<note> |
|||
<text>Stable ejabberd clustered server with good support and many transports and services: ICQ, AIM, MSN, Facebook, Weather, Yahoo, Notes, bots, MUCs, proxy65, STUN server for voice support, and more</text> |
|||
</note> |
|||
<registration xmlns="urn:xmpp:vcard:registration:1"> |
|||
<uri>xmpp:jabbim.cz</uri> |
|||
</registration> |
|||
<bday> |
|||
<date>2005</date> |
|||
</bday> |
|||
<adr> |
|||
<country>CZ</country> |
|||
</adr> |
|||
<ca xmlns="urn:xmpp:vcard:ca:0"> |
|||
<name>CAcert</name> |
|||
<uri>http://www.cacert.org/</uri> |
|||
</ca> |
|||
<name xmlns="jabber:iq:version">ejabberd</name> |
|||
<impp> |
|||
<uri>xmpp:pinky@njs.netlab.cz</uri> |
|||
</impp> |
|||
</vcard> |
|||
<vcard><fn><text>njs.netlab.cz</text></fn><kind><text>application</text></kind><url><uri>http://www.jabbim.cz/</uri></url><note><text>Public service hosted by jabbim.cz</text></note><registration xmlns="urn:xmpp:vcard:registration:1"><uri>xmpp:njs.netlab.cz</uri></registration><bday><date>2001</date></bday><adr><country>CZ</country></adr><ca xmlns="urn:xmpp:vcard:ca:0"><name>CAcert</name><uri>http://www.cacert.org/</uri></ca><name xmlns="jabber:iq:version">ejabberd</name><impp><uri>xmpp:pinky@njs.netlab.cz</uri></impp></vcard> |
|||
<vcard><fn><text>jabbim.pl</text></fn><kind><text>application</text></kind><url><uri>http://www.jabbim.cz/</uri></url><note><text>Public service hosted by jabbim.cz</text></note><registration xmlns="urn:xmpp:vcard:registration:1"><uri>xmpp:jabbim.pl</uri></registration><bday><date>2005</date></bday><adr><country>CZ</country></adr><ca xmlns="urn:xmpp:vcard:ca:0"><name>CAcert</name><uri>http://www.cacert.org/</uri></ca><name xmlns="jabber:iq:version">ejabberd</name><impp><uri>xmpp:pinky@njs.netlab.cz</uri></impp></vcard> |
|||
<vcard><fn><text>jabbim.sk</text></fn><kind><text>application</text></kind><url><uri>http://www.jabbim.cz/</uri></url><note><text>Public service hosted by jabbim.cz</text></note><registration xmlns="urn:xmpp:vcard:registration:1"><uri>xmpp:jabbim.sk</uri></registration><bday><date>2005</date></bday><adr><country>CZ</country></adr><ca xmlns="urn:xmpp:vcard:ca:0"><name>CAcert</name><uri>http://www.cacert.org/</uri></ca><name xmlns="jabber:iq:version">ejabberd</name><impp><uri>xmpp:pinky@njs.netlab.cz</uri></impp></vcard> |
|||
<vcard><fn><text>jabbim.com</text></fn><kind><text>application</text></kind><url><uri>http://www.jabbim.cz/</uri></url><note><text>Public service hosted by jabbim.cz</text></note><registration xmlns="urn:xmpp:vcard:registration:1"><uri>xmpp:jabbim.com</uri></registration><bday><date>2005</date></bday><adr><country>CZ</country></adr><ca xmlns="urn:xmpp:vcard:ca:0"><name>CAcert</name><uri>http://www.cacert.org/</uri></ca><name xmlns="jabber:iq:version">ejabberd</name><impp><uri>xmpp:pinky@njs.netlab.cz</uri></impp></vcard> |
|||
<vcard><fn><text>forumanalogue.fr</text></fn><kind><text>application</text></kind><url><uri>http://www.forumanalogue.fr/</uri></url><note><text>A public self-hosted Jabber server located in France.</text></note><registration xmlns="urn:xmpp:vcard:registration:1"><uri>xmpp:forumanalogue.fr</uri></registration><bday><date>2010</date></bday><adr><country>FR</country></adr><ca xmlns="urn:xmpp:vcard:ca:0"><name>StartSSL</name><uri>http://www.startssl.com/</uri></ca><name xmlns="jabber:iq:version">Openfire</name><impp><uri>xmpp:clement@forumanalogue.fr</uri></impp><geo><uri>geo:45.8,4.84</uri></geo><lang><parameters><pref>1</pref></parameters><language-tag>fr</language-tag></lang></vcard> |
|||
|
|||
</vcards> |
|||
|
|||
|
|||
|
|||
@ -0,0 +1,87 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* @package Widgets |
|||
* |
|||
* @file AccountError.php |
|||
* This file is part of MOVIM. |
|||
* |
|||
* @brief The account creation widget error. |
|||
* |
|||
* @author Timothée Jaussoin <edhelas@gmail.com> |
|||
* |
|||
* @version 1.0 |
|||
* @date 25 November 2011 |
|||
* |
|||
* Copyright (C)2010 MOVIM project |
|||
* |
|||
* See COPYING for licensing information. |
|||
*/ |
|||
|
|||
class AccountError extends WidgetBase { |
|||
|
|||
function WidgetLoad() |
|||
{ |
|||
$warning = ''; |
|||
|
|||
if(isset($_GET['err'])) |
|||
switch ($_GET['err']) { |
|||
case 'datamissing': |
|||
$warning = ' |
|||
<div class="message warning"> |
|||
'.t('Some data are missing !').' |
|||
</div> '; |
|||
break; |
|||
case 'jiderror': |
|||
$warning = ' |
|||
<div class="message warning"> |
|||
'.t('Wrong ID').' |
|||
</div> '; |
|||
break; |
|||
case 'passworddiff': |
|||
$warning = ' |
|||
<div class="message info"> |
|||
'.t('You entered different passwords').' |
|||
</div> '; |
|||
break; |
|||
case 'nameerr': |
|||
$warning = ' |
|||
<div class="message warning"> |
|||
'.t('Invalid name').' |
|||
</div> '; |
|||
break; |
|||
case 'notacceptable': |
|||
$warning = ' |
|||
<div class="message error"> |
|||
'.t('Request not acceptable').' |
|||
</div> '; |
|||
break; |
|||
case 'userconflict': |
|||
$warning = ' |
|||
<div class="message warning"> |
|||
'.t('Username already taken').' |
|||
</div> '; |
|||
break; |
|||
case 'xmppconnect': |
|||
$warning = ' |
|||
<div class="message error"> |
|||
'.t('Could not connect to the XMPP server').' |
|||
</div> '; |
|||
break; |
|||
case 'xmppcomm': |
|||
$warning = ' |
|||
<div class="message error"> |
|||
'.t('Could not communicate with the XMPP server').' |
|||
</div> '; |
|||
break; |
|||
case 'unknown': |
|||
$warning = ' |
|||
<div class="message error"> |
|||
'.t('Unknown error').' |
|||
</div> '; |
|||
break; |
|||
} |
|||
|
|||
$this->view->assign('warning', $warning); |
|||
} |
|||
} |
|||
@ -0,0 +1 @@ |
|||
{$warning} |
|||
@ -0,0 +1,239 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* @package Widgets |
|||
* |
|||
* @file Subscribe.php |
|||
* This file is part of MOVIM. |
|||
* |
|||
* @brief The account creation widget. |
|||
* |
|||
* @author Timothée Jaussoin <edhelas@gmail.com> |
|||
* |
|||
* @version 1.0 |
|||
* @date 25 November 2011 |
|||
* |
|||
* Copyright (C)2010 MOVIM project |
|||
* |
|||
* See COPYING for licensing information. |
|||
*/ |
|||
|
|||
class AccountNext extends WidgetBase { |
|||
|
|||
function WidgetLoad() |
|||
{ |
|||
$this->addcss('accountnext.css'); |
|||
$this->addjs('accountnext.js'); |
|||
|
|||
$xml = simplexml_load_string(file_get_contents('http://movim.eu/server-vcards.xml')); |
|||
$xml = (array)$xml->children(); |
|||
|
|||
$this->view->assign( |
|||
'getsubscriptionform', |
|||
$this->genCallAjax('ajaxDiscoverServer', "'".$_GET['s']."'") |
|||
); |
|||
|
|||
$this->view->assign('ndd', $_GET['s']); |
|||
|
|||
$this->view->assign('servers', $xml['vcard']); |
|||
} |
|||
|
|||
function ajaxDiscoverServer($ndd) { |
|||
try { |
|||
$dns = dns_get_record('_xmpp-client._tcp.'.$ndd); |
|||
|
|||
if(isset($dns[0]['target']) && $dns[0]['target'] != null) { |
|||
$domain = $dns[0]['target']; |
|||
} else { |
|||
$domain = $ndd['ndd']; |
|||
} |
|||
|
|||
$f = fsockopen($domain, 5222, $errno, $errstr, 10); |
|||
|
|||
if(!$f ) { |
|||
RPC::call('movim_reload', Route::urlize('account', 'xmppconnect')); |
|||
RPC::commit(); |
|||
exit; |
|||
} |
|||
|
|||
global $language; |
|||
|
|||
$stream = simplexml_load_string('<?xml version="1.0"?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0"><iq type="get" id="reg1" xml:lang="'.$language.'"><query xmlns="jabber:iq:register"/></iq></stream:stream>'); |
|||
$stream->addAttribute('to', $ndd); |
|||
if (false === fwrite($f, $stream->asXML())) { |
|||
\system\Logs\Logger::log('fail write to stream'); |
|||
throw new \Exception('fail write to stream'); |
|||
} |
|||
|
|||
unset($stream); |
|||
|
|||
$response = stream_get_contents($f); |
|||
if(!$response) { |
|||
RPC::call('movim_reload', Route::urlize('account', 'xmppcomm')); |
|||
RPC::commit(); |
|||
exit; |
|||
} |
|||
|
|||
$response = simplexml_load_string($response); |
|||
|
|||
$id = (string)$response->attributes()->id; |
|||
|
|||
$elements = (array)$response->iq->query; |
|||
|
|||
// We close properly our first register request
|
|||
$stream = simplexml_load_string('<?xml version="1.0"?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0"><iq type="set" id="unreg1"><query xmlns="jabber:iq:register"><remove/></query></iq></stream:stream>'); |
|||
$stream->addAttribute('to', $ndd); |
|||
fwrite($f, $stream->asXML()); |
|||
|
|||
fclose($f); unset($f); |
|||
|
|||
if(!empty($elements)) { |
|||
$formview = $this->tpl(); |
|||
|
|||
if($response->iq->query->instructions && $response->iq->query->x) { |
|||
$instr = ' |
|||
<div class="element simple large"> |
|||
<label>'.(string)$response->iq->query->instructions.'</label>'; |
|||
if($response->iq->query->x->url) |
|||
$instr .= ' |
|||
<a href="'.(string)$response->iq->query->x->url.'" target="_blank">'. |
|||
(string)$response->iq->query->x->url.' |
|||
</a>'; |
|||
$instr .= ' |
|||
</div>'; |
|||
|
|||
} |
|||
$form = new XMPPtoForm(); |
|||
if(!empty($response->iq->query->x)){ |
|||
$formh = $form->getHTML($response->iq->query->x->asXML()); |
|||
} else{// no <x> element in the XML
|
|||
$formh = $form->getHTML($response->iq->query->asXML()); |
|||
} |
|||
|
|||
if($formh != '') |
|||
$instr = ''; |
|||
|
|||
$formview->assign('instr', $instr); |
|||
$formview->assign('formh', $formh); |
|||
$formview->assign('id', $id); |
|||
$formview->assign('ndd', $ndd); |
|||
$formview->assign('domain', $domain); |
|||
|
|||
$formview->assign( |
|||
'submitdata', |
|||
$this->genCallAjax('ajaxSubmitData', "movim_form_to_json('data')")); |
|||
|
|||
$html = $formview->draw('_accountnext_form', true); |
|||
|
|||
/* |
|||
if(isset($elements['data'])) { |
|||
$html .= '<img src="data:image/jpg;base64,'.$elements['data'].'"/>'; |
|||
} |
|||
*/ |
|||
} else { |
|||
$html = ' |
|||
<div class="message warning"> |
|||
'.t('No account creation form founded on the server').' |
|||
</div>'; |
|||
} |
|||
|
|||
RPC::call('movim_fill', 'subscription_form', $html); |
|||
RPC::commit(); |
|||
|
|||
} catch(Exception $e) { |
|||
header(sprintf('HTTP/1.1 %d %s', $e->getCode(), $e->getMessage())); |
|||
header('Content-Type: text/plain; charset=utf-8'); |
|||
\system\Logs\Logger::log($e->getMessage()); |
|||
} |
|||
} |
|||
|
|||
function ajaxSubmitData($datas) { |
|||
define(XMPP_HOST, $datas->to->value); |
|||
define(XMPP_CONN, $datas->ndd->value); |
|||
|
|||
unset($datas->to); |
|||
unset($datas->ndd); |
|||
|
|||
define(XMPP_PORT, 5222); |
|||
|
|||
try { |
|||
// We try to connect to the XMPP Server
|
|||
$f = fsockopen(XMPP_CONN, XMPP_PORT, $errno, $errstr, 10); |
|||
|
|||
if(!$f) { |
|||
RPC::call('movim_reload', Route::urlize('accountnext', 'xmppconnect')); |
|||
RPC::commit(); |
|||
exit; |
|||
} |
|||
|
|||
// We create the XML Stanza
|
|||
$stream = simplexml_load_string('<?xml version="1.0"?><stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" version="1.0"><iq id="'.$datas->id->value.'" type="set"><query xmlns="jabber:iq:register"><x xmlns="jabber:x:data" type="form"></x></query></iq></stream:stream>'); |
|||
|
|||
unset($datas->id); |
|||
|
|||
$stream->addAttribute('to', XMPP_HOST); |
|||
|
|||
$xmpp = new FormtoXMPP(); |
|||
$stream = $xmpp->getXMPP($stream->asXML(), $datas); |
|||
|
|||
fwrite($f, $stream->asXML()); |
|||
|
|||
unset($stream); |
|||
|
|||
$response = stream_get_contents($f); |
|||
|
|||
if(!$response) { |
|||
RPC::call('movim_reload', Route::urlize('accountnext', array(XMPP_HOST, 'xmppcomm'))); |
|||
RPC::commit(); |
|||
exit; |
|||
} |
|||
|
|||
fclose($f); unset($f); |
|||
|
|||
$response = simplexml_load_string($response); |
|||
|
|||
if(!$response) throw new Exception('The XMPP server sent an invalid response', 500); |
|||
|
|||
if($stream_error = $response->xpath('/stream:stream/stream:error')) { |
|||
list($stream_error) = $stream_error; |
|||
list($cond) = $stream_error->children(); |
|||
|
|||
throw new Exception($stream_error->text ? $stream_error->text : $cond->getName(), 500); |
|||
} |
|||
|
|||
$iq = $response->iq; |
|||
|
|||
if($iq->error) { |
|||
list($cond) = $iq->error->children(); |
|||
if($cond->getName() == 'conflict') { |
|||
RPC::call('movim_reload', Route::urlize('accountnext', array(XMPP_HOST,'userconflict'))); |
|||
RPC::commit(); |
|||
exit; |
|||
} else if($cond->getName() == 'not-acceptable') { |
|||
RPC::call('movim_reload', Route::urlize('accountnext', array(XMPP_HOST,'notacceptable'))); |
|||
RPC::commit(); |
|||
exit; |
|||
} |
|||
throw new Exception($iq->error->text ? $iq->error->text : $cond->getName(), 400); |
|||
} |
|||
|
|||
if($iq = $response->iq and $iq->attributes()->type == 'result') { |
|||
RPC::call('movim_reload', Route::urlize('login', 'acccreated')); |
|||
RPC::commit(); |
|||
exit; |
|||
} else { |
|||
RPC::call('movim_reload', Route::urlize('accountnext', array(XMPP_HOST,'unknown'))); |
|||
RPC::commit(); |
|||
exit; |
|||
} |
|||
} catch(Exception $e) { |
|||
header(sprintf('HTTP/1.1 %d %s', $e->getCode(), $e->getMessage())); |
|||
header('Content-Type: text/plain; charset=utf-8'); |
|||
\system\Logs\Logger::log($e->getCode().' '.$e->getMessage().' file:'.$e->getFile().' - l.'.$e->getLine()); |
|||
} |
|||
} |
|||
|
|||
function flagPath($country) { |
|||
return BASE_URI.'themes/movim/img/flags/'.strtolower($country).'.png'; |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
<form name="data"> |
|||
<fieldset> |
|||
{$instr} |
|||
|
|||
<div class="clear"></div> |
|||
{$formh} |
|||
|
|||
<input |
|||
type="hidden" |
|||
value="{$domain}" |
|||
name="ndd" |
|||
id="ndd" |
|||
/> |
|||
|
|||
<input |
|||
type="hidden" |
|||
value="{$ndd}" |
|||
name="to" |
|||
id="to" |
|||
/> |
|||
|
|||
<input |
|||
type="hidden" |
|||
value="{$id}" |
|||
name="id" |
|||
id="id" |
|||
/> |
|||
|
|||
<input |
|||
id="submitb" |
|||
type="submit" |
|||
style="display: none;" |
|||
value="submit" |
|||
name="submitb" |
|||
/> |
|||
|
|||
<a |
|||
class="button color green icon yes" |
|||
style="float: right;" |
|||
onclick=" |
|||
localStorage.username = document.querySelector('#username').value+'@'+'{$ndd}'; |
|||
{$submitdata}" |
|||
> |
|||
{$c->t('Validate')} |
|||
</a> |
|||
</fieldset> |
|||
</form> |
|||
@ -0,0 +1 @@ |
|||
|
|||
@ -0,0 +1 @@ |
|||
|
|||
@ -0,0 +1,12 @@ |
|||
<div id="subscribe"> |
|||
<h1>{$c->t('Create a new account')} {$c->t('on')} {$ndd}</h1> |
|||
|
|||
<div id="subscription_form" class="paddedtop"> |
|||
{$c->t('Loading')} |
|||
</div> |
|||
|
|||
<script type="text/javascript"> |
|||
{$getsubscriptionform} |
|||
</script> |
|||
</div> |
|||
|
|||
@ -0,0 +1,41 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* @package Widgets |
|||
* |
|||
* @file Subscribe.php |
|||
* This file is part of MOVIM. |
|||
* |
|||
* @brief The account creation widget. |
|||
* |
|||
* @author Timothée Jaussoin <edhelas@gmail.com> |
|||
* |
|||
* @version 1.0 |
|||
* @date 25 November 2011 |
|||
* |
|||
* Copyright (C)2010 MOVIM project |
|||
* |
|||
* See COPYING for licensing information. |
|||
*/ |
|||
|
|||
class Subscribe extends WidgetBase { |
|||
|
|||
function WidgetLoad() |
|||
{ |
|||
$this->addcss('subscribe.css'); |
|||
$this->addjs('subscribe.js'); |
|||
|
|||
$xml = simplexml_load_string(file_get_contents('http://movim.eu/server-vcards.xml')); |
|||
$xml = (array)$xml->children(); |
|||
|
|||
$this->view->assign('servers', $xml['vcard']); |
|||
} |
|||
|
|||
function flagPath($country) { |
|||
return BASE_URI.'themes/movim/img/flags/'.strtolower($country).'.png'; |
|||
} |
|||
|
|||
function accountNext($server) { |
|||
return Route::urlize('accountnext', array($server)); |
|||
} |
|||
} |
|||
@ -0,0 +1,57 @@ |
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
|||
<!-- Generated by IcoMoon.io --> |
|||
|
|||
<svg |
|||
xmlns:dc="http://purl.org/dc/elements/1.1/" |
|||
xmlns:cc="http://creativecommons.org/ns#" |
|||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
|||
xmlns:svg="http://www.w3.org/2000/svg" |
|||
xmlns="http://www.w3.org/2000/svg" |
|||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
|||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
|||
version="1.1" |
|||
width="32" |
|||
height="32" |
|||
viewBox="0 0 32 32" |
|||
id="svg2" |
|||
inkscape:version="0.48.4 r9939" |
|||
sodipodi:docname="star.svg"> |
|||
<metadata |
|||
id="metadata10"> |
|||
<rdf:RDF> |
|||
<cc:Work |
|||
rdf:about=""> |
|||
<dc:format>image/svg+xml</dc:format> |
|||
<dc:type |
|||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
|||
</cc:Work> |
|||
</rdf:RDF> |
|||
</metadata> |
|||
<defs |
|||
id="defs8" /> |
|||
<sodipodi:namedview |
|||
pagecolor="#ffffff" |
|||
bordercolor="#666666" |
|||
borderopacity="1" |
|||
objecttolerance="10" |
|||
gridtolerance="10" |
|||
guidetolerance="10" |
|||
inkscape:pageopacity="0" |
|||
inkscape:pageshadow="2" |
|||
inkscape:window-width="1920" |
|||
inkscape:window-height="1012" |
|||
id="namedview6" |
|||
showgrid="false" |
|||
inkscape:zoom="7.375" |
|||
inkscape:cx="-9.1525424" |
|||
inkscape:cy="16" |
|||
inkscape:window-x="0" |
|||
inkscape:window-y="23" |
|||
inkscape:window-maximized="1" |
|||
inkscape:current-layer="svg2" /> |
|||
<path |
|||
d="M12.483 12.211c0 0-4.213 0.467-7.024 0.779-0.253 0.031-0.477 0.2-0.561 0.457s0 0.525 0.187 0.695c2.088 1.905 5.225 4.759 5.225 4.759-0.003 0-0.861 4.151-1.432 6.92-0.048 0.251 0.043 0.516 0.261 0.675 0.217 0.159 0.497 0.161 0.717 0.037 2.459-1.397 6.141-3.499 6.141-3.499s3.684 2.101 6.139 3.5c0.224 0.123 0.504 0.12 0.721-0.039 0.219-0.159 0.309-0.424 0.26-0.673-0.571-2.771-1.428-6.921-1.428-6.921s3.137-2.853 5.225-4.755c0.187-0.175 0.269-0.443 0.187-0.699s-0.307-0.425-0.56-0.455c-2.811-0.315-7.025-0.781-7.025-0.781s-1.747-3.864-2.911-6.44c-0.109-0.231-0.339-0.392-0.608-0.392s-0.5 0.163-0.604 0.392c-1.165 2.576-2.911 6.44-2.911 6.44z" |
|||
fill="#ffffff" |
|||
id="path4" |
|||
style="fill:#e2e152;fill-opacity:1" /> |
|||
</svg> |
|||
@ -0,0 +1,40 @@ |
|||
#subscribe .block { |
|||
border: 1px solid #DDD; |
|||
margin-right: 1em; |
|||
margin-bottom: 1em; |
|||
width: 48%; |
|||
padding: 1em; |
|||
display: inline-block; |
|||
box-sizing: border-box; |
|||
-webkit-box-sizing: border-box; |
|||
-moz-box-sizing: border-box; |
|||
} |
|||
|
|||
#subscribe .block:hover { |
|||
background-color: #EEE; |
|||
cursor: pointer; |
|||
border-color: #BBB; |
|||
} |
|||
|
|||
#subscribe .block h1 { |
|||
padding: 0; |
|||
line-height: 1em; |
|||
font-size: 1.2em; |
|||
} |
|||
|
|||
#subscribe .block img.flag { |
|||
float: right; |
|||
margin-top: -1em; |
|||
} |
|||
|
|||
#subscribe .block a { |
|||
text-decoration: none; |
|||
line-height: 1.5em; |
|||
} |
|||
|
|||
#subscribe .block.star { |
|||
background-image: url('img/star.svg'); |
|||
background-size: 3em 3em; |
|||
background-position: 100% 100%; |
|||
background-repeat: no-repeat; |
|||
} |
|||
@ -0,0 +1,35 @@ |
|||
<div id="subscribe"> |
|||
<h1>{$c->t('Create a new account')}</h1> |
|||
|
|||
<p class="paddedtop">{$c->t('Movim is a decentralized social network, before creating a new account you need to choose a server to register.')}</p> |
|||
|
|||
<div class="paddedtop"> |
|||
{loop="$servers"} |
|||
<div |
|||
class="block {if="$value->checked"}star{/if}" |
|||
onclick="movim_redirect('{$c->route('accountnext', array($value->fn->text, false))}')"> |
|||
<h1>{$value->fn->text}</h1> |
|||
|
|||
<img |
|||
class="flag" |
|||
title="{$value->adr->country}" |
|||
alt="{$value->adr->country}" |
|||
src="{$c->flagPath($value->adr->country)}"/> |
|||
<p>{$value->note->text}</p> |
|||
|
|||
<a target="_blank" href="{$value->url->uri}"> |
|||
{$value->url->uri} |
|||
</a> |
|||
</div> |
|||
{/loop} |
|||
|
|||
<div class="block"> |
|||
<h1>{$c->t('Your server here ?')}</h1> |
|||
|
|||
<p> |
|||
{$c->t('Contact us to add yours to the officially supported servers list')} • <a href="http://movim.eu/">http://movim.eu/</a> |
|||
</p> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue