コード例 #1
0
 /**
  * 
  */
 function __construct($name)
 {
     $theme =& x_getModuleManager();
     $this->m_template_file = $theme->invoke('xh_templateMapping', $name);
     if ($this->m_template_file === NULL) {
         xLog::log('Template', LOG_LEVEL_ERROR, 'Template mapping does not exists', __FILE__, __LINE__);
     }
 }
コード例 #2
0
 /**
  * @param string $search_dir The relative path to search
  * @return array An array of strings representing modules relative paths
  * @static
  */
 function findAllModules($search_dir, $suffix)
 {
     $full_search_dir = x_full_path($search_dir);
     $ret = array();
     if ($handle = opendir($full_search_dir)) {
         while (false !== ($file = readdir($handle))) {
             if ($file != "." && $file != "..") {
                 //search for spare file module
                 if (preg_match("#.\\." . $suffix . "\\.php#i", $file)) {
                     $mod_file = $search_dir . '/' . $file;
                     $ret[] = $mod_file;
                 } else {
                     $mod_file = $search_dir . '/' . $file . '/' . $file . '.' . $suffix . '.php';
                     if (is_file($mod_file)) {
                         $ret[] = $mod_file;
                     }
                 }
             }
         }
         closedir($handle);
     } else {
         xLog::log('Framework', LOG_LEVEL_ERROR, 'Invalid search directory for modules. Dump: ' . var_export($full_search_dir, true), __FILE__, __LINE__);
     }
     return $ret;
 }
コード例 #3
0
 /**
  * @access private
  */
 function _generateOrderClause($order, &$values)
 {
     $out = '';
     $first = true;
     foreach ($order as $clause) {
         if (isset($clause['column'])) {
             if (!$first) {
                 $out .= ',';
             } else {
                 $first = false;
             }
             if (strcasecmp($clause['direction'], 'asc') !== 0 && strcasecmp($clause['direction'], 'desc') !== 0) {
                 xLog::log('Database', LOG_LEVEL_ERROR, 'Invalid direction for ORDER clause: "' . $clause['direction'] . '"', __FILE__, __LINE__);
             } else {
                 $out .= '%s ' . $clause['direction'];
                 $values[] = $clause['column'];
             }
         }
     }
     if (!empty($out)) {
         $out = ' ORDER BY ' . $out;
     }
     return $out;
 }
コード例 #4
0
 /**
  * 
  */
 function _getCurrent()
 {
     if (isset($_GET['p'])) {
         $p = $_GET['p'];
         $path = xPath::_parse($p);
         if ($path !== NULL) {
             $path->m_params = $_GET;
             unset($path->m_params['p']);
             return $path;
         } else {
             xLog::log('Framework', LOG_LEVEL_WARNING, 'Invalid path', __FILE__, __LINE__);
         }
     }
     $path = new xPath(NULL, NULL, NULL);
     return $path;
 }
コード例 #5
0
/**
 * Callback function that log errors,warnigs,and notices. Note that in xanthine this is called only from code where core.php.inc is not included
 * and from unsuppressed php error, for other needs use xanth_log instead.
 */
function xanth_php_error_handler($errno, $message, $filename, $line)
{
    if ($errno == E_USER_ERROR) {
        xLog::log('PHP', LOG_LEVEL_ERROR, $message, $filename, $line);
    } elseif ($errno == E_USER_WARNING || $errno == E_WARNING || $errno == E_NOTICE) {
        xLog::log('PHP', LOG_LEVEL_WARNING, $message, $filename, $line);
    } elseif ($errno == E_USER_NOTICE) {
        xLog::log('PHP', LOG_LEVEL_NOTICE, $message, $filename, $line);
    }
}