View Full Version : PhraseGroupManager 1.0
Hoffi
01-04-2004, 10:00 PM
Hello,
during the Development of a big addition I often must create and delete Phrasegroups, so I developed this Hack.
It adds the Function to add and delete Phrasegroups from your Admin-CP. It don't show the Original Groups, so you should not be able to delete any original, but you must be careful if you this Hack.
Avaiable in German and English.
NTLDR
01-05-2004, 09:08 PM
I've been meaning to do this on my vB for a while now. I'd recomend all users who create large hacks install this so they can easily create new Phrase Groups.
Koutaru
01-05-2004, 10:45 PM
* Koutaru clicks install
Thanks :) I know I'll definately be installing some big hacks onto my forum
KuraFire
01-06-2004, 08:14 AM
I've been meaning to do this on my vB for a while now. I'd recomend all users who create large hacks install this so they can easily create new Phrase Groups.
Wait till you see the Hack Tracking Log - with that, you'll not even want to create phrasegroups yourself anymore, especially not with larger hacks :)
Dean C
01-06-2004, 10:01 AM
Great hack :)!
Dark_Wizard
01-06-2004, 10:58 AM
I'm definitely going to need this for my hack...thx!
Symbian.info
01-14-2004, 02:10 PM
thanks, just need it !!
gmarik
01-14-2004, 07:36 PM
This should be RC4 default function - wow!
SpankMe
04-09-2004, 01:46 AM
Good hack. Just what I need.
But why am I the only one that has noticed there is no code to handle the editgroup request in the code mod intructions.
Also the "add after" if ($_REQUEST['do'] == 'modify')
should be "add before"
Gary King
04-12-2004, 01:12 PM
Good hack. Just what I need.
But why am I the only one that has noticed there is no code to handle the editgroup request in the code mod intructions.
Also the "add after" if ($_REQUEST['do'] == 'modify')
should be "add before"
Yep a few problems here and there but generally it's not that bad, although it is unfinished.
SpankMe
04-12-2004, 08:13 PM
I've added the missing code myself if anyone is interested?
Gary King
04-12-2004, 10:20 PM
I've added the missing code myself if anyone is interested?
Sure, please post it :)
Scrub
04-20-2004, 10:37 PM
Has anyone ever fixed this hack? If so, could they post it? :D
SpankMe
04-24-2004, 09:00 PM
Here the phrase.php code:
// PhraseGroupManager by Hoffi
if ($_REQUEST['do'] == 'addgroup') {
print_form_header('phrase', 'insertgroup');
print_table_header($vbphrase['add_new_phrase_group']);
print_input_row($vbphrase['varname'], 'varname', 'var1', 1, 50);
print_input_row($vbphrase['phrasegroupname'], 'groupname', 'Group1', 1, 50);
print_submit_row($vbphrase['save']);
print_table_footer();
}
// ----------
if ($_REQUEST['do'] == 'editgroup') {
globalize($_REQUEST, array(
'p'));
$phrasetypes = fetch_phrasetypes_array();
// echo "<pre>";
// print_r($phrasetypes);
// echo "</pre>";
print_form_header('phrase', 'updategroup');
construct_hidden_code('p',$p);
construct_hidden_code('oldvarname', $phrasetypes[$p]['fieldname']);
print_table_header($vbphrase['add_new_phrase_group']);
print_input_row($vbphrase['varname'], 'varname', $phrasetypes[$p]['fieldname'], 1, 50);
print_input_row($vbphrase['phrasegroupname'], 'groupname', $phrasetypes[$p]['title'], 1, 50);
print_submit_row($vbphrase['save']);
print_table_footer();
}
// ----------
if ($_REQUEST['do'] == 'updategroup') {
globalize($_REQUEST, array(
'oldvarname',
'varname',
'groupname',
'p'));
if (!update_phrase_type($p, $oldvarname, $varname, $groupname)) {
print_stop_message('phrase_group_x_not_saved',$gro upname);
} else {
build_language(-1);
define('CP_REDIRECT', "phrase.php?do=listgroups");
print_stop_message('phrase_group_x_saved', $groupname);
}
}
// ----------
if ($_REQUEST['do'] == 'insertgroup') {
globalize($_REQUEST, array(
'varname',
'groupname'));
if (!add_phrase_type($varname, $groupname)) {
print_stop_message('phrase_group_x_not_saved',$gro upname);
} else {
build_language(-1);
define('CP_REDIRECT', "phrase.php?do=listgroups");
print_stop_message('phrase_group_x_saved', $groupname);
}
}
// ----------
if ($_REQUEST['do'] == 'killgroup') {
globalize($_REQUEST, array(
'p'));
if (!delete_phrase_type($p)) {
print_stop_message('phrase_group_x_not_deleted',$p );
} else {
build_language(-1);
define('CP_REDIRECT', "phrase.php?do=listgroups");
print_stop_message('phrase_group_x_deleted', $p);
}
}
// ----------
if ($_REQUEST['do'] == 'listgroups') {
print_form_header('phrase', 'addgroup');
print_table_header($vbphrase['list_custom_phrase_groups']);
$phrasetypes = fetch_phrasetypes_array();
foreach($phrasetypes AS $id => $type)
{
$cell = array();
if ($id < 1000 AND $id > 150) {
$cell[] = $type['title'] . "($id)";
$cell[] = construct_link_code($vbphrase['edit'], "phrase.php?do=editgroup&p=$id")." ".construct_link_code($vbphrase['delete'], "phrase.php?do=delgroup&p=$id");
}
print_cells_row($cell);
}
print_submit_row($vbphrase['add_new_phrase_group']);
print_table_footer();
}
// ----------
if ($_REQUEST['do'] == 'delgroup') {
globalize($_REQUEST, array(
'p'));
print_form_header('phrase', 'killgroup');
construct_hidden_code('p',$p);
print_table_header($vbphrase['list_phrase_groups']);
$phrasetypes = fetch_phrasetypes_array();
$cell = array();
$cell[] = construct_phrase($vbphrase['are_you_sure_to_delete_phrasegroup'], $phrasetypes[$p]['title']);
print_cells_row($cell);
print_submit_row($vbphrase['delete']);
}
// End PhraseGroupmanager
and the adminfunctions_language.php code:
// ################################################## ###########################
// function to allow modifications to update a phrasetype easily
function update_phrase_type($phrasegroup_id, $old_phrasegroup_name, $phrasegroup_name, $phrasegroup_title)
{
global $DB_site;
if ($phrasegroup_id)
{
$DB_site->query("UPDATE " . TABLE_PREFIX . "phrasetype SET fieldname = '" . addslashes($phrasegroup_name) . "', title = '" . addslashes($phrasegroup_title) . "' WHERE phrasetypeid = $phrasegroup_id");
if ($old_phrasegroup_name != $phrasegroup_name)
{
$DB_site->query("ALTER TABLE " . TABLE_PREFIX . "language CHANGE phrasegroup_" . addslashes($old_phrasegroup_name) . " phrasegroup_" . addslashes($phrasegroup_name) . " MEDIUMTEXT NOT NULL");
}
return true;
}
return false;
}
// ################################################## ###########################
// function from Hoffi to delete PhraseGroups easy
function delete_phrase_type($phrasegroup_id, $delphrases=1, $moveto=0)
{
global $DB_site;
$ret=false;
// first lets check if it exists
if ($check = $DB_site->query_first("SELECT * FROM " . TABLE_PREFIX . "phrasetype WHERE phrasetypeid = '$phrasegroup_id'")) {
if ($delphrases==1) {
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "phrase WHERE phrasetypeid = '$phrasegroup_id'");
$ret=true;
} else {
if ($check = $DB_site->query_first("SELECT * FROM " . TABLE_PREFIX . "phrasetype WHERE phrasetypeid = '$moveto'")) {
$DB_site->query("UPDATE " . TABLE_PREFIX . "phrase SET phrasetypeid = '$moveto' WHERE phrasetypeid = '$phrasegroup_id'");
$ret=true;
}
}
if ($ret) {
$DB_site->query("DELETE FROM " . TABLE_PREFIX . "phrasetype WHERE phrasetypeid = '$phrasegroup_id'");
$DB_site->query("ALTER TABLE " . TABLE_PREFIX . "language DROP phrasegroup_" . addslashes($check['fieldname']));
}
}
return $ret;
}
I think thats everything.
teksigns
06-19-2004, 02:37 PM
im getting error !
Fatal error: Call to undefined function: add_phrase_type() in phrase.php on line 927
Hoffi
06-20-2004, 08:38 PM
im getting error !
Fatal error: Call to undefined function: add_phrase_type() in phrase.php on line 927
Please check the Code you inserted in phrase.php
add_phrase_type() is a function delivered with vB3.
teksigns
06-21-2004, 01:34 AM
Please check the Code you inserted in phrase.php
add_phrase_type() is a function delivered with vB3.
everything works except i cant add a phrase
i can edit the ones that are custom and already added ....
but i cant add .......
nexialys
07-06-2004, 05:46 PM
@Hoffi... this would be good and cool to update your script with the missing parts, the one from SpankMe...
Hoffi
07-06-2004, 08:07 PM
I'll see over it after I have completed my Update.
Dark_Wizard
07-07-2004, 07:40 AM
Any plans on expanding this to do an export to xml of a particular phrasegroup? Would be a great addition.
Andreas
07-02-2005, 09:17 PM
Any plans on porting this to vB 3.5?
Would be useful :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2024, vBulletin Solutions Inc.