芝麻web文件管理V1.00
编辑当前文件:/home/p/r/i/prismawe/clients/canaldegap.fr/modules/Glossary/Glossary.module.php
in_filter = false; } function GetName() { return 'Glossary'; } function GetFriendlyName() { return $this->Lang('friendlyname'); } function MinimumCMSVersion() { return '1.4.1'; } function GetVersion() { return '0.6.8'; } function GetHelp() { return $this->Lang('help'); } function GetAuthor() { return 'SjG'; } function GetAuthorEmail() { return 'sjg@cmsmodules.com'; } function GetChangeLog() { return $this->Lang('changelog'); } function IsPluginModule() { return true; } function HasAdmin() { return true; } function GetAdminSection() { return 'content'; } function GetAdminDescription() { return $this->Lang('moddescription'); } function VisibleToAdminUser() { return $this->CheckPermission('Modify Glossary'); } function GetDependencies() { return array(); } function InstallPostMessage() { return $this->Lang('postinstall'); } function UninstallPostMessage() { return $this->Lang('postuninstall'); } function SearchResult($returnid, $articleid, $attr = '') { $targ = $this->GetPreference('glossary_page',''); if( !empty($targ) ) $returnid = $targ; $result = array(); if( $attr == 'glossary' ) { $db =& $this->GetDb(); $q = 'SELECT * FROM '.cms_db_prefix().'module_glossary_term WHERE term_id = ?'; $row = $db->GetRow($q,array($articleid)); if( $row ) { $result[0] = $this->GetFriendlyName(); $result[1] = $row['term']; $prettyurl = "glossarysing/{$row['term_id']}/{$returnid}"; $result[2] = $this->CreateLink('cntnt01','showsingle',$returnid, $row['term'],array('tid'=>$row['term_id']), '',true,true,'',true,$prettyurl); } } return $result; } function SearchReindex(&$module) { $db =& $this->GetDb(); $query = 'SELECT * FROM '.cms_db_prefix().'module_glossary_term'; $result =& $db->Execute($query); while( $result && !$result->EOF ) { $row =& $result->fields; $module->AddWords($this->GetName(),$row['term_id'],'glossary', $row['term'].' '.$row['definition']); $result->MoveNext(); } $result->Close(); } function ContentPostRender(&$content) { global $gCms; $config =& $gCms->GetConfig(); if( $this->in_filter === true ) return; if( empty($content) ) { return; } $db = &$this->cms->db; if ($this->GetPreference('filter_site','0') == '1') { $targ = $this->GetPreference('glossary_page',''); $inline = ($this->GetPreference('glossary_inline','0') == '1'); $show_single = ($this->GetPreference('show_single','0') == '1'); $query = "SELECT term_id, term, definition FROM ".cms_db_prefix(). "module_glossary_term"; $dbresult = $db->Execute($query); $c_body_start = stripos($content,'',$c_body_start)+1; $c_body_end = stripos($content,'FetchRow()) { //ON REMPLACE LE LIEN PAR UNE BALISE SPAN $link = '
'.$row['term'].'
'; //$link = $this->CreateTermLink('\2', $row['term'], $row['term_id'], $row['definition'], // $inline, $targ, $show_single); $term = preg_replace('/([\/#@$!.?*{}()|\[\]])/','\\\1',$row['term']); $subc = preg_replace('/(\s+)('.$term.')(\W)/i', '\1'.$link.'\3',$subc); } if( empty($subc) ) { $content = ''.$content; } $content = mb_substr($content,0,$c_body_start_end,$config['default_encoding']).$subc. mb_substr($content,$c_body_end,$config['default_encoding']); } } function CreateTermLink($term, $safeTermSrc, $termid, $def, $inline=true, $targ='', $show_single=false, $cat='') { global $gCms; $config =& $gCms->GetConfig(); $safeTerm = preg_replace('/[^a-zA-Z]/',"",$safeTermSrc); if ($this->GetPreference('process_smarty','') == 'yes') { $def = $this->ProcessTemplateFromData($def); } if ($inline) { if ($config['internal_pretty_urls']) { $lnk = '
'.$term.'
'; } else { $lnk = '
'.$term.'
'; } return $lnk; } else { $lnk = '
'.$term.'
'; return $lnk; } } function DoAction($action, $id, $params, $returnid=-1) { switch ($action) { case 'show': $action = 'default'; case 'def': case 'default': case 'showsingle': case 'random': parent::DoAction($action,$id,$params,$returnid); break; case 'defaultadmin': case 'listterms': { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->ListTerms($id, $params, $returnid); } break; } case 'editterm': { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->EditTerm($id, $params, $returnid); } break; } case 'saveterm': { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->SaveTerm($id, $params, $returnid); } break; } case 'delterm': { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->DeleteTerm($id, $params, $returnid); } break; } case "listtempl": { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->listTemplates($id, $params, $returnid); } } break; case "edittempl": { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->editTemplate($id, $params, $returnid); } } break; case "deletetempl": { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->delTemplate($id, $params, $returnid); } } break; case "submittempl": { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->submitTemplate($id, $params, $returnid); } } break; case "listcats": { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->listCats($id, $params, $returnid); } } break; case "editcat": { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->editCat($id, $params, $returnid); } } break; case "deletecat": { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->delCat($id, $params, $returnid); } } break; case "submitcat": { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->submitCat($id, $params, $returnid); } } break; case "adminprefs": { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->EditPrefs($id, $params, $returnid); } } break; case "submitprefs": { if ($this->checkPerm()) { $this->initAdminNav($id, $params, $returnid); $this->SubmitPrefs($id, $params, $returnid); } } break; } } function checkPerm($perm = 'Modify Glossary') { if (! $this->CheckPermission($perm)) { $this->DisplayErrorPage($id, $params, $returnid, $this->Lang('accessdenied')); return false; } return true; } function DisplayErrorPage($id, &$params, $returnid, $message='') { $this->smarty->assign('title_error', $this->Lang('error')); if ($message != '') { $this->smarty->assign_by_ref('message', $message); } // Display the populated template echo $this->ProcessTemplate('error.tpl'); } function ListTerms($id, &$params, $returnid, $message='') { global $gCms; $db = &$this->cms->db; $entryarray = array(); $total = 0; $step = $this->GetPreference('number_show_admin','20'); $startPoint = ((isset($params['start'])&&!empty($params['start']))?$params['start']:0); $filter = ((isset($params['filter'])&&!empty($params['filter']))?$params['filter']:0); $cats = array(); if ($filter > 0) { $query = "SELECT count(t.term_id) as total FROM ".cms_db_prefix(). "module_glossary_term t, ".cms_db_prefix()."module_glossary_cat c, ". cms_db_prefix()."module_glossary_term_cat ct " . " where ct.category_id = c.category_id and ct.term_id=t.term_id and c.category_id=?"; $dbresult = $db->Execute($query, array($filter)); } else { $query = "SELECT count(term_id) as total FROM ".cms_db_prefix(). "module_glossary_term"; $dbresult = $db->Execute($query); } $show_termids = $this->GetPreference('show_termids',0); if ($dbresult !== false && $row = $dbresult->FetchRow()) { $total=$row['total']; } else { $total= 0; } if ($filter > 0) { $query = "SELECT t.term_id, t.term, t.definition FROM ".cms_db_prefix(). "module_glossary_term t, ".cms_db_prefix()."module_glossary_cat c, ". cms_db_prefix()."module_glossary_term_cat ct " . " where ct.category_id = c.category_id and ct.term_id=t.term_id and c.category_id=? ORDER by t.term"; $dbresult = $db->SelectLimit($query,$step,$startPoint,array($filter)); } else { $query = "SELECT term_id, term, definition FROM ".cms_db_prefix(). "module_glossary_term ORDER by term"; $dbresult = $db->SelectLimit($query,$step,$startPoint,array()); } $rowclass = 'row1'; $param_add = array(); if ($filter > 0) { $param_add['filter']=$filter; } while ($dbresult !== false && $row = $dbresult->FetchRow()) { $onerow = new stdClass(); $onerow->id = $row['term_id']; $onerow->namelink = $this->CreateLink($id, 'editterm', $returnid,'',array('wid'=>$row['term_id'], 'start'=>$startPoint, 'filter'=>$filter),'',true); $onerow->name = $row['term']; $onerow->safename = preg_replace('[^a-zA-Z]',"",$row['term']); $onerow->rowclass = $rowclass; $onerow->definition = strip_tags($row['definition']); $onerow->editlink = $this->CreateLink($id, 'editterm', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/edit.gif', $this->Lang('edit'),'','','systemicon'), array_merge($param_add, array('wid'=>$row['term_id'], 'start'=>$startPoint) )); $onerow->dellink = $this->CreateLink($id, 'delterm', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/delete.gif', $this->Lang('delete'),'','','systemicon'), array_merge($param_add, array('wid'=>$row['term_id'], 'start'=>$startPoint)), $this->Lang('suredelete',$row['term'])); array_push($entryarray, $onerow); ($rowclass=="row1"?$rowclass="row2":$rowclass="row1"); } $cats[$this->Lang('title_all')] = ''; $dbresult = $db->Execute("select category_id, name from ".cms_db_prefix(). "module_glossary_cat"); while ($dbresult !== false && $row = $dbresult->FetchRow()) { $cats[$row['name']]=$row['category_id']; } if ($startPoint >= $step) { $prev_id = $startPoint - $step; $this->smarty->assign('prev_page', $this->CreateLink($id, 'listterms', $returnid, $this->Lang('prev'), array_merge($param_add, array('start'=>$prev_id)))); } if ($startPoint + $step < $total) { $next_id = $startPoint + $step; $this->smarty->assign('next_page', $this->CreateLink($id, 'listterms', $returnid, $this->Lang('next'), array_merge($param_add, array('start'=>$next_id)))); } if (ceil($total/$step) > 1) { $curpg = floor($startPoint/$step) + 1; $linkstr = ''; $first = 1; for ($i=0;$i<$total;$i+=$step) { $thisPg = floor($i/$step) + 1; if ($first) { $first = 0; } else { $linkstr .= ' : '; } if ($i == $startPoint) { $linkstr .= '['.$thisPg.']'; } else { $linkstr .= $this->CreateLink($id, 'listterms', $returnid, $thisPg, array_merge($param_add, array('start'=>$i))); } } $this->smarty->assign('page_no', 'Page '.$curpg.' of '.ceil($total/$step)); $this->smarty->assign_by_ref('page_links', $linkstr); } $this->smarty->assign('column_termid', $this->Lang('column_termid')); $this->smarty->assign('column_term', $this->Lang('column_term')); $this->smarty->assign('column_definition', $this->Lang('column_definition')); $this->smarty->assign('column_action', $this->Lang('column_action')); $this->smarty->assign('title_filter_category', $this->Lang('title_filter_category')); $this->smarty->assign('startform', $this->CreateFormStart($id, 'listterms', $returnid)); $this->smarty->assign('endform', $this->CreateFormEnd()); $this->smarty->assign('submit', $this->CreateInputSubmit($id, 'submit', $this->Lang("filter"))); $this->smarty->assign('input_filter_category', $this->CreateInputDropdown($id, 'filter', $cats, -1, isset($params['filter'])?$params['filter']:'',"onChange=\"submit()\"")); $this->smarty->assign_by_ref('items', $entryarray); $this->smarty->assign('itemcount', count($entryarray)); if ($message != "") { $this->smarty->assign_by_ref('message', $message); } $this->smarty->assign('addlink', $this->CreateLink($id, 'editterm', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/newobject.gif', $this->Lang('addterm'),'','','systemicon'), array_merge($param_add, array('start'=>$startPoint)), '', false, false, '') .' '. $this->CreateLink($id, 'editterm', $returnid, $this->Lang('addterm'), array_merge($param_add, array('start'=>$startPoint)), '',false, false, 'class="pageoptions"')); $this->smarty->assign('title_section', $this->Lang('title_term_list')); if ($show_termids) { $this->smarty->assign('show_termids', '1'); } else { $this->smarty->assign('show_termids', '0'); } // Display the populated template echo $this->ProcessTemplate('listterms.tpl'); } function SaveTerm($id, &$params, $returnid) { $db = &$this->cms->db; if (isset($params['wid'])) { // updating $query = 'UPDATE '. cms_db_prefix(). 'module_glossary_term set term=?,definition=? WHERE term_id=?'; $dbresult = $db->Execute($query,array( $params['term'],$params['definition'],$params['wid'])); if ($dbresult === false) { return $this->DisplayErrorPage($id, $params, $returnid, $db->ErrorMsg()); } $term_id = $params['wid']; } else { // new record $term_id = $db->GenID(cms_db_prefix().'module_glossary_term_seq'); $query = 'INSERT INTO '. cms_db_prefix(). 'module_glossary_term (term_id, term, definition) VALUES (?,?,?)'; $dbresult = $db->Execute($query,array($term_id, $params['term'],$params['definition'])); if ($dbresult === false) { return $this->DisplayErrorPage($id, $params, $returnid, $db->ErrorMsg()); } } if (isset($params['cats'])) { if (! is_array($params['cats'])) { $params['cats'] = array($params['cats']); } $query = 'DELETE FROM '. cms_db_prefix(). 'module_glossary_term_cat where term_id=?'; $dbresult = $db->Execute($query,array($term_id)); if ($dbresult === false) { return $this->displayError($db->ErrorMsg()); } foreach ($params['cats'] as $thisCat) { $query = 'INSERT INTO '. cms_db_prefix(). 'module_glossary_term_cat (term_id, category_id) VALUES (?,?)'; $dbresult = $db->Execute($query,array($term_id, $thisCat)); if ($dbresult === false) { return $this->displayError($db->ErrorMsg()); } } } // update Search $module =& $this->GetModuleInstance('Search'); if ($module != FALSE) { $txt = $params['term'].' '.$params['definition']; $module->AddWords($this->GetName(),$term_id, 'glossary', $txt, NULL ); } return $this->ListTerms($id, $params, $returnid, $this->Lang('termadded')); } function DeleteTerm($id, &$params, $returnid) { $db = &$this->cms->db; if (isset($params['wid'])) { // updating $query = 'DELETE FROM '. cms_db_prefix(). 'module_glossary_term WHERE term_id=?'; $dbresult = $db->Execute($query,array($params['wid'])); if ($dbresult === false) { return $this->DisplayErrorPage($id, $params, $returnid, $db->ErrorMsg()); } $query = 'DELETE FROM '. cms_db_prefix(). 'module_glossary_term_cat WHERE term_id=?'; $dbresult = $db->Execute($query,array($params['wid'])); if ($dbresult === false) { return $this->DisplayErrorPage($id, $params, $returnid, $db->ErrorMsg()); } // update Search $module =& $this->GetModuleInstance('Search'); if ($module != FALSE) { $module->DeleteWords($this->GetName(),$params['wid'], 'glossary'); } } return $this->ListTerms($id, $params, $returnid, $this->Lang('termdeleted')); } function EditTerm($id, &$params, $returnid, $message="") { $db = &$this->cms->db; $cats = array(); $membercats=array(); $query = "SELECT category_id, name FROM ".cms_db_prefix(). "module_glossary_cat"; $dbresult = $db->Execute($query); while ($dbresult !== false && $row = $dbresult->FetchRow()) { $cats[$row['name']] = $row['category_id']; } if (isset($params['wid'])) { $query = "SELECT * FROM ".cms_db_prefix(). "module_glossary_term WHERE term_id=?"; $dbresult = $db->Execute($query,array($params['wid'])); if ($dbresult !== false && $row = $dbresult->FetchRow()) { $term = $row['term']; $def = $row['definition']; } $query = "SELECT category_id FROM ".cms_db_prefix(). "module_glossary_term_cat WHERE term_id=?"; $dbresult = $db->Execute($query,array($params['wid'])); while ($dbresult !== false && $row = $dbresult->FetchRow()) { array_push($membercats, $row['category_id']); } } else { $term=''; $def=''; } $this->smarty->assign('startform', $this->CreateFormStart($id, 'saveterm', $returnid)); $this->smarty->assign('endform', $this->CreateFormEnd()); $this->smarty->assign('submit', $this->CreateInputSubmit($id, 'submit', 'Submit')); $this->smarty->assign('title_field_term',$this->Lang('title_term')); $this->smarty->assign('title_field_definition',$this->Lang('title_definition')); $this->smarty->assign('title_field_cats',$this->Lang('title_cats')); $this->smarty->assign('input_field_term',$this->CreateTextArea(($this->GetPreference('wysiwyg_terms','no')=='yes'), $id, $term, 'term','pageheadtags','','','',80,5)); $this->smarty->assign('input_field_definition',$this->CreateTextArea(($this->GetPreference('wysiwyg_definitions','no')=='yes'), $id, $def, 'definition')); $this->smarty->assign('input_field_cats',$this->CreateInputSelectList($id, 'cats[]', $cats, $membercats, 5)); if (isset($params['wid'])) { $this->smarty->assign('hidden',$this->CreateInputHidden($id,'wid',$params['wid']). $this->CreateInputHidden($id,'start',$params['start']). $this->CreateInputHidden($id,'filter',$params['filter'])); } else { $this->smarty->assign('hidden',$this->CreateInputHidden($id,'start',$params['start']). $this->CreateInputHidden($id,'filter',$params['filter'])); } if($message != '') { $this->smarty->assign('message',$message); } echo $this->ProcessTemplate('editterm.tpl'); } function listTemplates($id, &$params, $returnid, $message="") { global $gCms; $db = &$this->cms->db; //Load the shows $entryarray = array(); $query = "SELECT template_id, name FROM ". cms_db_prefix()."module_glossary_template ORDER by name"; $dbresult = $db->Execute($query); $rowclass = 'row1'; while ($dbresult !== false && $row = $dbresult->FetchRow()) { $onerow = new stdClass(); $onerow->id = $row['template_id']; $onerow->name = $this->CreateLink($id, 'edittempl', $returnid, $row['name'], array('template_id'=>$row['template_id'])); $onerow->rowclass = $rowclass; $onerow->editlink = $this->CreateLink($id, 'edittempl', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/edit.gif', $this->Lang('edit'),'','','systemicon'), array('template_id'=>$row['template_id'])); $onerow->deletelink = $this->CreateLink($id, 'deletetempl', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/delete.gif', $this->Lang('delete'),'','','systemicon'), array('template_id'=>$row['template_id']), $this->Lang('areyousure','Template')); array_push($entryarray, $onerow); ($rowclass=="row1"?$rowclass="row2":$rowclass="row1"); } $this->smarty->assign_by_ref('items', $entryarray); $this->smarty->assign('itemcount', count($entryarray)); $this->smarty->assign('section',$this->Lang('templatelist')); $this->smarty->assign('column_template',$this->Lang('column_template')); $this->smarty->assign('notemplates',$this->Lang('notemplates')); if ($message != '') { $this->smarty->assign_by_ref('message',$message); } $this->smarty->assign('addlink', $this->CreateLink($id, 'edittempl', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/newobject.gif', $this->Lang('addtemplate'),'','','systemicon'), array(), '', false, false, '') .' '. $this->CreateLink($id, 'edittempl', $returnid, $this->Lang('addtemplate'), array(), '', false, false, 'class="pageoptions"')); #Display template echo $this->ProcessTemplate('listtemplates.tpl'); } function editTemplate($id, &$params, $returnid) { $db = &$this->cms->db; $types = array(); $typeids = array(); if (isset($params['template_id'])) { // editing a template $query = 'SELECT name, template FROM ' . cms_db_prefix(). 'module_glossary_template WHERE template_id=?'; $dbresult = $db->Execute($query,array($params['template_id'])); $row = $dbresult->FetchRow(); $templateid = $params['template_id']; $name=$row['name']; $template=$row['template']; } else { // adding a template $templateid = ''; $name=''; $template=''; $this->smarty->assign('op', 'Add Template'); } $this->smarty->assign('startform', $this->CreateFormStart($id, 'submittempl', $returnid)); $this->smarty->assign('endform', $this->CreateFormEnd()); $this->smarty->assign('hidden',$this->CreateInputHidden($id, 'template_id', $templateid)); $this->smarty->assign('title_name',$this->Lang('title_name')); $this->smarty->assign('title_template',$this->Lang('title_template')); $this->smarty->assign('input_name',$this->CreateInputText($id, 'name', $name, 20, 255)); $this->smarty->assign('input_template',$this->CreateTextArea(false, $id, $template, 'templ')); $this->smarty->assign('submit', $this->CreateInputSubmit($id, 'submit', 'Submit')); echo $this->ProcessTemplate('edittemplate.tpl'); } function submitTemplate($id, &$params, $returnid) { $db = &$this->cms->db; if (! empty($params['template_id'])) { // updating a template $query = 'UPDATE '. cms_db_prefix(). 'module_glossary_template set name=?, template=? WHERE template_id=?'; $dbresult = $db->Execute($query,array($params['name'],$params['templ'], $params['template_id'])); $template_id = $params['template_id']; } else { // creating a template $query = 'INSERT INTO '. cms_db_prefix(). 'module_glossary_template (template_id, name, template) VALUES (?,?,?)'; $template_id = $db->GenID(cms_db_prefix().'module_glossary_template_seq'); $dbresult = $db->Execute($query,array($template_id,$params['name'],$params['templ'])); } $this->SetTemplate('glossary_'.$template_id,$params['templ']); $this->listTemplates($id, $params, $returnid,$this->Lang('templateupdated')); } function delTemplate($id, &$params, $returnid) { $db = &$this->cms->db; if (! empty($params['template_id'])) { // updating a template $query = 'DELETE FROM '. cms_db_prefix(). 'module_glossary_template WHERE template_id=?'; $dbresult = $db->Execute($query,array($params['template_id'])); $this->DeleteTemplate('glossary_'.$params['template_id']); } $this->listTemplates($id, $params, $returnid,$this->Lang('templatedeleted')); } function listCats($id, &$params, $returnid, $message="") { global $gCms; $db = &$this->cms->db; //Load the shows $entryarray = array(); $query = "SELECT category_id, name FROM ". cms_db_prefix()."module_glossary_cat ORDER by name"; $dbresult = $db->Execute($query); $rowclass = 'row1'; while ($dbresult !== false && $row = $dbresult->FetchRow()) { $onerow = new stdClass(); $onerow->id = $row['category_id']; $onerow->name = $this->CreateLink($id, 'editcat', $returnid, $row['name'], array('category_id'=>$row['category_id'])); $onerow->rowclass = $rowclass; $onerow->editlink = $this->CreateLink($id, 'editcat', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/edit.gif', $this->Lang('edit'),'','','systemicon'), array('category_id'=>$row['category_id'])); $onerow->deletelink = $this->CreateLink($id, 'deletecat', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/delete.gif', $this->Lang('delete'),'','','systemicon'), array('category_id'=>$row['category_id']), $this->Lang('areyousure','Category')); array_push($entryarray, $onerow); ($rowclass=="row1"?$rowclass="row2":$rowclass="row1"); } $this->smarty->assign_by_ref('items', $entryarray); $this->smarty->assign('itemcount', count($entryarray)); $this->smarty->assign('section',$this->Lang('listcats')); $this->smarty->assign('column_category',$this->Lang('column_category')); $this->smarty->assign('nocats',$this->Lang('nocats')); if ($message != '') { $this->smarty->assign_by_ref('message',$message); } $this->smarty->assign('addlink', $this->CreateLink($id, 'editcat', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/system/newobject.gif', $this->Lang('addcat'),'','','systemicon'), array(), '', false, false, '') .' '. $this->CreateLink($id, 'editcat', $returnid, $this->Lang('addcat'), array(), '', false, false, 'class="pageoptions"')); #Display template echo $this->ProcessTemplate('listcats.tpl'); } function editCat($id, &$params, $returnid) { $db = &$this->cms->db; $types = array(); $typeids = array(); if (isset($params['category_id'])) { $query = 'SELECT name FROM ' . cms_db_prefix(). 'module_glossary_cat WHERE category_id=?'; $dbresult = $db->Execute($query,array($params['category_id'])); $row = $dbresult->FetchRow(); $catid = $params['category_id']; $name=$row['name']; } else { $catid = ''; $name=''; } $this->smarty->assign('startform', $this->CreateFormStart($id, 'submitcat', $returnid)); $this->smarty->assign('endform', $this->CreateFormEnd()); $this->smarty->assign('hidden',$this->CreateInputHidden($id, 'category_id', $catid)); $this->smarty->assign('title_name',$this->Lang('title_name')); $this->smarty->assign('input_name',$this->CreateInputText($id, 'name', $name, 20, 255)); $this->smarty->assign('submit', $this->CreateInputSubmit($id, 'submit', 'Submit')); echo $this->ProcessTemplate('editcat.tpl'); } function submitCat($id, &$params, $returnid) { $db = &$this->cms->db; if (! empty($params['category_id'])) { $query = 'UPDATE '. cms_db_prefix(). 'module_glossary_cat set name=? WHERE category_id=?'; $dbresult = $db->Execute($query,array($params['name'],$params['category_id'])); } else { $query = 'INSERT INTO '. cms_db_prefix(). 'module_glossary_cat (category_id, name) VALUES (?,?)'; $category_id = $db->GenID(cms_db_prefix().'module_glossary_cat_seq'); $dbresult = $db->Execute($query,array($category_id,$params['name'])); } $this->listCats($id, $params, $returnid,$this->Lang('catupdated')); } function delCat($id, &$params, $returnid) { $db = &$this->cms->db; if (! empty($params['category_id'])) { // updating a template $query = 'DELETE FROM '. cms_db_prefix(). 'module_glossary_cat WHERE category_id=?'; $dbresult = $db->Execute($query,array($params['category_id'])); if ($dbresult === false) { return $this->DisplayErrorPage($id, $params, $returnid, $db->ErrorMsg()); } $query = 'DELETE FROM '. cms_db_prefix(). 'module_glossary_term_cat WHERE category_id=?'; $dbresult = $db->Execute($query,array($params['category_id'])); if ($dbresult === false) { return $this->DisplayErrorPage($id, $params, $returnid, $db->ErrorMsg()); } } $this->listCats($id, $params, $returnid,$this->Lang('catdeleted')); } function initAdminNav($id, &$params, $returnid) { global $gCms; $this->smarty->assign('innernav', $this->CreateLink($id, 'listterms', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/topfiles/adminlog.gif', $this->Lang('listterms'),'','','systemicon'), array()) . $this->CreateLink($id, 'listterms', $returnid, $this->Lang('listterms'), array()) . ' : ' . $this->CreateLink($id, 'listcats', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/topfiles/preferences.gif', $this->Lang('listcats'),'','','systemicon'), array()) . $this->CreateLink($id, 'listcats', $returnid, $this->Lang('listcats'), array()) . ' : ' . $this->CreateLink($id, 'listtempl', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/topfiles/template.gif', $this->Lang('listtempl'),'','','systemicon'), array()) . $this->CreateLink($id, 'listtempl', $returnid, $this->Lang('listtempl'), array()) . ' : ' . $this->CreateLink($id, 'adminprefs', $returnid, $gCms->variables['admintheme']->DisplayImage('icons/topfiles/siteprefs.gif', $this->Lang('manageprefs'),'','','systemicon'), array()) . $this->CreateLink($id, 'adminprefs', $returnid, $this->Lang('manageprefs'), array())); } function EditPrefs($id, &$params, $returnid, $message='') { global $gCms; $db = &$this->cms->db; $templates = array(); $query = "SELECT template_id, name FROM ". cms_db_prefix()."module_glossary_template ORDER by name"; $dbresult = $db->Execute($query); while ($dbresult !== false && $row = $dbresult->FetchRow()) { $templates[$row['name']] = $row['template_id']; } $this->smarty->assign('tab_headers',$this->StartTabHeaders(). $this->SetTabHeader('display',$this->Lang('title_display_tab')). $this->SetTabHeader('link',$this->Lang('title_link_tab')). $this->SetTabHeader('filtering',$this->Lang('title_filtering_tab')). $this->SetTabHeader('admin',$this->Lang('title_admin_tab')). $this->EndTabHeaders().$this->StartTabContent()); $this->smarty->assign('end_tab',$this->EndTab()); $this->smarty->assign('tab_footers',$this->EndTabContent()); $this->smarty->assign('start_display_tab',$this->StartTab('display')); $this->smarty->assign('start_admin_tab',$this->StartTab('admin')); $this->smarty->assign('start_filtering_tab',$this->StartTab('filtering')); $this->smarty->assign('start_link_tab',$this->StartTab('link')); $this->smarty->assign('startform', $this->CreateFormStart($id, 'submitprefs', $returnid)); $this->smarty->assign('endform', $this->CreateFormEnd()); $this->smarty->assign('submit', $this->CreateInputSubmit($id, 'submit', 'Submit')); $this->smarty->assign('title_default_template', $this->Lang('title_default_template')); $this->smarty->assign('title_default_single_term_template', $this->Lang('title_default_single_term_template')); $this->smarty->assign('title_number_show', $this->Lang('title_number_show')); $this->smarty->assign('title_default_number_show', $this->Lang('title_default_number_show')); $this->smarty->assign('title_filter_site', $this->Lang('title_filter_site')); $this->smarty->assign('title_filter_news', $this->Lang('title_filter_news')); $this->smarty->assign('title_disable_prettyurls',$this->Lang('title_disable_prettyurls')); $this->smarty->assign('title_glossary_inline', $this->Lang('title_glossary_inline')); $this->smarty->assign('glossary_prettyurls_help',$this->Lang('glossary_prettyurls_help')); $this->smarty->assign('glossary_inline_help',$this->Lang('glossary_inline_help')); $this->smarty->assign('title_single_term', $this->Lang('title_single_term')); $this->smarty->assign('title_glossary_page', $this->Lang('title_glossary_page')); $this->smarty->assign('glossary_page_help',$this->Lang('glossary_page_help')); $this->smarty->assign('title_filter_site_type', $this->Lang('title_filter_site_type')); $this->smarty->assign('title_show_termids', $this->Lang('title_show_termids')); $this->smarty->assign('title_number_spining_chars', $this->Lang('title_number_spining_chars')); $this->smarty->assign('title_process_smarty', $this->Lang('title_process_smarty')); $this->smarty->assign('title_wysiwyg_definitions', $this->Lang('title_wysiwyg_definitions')); $this->smarty->assign('title_wysiwyg_terms', $this->Lang('title_wysiwyg_terms')); $this->smarty->assign('input_default_template', $this->CreateInputDropdown($id, 'default_template', $templates, -1, $this->GetPreference('default_template'))); $this->smarty->assign('input_default_single_term_template', $this->CreateInputDropdown($id, 'default_single_term_template', $templates, -1, $this->GetPreference('default_single_term_template'))); $characters = array('1'=>'1','2'=>'2','3'=>'3','4'=>'4','5'=>'5','6'=>'6','7'=>'7','8'=>'8', '9'=>'9','10'=>'10'); $this->smarty->assign('input_number_spining_chars', $this->CreateInputDropdown($id, 'spining_chars', $characters, -1, $this->GetPreference('spining_chars','5'))); $sizes = array('5'=>'5','10'=>'10','15'=>'15','20'=>'20','25'=>'25','30'=>'30', '40'=>'40','50'=>'50','75'=>'75','100'=>'100','200'=>'200','1000'=>'1000'); $this->smarty->assign('input_number_show', $this->CreateInputDropdown($id, 'number_show', $sizes, -1, $this->GetPreference('number_show','20'))); $this->smarty->assign('input_number_show_admin', $this->CreateInputDropdown($id, 'number_show_admin', $sizes, -1, $this->GetPreference('number_show_admin','20'))); $this->smarty->assign('input_filter_site',$this->CreateInputCheckbox($id, 'filter_site', 1, $this->GetPreference('filter_site', 0)).' '. $this->Lang('title_filter_site_label')); $this->smarty->assign('input_filter_news',$this->CreateInputCheckbox($id, 'filter_news', 1, $this->GetPreference('filter_news', 0))); $this->smarty->assign('input_button_filter', $this->CreateInputSubmit($id,'filter_site_now',$this->Lang('filter_site_now'),'','',$this->Lang('areyousure_altercontent'))); $this->smarty->assign('input_single_term',$this->CreateInputCheckbox($id, 'show_single', 1, $this->GetPreference('show_single', 0)).' '. $this->Lang('title_single_term_label')); $this->smarty->assign('input_disable_prettyurls', $this->CreateInputCheckbox($id,'disable_prettyurls',1,$this->GetPreference('disable_prettyurls','0')).' '.$this->Lang('title_disable_prettyurls_label')); $this->smarty->assign('input_glossary_inline',$this->CreateInputCheckbox($id, 'glossary_inline', 1, $this->GetPreference('glossary_inline', '1')).' '. $this->Lang('title_glossary_inline_label')); $reqs = array($this->Lang('no')=>'no',$this->Lang('yes')=>'yes'); $this->smarty->assign('input_process_smarty', $this->CreateInputRadioGroup($id,'process_smarty',$reqs,$this->GetPreference('process_smarty','no'))); $this->smarty->assign('input_wysiwyg_definitions', $this->CreateInputRadioGroup($id,'wysiwyg_definitions',$reqs,$this->GetPreference('wysiwyg_definitions','no'))); $this->smarty->assign('input_wysiwyg_terms', $this->CreateInputRadioGroup($id,'wysiwyg_terms',$reqs,$this->GetPreference('wysiwyg_terms','no'))); $this->smarty->assign('title_wysiwyg_terms_help',$this->Lang('title_wysiwyg_terms_help')); $this->smarty->assign('input_show_termids',$this->CreateInputCheckbox($id, 'show_termids', 1, $this->GetPreference('show_termids', 0)).' '. $this->Lang('title_show_termids')); $contentops =& $gCms->GetContentOperations(); //$ret[]= array(lang('parent').':',$contentops->CreateHierarchyDropdown($this->mId, $this->mParentId)); $this->smarty->assign('input_glossary_page',$contentops->CreateHierarchyDropdown('', $this->GetPreference('glossary_page',''),$id.'glossary_page')); $this->smarty->assign_by_ref('message', $message); $this->smarty->assign('section', $this->Lang('manageprefs')); #Display template echo $this->ProcessTemplate('adminprefs.tpl'); } function SubmitPrefs($id, &$params, $returnid) { if( isset($params['filter_site_now']) ) { include(dirname(__FILE__).'/function.filter_site.php'); } else { $this->SetPreference('default_template', isset($params['default_template'])?$params['default_template']:''); $this->SetPreference('default_single_term_template', isset($params['default_single_term_template'])?$params['default_single_term_template']:''); $this->SetPreference('number_show', isset($params['number_show'])?$params['number_show']:'20'); $this->SetPreference('number_show_admin', isset($params['number_show_admin'])?$params['number_show_admin']:'20'); $this->SetPreference('filter_site', isset($params['filter_site'])?$params['filter_site']:0); $this->SetPreference('filter_news', isset($params['filter_news'])?$params['filter_news']:0); $this->SetPreference('show_single', isset($params['show_single'])?$params['show_single']:0); $this->SetPreference('disable_prettyurls',isset($params['disable_prettyurls'])?$params['disable_prettyurls']:'0'); $this->SetPreference('glossary_inline', isset($params['glossary_inline'])?$params['glossary_inline']:'0'); $this->SetPreference('show_termids', isset($params['show_termids'])?$params['show_termids']:0); $this->SetPreference('spining_chars', isset($params['spining_chars'])?$params['spining_chars']:'5'); $this->SetPreference('glossary_page', isset($params['glossary_page'])?$params['glossary_page']:''); $this->SetPreference('process_smarty', isset($params['process_smarty'])?$params['process_smarty']:'no'); $this->SetPreference('wysiwyg_definitions', isset($params['wysiwyg_definitions'])?$params['wysiwyg_definitions']:'no'); $this->SetPreference('wysiwyg_terms', isset($params['wysiwyg_terms'])?$params['wysiwyg_terms']:'no'); } return $this->EditPrefs($id, $params, $returnid, $this->Lang('prefsupdated')); } /* pass an associative array with one or more of the following set: tid = term id term = term name catid = category id cat = category name term_count = number to show (if list query) keyword = keyword to find in definition sort = random/alpha show_nav = true/false */ function SmartyTermList($opts=array(),$id,$returnid) { global $gCms; $db = &$gCms->GetDb(); $config =& $gCms->GetConfig(); $query = 'SELECT t.term_id, t.term, t.definition'; $from = array(cms_db_prefix().'module_glossary_term t'); $where = array(); $prms = array(); $no_pass = array(); if (!isset($opts['cat']) && isset($_REQUEST['cat'])) { $opts['cat'] = $_REQUEST['cat']; } if (!isset($opts['catid']) && isset($_REQUEST['catid'])) { $opts['catid'] = $_REQUEST['catid']; } if (!isset($opts['term']) && isset($_REQUEST['term'])) { $opts['term'] = $_REQUEST['term']; } if (!isset($opts['tid']) && isset($_REQUEST['tid'])) { $opts['tid'] = $_REQUEST['tid']; } if (isset($opts['no_pass_restriction'])) { $np = explode(',',$opts['no_pass_restriction']); foreach ($np as $tnp) { $no_pass[$tnp] = 1; } } if (isset($opts['cat'])) { array_push($from,cms_db_prefix().'module_glossary_cat c'); array_push($from,cms_db_prefix().'module_glossary_term_cat tc'); array_push($where,'c.name = ? and c.category_id = tc.category_id and t.term_id = tc.term_id'); array_push($prms,$opts['cat']); } elseif (isset($opts['catid'])) { array_push($from,cms_db_prefix().'module_glossary_term_cat tc'); array_push($where,'tc.category_id=? and t.term_id = tc.term_id'); array_push($prms,$opts['catid']); } if (isset($opts['term'])) { array_push($where,'t.term=?'); array_push($prms,$opts['term']); } if (isset($opts['termid'])) { array_push($where,'t.term_id=?'); array_push($prms,$opts['termid']); } if (isset($opts['keyword'])) { array_push($where,"t.definition like '%".addslashes($opts['keyword'])."%'"); } $query .= ' from '.implode(',',$from); if (count($where) > 0) { $query .= ' where '.implode(' and ',$where); } if (isset($opts['sort']) && $opts['sort'] == 'random') { if ($db->dbtype == 'mysql') { $query .= ' order by rand()'; } else if ($db->dbtype == 'postgres') { $query .= ' order by random()'; } else if ($db->dbtype == 'sqlserver') { $query .= ' order by NewId()'; } else if ($db->dbtype == 'sqllite') { $query .= ' order by random()'; } else { // punt $query .= ' order by random()'; } } else { $query .= ' order by term asc'; } if (!isset($opts['start'])) { $opts['start'] = 0; } $maxSize = $this->GetPreference('number_show','20'); if (isset($opts['term_count']) && ! empty($opts['term_count'])) { $maxSize = $opts['term_count']; } $dbresult = $db->Execute($query,$prms); $count = 0; $selectedTerm = -1; $entryarray = array(); while ($dbresult !== false && $row = $dbresult->FetchRow()) { $onerow = array(); $linkparams = array(); if (! isset($no_pass['term_count'])) { $linkparams['term_count'] = $maxSize; } if (isset($opts['sort']) && !isset($no_pass['sort'])) { $linkparams['sort'] = $opts['sort']; } if (isset($opts['start']) && !isset($no_pass['start'])) { $linkparams['start'] = $opts['start']; } if (isset($opts['keyword']) && !isset($no_pass['keyword'])) { $linkparams['keyword'] = $opts['keyword']; } if (isset($opts['cat']) && !isset($no_pass['cat'])) { $linkparams['cat'] = $opts['cat']; } if (isset($opts['template']) && !isset($no_pass['template'])) { $linkparams['template'] = $opts['template']; } $onerow['id'] = $row['term_id']; $onerow['name'] = $row['term']; $onerow['safeterm'] = preg_replace('/[^a-zA-Z]/',"",$row['term']); $prettyurl = ''; if( $this->GetPreference('disable_prettyurls',0) == 0 ) { $prettyurl = 'glossary/'.$row['term'].'/'.$returnid; } if ($this->GetPreference('show_single','0') == '1') { $onerow['term'] = $this->CreateLink($id, 'showsingle', $returnid, $row['term'], array_merge($linkparams,array('tid'=>$row['term_id'])), '', false, false, '', false, $prettyurl); } else { $onerow['term'] = $this->CreateLink($id, 'show', $returnid, $row['term'], array_merge($linkparams,array('tid'=>$row['term_id'])), '', false, false, '', false, $prettyurl); } if ($this->GetPreference('process_smarty','') == 'yes') { $def = $this->ProcessTemplateFromData($row['definition']); } else { $def = $row['definition']; } $onerow['definition'] = $def; $onerow['showdef'] = 0; if (isset($opts['tid']) && $opts['tid'] == $row['term_id']) { $onerow['showdef'] = 1; $selectedTerm = $count; } if (isset($opts['term']) && $opts['term'] == $row['term']) { $onerow['showdef'] = 1; $selectedTerm = $count; } array_push($entryarray, $onerow); $count++; } $spining_chars = $this->GetPreference('spining_chars','5') + 1; if (! isset($opts['show_nav']) || $opts['show_nav'] != '0') { if ($selectedTerm > -1) { $start = ((integer)($selectedTerm / $maxSize)) * $maxSize; } else if (isset($opts['start'])) { $start = $opts['start']; } else { $start = 0; } if ($start > 0) { $linkparams['start'] = max($start-$maxSize,0); $prettyurl = ''; if( $this->GetPreference('disable_prettyurls',0) == 0 ) { $prettyurl = 'glossarynv/'.$linkparams['start']; if (isset($cat)) { $prettyurl .= '/'.$cat; } $prettyurl .= '/'.$returnid; } $this->smarty->assign('navprev', $this->CreateLink($id, 'show', $returnid, $this->Lang('prev'), $linkparams, '', false, false, '', false, $prettyurl)); } else { $this->smarty->assign('prev', ''); } $count = count($entryarray); $starts = array(); $links = array(); if ($count > $maxSize) { // pass 1: load edge words into array for ($i=0;$i<$count;$i+=$maxSize) { array_push($starts,$this->local_mb_ucfirst(mb_strtolower($entryarray[$i]['name']))); array_push($links, ($i+1)); if ($i+$maxSize-1 < $count) { array_push($starts,$this->local_mb_ucfirst(mb_strtolower($entryarray[$i+$maxSize-1]['name']))); array_push($links, ($i+1)); } } if (($count % $maxSize) > 1) { array_push($starts,$this->local_mb_ucfirst(mb_strtolower($entryarray[$count-1]['name']))); array_push($links, ($count-1)); } } else if ($count > 1) { array_push($starts,$this->local_mb_ucfirst(mb_strtolower($entryarray[0]['name']))); array_push($links, 1); array_push($starts,$this->local_mb_ucfirst(mb_strtolower($entryarray[$count-1]['name']))); array_push($links, $count); } // pass 2: make 'em minimum difference $entrySize = count($starts); for ($i=0;$i<$entrySize;$i++) { if ($i > 0 && $i % 2 ==0) { if ($difLen > 1) { $difLen--; } } else { $difLen = 1; } $flet = ''; $llet = ''; while ($flet == $llet && $difLen < $spining_chars) { if (mb_strlen($starts[$i]) >= $difLen) { $flet = mb_substr($starts[$i],0,$difLen,$config['default_encoding']); } if ($i + 1 < $entrySize && mb_strlen($starts[min($i+1, $entrySize-1)]) >= $difLen) { $llet = mb_substr($starts[min($i+1, $entrySize-1)],0,$difLen,$config['default_encoding']); } $difLen++; } $starts[$i] = mb_substr($starts[$i],0,$difLen - 1,$config['default_encoding']); } $navElements = array(); for ($i=0;$i<$entrySize;$i+=2) { $thisElement = array(); $thisElement['name'] = $starts[$i]; if ($i < $entrySize - 1) { $thisElement['name'].= '-'.$starts[$i+1]; } if ($start >= $links[$i] && $start < $i+$maxSize) { $thisElement['link'] = ''; } else { $linkparams['start']=$links[$i]-1; $prettyurl = ''; if( $this->GetPreference('disable_prettyurls',0) == 0 ) { $prettyurl = 'glossarynv/'.$linkparams['start']; if (isset($cat)) { $prettyurl .= '/'.$cat; } $prettyurl .= '/'.$returnid; } $thisElement['link'] = $this->CreateLink($id, 'show', $returnid, '', $linkparams,'',true, false, '', false, $prettyurl); } array_push($navElements, $thisElement); } if ($start + $maxSize < $count) { $linkparams['start']=($start+$maxSize); $prettyurl = ''; if( $this->GetPreference('disable_prettyurls',0) == 0 ) { $prettyurl = 'glossarynv/'.$linkparams['start']; if (isset($cat)) { $prettyurl .= '/'.$cat; } $prettyurl .= '/'.$returnid; } $this->smarty->assign('navnext', $this->CreateLink($id, 'show', $returnid, $this->Lang('next'), $linkparams, '', false, false, '', false, $prettyurl)); } else { $this->smarty->assign('navnext',''); } $this->smarty->assign('navarray', $navElements); } else { $this->smarty->assign('navarray',array()); $this->smarty->assign('navnext',''); $this->smarty->assign('navprev',''); } $entryarray = array_splice($entryarray, $start, $maxSize); $this->smarty->assign('title_section', $this->Lang('title_term_list')); if (isset($cat)) { $this->smarty->assign('cat',$cat); } $this->smarty->assign_by_ref('items', $entryarray); $this->smarty->assign('itemcount', count($entryarray)); } function SetParameters() { $this->RestrictUnknownParams(); $this->RegisterModulePlugin(); $this->CreateParameter('glossarysing', '', ''); $this->SetParameterType('glossarysing',CLEAN_STRING); $this->CreateParameter('tid', '', $this->Lang('help_glossary_tid')); $this->SetParameterType('tid',CLEAN_INT); $this->CreateParameter('catid', '', $this->Lang('help_glossary_catid')); $this->SetParameterType('cattid',CLEAN_INT); $this->CreateParameter('start', '', $this->Lang('help_glossary_start')); $this->SetParameterType('start',CLEAN_INT); $this->CreateParameter('term', '', $this->Lang('help_glossary_term')); $this->SetParameterType('term',CLEAN_STRING); $this->CreateParameter('cat', '', $this->Lang('help_glossary_cat')); $this->SetParameterType('cat',CLEAN_STRING); $this->CreateParameter('template', '', $this->Lang('help_glossary_template')); $this->SetParameterType('template',CLEAN_STRING); $this->CreateParameter('term_count', '', $this->Lang('help_glossary_term_count')); $this->SetParameterType('term_count',CLEAN_INT); $this->CreateParameter('show_nav', '', $this->Lang('help_glossary_show_nav')); $this->SetParameterType('show_nav',CLEAN_INT); $this->CreateParameter('no_pass_restriction', '', $this->Lang('help_glossary_no_pass_restriction')); $this->SetParameterType('no_pass_restriction',CLEAN_STRING); $this->CreateParameter('keyword', '', $this->Lang('help_glossary_keyword')); $this->SetParameterType('keyword',CLEAN_STRING); $this->CreateParameter('sort', '', $this->Lang('help_glossary_sort')); $this->SetParameterType('sort',CLEAN_STRING); $this->CreateParameter('glossary', '', ''); $this->SetParameterType('glossary',CLEAN_STRING); // For viewing a picture $this->RegisterRoute('/glossarysing\/(?P
[0-9]+)\/(?P
[0-9]+)$/', array('action'=>'showsingle')); $this->RegisterRoute('/glossarysing\/(?P
[a-zA-Z]+)\/(?P
[0-9]+)$/', array('action'=>'showsingle')); $this->RegisterRoute('/glossarysing\/(?P
[0-9]+)\/(?P
[a-zA-Z]+)\/(?P
[0-9]+)$/', array('action'=>'showsingle')); $this->RegisterRoute('/glossary\/(?P
[0-9]+)\/(?P
[0-9]+)$/', array('action'=>'show')); $this->RegisterRoute('/glossary\/(?P
[a-zA-Z]+)\/(?P
[0-9]+)$/', array('action'=>'show')); $this->RegisterRoute('/glossary\/(?P
[0-9]+)\/(?P
[a-zA-Z]+)\/(?P
[0-9]+)$/', array('action'=>'show')); $this->RegisterRoute('/glossarypg\/(?P
[0-9]+)\/(?P
[0-9]+)$/', array('action'=>'show')); $this->RegisterRoute('/glossarynv\/(?P
[0-9]+)\/(?P
[0-9]+)$/', array('action'=>'show')); $this->RegisterRoute('/glossarynv\/(?P
[0-9]+)\/(?P
[a-zA-Z]+)\/(?P
[0-9]+)$/', array('action'=>'show')); } function local_mb_ucfirst($string) { $string = mb_strtoupper(mb_substr($string, 0, 1)) . mb_substr($string, 1); return $string; } } ?>