15 // Change this line to wherever your AjIM installation is |
15 // Change this line to wherever your AjIM installation is |
16 |
16 |
17 if(defined('scriptPath')) |
17 if(defined('scriptPath')) |
18 define('ajimClientPath', scriptPath.'/ajim'); |
18 define('ajimClientPath', scriptPath.'/ajim'); |
19 |
19 |
20 if(!defined('ENANO_ROOT')) |
20 // if(!defined('ENANO_ROOT')) |
21 define('ENANO_ROOT', dirname(dirname(__FILE__))); |
21 // define('ENANO_ROOT', dirname(dirname(__FILE__))); |
22 define('ajimServerPath', ENANO_ROOT.'/ajim'); |
22 |
23 global $db, $session, $paths, $template, $plugins; // Common objects |
23 global $db, $session, $paths, $template, $plugins; // Common objects |
24 $__ajim_config = Array( |
24 $__ajim_config = Array( |
25 'sb_color_background'=>'#FFF', |
25 'sb_color_background'=>'#FFF', |
26 'sb_color_foreground'=>'#000', |
26 'sb_color_foreground'=>'#000', |
27 ); |
27 ); |
28 if(defined('ENANO_INSTALLED') || defined('MIDGET_INSTALLED')) |
28 if(defined('ENANO_INSTALLED') || defined('MIDGET_INSTALLED')) |
29 { |
29 { |
30 if(!isset($_GET['admin'])) |
30 define('ajimServerPath', ENANO_ROOT.'/ajim'); |
|
31 |
|
32 $plugins->attachHook('compile_template', 'AjIM_SideBar();'); |
|
33 $plugins->attachHook('acl_rule_init', 'global $session; $session->register_acl_type(\'ajim_post\', AUTH_ALLOW, \'Submit AjIM posts\');'); |
|
34 require_once(ajimServerPath . '/ajim.php'); |
|
35 |
|
36 function AjIM_SideBar() |
31 { |
37 { |
32 $plugins->attachHook('compile_template', 'AjIM_SideBar();'); |
38 global $db, $session, $paths, $template, $plugins; // Common objects |
33 $plugins->attachHook('acl_rule_init', 'global $session; $session->register_acl_type(\'ajim_post\', AUTH_ALLOW, \'Submit AjIM posts\');'); |
39 global $__ajim_config; |
34 include(ajimServerPath . '/ajim.php'); |
40 $paths->addAdminNode('Plugin configuration', 'AjIM configuration', 'AjIM_Config'); |
35 |
41 $dir = getcwd(); |
36 function AjIM_SideBar() |
42 chdir(ENANO_ROOT); |
|
43 include('config.php'); |
|
44 chdir($dir); |
|
45 unset($dir); |
|
46 if($session->user_level >= USER_LEVEL_ADMIN) |
37 { |
47 { |
38 global $db, $session, $paths, $template, $plugins; // Common objects |
48 $r = $db->sql_query('SELECT password FROM '.table_prefix.'users WHERE username=\''.$session->username.'\''); |
39 global $__ajim_config; |
49 $p = $db->fetchrow_num($r); |
40 $paths->addAdminNode('Plugin configuration', 'AjIM configuration', 'AjIM_Config'); |
50 $admin = $p[0]; |
41 $dir = getcwd(); |
|
42 chdir(ENANO_ROOT); |
|
43 include('config.php'); |
|
44 chdir($dir); |
|
45 unset($dir); |
|
46 if($session->user_level >= USER_LEVEL_ADMIN) |
|
47 { |
|
48 $r = $db->sql_query('SELECT password FROM '.table_prefix.'users WHERE username=\''.$session->username.'\''); |
|
49 $p = $db->fetchrow_num($r); |
|
50 $admin = $p[0]; |
|
51 } |
|
52 else |
|
53 { |
|
54 $admin = false; |
|
55 } |
|
56 $__ajim_config['db_connection_handle'] = $db->_conn; |
|
57 if(!$session->user_logged_in) |
|
58 { |
|
59 $__ajim_config['cant_post_notice'] = 'The administrator requires that you <a href="'.makeUrlNS('Special', 'Login/'.$paths->page, null, true).'">log in</a> to post messages.'; |
|
60 } |
|
61 else |
|
62 { |
|
63 $__ajim_config['cant_post_notice'] = 'The administrator has disallowed message posting for your user account.'; |
|
64 } |
|
65 $canpost = ( $session->get_permissions('ajim_post') ) ? true : false; |
|
66 $ajim = new ajim($__ajim_config, table_prefix, scriptPath.'/plugins/ajim.php', $admin, false, $canpost, array('RenderMan', 'render')); |
|
67 $template->sidebar_widget('Shoutbox', $ajim->html(ajimClientPath)); |
|
68 $template->additional_headers .= '<link rel="stylesheet" type="text/css" href="'.ajimClientPath.'/ajim.php?css&id='.$ajim->id.'&pfx='.table_prefix.'&path='.scriptPath.'/plugins/ajim.php" />'; |
|
69 } |
51 } |
|
52 else |
|
53 { |
|
54 $admin = false; |
|
55 } |
|
56 $__ajim_config['db_connection_handle'] = $db->_conn; |
|
57 if(!$session->user_logged_in) |
|
58 { |
|
59 $__ajim_config['cant_post_notice'] = 'The administrator requires that you <a href="'.makeUrlNS('Special', 'Login/'.$paths->page, null, true).'">log in</a> to post messages.'; |
|
60 } |
|
61 else |
|
62 { |
|
63 $__ajim_config['cant_post_notice'] = 'The administrator has disallowed message posting for your user account.'; |
|
64 } |
|
65 $canpost = ( $session->get_permissions('ajim_post') ) ? true : false; |
|
66 $ajim = new ajim($__ajim_config, table_prefix, scriptPath.'/plugins/ajim.php', $admin, false, $canpost, array('RenderMan', 'render')); |
|
67 $template->sidebar_widget('Shoutbox', $ajim->html(ajimClientPath)); |
|
68 $template->additional_headers .= '<link rel="stylesheet" type="text/css" href="'.ajimClientPath.'/ajim.php?css&id='.$ajim->id.'&pfx='.table_prefix.'&path='.scriptPath.'/plugins/ajim.php" />'; |
70 } |
69 } |
71 } elseif(isset($_GET['ajimmode'])) { |
70 } |
|
71 elseif ( isset($_GET['ajimmode']) ) |
|
72 { |
72 global $db, $session, $paths, $template, $plugins, $dbhost, $dbname, $dbuser, $dbpasswd; |
73 global $db, $session, $paths, $template, $plugins, $dbhost, $dbname, $dbuser, $dbpasswd; |
73 require_once('../includes/common.php'); |
74 require_once('../includes/common.php'); |
|
75 define('ajimServerPath', ENANO_ROOT.'/ajim'); |
74 require_once(ajimServerPath . '/ajim.php'); |
76 require_once(ajimServerPath . '/ajim.php'); |
75 header('HTTP/1.1 200 OK'); |
77 header('HTTP/1.1 200 OK'); |
76 define('ajimClientPath', scriptPath.'/ajim'); |
78 define('ajimClientPath', scriptPath.'/ajim'); |
77 if($session->user_level >= USER_LEVEL_ADMIN) { |
79 if ( $session->user_level >= USER_LEVEL_ADMIN ) |
|
80 { |
78 $admin = $session->grab_password_hash(); |
81 $admin = $session->grab_password_hash(); |
79 } else $admin = false; |
82 } |
|
83 else |
|
84 { |
|
85 $admin = false; |
|
86 } |
80 require('../config.php'); |
87 require('../config.php'); |
81 $canpost = (getConfig('ajim_require_login') != '1' || $session->user_logged_in) ? true : false; |
88 $canpost = (getConfig('ajim_require_login') != '1' || $session->user_logged_in) ? true : false; |
82 $__ajim_config['db_connection_handle'] = $db->_conn; |
89 $__ajim_config['db_connection_handle'] = $db->_conn; |
83 $__ajim_config['cant_post_notice'] = 'The administrator requires that you <a href="'.makeUrlNS('Special', 'Login/'.$paths->page, null, true).'">log in</a> to post messages.'; |
90 $__ajim_config['cant_post_notice'] = 'The administrator requires that you <a href="'.makeUrlNS('Special', 'Login/'.$paths->page, null, true).'">log in</a> to post messages.'; |
84 $__ajim_config['allow_looping'] = true; |
91 $__ajim_config['allow_looping'] = true; |