altocompta/include/ext_inc.php
Dany De Bontridder fd7516f391 Merged revisions 3329-3332 via svnmerge from
svn+ssh://danydb@svn/svn/phpcompta/branches/rel510

........
  r3329 | danydb | 2010-06-23 18:18:21 +0200 (Wed, 23 Jun 2010) | 2 lines
  
  Check if the plugin does exist
........
  r3330 | danydb | 2010-06-23 18:23:10 +0200 (Wed, 23 Jun 2010) | 2 lines
  
  check if file exists for the plugin
........
  r3331 | danydb | 2010-06-23 18:29:36 +0200 (Wed, 23 Jun 2010) | 1 line
  
  Improve extension : add preferences, check on the file to include
........
  r3332 | danydb | 2010-06-23 18:31:17 +0200 (Wed, 23 Jun 2010) | 3 lines
  
  Attribut : add a sort on object with usort (faster)
  Add new method for card : setAttribut
  Fiche_Def after an insert the $this->id is now set
........
2010-06-24 06:54:41 +00:00

30 lines
1,013 B
PHP

<?php
/* if a code has been asked */
if (isset($_REQUEST['plugin_code']) ) {
$cn=new Database(dossier::id());
$ext=new Extension($cn);
$ext->search('code',$_REQUEST['plugin_code']);
if ( $ext->get_parameter('id') != 0 ) {
/* security */
if ( $ext->can_request($_SESSION['g_user']) == 0 ) {
alert(j(_("Vous ne pouvez pas utiliser cette extension. Contactez votre responsable")));
exit();
}
/* show name of extension */
echo '<div style="position:absolute;left:3px;top:3px;margin:0;z-index:10" class="noprint">';
echo '<h2 class="error" style="display:inline;padding:0px;margin:0px">'.$ext->get_parameter('name').'</h2>';
echo '</div>';
if ( ! file_exists('../include/ext'.DIRECTORY_SEPARATOR.trim($ext->get_parameter('filepath')))) {
alert(j(_("Ce fichier n'existe pas "))); exit();
}
require_once('ext'.DIRECTORY_SEPARATOR.trim($ext->get_parameter('filepath')));
} else {
alert(j(_("Cette extension n'existe pas ")));
exit();
}
}
?>