[ 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.last_modified_by.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_last_modified_by($params, &$smarty) 
  20  {
  21          global $gCms;
  22      $pageinfo = $gCms->variables['pageinfo'];
  23  
  24          $id = "";
  25   
  26      if (isset($pageinfo) && $pageinfo->content_last_modified_by_id > -1)
  27      {
  28          $id = $pageinfo->content_last_modified_by_id;
  29      } else {
  30                  return "";
  31          }
  32  
  33      if(empty($params['format']))
  34      {
  35          $format = "id";
  36      }
  37      else
  38      {
  39          $format = $params['format'];
  40          global $gCms;
  41          $userops =& $gCms->GetUserOperations();
  42          $thisuser =& $userops->LoadUserByID($id);
  43      }
  44  
  45  
  46  
  47    if($format==="id") {
  48       return $id;
  49    } else if ($format==="username") {
  50       return htmlentities($thisuser->username);
  51    } else if ($format==="fullname") {
  52       return htmlentities($thisuser->firstname ." ". $thisuser->lastname);
  53    } else {
  54       return "";
  55    }
  56  }
  57  
  58  function smarty_cms_help_function_last_modified_by()
  59  {
  60          ?>
  61          <h3>What does this do?</h3>
  62          <p>Prints last person that edited this page.  If no format is given, it will default to a ID number of user .</p>
  63          <h3>How do I use it?</h3>
  64          <p>Just insert the tag into your template/page like: <code>{last_modified_by format="fullname"}</code></p>
  65          <h3>What parameters does it take?</h3>
  66          <ul>
  67                  <li><em>(optional)</em>format - id, username, fullname</li>
  68          </ul>
  69          <?php
  70  }
  71  
  72  function smarty_cms_about_function_last_modified_by() {
  73      ?>
  74      <p>Author: Ted Kulp&lt;tedkulp@users.sf.net&gt;</p>
  75      <p>Version: 1.0</p>
  76      <p>
  77      Change History:<br/>
  78      </p>
  79      <?php
  80  }
  81  ?>


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