HEX
Server: Apache
System: Linux dev.epsylon.net 3.10.0-1160.144.1.el7.tuxcare.els2.x86_64 #1 SMP Sun Feb 15 11:22:42 UTC 2026 x86_64
User: nexper (1054)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/nexper/www/67.225.167.226/public_html/crm/include/Smarty/plugins/function.sugar_include.php
<?php
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */


/**
 * Smarty {sugar_include} function plugin
 *
 * Type:     function<br>
 * Name:     sugar_include<br>
 * Purpose:  Handles rendering the global file includes from the metadata files defined
 *           in templateMeta=>includes.
 * 
 * @author Collin Lee {clee@sugarcrm.com}
 * @param array
 * @param Smarty
 */
function smarty_function_sugar_include($params, &$smarty)
{
    global $app_strings;

    if(isset($params['type']) && $params['type'] == 'php') {
		if(!isset($params['file'])) {
		   $smarty->trigger_error($app_strings['ERR_MISSING_REQUIRED_FIELDS'] . 'include');
		} 
		
		$includeFile = $params['file'];
		if(!file_exists($includeFile)) {
		   $smarty->trigger_error($app_strings['ERR_NO_SUCH_FILE'] . ': ' . $includeFile);
		}
		
	    ob_start();
	    require($includeFile);
	    $output_html = ob_get_contents();
	    ob_end_clean();
	    echo $output_html; 
    } else if(is_array($params['include'])) {
	   	  $code = '';
	   	  foreach($params['include'] as $include) {
	   	  	      if(isset($include['file'])) {
	   	  	         $file = $include['file'];
	   	  	         if(preg_match('/[\.]js$/si',$file)) {
	   	  	            $code .= "<script src=\"". getJSPath($include['file']) ."\"></script>";
	   	  	         } else if(preg_match('/[\.]php$/si', $file)) {
	   	  	            require_once($file);	
	   	  	         }
	   	  	      } 
	   	  } //foreach
	      return $code;
   	} //if
}
?>