newfilename.php
PHP Code:
<?php
require_once("./global.php");
// #############################################################################
// function to allow modifications to add a phrasetype easily
function add_phrase_type($phrasegroup_name, $phrasegroup_title)
{
global $DB_site;
// first lets check if it exists
if ($check = $DB_site->query_first("SELECT * FROM " . TABLE_PREFIX . "phrasetype WHERE fieldname = '$phrasegroup_name'"))
{
return false;
}
else
{ // check max id
$max_rows = $DB_site->query_first("SELECT MAX(phrasetypeid) + 1 AS max FROM " . TABLE_PREFIX . "phrasetype WHERE phrasetypeid < 1000");
$phrasetypeid = $max_rows['max'];
if ($phrasetypeid)
{
$DB_site->query("INSERT INTO " . TABLE_PREFIX . "phrasetype (phrasetypeid, fieldname, title, editrows) VALUES ($phrasetypeid, '" . addslashes($phrasegroup_name) . "', '" . addslashes($phrasegroup_title) . "', 3)");
$DB_site->query("ALTER TABLE " . TABLE_PREFIX . "language ADD phrasegroup_" . addslashes($phrasegroup_name) . " MEDIUMTEXT NOT NULL");
return $phrasetypeid;
}
}
return false;
}
if ($_REQUEST['name'] AND $_REQUEST['title'])
{
add_phrase_type($_REQUEST['name'], $_REQUEST['title');
}
?>
Run newfilename.php?name=(NEWPHRASENAME)&title=(NEWPHR ASETITLE)