diff -r 000000000000 -r 902822492a68 plugins/ajim.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/ajim.php Wed Jun 13 16:03:00 2007 -0400 @@ -0,0 +1,107 @@ +'#FFF', + 'sb_color_foreground'=>'#000', + ); + if(defined('ENANO_INSTALLED') || defined('MIDGET_INSTALLED')) + { + if(!isset($_GET['admin'])) + { + $plugins->attachHook('compile_template', 'AjIM_SideBar();'); + $plugins->attachHook('acl_rule_init', 'global $session; $session->register_acl_type(\'ajim_post\', AUTH_ALLOW, \'Submit AjIM posts\');'); + include(ajimServerPath . '/ajim.php'); + + function AjIM_SideBar() + { + global $db, $session, $paths, $template, $plugins; // Common objects + global $__ajim_config; + $paths->addAdminNode('Plugin configuration', 'AjIM configuration', 'AjIM_Config'); + $dir = getcwd(); + chdir(ENANO_ROOT); + include('config.php'); + chdir($dir); + unset($dir); + if($session->user_level >= USER_LEVEL_ADMIN) + { + $r = $db->sql_query('SELECT password FROM '.table_prefix.'users WHERE username=\''.$session->username.'\''); + $p = $db->fetchrow_num($r); + $admin = $p[0]; + } + else + { + $admin = false; + } + $__ajim_config['db_connection_handle'] = $db->_conn; + if(!$session->user_logged_in) + { + $__ajim_config['cant_post_notice'] = 'The administrator requires that you log in to post messages.'; + } + else + { + $__ajim_config['cant_post_notice'] = 'The administrator has disallowed message posting for your user account.'; + } + $canpost = ( $session->get_permissions('ajim_post') ) ? true : false; + $ajim = new ajim($__ajim_config, table_prefix, scriptPath.'/plugins/ajim.php', $admin, false, $canpost, array('RenderMan', 'render')); + $template->sidebar_widget('Shoutbox', $ajim->html(ajimClientPath)); + $template->additional_headers .= ''; + } + } + } elseif(isset($_GET['ajimmode'])) { + global $db, $session, $paths, $template, $plugins, $dbhost, $dbname, $dbuser, $dbpasswd; + require_once('../includes/common.php'); + require_once(ajimServerPath . '/ajim.php'); + header('HTTP/1.1 200 OK'); + define('ajimClientPath', scriptPath.'/ajim'); + if($session->user_level >= 2) { + $admin = $session->grab_password_hash(); + } else $admin = false; + require('../config.php'); + $canpost = (getConfig('ajim_require_login') != '1' || $session->user_logged_in) ? true : false; + $__ajim_config['db_connection_handle'] = $db->_conn; + $__ajim_config['cant_post_notice'] = 'The administrator requires that you log in to post messages.'; + $__ajim_config['allow_looping'] = true; + $ajim = new ajim($__ajim_config, table_prefix, scriptPath.'/plugins/ajim.php', $admin, $_GET['id'], $canpost, array('RenderMan', 'render')); + $db->close(); + exit; + } + + function page_Admin_AjIM_Config() + { + global $db, $session, $paths, $template, $plugins; // Common objects + if(isset($_POST['_save'])) + { + setConfig('ajim_require_login', ( isset($_POST['ajim_require_login']) ) ? '1' : '0'); + } + echo '
'; + ?> +

Configure AjIM, the Asynchronous Javascript Instant Messenger

+

Only one option right now...

+

+

+ '; + } +} +?>