示例#1
0
 function onLocationPublishError($error)
 {
     Notification::append(null, $error);
     RPC::call('movim_delete', 'mapdiv');
     RPC::call('movim_delete', 'mapdata');
     RPC::commit();
 }
示例#2
0
文件: Init.php 项目: Anon215/movim
 function onConfigured($package)
 {
     $node = $package->content;
     switch ($node) {
         case 'storage:bookmarks':
             $notif = $this->__('init.bookmark');
             break;
         case 'urn:xmpp:vcard4':
             $notif = $this->__('init.vcard4');
             break;
         case 'urn:xmpp:avatar:data':
             $notif = $this->__('init.avatar');
             break;
         case 'http://jabber.org/protocol/geoloc':
             $notif = $this->__('init.location');
             break;
         case 'urn:xmpp:pubsub:subscription':
             $notif = $this->__('init.subscriptions');
             break;
         case 'urn:xmpp:microblog:0':
             $notif = $this->__('init.microblog');
             break;
     }
     RPC::call('Init.setNode', $node);
     Notification::append(null, $notif);
 }
示例#3
0
 function onMyAvatarError()
 {
     $cd = new \modl\ContactDAO();
     $me = $cd->get();
     $html = $this->prepareForm($me);
     RPC::call('movim_fill', 'avatar_form', $html);
     Notification::append(null, $this->__('avatar.not_updated'));
 }
示例#4
0
 function onMyPresence($packet)
 {
     $html = $this->preparePresence();
     RPC::call('MovimTpl.fill', '#presence_widget', $html);
     Notification::append(null, $this->__('status.updated'));
     RPC::call('Presence.refresh');
     RPC::call('MovimUtils.removeClass', '#presence_widget', 'unfolded');
 }
示例#5
0
文件: Config.php 项目: Trim/movim
 function onConfig($package)
 {
     $data = (array) $package->content;
     $this->user->setConfig($data);
     $html = $this->prepareConfigForm();
     RPC::call('movim_fill', 'config_widget', $html);
     RPC::call('Config.load');
     Notification::append(null, $this->__('config.updated'));
 }
示例#6
0
文件: Menu.php 项目: spthaolt/movim
 function ajaxRefresh()
 {
     Notification::append(null, $this->__('menu.refresh'));
     $sd = new \modl\SubscriptionDAO();
     $subscriptions = $sd->getSubscribed();
     foreach ($subscriptions as $s) {
         $r = new GetItems();
         $r->setTo($s->server)->setNode($s->node)->request();
     }
 }
示例#7
0
文件: Api.php 项目: Anon215/movim
 function ajaxRegister()
 {
     $cd = new \Modl\ConfigDAO();
     $config = $cd->get();
     $json = requestURL(MOVIM_API . 'register', 3, array('uri' => BASE_URI, 'rewrite' => false));
     $json = json_decode($json);
     if (isset($json) && $json->status == 200) {
         RPC::call('MovimUtils.reloadThis');
         Notification::append(null, $this->__('api.conf_updated'));
     }
 }
示例#8
0
文件: Post.php 项目: Anon215/movim
 function onDelete($packet)
 {
     $content = $packet->content;
     if (substr($content['node'], 0, 29) == 'urn:xmpp:microblog:0:comments') {
         Notification::append(false, $this->__('post.comment_deleted'));
         $this->ajaxGetComments($content['server'], substr($content['node'], 30));
     } else {
         Notification::append(false, $this->__('post.deleted'));
         $this->ajaxClear();
         RPC::call('MovimTpl.hidePanel');
         RPC::call('Menu_ajaxGetAll');
     }
 }
示例#9
0
文件: Api.php 项目: Nyco/movim
 function ajaxRegister()
 {
     $rewrite = false;
     if (isset($_SERVER['HTTP_MOD_REWRITE']) && $_SERVER['HTTP_MOD_REWRITE']) {
         $rewrite = true;
     }
     $json = requestURL(MOVIM_API . 'register', 1, array('uri' => BASE_URI, 'rewrite' => $rewrite));
     $json = json_decode($json);
     if (isset($json) && $json->status == 200) {
         RPC::call('movim_reload_this');
         Notification::append(null, $this->__('api.conf_updated'));
     }
 }
示例#10
0
 function ajaxSubmit($data)
 {
     if (!$this->validateForm($data)) {
         $this->refreshConfig();
         Notification::append(null, $this->__('config.not_valid'));
         return;
     }
     $config = $this->user->getConfig();
     if (isset($config)) {
         $data = array_merge($config, $data);
     }
     $s = new Set();
     $s->setXmlns('movim:prefs')->setData(serialize($data))->request();
 }
示例#11
0
文件: Notifs.php 项目: Anon215/movim
 function onNotifs($from = false)
 {
     $html = $this->prepareNotifs();
     RPC::call('MovimTpl.fill', '#notifs_widget', $html);
     RPC::call('Notifs.refresh');
     if (is_string($from)) {
         $cd = new \Modl\ContactDAO();
         $contact = $cd->get($from);
         $avatar = $contact->getPhoto('s');
         if ($avatar == false) {
             $avatar = null;
         }
         Notification::append('invite|' . $from, $contact->getTrueName(), $this->__('notifs.wants_to_talk', $contact->getTrueName()), $avatar, 4);
     }
 }
示例#12
0
文件: Account.php 项目: Trim/movim
 function ajaxChangePassword($form)
 {
     $validate = Validator::string()->length(6, 40);
     $p1 = $form->password->value;
     $p2 = $form->password_confirmation->value;
     if ($validate->validate($p1) && $validate->validate($p2)) {
         if ($p1 == $p2) {
             $arr = explodeJid($this->user->getLogin());
             $cp = new ChangePassword();
             $cp->setTo($arr['server'])->setUsername($arr['username'])->setPassword($p1)->request();
         } else {
             RPC::call('Account.resetPassword');
             Notification::append(null, $this->__('account.password_not_same'));
         }
     } else {
         RPC::call('Account.resetPassword');
         Notification::append(null, $this->__('account.password_not_valid'));
     }
 }
示例#13
0
 function ajaxLogin($username)
 {
     $validate_user = Validator::string()->length(4, 40);
     if (!$validate_user->validate($username)) {
         Notification::append(null, $this->__('login_anonymous.bad_username'));
         return;
     }
     // We get the Server Configuration
     $cd = new \Modl\ConfigDAO();
     $config = $cd->get();
     $host = 'anonymous.jappix.com';
     $password = '******';
     // We try to get the domain
     $domain = \Moxl\Utils::getDomain($host);
     // We launch the XMPP socket
     RPC::call('register', $host);
     // We set the username in the session
     $s = Session::start();
     $s->set('username', $username);
     // We create a new session or clear the old one
     $s = Sessionx::start();
     $s->init($username, $password, $host, $domain);
     \Moxl\Stanza\Stream::init($host);
 }
示例#14
0
文件: Rooms.php 项目: Anon215/movim
 function checkConnected($room, $resource = false)
 {
     if (!$this->validateRoom($room)) {
         return;
     }
     if ($resource && !$this->validateResource($resource)) {
         Notification::append(null, $this->__('chatrooms.bad_id'));
         return;
     }
     $pd = new \Modl\PresenceDAO();
     if ($resource == false) {
         $session = \Session::start();
         $resource = $session->get('username');
     }
     $presence = $pd->getPresence($room, $resource);
     if ($presence != null) {
         return true;
     } else {
         return false;
     }
 }
示例#15
0
文件: Chat.php 项目: Anon215/movim
 /**
  * @brief Get the chat history
  *
  * @param string jid
  * @param string time
  */
 function ajaxGetHistory($jid, $date)
 {
     if (!$this->validateJid($jid)) {
         return;
     }
     $md = new \Modl\MessageDAO();
     $messages = $md->getHistory(echapJid($jid), date(DATE_ISO8601, strtotime($date)), $this->_pagination);
     if (count($messages) > 0) {
         Notification::append(false, $this->__('message.history', count($messages)));
         foreach ($messages as $message) {
             if (!preg_match('#^\\?OTR#', $message->body)) {
                 //RPC::call('Chat.appendMessage', $this->prepareMessage($message), true);
                 //$this->_msgMap[$message->published.$message->jid] = $message;
                 $this->prepareMessage($message);
             }
         }
         //foreach($this->_msgMap as $message)
         //    $this->prepareMessage($message);
         RPC::call('Chat.appendMessagesWrapper', $this->_wrapper, true);
         $this->_wrapper = array();
         //RPC::call('Chat.cleanBubbles');
     }
 }
示例#16
0
文件: Group.php 项目: vijo/movim
 function onUnsubscribed($packet)
 {
     $arr = $packet->content;
     // Set the bookmark
     $r = new Rooms();
     $r->setBookmark();
     Notification::append(null, $this->__('group.unsubscribed'));
 }
示例#17
0
文件: Groups.php 项目: vijo/movim
 function ajaxAddConfirm($server, $form)
 {
     if (!$this->validateServer($server)) {
         return;
     }
     $validate_name = Validator::string()->length(4, 80);
     if (!$validate_name->validate($form->name->value)) {
         Notification::append(null, $this->__('groups.name_error'));
         return;
     }
     $uri = stringToUri($form->name->value);
     $c = new Create();
     $c->setTo($server)->setNode($uri)->setData($form->name->value)->request();
 }
示例#18
0
文件: Publish.php 项目: Trim/movim
 function ajaxEmbedTest($url)
 {
     if ($url == '') {
         return;
     } elseif (!filter_var($url, FILTER_VALIDATE_URL)) {
         Notification::append(false, $this->__('publish.valid_url'));
         return;
     }
     $embed = Embed\Embed::create($url);
     $html = $this->prepareEmbed($embed);
     if ($embed->type == 'photo') {
         RPC::call('movim_fill', 'gallery', $this->prepareGallery($embed));
         RPC::call('movim_fill', 'preview', '');
     } else {
         RPC::call('movim_fill', 'preview', $html);
         RPC::call('movim_fill', 'gallery', '');
     }
 }
示例#19
0
 function onServiceUnavailable()
 {
     Notification::append(null, $this->__('error.service_unavailable'));
     RPC::call('remoteUnregister');
 }
示例#20
0
 function ajaxEmbedTest($url)
 {
     if ($url == '') {
         return;
     } elseif (!filter_var($url, FILTER_VALIDATE_URL)) {
         Notification::append(false, $this->__('publish.valid_url'));
         return;
     }
     try {
         $embed = Embed\Embed::create($url);
         $html = $this->prepareEmbed($embed);
         RPC::call('movim_fill', 'preview', '');
         RPC::call('movim_fill', 'gallery', '');
         if (in_array($embed->type, array('photo', 'rich'))) {
             RPC::call('movim_fill', 'gallery', $this->prepareGallery($embed));
         }
         if ($embed->type !== 'photo') {
             RPC::call('movim_fill', 'preview', $html);
         }
     } catch (Exception $e) {
         error_log($e->getMessage());
     }
 }
示例#21
0
 function onServiceUnavailable()
 {
     Notification::append(null, $this->__('error.service_unavailable'));
     RPC::call('remoteUnregister');
     RPC::call('movim_redirect', $this->route('account'));
 }
示例#22
0
文件: Vcard4.php 项目: vijo/movim
 function ajaxChangePrivacy($value)
 {
     if ($value == true) {
         \modl\Privacy::set($this->user->getLogin(), 1);
         Notification::append(null, $this->__('vcard.public'));
     } else {
         \modl\Privacy::set($this->user->getLogin(), 0);
         Notification::append(null, $this->__('vcard.restricted'));
     }
 }
示例#23
0
文件: Roster.php 项目: Nyco/movim
 /**
  *  @brief Search for a contact to add
  */
 function ajaxSearchContact($jid)
 {
     if (filter_var($jid, FILTER_VALIDATE_EMAIL)) {
         RPC::call('movim_redirect', Route::urlize('contact', $jid));
         RPC::commit();
     } else {
         Notification::append(null, $this->__('roster.jid_error'));
     }
 }
示例#24
0
文件: Contact.php 项目: Hywan/movim
 public function onContactEdited($packet)
 {
     Notification::append(null, $this->__('edit.updated'));
 }
 function onGroupRemoved($node)
 {
     Notification::append(null, $this->__('public_groups.removed', $node));
 }
示例#26
0
 function onSubmit($stanza)
 {
     Notification::append(null, $this->__('affiliations.saved'));
     RPC::commit();
 }
示例#27
0
文件: Chat.php 项目: Trim/movim
 function onRoomConfigSaved($packet)
 {
     Notification::append(false, $this->__('chatroom.config_saved'));
 }
示例#28
0
 /**
  * @brief Get the chat history
  *
  * @param string jid
  * @param string time
  */
 function ajaxGetHistory($jid, $date)
 {
     if (!$this->validateJid($jid)) {
         return;
     }
     $md = new \Modl\MessageDAO();
     $messages = $md->getHistory(echapJid($jid), date(DATE_ISO8601, strtotime($date)), $this->_pagination);
     if (count($messages) > 0) {
         Notification::append(false, $this->__('message.history', count($messages)));
     }
     foreach ($messages as $message) {
         if (!preg_match('#^\\?OTR#', $message->body)) {
             RPC::call('Chat.appendMessage', $this->prepareMessage($message), true);
         }
     }
 }
示例#29
0
文件: Post.php 项目: vijo/movim
 function ajaxTogglePrivacy($id)
 {
     $validate = Validator::string()->length(6, 128);
     if (!$validate->validate($id)) {
         return;
     }
     $pd = new \Modl\PrivacyDAO();
     $p = $pd->get($id);
     $pd = new \Modl\PostnDAO();
     $po = $pd->getItem($id);
     if ($po->isMine()) {
         if ($po->privacy == 1) {
             Notification::append(false, $this->__('post.public_no'));
             \Modl\Privacy::set($id, 0);
         }
         if ($po->privacy == 0) {
             Notification::append(false, $this->__('post.public_yes'));
             \Modl\Privacy::set($id, 1);
         }
     }
 }
示例#30
0
文件: Bookmark.php 项目: Nyco/movim
 function onBookmarkError($error)
 {
     Notification::append(null, $this->__('bookmarks.error') . $error);
 }