kernel
[ class tree: kernel ] [ index: kernel ] [ all elements ]

Source for file modules_inc.php

Documentation is available at modules_inc.php

  1. <?php
  2. /**
  3.  * @version $Header: /cvsroot/bitweaver/_bit_kernel/modules_inc.php,v 1.10 2006/12/02 17:13:00 spiderr Exp $
  4.  * @package kernel
  5.  * @subpackage functions
  6.  */
  7.  
  8. // $Header: /cvsroot/bitweaver/_bit_kernel/modules_inc.php,v 1.10 2006/12/02 17:13:00 spiderr Exp $
  9. // Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
  10. // All Rights Reserved. See copyright.txt for details and a complete list of authors.
  11. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
  12.  
  13.  
  14.  
  15. global $gBitSmarty$gBitSystem$gBitThemes$gBitUser;
  16.  
  17. $now $gBitSystem->getUTCTime();
  18.  
  19. /* this doesn't seem to used anywhere - xing
  20. if (!$gBitUser->isAdmin() ) {
  21.     $user_groups = $gBitUser->getGroups();
  22. } else {
  23.     $listHash = array( 'sort_mode' => 'group_name_desc' );
  24.     $allgroups = $gBitUser->getAllGroups( $listHash );
  25.  
  26.     $user_groups = array();
  27.  
  28.     foreach ($allgroups["data"] as $grp) {
  29.         $user_groups[] = $grp["group_name"];
  30.     }
  31. }
  32. */
  33.  
  34. global $module_column$gHideModules;
  35. if$gBitSystem->mLayout && empty$gHideModules ) ) {
  36.     foreacharray_keys$gBitSystem->mLayout as $column {
  37.         if ($column != 'c'{    // We don't need to pre-fetch center columns
  38.             $module_column $column;
  39.             for ($i 0$i count$gBitSystem->mLayout[$column)$i++{
  40.                 $r &$gBitSystem->mLayout[$column][$i];
  41.                 if!empty$r['visible') ) {
  42.                     list$package$template split(  '/'$r['module_rsrc');
  43.                     if$package == '_custom:custom' {
  44.                         global $gBitLanguage;
  45.                         //print("Es user module");
  46. // We're gonna run our own cache mechanism for user_modules
  47.                         // the cache is here to avoid calls to consumming queries,
  48.                         // each module is different for each language because of the strings
  49.                         
  50.                         $cacheDir TEMP_PKG_PATH.'modules/cache/';
  51.                         if!is_dir$cacheDir ) ) {
  52.                             mkdir_p$cacheDir );
  53.                         }
  54.                         $cachefile $cacheDir.'_custom.'.$gBitLanguage->mLanguage.'.'.$template.'.tpl.cache';
  55.                         iffile_exists$cachefile && !( ($now filemtime($cachefile)) $r["cache_time"]) ) {
  56.                             //print("Usando cache<br/>");
  57.                             $fp fopen($cachefile"r");
  58.                             $data fread($fpfilesize($cachefile));
  59.                             fclose ($fp);
  60.                             $r["data"$data;
  61.                         else {
  62.                             if$info $gBitThemes->getCustomModule$template ) ) {
  63.                                 // Ahora usar el template de user
  64.                                 $gBitSmarty->assign_by_ref('user_title'$info["title"]);
  65.                                 $gBitSmarty->assign_by_ref('user_data'$info["data"]);
  66.                                 $gBitSmarty->assign_by_ref('user_module_name'$info["name"]);
  67.                                 $data $gBitSmarty->fetch'bitpackage:themes/custom_module.tpl' );
  68.                                 $fp fopen($cachefile"w+");
  69.                                 fwrite($fp$datastrlen($data));
  70.                                 fclose ($fp);
  71.                                 $r["data"$data;
  72.                             }
  73.                         }
  74.                     else {
  75.                         list$rsrc_type$package split(  ':'$package );
  76.                         //print("Cache: $cachefile PHP: $phpfile Template: $template<br/>");
  77.                         if!$r['module_rows'{
  78.                             $r['module_rows'10;
  79.                         }
  80.                         global $module_rows$module_params$module_title;
  81.                         $gBitSmarty->assign_by_ref'module_rows'$module_rows $r['module_rows');
  82.                         ifstrpostrim$r['params')' ' ) ) {
  83.                             $module_params parse_xml_attributes$r['params');
  84.                         else {
  85.                             parse_str$r["params"]$module_params );
  86.                         }
  87.                         $module_title isset$r['title'tra$r['title'isset$module_params['title'$module_params['title'NULL ) );
  88.                         $pattern[0"/.*\/mod_(.*)\.tpl/";
  89.                         $replace[0"$1";
  90.                         $pattern[1"/_/";
  91.                         $replace[1" ";
  92.                         $gBitSmarty->assign'moduleTitle'isset$module_title tra$module_title traucfirstpreg_replace$pattern$replace$r['module_rsrc') ) ) ) );
  93.                         $gBitSmarty->assign_by_ref'module_rows'$r['module_rows');
  94.                         $gBitSmarty->assign_by_ref'module_id'$r["module_id");
  95.                         $gBitSmarty->assign_by_ref'module_layout'$r["layout");
  96.                         $colkey ($column == 'r''right' 'left';
  97.                         $gBitSmarty->assign_by_ref'colkey'$colkey);
  98.                         $r['data'$gBitSmarty->fetch$r['module_rsrc');
  99.                         unset$module_rows );
  100.                     }
  101.                 }
  102.                 unset$data );
  103.             }
  104.             $gBitSmarty->assign_by_ref$column.'_modules'$gBitSystem->mLayout[$column);
  105.         }
  106.     }
  107. }
  108. ?>

Documentation generated on Thu, 15 Feb 2007 20:45:03 +0000 by phpDocumentor 1.3.0