Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
PhraseGroupManager 1.0 Details »»
PhraseGroupManager 1.0
Version: 1.00, by Hoffi Hoffi is offline
Developer Last Online: Mar 2016 Show Printable Version Email this Page

Version: 3.0.0 Rating:
Released: 01-04-2004 Last Update: Never Installs: 17
 
No support by the author.

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.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 04-12-2004, 08:13 PM
SpankMe's Avatar
SpankMe SpankMe is offline
 
Join Date: Nov 2001
Location: New Zealand
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've added the missing code myself if anyone is interested?
Reply With Quote
  #13  
Old 04-12-2004, 10:20 PM
Gary King's Avatar
Gary King Gary King is offline
 
Join Date: Jan 2002
Posts: 2,046
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by SpankMe
I've added the missing code myself if anyone is interested?
Sure, please post it
Reply With Quote
  #14  
Old 04-20-2004, 10:37 PM
Scrub's Avatar
Scrub Scrub is offline
 
Join Date: Oct 2001
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Has anyone ever fixed this hack? If so, could they post it?
Reply With Quote
  #15  
Old 04-24-2004, 09:00 PM
SpankMe's Avatar
SpankMe SpankMe is offline
 
Join Date: Nov 2001
Location: New Zealand
Posts: 141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here the phrase.php code:

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'150);
    
print_input_row($vbphrase['phrasegroupname'], 'groupname''Group1'150);
    
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'], 150);
    
print_input_row($vbphrase['phrasegroupname'], 'groupname'$phrasetypes[$p]['title'], 150);
    
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',$groupname);
    } 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',$groupname);
    } 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:
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.
Reply With Quote
  #16  
Old 06-19-2004, 02:37 PM
teksigns's Avatar
teksigns teksigns is offline
 
Join Date: Sep 2003
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

im getting error !

Fatal error: Call to undefined function: add_phrase_type() in phrase.php on line 927
Reply With Quote
  #17  
Old 06-20-2004, 08:38 PM
Hoffi's Avatar
Hoffi Hoffi is offline
 
Join Date: Nov 2001
Location: Germany
Posts: 342
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by teksigns
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.
Reply With Quote
  #18  
Old 06-21-2004, 01:34 AM
teksigns's Avatar
teksigns teksigns is offline
 
Join Date: Sep 2003
Posts: 133
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Hoffi
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 .......
Reply With Quote
  #19  
Old 07-06-2004, 05:46 PM
nexialys
Guest
 
Posts: n/a
Default

@Hoffi... this would be good and cool to update your script with the missing parts, the one from SpankMe...
Reply With Quote
  #20  
Old 07-06-2004, 08:07 PM
Hoffi's Avatar
Hoffi Hoffi is offline
 
Join Date: Nov 2001
Location: Germany
Posts: 342
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll see over it after I have completed my Update.
Reply With Quote
  #21  
Old 07-07-2004, 07:40 AM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any plans on expanding this to do an export to xml of a particular phrasegroup? Would be a great addition.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:11 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05059 seconds
  • Memory Usage 2,363KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete