HellRazor |
11-28-2004 04:55 AM |
Here's another update. This version now allows you to put in an optional URL for the entry. Clicking on the title of the mod in the list will take you to the URL you specify.
This version requires one additional phrase (modslog_name_url) and one additional field in the database table (modurl).
Hope the original author doesn't mind! :nervous:
Here are the updated files.
Modslog.php:
Code:
<?php
// ######################## SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### PRE-CACHE TEMPLATES AND DATA ######################
$phrasegroups = array();
$specialtemplates = array();
// ########################## REQUIRE BACK-END ############################
require_once('./global.php');
// ########################################################################
// ######################### START MAIN SCRIPT ############################
// ########################################################################
print_cp_header('Modification Log');
if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'list';
}
if ($_REQUEST['do'] == 'list' ) {
$modsquery = $DB_site->query("SELECT * FROM modslog ORDER BY date");
if ($modsquery){
print_form_header('modslog', 'showset');
print_table_header('Modification Log', 5);
print_cells_row(array(
'Name',
'Version',
'Author',
'Date Installed',
//'Show Users'
'Actions'
), 1, '', 1);
while($mod = $DB_site->fetch_array($modsquery)){
$vbphrase['modslog_actions_compiled'] = construct_phrase($vbphrase['modslog_actions'], $mod['modid']);
if (empty($mod['modurl'])){
$vbphrase['modslog_name_compiled'] = construct_phrase($vbphrase['modslog_name'], $mod['name'],
$mod['description']);
} else {
$vbphrase['modslog_name_compiled'] = construct_phrase($vbphrase['modslog_name_url'], $mod['name'], $mod['modurl'], $mod['description']);
}
$date = $date = date("D-d-M-y",$mod['date']);
print_cells_row(array($vbphrase['modslog_name_compiled'],$mod['version'],$mod['author'],$date,$vbphrase['modslog_actions_compiled']),0,'');
}
} else {
print_form_header('modslog', 'showset');
print_table_header('Modification Log', 1);
print_cells_row(array('There are currently No Modifications in the Log'),0,'');
}
print_table_footer();
}
//Form to add a mod to the list
if ($_REQUEST['do'] == 'add' ) {
print_form_header('modslog', 'new');
print_table_header('Add Modification to Log');
print_input_row('Name of Modification', 'name');
print_input_row('Description of the Modification\'s function', 'description');
print_input_row('Modification version number', 'version');
print_input_row('Author name', 'author');
print_input_row('Modification URL', 'modurl');
print_submit_row($vbphrase['save'], 0);
}
//Form to edit a mod in the list
if ($_REQUEST['do'] == 'edit' ) {
$id = $_REQUEST['id'] ;
$id = addslashes($id);
$modsquery = $DB_site->query("SELECT * FROM modslog WHERE modid=$id ");
$mod = $DB_site->fetch_array($modsquery);
print_form_header('modslog', 'modify');
print_table_header('Edit Modification in the Log');
print_input_row('Name of Modification', 'name', $mod['name']);
print_input_row('Description of the Modification\'s function', 'description', $mod['description']);
print_input_row('Modification version number', 'version', $mod['version']);
print_input_row('Author name', 'author', $mod['author']);
print_input_row('Modification URL', 'modurl', $mod['modurl']);
construct_hidden_code(id, $id);
print_submit_row($vbphrase['save'], 0);
}
if ($_REQUEST['do'] == 'new' OR 'modify' ) {
$name = addslashes($_POST['name']);
$description = addslashes($_POST['description']);
$version = addslashes($_POST['version']);
$author = addslashes($_POST['author']);
$modurl = addslashes($_POST['modurl']);
$id = addslashes($_POST['id']);
}
if ($_REQUEST['do'] == 'new' ) {
$date = TIMENOW ;
$DB_site->query("INSERT INTO modslog (name,description,author,version,modurl,date) VALUES ('$name','$description','$author','$version','$modurl','$date')");
define('CP_REDIRECT', 'modslog.php');
print_stop_message('modslog_modadded');
}
if ($_REQUEST['do'] == 'modify' ) {
$DB_site->query("UPDATE modslog SET name='$name',description='$description',author='$author',modurl='$modurl',version='$version' WHERE modid='$id' ");
define('CP_REDIRECT', 'modslog.php');
print_stop_message('modslog_modedited');
}
if ($_REQUEST['do'] == 'delete' ) {
$id = $_REQUEST['id'] ;
$id = addslashes($id);
$DB_site->query("DELETE FROM modslog WHERE modid='$id' ");
define('CP_REDIRECT', 'modslog.php');
print_stop_message('modslog_moddeleted');
}
echo '<div align="center"><br /><a href="modslog.php" > [Return to Modificaton Listing] </a> - <a href="modslog.php?do=add" > [Add a Modification to the Log] </a></div>' ;
print_cp_footer();
?>
Here are the updated install instructions:
Code:
This hack will add a new option under Logs and Statistics in your Admin CP. It allows you to track which modifications you have installed on to your board by filling out the form in the hack to contain a name, Author name, Version Number, Description and an Installation date. This hack can be made dynamic so you do not have to add the info your self but a hack releaser would just need to add an extra query to the install to do it for you. In the future I intend to extend this to log which files have been modified in the hack and what queries have been run, possibly through making it into an installation system.
This hack was made out of a want to track what I have installed simply and without having to go to the trouble of installing the HTL. If the Author of that hack wants me to remove this I will as the original idea was essentially his.
--Copyright 2004 Stewart Ritchie/burnist/acid burn/acid/dogwood (me basicly).
--Provided as is, use at your own discression. I am not responsible if your vBulletin screws up so back up both files
before installing.
--Can only be distributed at vB.org
###############################################################################
###############################################################################
--------------------------------------------------------------------
File Uploads -- Upload modslog.php to /admincp/
--------------------------------------------------------------------
###############################################################################
###############################################################################
--------------------------------------------------------------------
Database Query -- Run This in PHPMyAdmin or another tool for DB Manipulation
--------------------------------------------------------------------
CREATE TABLE modslog (
modid int(10) auto_increment,
name varchar(250),
description varchar(250),
author varchar(250),
version varchar(250),
modurl varchar (250),
date int(10),
PRIMARY KEY(modid))
###############################################################################
###############################################################################
--------------------------------------------------------------------
File Edits -- One One, its in admincp/index.php
--------------------------------------------------------------------
~~~~~~~~~
~Find~~~~
~~~~~~~~~
construct_nav_option($vbphrase['scheduled_task_log'], 'cronlog.php?do=choose', '<br />');
~~~~~~~~~~~~~~~~~
~Below Add~~~~~~~
~~~~~~~~~~~~~~~~~
construct_nav_option('Modification Log', 'modslog.php', '<br />');
###############################################################################
###############################################################################
--------------------------------------------------------------------
Phrases -- All of these get added to the Control Panel Global Phrase Group
--------------------------------------------------------------------
Title: modslog_actions
Text : <a href="modslog.php?do=edit&id={1}"> Edit Entry </a> <a href="modslog.php?do=delete&id={1}"> Delete Entry </a>
Title: modslog_name
Text : <b>{1}</b><br /> {2}
Title: modslog_name_url
Test : <b><a href="{2}" target="_blank">{1}</a></b><br /> {3}
--------------------------------------------------------------------
Phrases -- All of these get added to the Control Panel Stop Message Group
--------------------------------------------------------------------
Title: modslog_moddeleted
Text : Your Modification was successfully removed from the log, you will now be returned to the listing
Title: modslog_modedited
Text : Your Modification was successfully edited, you will now be returned to the listing
Title: modslog_modadded
Text : Your Modification was successfully added to the log, you will now be returned to the listing
|