diff options
-rw-r--r-- | actions/get_icons.php | 2 | ||||
-rw-r--r-- | actions/join_groupchat.php | 2 | ||||
-rw-r--r-- | actions/leave_groupchat.php | 2 | ||||
-rw-r--r-- | actions/save_state.php | 2 | ||||
-rw-r--r-- | disablechat.php | 4 | ||||
-rw-r--r-- | enablechat.php | 4 | ||||
-rw-r--r-- | lib/beechat.php | 30 | ||||
-rw-r--r-- | start.php | 33 | ||||
-rw-r--r-- | views/default/beechat/beechat.php | 2 | ||||
-rw-r--r-- | views/default/beechat/beechat.userjs.php | 2 | ||||
-rwxr-xr-x | views/default/settings/beechat/edit.php | 14 |
11 files changed, 50 insertions, 47 deletions
diff --git a/actions/get_icons.php b/actions/get_icons.php index 88e7bdd3b..33d447e2e 100644 --- a/actions/get_icons.php +++ b/actions/get_icons.php @@ -30,7 +30,7 @@ $jid_host = $splitjid[1]; foreach ($userFriendsEntities as $friend) { - if ((strtolower($friend->username) == strtolower($jid_name) && $jid_host == get_plugin_setting("domain", "beechat"))) + if ((strtolower($friend->username) == strtolower($jid_name) && $jid_host == elgg_get_plugin_setting("domain", "beechat"))) { $res[$value] = array('small' => $friend->getIcon('small'), 'tiny' => $friend->getIcon('tiny')); $found = true; diff --git a/actions/join_groupchat.php b/actions/join_groupchat.php index 0d2d75c61..c694d7957 100644 --- a/actions/join_groupchat.php +++ b/actions/join_groupchat.php @@ -1,6 +1,6 @@ <?php -$user = get_loggedin_user(); +$user = elgg_get_logged_in_user_entity(); $group = get_entity(get_input('group_guid')); if ($user && $group) { diff --git a/actions/leave_groupchat.php b/actions/leave_groupchat.php index 079ad4898..e04ab8846 100644 --- a/actions/leave_groupchat.php +++ b/actions/leave_groupchat.php @@ -1,6 +1,6 @@ <?php -$user = get_loggedin_user(); +$user = elgg_get_logged_in_user_entity(); $group = get_entity(get_input('group_guid')); if ($user && $group) { diff --git a/actions/save_state.php b/actions/save_state.php index 42e429e4a..f8a61c580 100644 --- a/actions/save_state.php +++ b/actions/save_state.php @@ -11,7 +11,7 @@ // gatekeeper(); - if (isloggedin()) + if (elgg_is_logged_in()) { global $SESSION; diff --git a/disablechat.php b/disablechat.php index 38a440cf2..490fb327b 100644 --- a/disablechat.php +++ b/disablechat.php @@ -1,7 +1,7 @@ <?php require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - if (isloggedin()) { - get_loggedin_user()->chatenabled = false; + if (elgg_is_logged_in()) { + elgg_get_logged_in_user_entity()->chatenabled = false; system_message(elgg_echo("beechat:disabled")); } forward($_SERVER['HTTP_REFERER']); diff --git a/enablechat.php b/enablechat.php index f3449520c..5d3de7e2a 100644 --- a/enablechat.php +++ b/enablechat.php @@ -1,7 +1,7 @@ <?php require_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php"); - if (isloggedin()) { - get_loggedin_user()->chatenabled = true; + if (elgg_is_logged_in()) { + elgg_get_logged_in_user_entity()->chatenabled = true; system_message(elgg_echo("beechat:enabled")); } forward($_SERVER['HTTP_REFERER']); diff --git a/lib/beechat.php b/lib/beechat.php index a7db64052..bf002d648 100644 --- a/lib/beechat.php +++ b/lib/beechat.php @@ -35,7 +35,7 @@ function ejabberd_xmlrpc_send($request) 'content' => $request ))); - $file = file_get_contents("http://".get_plugin_setting("xmlrpcip", "beechat").":4560/RPC2", false, $context); + $file = file_get_contents("http://".elgg_get_plugin_setting("xmlrpcip", "beechat").":4560/RPC2", false, $context); $response = xmlrpc_decode($file); if (is_array($response) && xmlrpc_is_fault($response)) { @@ -73,8 +73,8 @@ class EjabberdMucRoom { } function setOption($name, $value) { $group = $this->group; - $param=array("name"=>friendly_title($group->name), - "service"=>get_plugin_setting("groupdomain", "beechat"), + $param=array("name"=>elgg_get_friendly_title($group->name), + "service"=>elgg_get_plugin_setting("groupdomain", "beechat"), "option"=>$name, "value"=>$value); ejabberd_xmlrpc_command('muc_room_change_option', $param); @@ -93,9 +93,9 @@ class EjabberdMucRoom { function setAffiliation($member, $affiliation) { $group = $this->group; - $param = array("name" => friendly_title($group->name), - "service" => get_plugin_setting("groupdomain", "beechat"), - "jid" => xmpp_escape($member->username) . '@' . get_plugin_setting("domain", "beechat"), + $param = array("name" => elgg_get_friendly_title($group->name), + "service" => elgg_get_plugin_setting("groupdomain", "beechat"), + "jid" => xmpp_escape($member->username) . '@' . elgg_get_plugin_setting("domain", "beechat"), "affiliation" => $affiliation); ejabberd_xmlrpc_command('muc_room_set_affiliation', $param); //echo "set affiliation ".$member->username."<br/>"; @@ -106,9 +106,9 @@ function ejabberd_create_group($group) { //echo "creating " . $group->name . "<br/>"; // create room - $param=array("name"=>friendly_title($group->name), - "service"=>get_plugin_setting("groupdomain", "beechat"), - "server"=>get_plugin_setting("domain", "beechat")); + $param=array("name"=>elgg_get_friendly_title($group->name), + "service"=>elgg_get_plugin_setting("groupdomain", "beechat"), + "server"=>elgg_get_plugin_setting("domain", "beechat")); ejabberd_xmlrpc_command('create_muc_room', $param); // persistency @@ -140,9 +140,9 @@ function ejabberd_create_group($group) function ejabberd_destroy_group($group) { - $param=array("name"=>friendly_title($group->name), - "service"=>get_plugin_setting("groupdomain", "beechat"), - "server"=>get_plugin_setting("domain", "beechat")); + $param=array("name"=>elgg_get_friendly_title($group->name), + "service"=>elgg_get_plugin_setting("groupdomain", "beechat"), + "server"=>elgg_get_plugin_setting("domain", "beechat")); ejabberd_xmlrpc_command('delete_muc_room', $param); } @@ -172,7 +172,7 @@ function ejabberd_getjid($user, $do_external=false) } else { $username = $user->username; - $host = get_plugin_setting("domain", "beechat"); + $host = elgg_get_plugin_setting("domain", "beechat"); } return xmpp_escape($username) . '@' . $host; } @@ -184,8 +184,8 @@ function ejabberd_friend_command($user, $friend, $command, $is_out) // $user add error_log(" * beechat: friend is foreign!"); return; } - $param = array("user" => friendly_title($friend->username), - "server" => get_plugin_setting("domain", "beechat"), + $param = array("user" => elgg_get_friendly_title($friend->username), + "server" => elgg_get_plugin_setting("domain", "beechat"), "from" => ejabberd_getjid($user), "subs" => $command); if ($is_out) { @@ -82,7 +82,7 @@ // new friend sync elgg_register_event_handler('delete', 'friend', array('BeechatSync', 'onFriendDelete')); - elgg_register_event_handler('create', 'friendrequest', array('BeechatSync', 'onFriendCreate')); + //elgg_register_event_handler('create', 'friendrequest', array('BeechatSync', 'onFriendCreate')); elgg_register_event_handler('delete', 'friendrequest', array('BeechatSync', 'onFriendDelete')); @@ -138,30 +138,34 @@ function beechat_pagesetup() { global $CONFIG; - /*if (get_context() == 'group_profile' && isloggedin()) { - if (get_plugin_setting("groupdomain", "beechat")) { - $user = get_loggedin_user(); - $group = page_owner_entity(); + /*if (elgg_get_context() == 'group_profile' && elgg_is_logged_in()) { + if (elgg_get_plugin_setting("groupdomain", "beechat")) { + $user = elgg_get_logged_in_user_entity(); + $group = elgg_get_page_owner_entity(); if (!$group || !($group instanceof ElggGroup)) return; - if ($user->chatenabled && get_plugin_setting("groupdomain", "beechat")) { - if ($group->isPublicMembership() || $group->isMember($user)) - add_submenu_item(elgg_echo('beechat:chatroom'), "javascript:g_beechat_user.joinRoom('".beechat_friendly_title($group->name)."@".$CONFIG->chatsettings['groupdomain']."', '".$group->guid."')"); + if ($user->chatenabled && elgg_get_plugin_setting("groupdomain", "beechat")) { + if ($group->isPublicMembership() || $group->isMember($user)) { + $item = new ElggMenuItem('chatroom', elgg_echo('beechat:chatroom'), "javascript:g_beechat_user.joinRoom('".beechat_friendly_title($group->name)."@".$CONFIG->chatsettings['groupdomain']."', '".$group->guid."')"); + elgg_register_menu_item('page', 'item'); + } } } } else*/if (elgg_get_context() == 'settings' && elgg_is_logged_in()) { - if (get_loggedin_user()->chatenabled) { - add_submenu_item(elgg_echo('beechat:disablechat'), $CONFIG->wwwroot . "mod/beechat/disablechat.php"); - } - else - add_submenu_item(elgg_echo('beechat:enablechat'), $CONFIG->wwwroot . "mod/beechat/enablechat.php"); + $is_enabled = elgg_get_logged_in_user_entity()->chatenabled; + $action = $is_enabled ? 'disable' : 'enable'; + elgg_register_menu_item('page', array( + 'name' => 'beechat', + 'text'=> elgg_echo("beechat:{$action}chat"), + 'href' => $CONFIG->wwwroot . "mod/beechat/{$action}chat.php", + )); } } function ejabberd_send_chat($user, $body) { // $user adds $friend - $from = 'notify@'.get_plugin_setting("domain", "beechat").'/net'; + $from = 'notify@'.elgg_get_plugin_setting("domain", "beechat").'/net'; if ($user->alias) { } @@ -178,4 +182,3 @@ elgg_register_event_handler('init', 'system', 'beechat_init'); -?> diff --git a/views/default/beechat/beechat.php b/views/default/beechat/beechat.php index d1e9e17be..397d35f74 100644 --- a/views/default/beechat/beechat.php +++ b/views/default/beechat/beechat.php @@ -9,7 +9,7 @@ * @link http://beechannels.com/ */ -if (isloggedin() && get_loggedin_user()->chatenabled && elgg_get_context() != 'admin') { +if (elgg_is_logged_in() && elgg_get_logged_in_user_entity()->chatenabled && elgg_get_context() != 'admin') { ?> <div id="beechat"> <div id="beechat_left"> diff --git a/views/default/beechat/beechat.userjs.php b/views/default/beechat/beechat.userjs.php index 1a4d1565c..ed59b683f 100644 --- a/views/default/beechat/beechat.userjs.php +++ b/views/default/beechat/beechat.userjs.php @@ -46,7 +46,7 @@ if (elgg_is_logged_in()) { 'limit' => 0)); if (!empty($chatrooms)) { foreach($chatrooms as $chatroom) { - echo "g_user_rooms.push(['".beechat_friendly_title($chatroom->name)."@".get_plugin_setting("groupdomain", "beechat")."', '".$chatroom->guid."']);"; + echo "g_user_rooms.push(['".beechat_friendly_title($chatroom->name)."@".elgg_get_plugin_setting("groupdomain", "beechat")."', '".$chatroom->guid."']);"; } } } diff --git a/views/default/settings/beechat/edit.php b/views/default/settings/beechat/edit.php index 24dcd4e25..ec4ab08de 100755 --- a/views/default/settings/beechat/edit.php +++ b/views/default/settings/beechat/edit.php @@ -3,13 +3,13 @@ * Barter Plugin * @package Barters **/ - $domain = get_plugin_setting("domain", "beechat"); - //$group_domain = get_plugin_setting("groupdomain", "beechat"); - $xmlrpc_ip = get_plugin_setting("xmlrpcip", "beechat"); - $dbname = get_plugin_setting("dbname", "beechat"); - $dbhost = get_plugin_setting("dbhost", "beechat"); - $dbuser = get_plugin_setting("dbuser", "beechat"); - $dbpassword = get_plugin_setting("dbpassword", "beechat"); + $domain = elgg_get_plugin_setting("domain", "beechat"); + //$group_domain = elgg_get_plugin_setting("groupdomain", "beechat"); + $xmlrpc_ip = elgg_get_plugin_setting("xmlrpcip", "beechat"); + $dbname = elgg_get_plugin_setting("dbname", "beechat"); + $dbhost = elgg_get_plugin_setting("dbhost", "beechat"); + $dbuser = elgg_get_plugin_setting("dbuser", "beechat"); + $dbpassword = elgg_get_plugin_setting("dbpassword", "beechat"); ?> <p> <?php echo elgg_echo('beechat:domain'); ?> |