Dirty adaption for loginmod

General discussion about Plugins for Cacti

Moderators: Developers, Moderators

Post Reply
galco
Cacti User
Posts: 63
Joined: Fri Aug 03, 2007 3:09 am
Location: Barcelona, Catalunya

Dirty adaption for loginmod

Post by galco »

I've only added/changed three function to adapt the loginmod plugin to the new PIA already integrated to Cacti 0.8.8. In my case I'm running properly with Version 0.8.8a.

Replace the origial setup.php file or put this setup.php file into cacti/plugins/loginmod folder

Code: Select all

# cat setup.php 
<?php
/*
 +-------------------------------------------------------------------------+
 | Copyright (C) 2008 The Cacti Group                                      |
 |                                                                         |
 | This program is free software; you can redistribute it and/or           |
 | modify it under the terms of the GNU General Public License             |
 | as published by the Free Software Foundation; either version 2          |
 | of the License, or (at your option) any later version.                  |
 |                                                                         |
 | This program is distributed in the hope that it will be useful,         |
 | but WITHOUT ANY WARRANTY; without even the implied warranty of          |
 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
 | GNU General Public License for more details.                            |
 +-------------------------------------------------------------------------+
 | Cacti: The Complete RRDTool-based Graphing Solution                     |
 +-------------------------------------------------------------------------+
 | This code is designed, written, and maintained by the Cacti Group. See  |
 | about.php and/or the AUTHORS file for specific developer information.   |
 +-------------------------------------------------------------------------+
 | http://www.cacti.net/                                                   |
 +-------------------------------------------------------------------------+
*/



// IMPORTANT!!!!!!
// Plugin floder has to be named "loginmod"


function plugin_loginmod_install () {
     api_plugin_register_hook('loginmod', 'login_before', 'plugin_loginmod_loginbefore', 'setup.php');
     api_plugin_register_hook('loginmod', 'login_after', 'plugin_loginmod_loginafter', 'setup.php');
     api_plugin_register_hook('loginmod', 'cacti_image', 'plugin_loginmod_cacti_image', 'setup.php');
}

function plugin_loginmod_version () {
	return array(	'name'		=> 'loginmod',
			'version' 	=> '1.1',
			'longname'	=> 'Login Page Mod',
			'author'	=> 'Gerard',
			'homepage'	=> 'http://mywebsite.com',
			'email'	=> 'me@email.com',
			'url'		=> 'http://checkforupdates.mywebsite.com/'
			);
}

function plugin_loginmod_check_config () {
/*	if (read_config_option('PLUGINNAME_SETTING') != '') {
		return true;
	}
	return false;*/

	return true;
}

/*
function loginmod_version () {
	return array( 'name' 	=> 'loginmod',
			'version' 	=> '1.0',
			'longname'	=> 'Login Page Mod',
			'author'		=> 'Jimmy Conner',
			'homepage'	=> 'http://cactiusers.org',
			'email'		=> 'jimmy@sqmail.org',
			'url'		=> 'http://versions.cactiusers.org/'
			);
}
*/

function plugin_loginmod_loginbefore() {
	print "<style>
		body {
			margin: 0 0;
			padding: 0;
			background-color:  #508040;
			font-weight: bold;
		}
		input {
			border: 1px solid #508040;
			background-color:  #eee;
			font-size: 110%;
			color: #508040;
			font-weight: bold;
			text-align: center;
		}
		#loginwrapper {
			position: relative;
			background-color:  #fff;
			width: 500;
			margin: 15% auto 0 auto;
			padding: 10px;
			border: 1px solid #000;
		}
	</style>";
	print "<center><div id='loginwrapper'>";
}

function plugin_loginmod_loginafter() {
	print "</div><script>document.login.submit.value;</script>";



}

function plugin_loginmod_cacti_image ($image) {
	return $image;
}
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests