Skip to content

Commit

Permalink
Updated version of plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
v29neil committed Jan 4, 2017
1 parent 6606552 commit d9db3bc
Show file tree
Hide file tree
Showing 243 changed files with 542 additions and 5,841 deletions.
34 changes: 17 additions & 17 deletions classes/event_handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function getInstance()
public function genericInit()
{
OW::getEventManager()->bind(OW_EventManager::ON_FINALIZE, array($this, 'onPluginInit'));
OW::getEventManager()->bind('admin.add_auth_labels', array($this, 'onCollectAuthLabels'));
// OW::getEventManager()->bind('admin.add_auth_labels', array($this, 'onCollectAuthLabels'));


}
Expand All @@ -47,22 +47,22 @@ public function onPluginInit()
}


public function onCollectAuthLabels( BASE_CLASS_EventCollector $event )
{
$language = OW::getLanguage();
$event->add(
array(
'iflychat' => array(
'label' => $language->text('iflychat', 'auth_group_label'),
'actions' => array(
'add_chat' => $language->text('iflychat', 'auth_action_label_chat'),
'mod' => $language->text('iflychat', 'auth_action_label_admin')
)
)
)
);

}
// public function onCollectAuthLabels( BASE_CLASS_EventCollector $event )
// {
// $language = OW::getLanguage();
// $event->add(
// array(
// 'iflychat' => array(
// 'label' => $language->text('iflychat', 'auth_group_label'),
// 'actions' => array(
// 'add_chat' => $language->text('iflychat', 'auth_action_label_chat'),
// 'mod' => $language->text('iflychat', 'auth_action_label_admin')
// )
// )
// )
// );
//
// }


}
167 changes: 34 additions & 133 deletions components/toolbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,138 +17,39 @@ public function render()
{

$obj = new iflychatHelper;


$variable_get = $obj->params('iflychat_ext_d_i');


define('IFLYCHAT_EXTERNAL_HOST', 'http://api'.$variable_get.'.iflychat.com');
define('IFLYCHAT_EXTERNAL_PORT', '80');
define('IFLYCHAT_EXTERNAL_A_HOST', 'https://api'.$variable_get.'.iflychat.com');
define('IFLYCHAT_EXTERNAL_A_PORT', '443');


if($obj->params('iflychat_theme') == 1) {
$iflychat_theme = 'light';
}
else {
$iflychat_theme = 'dark';
}

$language = OW::getLanguage();

$iflychat_settings = array(

// 'username' => ($user->id)?$user->name:'default', //$a_name
// 'uid' => $user->id, //($user->id)?$user->id:'0-'._drupalchat_get_sid(),
'current_timestamp' => time(),
'polling_method' => '', //$polling_method
'pollUrl' => '',
'sendUrl' => '',
'statusUrl' => '',
'status' => '',
'goOnline' => $language->text('iflychat','MOD_GO_ONLINE'),
'goIdle' => $language->text('iflychat','MOD_GO_IDLE'),
'newMessage' => $language->text('iflychat','MOD_NEW_CHAT_MESSAGE'),
'images' => OW::getPluginManager()->getPlugin('iflychat')->getStaticUrl() . 'themes/' . $iflychat_theme . '/images/',
'sound' => OW::getPluginManager()->getPlugin('iflychat')->getStaticUrl() . 'swf/sound.swf',
'soundFile' => OW::getPluginManager()->getPlugin('iflychat')->getStaticUrl() . 'wav/notification.mp3',
'noUsers' => '',
'smileyURL' => OW::getPluginManager()->getPlugin('iflychat')->getStaticUrl() . 'smileys/very_emotional_emoticons-png/png-32x32/',
'addUrl' => '',
'notificationSound' => $obj->params('iflychat_notification_sound'),
'exurl' => OW::getRouter()->getBaseUrl().'iflychat/iflychat/auth',
'mobileWebUrl' => OW::getRouter()->getBaseUrl().'iflychat/iflychat/mobileauth',
'soffurl' => '',
'chat_type' => $obj->params('iflychat_show_admin_list'),
'guestPrefix' => $obj->params('iflychat_anon_prefix'),
'changeurl' => OW::getRouter()->getBaseUrl().'iflychat/iflychat/changeguestname',
'allowSmileys' => $obj->params('iflychat_enable_smileys'),
'admin' => $obj->iflychat_check_chat_admin()?'1':'0',
'theme' => $iflychat_theme,
);
if($obj->iflychat_check_chat_admin()) {
$iflychat_settings['arole'] = $obj->roleArray();;
}

$iflychat_settings['iup'] = $obj->params('iflychat_user_picture');
if($obj->params('iflychat_user_picture')==1) {
$iflychat_settings['default_up'] = OW::getPluginManager()->getPlugin('iflychat')->getStaticUrl() . 'themes/' . $iflychat_theme . '/images/default_avatar.png';
$iflychat_settings['default_cr'] = OW::getPluginManager()->getPlugin('iflychat')->getStaticUrl() . 'themes/' . $iflychat_theme . '/images/default_room.png';
$iflychat_settings['default_team'] = OW::getPluginManager()->getPlugin('iflychat')->getStaticUrl() . 'themes/' . $iflychat_theme . '/images/default_team.png';
}

if($obj->isSSL()) {
$iflychat_settings['external_host'] = IFLYCHAT_EXTERNAL_A_HOST;
$iflychat_settings['external_port'] = IFLYCHAT_EXTERNAL_A_PORT;
$iflychat_settings['external_a_host'] = IFLYCHAT_EXTERNAL_A_HOST;
$iflychat_settings['external_a_port'] = IFLYCHAT_EXTERNAL_A_PORT;
}
else {
$iflychat_settings['external_host'] = IFLYCHAT_EXTERNAL_HOST;
$iflychat_settings['external_port'] = IFLYCHAT_EXTERNAL_PORT;
$iflychat_settings['external_a_host'] = IFLYCHAT_EXTERNAL_HOST;
$iflychat_settings['external_a_port'] = IFLYCHAT_EXTERNAL_PORT;
}



$iflychat_settings['text_currently_offline'] = $language->text('iflychat','MOD_USER_CURRENTLY_OFFLINE');
$iflychat_settings['text_is_typing'] = $language->text('iflychat','MOD_USER_IS_TYPING');
$iflychat_settings['text_close'] = $language->text('iflychat','MOD_CLOSE');
$iflychat_settings['text_minimize'] = $language->text('iflychat','MOD_MINIMIZE');
$iflychat_settings['text_mute'] = $language->text('iflychat','MOD_CLICK_TO_MUTE');
$iflychat_settings['text_unmute'] = $language->text('iflychat','MOD_CLICK_TO_UNMUTE');
$iflychat_settings['text_available'] = $language->text('iflychat','MOD_AVAILABLE');
$iflychat_settings['text_idle'] = $language->text('iflychat','MOD_IDLE');
$iflychat_settings['text_busy'] = $language->text('iflychat','MOD_BUSY');
$iflychat_settings['text_offline'] = $language->text('iflychat','MOD_OFFLINE');
$iflychat_settings['text_lmm'] = $language->text('iflychat','MOD_LOAD_MORE_MESSAGES');
$iflychat_settings['text_nmm'] = $language->text('iflychat','MOD_NO_MORE_MESSAGES');
$iflychat_settings['text_clear_room'] = $language->text('iflychat','MOD_CLEAR_ALL_MESSAGES');
$iflychat_settings['msg_p'] = $language->text('iflychat','MOD_TYPE_AND_PRESS_ENTER');

if($obj->iflychat_check_chat_admin()) {
$iflychat_settings['text_ban'] = $language->text('iflychat','MOD_BAN');//__('Ban', 'iflychat');
$iflychat_settings['text_ban_ip'] = $language->text('iflychat','MOD_BAN_IP');//__('Ban IP', 'iflychat');
$iflychat_settings['text_kick'] = $language->text('iflychat','MOD_KICK');//__('Kick', 'iflychat');
$iflychat_settings['text_ban_window_title'] = $language->text('iflychat','MOD_BANNED_USERS');//__('Banned Users', 'iflychat');
$iflychat_settings['text_ban_window_default'] = $language->text('iflychat','MOD_NO_BAN');//__('No users have been banned currently.', 'iflychat');
$iflychat_settings['text_ban_window_loading'] = $language->text('iflychat','MOD_LOADING');//__('Loading banned user list...', 'iflychat');
$iflychat_settings['text_manage_rooms'] = $language->text('iflychat','MOD_MANAGE_ROOMS');//__('Manage Rooms', 'iflychat');
$iflychat_settings['text_unban'] = $language->text('iflychat','MOD_UNBAN');//__('Unban', 'iflychat');
$iflychat_settings['text_unban_ip'] = $language->text('iflychat','MOD_UNBAN_IP');//__('Unban IP', 'iflychat');
}
if(($obj->params('iflychat_show_admin_list') == 1)) {
$iflychat_settings['text_support_chat_init_label'] = $obj->params('iflychat_support_chat_init_label');
$iflychat_settings['text_support_chat_box_header'] = $obj->params('iflychat_support_chat_box_header');
$iflychat_settings['text_support_chat_box_company_name'] = $obj->params('iflychat_support_chat_box_company_name');
$iflychat_settings['text_support_chat_box_company_tagline'] = $obj->params('iflychat_support_chat_box_company_tagline');
$iflychat_settings['text_support_chat_auto_greet_enable'] = $obj->params('iflychat_support_chat_auto_greet_enable');
$iflychat_settings['text_support_chat_auto_greet_message'] = $obj->params('iflychat_support_chat_auto_greet_message');
$iflychat_settings['text_support_chat_auto_greet_time'] = $obj->params('iflychat_support_chat_auto_greet_time');
$iflychat_settings['text_support_chat_offline_message_label'] = $obj->params('iflychat_support_chat_offline_message_label');
$iflychat_settings['text_support_chat_offline_message_contact'] = $obj->params('iflychat_support_chat_offline_message_contact');
$iflychat_settings['text_support_chat_offline_message_send_button'] = $obj->params('iflychat_support_chat_offline_message_send_button');
$iflychat_settings['text_support_chat_offline_message_desc'] = $obj->params('iflychat_support_chat_offline_message_desc');
$iflychat_settings['text_support_chat_init_label_off'] = $obj->params('iflychat_support_chat_init_label_off');
}
$iflychat_settings['open_chatlist_default'] = ($obj->params('iflychat_minimize_chat_user_list')==2)?'1':'2';
$iflychat_settings['useStopWordList'] = $obj->params('iflychat_use_stop_word_list');
$iflychat_settings['blockHL'] = $obj->params('iflychat_stop_links');
$iflychat_settings['allowAnonHL'] = $obj->params('iflychat_allow_anon_links');
$iflychat_settings['renderImageInline'] = ($obj->params('iflychat_allow_render_images')=='1')?'1':'2';
$iflychat_settings['searchBar'] = ($obj->params('iflychat_enable_search_bar')=='1')?'1':'2';
$iflychat_settings['text_search_bar'] = $language->text('iflychat','MOD_TYPE_HERE_TO_SEARCH');

if($obj->iflychat_path_check()){
if(($obj->params('iflychat_show_admin_list') == 1)) {
OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('iflychat')->getStaticJsUrl() . 'ba-emotify.js');
OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('iflychat')->getStaticJsUrl() . 'jquery.titlealert.min.js');
}
OW::getDocument()->addScript(OW::getPluginManager()->getPlugin('iflychat')->getStaticJsUrl() . 'iflychat.js');
OW::getDocument()->addScriptDeclarationBeforeIncludes("Drupal={};Drupal.settings={};Drupal.settings.drupalchat=" . json_encode($iflychat_settings).";\n ");
OW::getDocument()->addScriptDeclarationBeforeIncludes('window.my_var_handle ="' . OW::getPluginManager()->getPlugin('iflychat')->getStaticUrl() . '"');
$uid = OW::getUser()->getId();
$r = '';
$r .= 'var iflychat_bundle = document.createElement("script");';
$r .= 'iflychat_bundle.src = "//'.IFLYCHAT_EXTERNAL_CDN_HOST.'/js/iflychat-v2.min.js?app_id=' . $obj->params('iflychat_app_id') . '";';
$r .= 'iflychat_bundle.async="async";';
$r .= 'document.body.appendChild(iflychat_bundle);';
$r .= '';
// if ($obj->params('iflychat_enable_friends') == '1') {
// if (isset($_SESSION['token']) && !empty($_SESSION['token'])) {
// $r .= 'var iflychat_auth_token = "' . $_SESSION['token'] . '";';
// }
// }
if ($uid) {

$r .= ' var iflychat_auth_url = "' . OW::getRouter()->getBaseUrl() . 'iflychat/iflychat/auth";';
}
if (($obj->params('iflychat_show_popup_chat') == '1')) {
$r .= 'var iFlyChatDiv = document.createElement("div");';
$r .= 'iFlyChatDiv.className = \'iflychat-popup\';';
$r .= 'document.body.appendChild(iFlyChatDiv);';
// $r .= '';
} else if ($obj->params('iflychat_show_popup_chat') == '2' && !OW_User::getInstance()->isAdmin()) {
$r .= 'var iFlyChatDiv = document.createElement("div");';
$r .= 'iFlyChatDiv.className = \'iflychat-popup\';';
$r .= 'document.body.appendChild(iFlyChatDiv);';
// $r .= '';
} else if (($obj->params('iflychat_show_popup_chat') == '3' || $obj->params('iflychat_show_popup_chat') == '4') && $obj->iflychat_path_check()) {
$r .= 'var iFlyChatDiv = document.createElement("div");';
$r .= 'iFlyChatDiv.className = \'iflychat-popup\';';
$r .= 'document.body.appendChild(iFlyChatDiv);';
// $r .= '';
}
OW::getDocument()->addScriptDeclarationBeforeIncludes($r);
return parent::render();
} }
}
}
Loading

0 comments on commit d9db3bc

Please sign in to comment.