[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/plugins/ -> function.cms_module.php (source)

   1  <?php
   2  #CMS - CMS Made Simple
   3  #(c)2004 by Ted Kulp (wishy@users.sf.net)
   4  #This project's homepage is: http://cmsmadesimple.sf.net
   5  #
   6  #This program is free software; you can redistribute it and/or modify
   7  #it under the terms of the GNU General Public License as published by
   8  #the Free Software Foundation; either version 2 of the License, or
   9  #(at your option) any later version.
  10  #
  11  #This program is distributed in the hope that it will be useful,
  12  #but WITHOUT ANY WARRANTY; without even the implied warranty of
  13  #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14  #GNU General Public License for more details.
  15  #You should have received a copy of the GNU General Public License
  16  #along with this program; if not, write to the Free Software
  17  #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  18  
  19  function smarty_cms_function_cms_module($params, &$smarty)
  20  {
  21      global $gCms;
  22      $cmsmodules = &$gCms->modules;
  23  
  24      $id = 'm' . ++$gCms->variables["modulenum"];
  25      $params = array_merge($params, GetModuleParameters($id));
  26  
  27      $modulename = '';
  28      $action = 'default';
  29      $inline = false;
  30  
  31      $checkid = '';
  32  
  33      if (isset($params['module'])) $modulename = $params['module'];
  34      if (isset($_REQUEST['id'])) //Not really needed now...
  35      {
  36          $checkid = $_REQUEST['id'];
  37      }
  38      else if (isset($_REQUEST['mact']))
  39      {
  40          $ary = explode(',', $_REQUEST['mact'], 4);
  41          $mactmodulename = (isset($ary[0])?$ary[0]:'');
  42          if (strtolower($mactmodulename) == strtolower($params['module']))
  43          {
  44              $checkid = (isset($ary[1])?$ary[1]:'');
  45              $mactaction = (isset($ary[2])?$ary[2]:'');
  46          }
  47          $mactinline = (isset($ary[3]) && $ary[3] == 1?true:false);
  48          if ($checkid == $id)
  49          {
  50              $action = $mactaction;
  51              $inline = $mactinline;
  52          }
  53      }
  54  
  55      #$actioninparams = false;
  56  
  57      #if (isset($_REQUEST[$id.'action']))
  58      #{
  59      #    $action = $_REQUEST[$id.'action'];
  60      #}
  61      #else if (isset($_REQUEST['action']))
  62      #{
  63      #    $action = $_REQUEST['action'];
  64      #}
  65      if (isset($params['action']) && $params['action'] != '')
  66      {
  67          $action = $params['action'];
  68          #$actioninparams = true;
  69      }
  70  
  71      if (isset($cmsmodules))
  72      {
  73          $modulename = $params['module'];
  74  
  75          foreach ($cmsmodules as $key=>$value)
  76          {
  77              if (strtolower($modulename) == strtolower($key))
  78              {
  79                  $modulename = $key;
  80              }
  81          }
  82  
  83          if (isset($modulename))
  84          {
  85              if (isset($cmsmodules[$modulename]))
  86              {
  87                  if (isset($cmsmodules[$modulename]['object'])
  88                      && $cmsmodules[$modulename]['installed'] == true
  89                      && $cmsmodules[$modulename]['active'] == true
  90                      && $cmsmodules[$modulename]['object']->IsPluginModule())
  91                  {
  92                      @ob_start();
  93  
  94                      #if (($inline == false && $actioninparams == false) || $action == '')
  95                      #    $action = 'default';
  96  
  97                      $returnid = '';
  98                      if (isset($gCms->variables['pageinfo']) && isset($gCms->variables['pageinfo']->content_id))
  99                      {
 100                          $returnid = $gCms->variables['pageinfo']->content_id;
 101                      }
 102  
 103                      $result = $cmsmodules[$modulename]['object']->DoActionBase($action, $id, $params, $returnid);
 104                      if ($result !== FALSE)
 105                      {
 106                          echo $result;
 107                      }
 108                      $modresult = @ob_get_contents();
 109                      @ob_end_clean();
 110                      return $modresult;
 111                  }
 112                  else
 113                  {
 114                      return "<!-- Not a tag module -->\n";
 115                  }
 116              }
 117          }
 118      }
 119  }
 120  
 121  function smarty_cms_help_function_cms_module() {
 122      ?>
 123      <h3>What does this do?</h3>
 124      <p>This tag is used to insert modules into your templates and pages.  If a module is created to be used as a tag plugin (check it's help for details), then you should be able to insert it with this tag.</p>
 125      <h3>How do I use it?</h3>
 126      <p>It's just a basic tag plugin.  You would insert it into your template or page like so: <code>{cms_module module="somemodulename"}</code>
 127      <h3>What parameters does it take?</h3>
 128      <p>There is only one required parameter.  All other parameters are passed on to the module.
 129      <ul>
 130          <li>module - Name of the module to insert.  This is not case sensitive.</li>
 131      </ul>
 132      </p>
 133      <?php
 134  }
 135  
 136  function smarty_cms_about_function_cms_module() {
 137      ?>
 138      <p>Author: Ted Kulp&lt;tedkulp@users.sf.net&gt;</p>
 139      <p>Version: 1.0</p>
 140      <p>
 141      Change History:<br/>
 142      None
 143      </p>
 144      <?php
 145  }
 146  
 147  
 148  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7