[ABD] Lexicon / Acronym MOD

Any abandoned MODs will be moved to this forum.

WARNING: MODs in this forum are not currently being supported or maintained by the original MOD author. Proceed at your own risk.
Forum rules
IMPORTANT: MOD Development Forum rules

WARNING: MODs in this forum are not currently being supported nor updated by the original MOD author. Proceed at your own risk.
Bombybob
Registered User
Posts: 50
Joined: Sat Sep 06, 2008 11:51 am

Re: [ALPHA] Lexicon / Acronym MOD

Post by Bombybob »

ok for prosilver a member of my forum found solution.

Lexicon;php

Code: Select all

<?php
/*
* Addon for the Acronym mod
*/

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
require($phpbb_root_path . 'common.' . $phpEx);
require($phpbb_root_path . 'includes/functions_user.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
$user->add_lang('mods/lexicon');
// End session management

// Recherche les lettres présentes dans le lexicon
$sql = "SELECT DISTINCT UPPER(LEFT(TRIM(term),1)) AS a FROM " . LEXICON_TABLE. " WHERE lang = 'fr' ORDER BY a" ;
if( !$result = $db->sql_query($sql) )
{
  message_die(GENERAL_ERROR, "Could not obtain lexicon data", "", __LINE__, __FILE__, $sql);
}

$abc_links = '';
$abc = array('#','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',$user->lang['LEXICON_ALL']);
$letter = request_var('letter', '');
$letter = ($letter == '0') ? '#' : $letter;
$letter = (!in_array($letter,$abc)) ? '' : $letter;

while($row = $db->sql_fetchrow($result))
{
  $row['a'] = str_replace (array("Ä", "Ö", "Ü"), array("A", "O", "U"),$row['a']);
  $alphabeth[] = in_array($row['a'], $abc) ?  $row['a'] : '#';
}

foreach ($abc as $l)  //make A-Z, link if entry
{
  $abc_links .= (in_array($l, $abc) OR $l == $user->lang['LEXICON_ALL']) ?
     "<a href='lexicon.php?letter=$l&' " . ($letter === $l ? "class='letter'>" : ">") .
      "$l</a><span class='page-sep'>, </span>" :
      "<span class='noabc'>$l</span><span class='page-sep'>, </span>" ;
}
$abc_links = str_replace('#&','0&',$abc_links);

$template->assign_vars(array(
  "LEXICON_ABC" => $letter == $user->lang['LEXICON_ALL'] ? $user->lang['LEXICON_ALL_TERMS'] : sprintf($user->lang['LEXICON_ABC'], $letter),
  "S_LETTER" => $letter ? true : false,
  "ABC" => $abc_links
));

if($letter)
{
  if($letter == $user->lang['LEXICON_ALL'])
  {
    $where = ' ';  // Select entrys with letter
  }
  else
  {
    // Select entrys with letter
    $where = " WHERE " . ($letter == "#" ?
             $db->sql_in_set('LEFT(term,1)', $abc, true) :  // all not-letters
             "term LIKE '$letter%' AND lang = 'fr'");
  }
 
  $sql = "SELECT TRIM(term) AS term, description, long_desc FROM " . LEXICON_TABLE . $where ." ORDER BY term";

  if( !$result = $db->sql_query($sql) )
  {
    message_die(GENERAL_ERROR, "Could not obtain term data", "", __LINE__, __FILE__, $sql);
  }


  while( $term_row = $db->sql_fetchrow($result) )
  {
    $template->assign_block_vars("term_row", array(
      "TERM" => $term_row['term'],
      "DESCRIPTION" => $term_row['description'],
      "LONGTEXT" => $term_row['long_desc']
    ));
  }
}
else  {
  // kein Buchstabe ausgewählt

}

// Output page
page_header($user->lang['LEXICON_TITLE'] . " - $letter");

$template->set_filenames(array(
  "body" => "lexicon.html")
);

page_footer();

?>

fucnction acronym.php

Code: Select all

<?php
/**
*
* @package acronym
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
  exit;
}

/**
* automatic acronym insertion
*/
function acronym_pass($text)
{
  $acronym_cache = new acronym_cache();
  static $acronyms;
  global $cache;
  if (!isset($acronyms) || !is_array($acronyms))
  {
    // obtain_acronym_list is taking care of the users acronyms option and the board-wide option
    $acronyms = $acronym_cache->obtain_acronym_list();
  }

  if (sizeof($acronyms))
  {
    return preg_replace($acronyms['match'], $acronyms['replace'], $text);
  }

  return $text;
}


/**
* Class for grabbing/handling acronym cached entries, extends acm_file or acm_db depending on the setup
* @package acm
*/
class acronym_cache extends acm
{//----------------------------------------------------------------------
// Acronym MOD - Begin Code Alteration
//
  /**
  * Obtain list of lexicon words for acronyms and build preg style replacement arrays for use by the
  * calling script
  */
  function obtain_acronym_list()
  {
    global $config, $user, $db;

/*    if (!$user->optionget('viewcensors') && $config['allow_nocensors'])
    {
      return array();
    }
*/
    if (($acronyms = $this->get('_acronyms')) === false)
    {
      $sql = 'SELECT term_id, acronym, description, NOT ISNULL(long_desc) AS long_desc
        FROM ' . LEXICON_TABLE . "
          WHERE lang = 'fr'
        ORDER BY LENGTH(TRIM(acronym))  DESC";
      $result = $db->sql_query($sql);
      $acronyms = array();
      while ($row = $db->sql_fetchrow($result))
      {
        $firstspace = (!strstr($row['acronym'], ' ')? '[?|\[|\]|.|,|(|)|\'|:|\s]+' : ' ');
        $lastspace = (!strrchr($row['acronym'], ' ')? '[?|\[|\]|\'|:|,|.|s|!|)|(|;|\s]' : '');
        $acronyms['match'][] = '#([\w|.|\[|\]|,|\(|\)|\'|:|\s]{0}'.$firstspace.'' . preg_quote($row['acronym'], '#'). $lastspace. ')#i';
        $acronyms['replace'][] = $row['long_desc'] ?
           '<acronym class="id' .$row['term_id']. '" title="' . $row['description'] . '"><b>\\1</b></acronym>' :
           '<acronym title="' . $row['description'] . '">\\1</acronym>' ;
      }
      $db->sql_freeresult($result);
      $this->put('_acronyms', $acronyms);
    }

    return $acronyms;
  }
//
// Acronym MOD - End Code Alteration
//----------------------------------------------------------------------

}
?>
Thank you Franck. ;)
reh
Registered User
Posts: 66
Joined: Mon Jun 28, 2004 7:55 am

Re: [ALPHA] Lexicon / Acronym MOD

Post by reh »

Your changes have absolutly nothing to do with prosilver!

Your user_lang is 'fr_standard', but i tseems like you use 'fr' in the lexicon table.
If you only use one lang, you can hardcode 'fr' rather then $user->data['user_lang'], but whats, if one use more langs?
The cleaner way is, to assure, your forum and the mod use the same language names.
pcmander
Registered User
Posts: 6
Joined: Thu Sep 04, 2008 5:43 pm

Re: [ALPHA] Lexicon / Acronym MOD

Post by pcmander »

Hey

First i will say great mod

but i have a problem:

If i had a space before and after Akronym don't work in topics

If i hadn't it's ok but not if acronym is in a word.

Please help me, and i'm sorry for my bad english
reh
Registered User
Posts: 66
Joined: Mon Jun 28, 2004 7:55 am

Re: [ALPHA] Lexicon / Acronym MOD

Post by reh »

I found an error in the acp modul.
I forgot, in the past i replaced the space with an &nbsp; there, so it not work mit anything further searching for an space.
In phpmyadmin the &nbsp; is invisible why it is shown as space and i dont noticed it, why i insert my words with phpmyadmin.

For they, who have lots of word with wrong spaces in the db, use this statement (after backup your table):

Code: Select all

UPDATE `YOUR_PREFIX_lexicon` SET acronym = REPLACE( acronym, '&nbsp;', ' ' )
I uploaded a new version (first post) and hope, i dont made more errors there.
User avatar
Bruno36
Registered User
Posts: 287
Joined: Fri Mar 02, 2007 2:16 pm
Location: france
Name: bruno astie

Re: [ALPHA] Lexicon / Acronym MOD

Post by Bruno36 »

Hello!

How inserted a picture?
Excuse me for my poor English, I speak french
Bruno36
Patrick S.
Registered User
Posts: 3
Joined: Thu Oct 16, 2008 1:38 pm

Re: [ALPHA] Lexicon / Acronym MOD

Post by Patrick S. »

Hello!

i cannot install the lexicon mod correct.
After browsing to the install.php i click the link "Install Database Changes" and receive this text:
[phpBB Debug] PHP Notice: in file /install.php on line 447: Invalid argument supplied for foreach()
Lexicon Installer

Welcome to the Lexicon Installer. This is a script that you can use to install or uninstall the database changes required for the Lexicon modification to operate correctly on your phpBB 3 forum. Please select an option below to continue.

Please remember that this script only works with the database changes required for Lexicon on phpBB 3. Any file alterations or additions must be installed, uninstalled, or upgraded separately. Check the documentation of Lexicon for details on such steps.

This installer will now attempt to make the database changes for Lexicon.

* No changes were attempted! You may have already run the installer successfully.

The installer process is now complete.

You should now delete install.php from your forum.

Be sure to visit the Administration Control Panel to check and update any configuration options that may have been affected by this process.
Lexicon Copyright © 2007 by Renate Regitz
When i look in the acp -> postings -> i see the ACP_LEXICON link. if i press the button, he gives me following message:
SQL ERROR [ mysqli ]

Table 'corsaforum.LEXICON_TABLE' doesn't exist [1146]

SQL

SELECT * FROM LEXICON_TABLE ORDER BY term

BACKTRACE

FILE: includes/db/mysqli.php
LINE: 143
CALL: dbal->sql_error()

FILE: includes/acp/acp_lexicon.php
LINE: 180
CALL: dbal_mysqli->sql_query()

FILE: includes/functions_module.php
LINE: 471
CALL: acp_lexicon->main()

FILE: adm/index.php
LINE: 74
CALL: p_master->load_active()
Can anyone help me? I've checked the file permissions already.
any ideas??

thanks, patrick
http://www.corsaforum.de - Repair, Tuning, Workshops, ... !
User avatar
Bruno36
Registered User
Posts: 287
Joined: Fri Mar 02, 2007 2:16 pm
Location: france
Name: bruno astie

Re: [ALPHA] Lexicon / Acronym MOD

Post by Bruno36 »

Bruno36 wrote:Hello!

How inserted a picture?
Excuse me for my poor English, I speak french
Bruno36
reh
Registered User
Posts: 66
Joined: Mon Jun 28, 2004 7:55 am

Re: [ALPHA] Lexicon / Acronym MOD

Post by reh »

able 'corsaforum.LEXICON_TABLE' doesn't exist [1146]
have you inserted LEXICON_TABLE to the constants.php?


There are no function to add pics, so you must insert it in html in your text, it wasnt parsed with anything.
Or you add functions to use an editor and bbcodes.
User avatar
Bruno36
Registered User
Posts: 287
Joined: Fri Mar 02, 2007 2:16 pm
Location: france
Name: bruno astie

Re: [ALPHA] Lexicon / Acronym MOD

Post by Bruno36 »

Thank you, it is a pity
Excuse me for my poor English, I speak french
Bruno36
Patrick S.
Registered User
Posts: 3
Joined: Thu Oct 16, 2008 1:38 pm

Re: [ALPHA] Lexicon / Acronym MOD

Post by Patrick S. »

reh wrote:
able 'corsaforum.LEXICON_TABLE' doesn't exist [1146]
have you inserted LEXICON_TABLE to the constants.php?
No, where was mentioned about..?

Edit: Sorry, i found the install_mod.xml now! uncommon readme, but OK.. thanks! :)
Last edited by Patrick S. on Fri Oct 17, 2008 9:45 am, edited 1 time in total.
http://www.corsaforum.de - Repair, Tuning, Workshops, ... !
Patrick S.
Registered User
Posts: 3
Joined: Thu Oct 16, 2008 1:38 pm

Re: [ALPHA] Lexicon / Acronym MOD

Post by Patrick S. »

oh, it works! please delete this posting
http://www.corsaforum.de - Repair, Tuning, Workshops, ... !
yoyob
Registered User
Posts: 5
Joined: Sun Dec 24, 2006 9:31 am

Re: [ALPHA] Lexicon / Acronym MOD

Post by yoyob »

hi, great Mod!
what need to cahnge/add for more language (Arabic, Hebrew) in lexicon page?
i was add letters to this line...

Code: Select all

$abc = array('#','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',$user->lang['LEXICON_ALL']);
but when i click on the letter its not working.
i need to do more somthing else?
yoyob
Registered User
Posts: 5
Joined: Sun Dec 24, 2006 9:31 am

Re: [ALPHA] Lexicon / Acronym MOD

Post by yoyob »

one more thing...
i cant put a link or image in the post if its with term...
User avatar
Bruno36
Registered User
Posts: 287
Joined: Fri Mar 02, 2007 2:16 pm
Location: france
Name: bruno astie

Re: [ALPHA] Lexicon / Acronym MOD

Post by Bruno36 »

Excuse me for my poor English, I speak french
Bruno36
User avatar
rosdi
Registered User
Posts: 166
Joined: Wed May 14, 2008 10:26 am

Re: [ALPHA] Lexicon / Acronym MOD

Post by rosdi »

This is the mod that I'm looking for. No need for me to add glossary page.

Before I start with the mod, I would like to know that there is an index.php file in zip package. I can't find in the install_mod and install_mod_ajax to where it should be uploaded.

Thanks.

Return to “[3.0.x] Abandoned MODs”