* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * \file htdocs/admin/triggers.php * \brief Page de configuration et activation des triggers * \version $Id$ */ require("../main.inc.php"); if (!$user->admin) accessforbidden(); /* * Action */ /* * View */ llxHeader("",""); $html = new Form($db); print_fiche_titre($langs->trans("TriggersAvailable"),'','setup'); print $langs->trans("TriggersDesc")."
"; print "
\n"; print "\n"; print "\n"; print " \n"; //print " \n"; print " \n"; print " \n"; print " \n"; print "\n"; $files = array(); $modules = array(); $orders = array(); $i = 0; foreach($conf->triggers_modules as $dir) { // Check if directory exists if (!is_dir($dir)) continue; $handle=opendir($dir); while (($file = readdir($handle))!==false) { if (is_readable($dir.'/'.$file) && preg_match('/^interface_([^_]+)_(.+)\.class\.php/',$file,$reg)) { $modName = 'Interface'.ucfirst($reg[2]); //print "file=$file"; print "modName=$modName"; exit; if (in_array($modName,$modules)) { $langs->load("errors"); print '
'.$langs->trans("Error").' : '.$langs->trans("ErrorDuplicateTrigger",$modName,"/htdocs/includes/triggers/").'
'; $objMod = new $modName($db); $modules[$i] = $modName; $files[$i] = $file; $orders[$i] = $objMod->family; // Tri par famille $i++; } else { include_once($dir.'/'.$file); $objMod = new $modName($db); $modules[$i] = $modName; $files[$i] = $file; $orders[$i] = $objMod->family; // Tri par famille $i++; } } } closedir($handle); } asort($orders); $var=True; // Loop on each trigger foreach ($orders as $key => $value) { $tab=explode('_',$value); $family=$tab[0]; $numero=$tab[1]; $modName = $modules[$key]; if ($modName) { $objMod = new $modName($db); } $var=!$var; // Define disabledbyname and disabledbymodule $disabledbyname=0; $disabledbymodule=1; $module=''; if (preg_match('/NORUN$/i',$files[$key])) $disabledbyname=1; if (preg_match('/^interface_([^_]+)_(.+)\.class\.php/i',$files[$key],$reg)) { // Check if trigger file is for a particular module $module=preg_replace('/^mod/i','',$reg[1]); $constparam='MAIN_MODULE_'.strtoupper($module); if (strtolower($reg[1]) == 'all') $disabledbymodule=0; else if (empty($conf->global->$constparam)) $disabledbymodule=2; } // Show line for trigger file print "\n"; print ''; print '\n"; //print '\n"; print "\n"; // Etat trigger print "\n"; print '\n"; print "\n"; } print "
".$langs->trans("File")."".$langs->trans("Description")."".$langs->trans("Version")."".$langs->trans("Active")." 
'; print $objMod->picto?img_object('',$objMod->picto):img_object('','generic'); print ''.$files[$key]."'.$objMod->getDesc()."".$objMod->getVersion().""; if ($disabledbyname > 0 || $disabledbymodule > 1) { print " "; } else { print img_tick(); } print "'; $text =''.$langs->trans("Description").':
'; $text.=$objMod->getDesc().'
'; $text.='
'.$langs->trans("Status").':
'; if ($disabledbyname == 1) { $text.=$langs->trans("TriggerDisabledByName").'
'; if ($disabledbymodule == 2) $text.=$langs->trans("TriggerDisabledAsModuleDisabled",$module).'
'; } else { if ($disabledbymodule == 0) $text.=$langs->trans("TriggerAlwaysActive").'
'; if ($disabledbymodule == 1) $text.=$langs->trans("TriggerActiveAsModuleActive",$module).'
'; if ($disabledbymodule == 2) $text.=$langs->trans("TriggerDisabledAsModuleDisabled",$module).'
'; } print $html->textwithpicto('',$text); print "
\n"; llxFooter('$Date$ - $Revision$'); ?>