[ Index ]
 

Code source de CMS made simple 1.0.5

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

title

Body

[fermer]

/admin/ -> listcss.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  #$Id: listcss.php 3701 2007-01-02 04:45:26Z elijahlofgren $
  20  
  21  /**
  22   * This page is in charge of listing all CSS, and giving acces to editing and
  23   * deleting.
  24   *
  25   * There is no particular argument.
  26   *
  27   * @since    0.6
  28   * @author    calexico
  29   */
  30  
  31  
  32  
  33  $CMS_ADMIN_PAGE=1;
  34  
  35  require_once ("../include.php");
  36  
  37  check_login();
  38  
  39  include_once ("header.php");
  40  global $gCms;
  41  $db =& $gCms->GetDb();
  42  
  43  #******************************************************************************
  44  # first : displaying error message, if any.
  45  #******************************************************************************
  46  if (isset($_GET["message"])) {
  47      $message = preg_replace('/\</','',$_GET['message']);
  48      echo '<div class="pagemcontainer"><p class="pagemessage">'.$message.'</p></div>';
  49  }
  50  
  51  ?>
  52  <form action="multistylesheet.php" method="post">
  53  
  54  <div class="pagecontainer">
  55      <div class="pageoverflow">
  56  <?php
  57  
  58  #******************************************************************************
  59  # first getting all permission : we only display elements the user has access
  60  # too
  61  #******************************************************************************
  62      $userid = get_userid();
  63  
  64      $modify = check_permission($userid, 'Modify Stylesheets');
  65      $addcss = check_permission($userid, 'Add Stylesheets');
  66      $delcss = check_permission($userid, 'Remove Stylesheets');
  67  
  68      $query = "SELECT * FROM ".cms_db_prefix()."css ORDER BY css_name";
  69      $result = $db->Execute($query);
  70  
  71      $page = 1;
  72      if (isset($_GET['page'])) $page = $_GET['page'];
  73      $limit = 20;
  74      if ($result->RecordCount() > $limit)
  75      {
  76          echo "<p class=\"pageshowrows\">".pagination($page, $result->RecordCount(), $limit)."</p>";
  77      }
  78      echo $themeObject->ShowHeader('liststylesheets').'</div>';
  79      if ($result && $result->RecordCount() > 0)
  80      {
  81          # displaying the table header
  82          echo "<table cellspacing=\"0\" class=\"pagetable\">\n";
  83          echo '<thead>';
  84          echo "<tr>\n";
  85          echo "<th>".lang('title')."</th>\n";
  86          echo "<th class=\"pageicon\">&nbsp;</th>\n";
  87          echo "<th class=\"pageicon\">&nbsp;</th>\n";
  88          echo "<th class=\"pageicon\">&nbsp;</th>\n";
  89          echo "<th class=\"pageicon\">&nbsp;</th>\n";
  90          echo "<th class=\"pageicon\">&nbsp;</th>\n";
  91          echo "</tr>\n";
  92          echo '</thead>';
  93          echo '<tbody>';
  94  
  95          # this var is used to show each line with different color
  96          $currow = "row1";
  97  
  98          # we now show each line
  99          $counter = 0;
 100          while ($one = $result->FetchRow()){
 101              if ($counter < $page*$limit && $counter >= ($page*$limit)-$limit) {
 102                  echo "<tr class=\"$currow\" onmouseover=\"this.className='".$currow.'hover'."';\" onmouseout=\"this.className='".$currow."';\">\n";
 103                  echo "<td><a href=\"editcss.php?css_id=".$one["css_id"]."\">".$one["css_name"]."</a></td>\n";
 104                  echo "<td class=\"icons_wide\"><a href=\"templatecss.php?id=".$one["css_id"]."&amp;type=template\">";
 105                  echo $themeObject->DisplayImage('icons/system/css.gif', lang('attachtotemplate'),'','','systemicon');
 106                  echo "</a></td>\n";
 107  
 108                  # if user has right to add (copy)
 109                  if ($addcss)
 110                  {
 111                      echo '<td class="icons_wide"><a href="copystylesheet.php?stylesheet_id=' . $one['css_id'] . '&amp;stylesheet_name=' . urlencode($one['css_name']) . '">';
 112                      echo $themeObject->DisplayImage('icons/system/copy.gif', lang('copy'),'','','systemicon');
 113                      echo "</a></td>\n";
 114                  }
 115                  else
 116                  {
 117                      echo "<td>&nbsp;</td>";
 118                  }
 119  
 120                  # if user has right to edit
 121                  if ($modify)
 122                  {
 123                      echo "<td class=\"icons_wide\"><a href=\"editcss.php?css_id=".$one["css_id"]."\">";
 124                      echo $themeObject->DisplayImage('icons/system/edit.gif', lang('edit'),'','','systemicon');
 125                      echo "</a></td>\n";
 126                  }
 127                  else
 128                  {
 129                      echo "<td>&nbsp;</td>";
 130                  }
 131  
 132                  # if user has right to delete
 133                  if ($delcss)
 134                  {
 135                      echo "<td class=\"icons_wide\"><a href=\"deletecss.php?css_id=".$one["css_id"]."\" onclick=\"return confirm('".lang('deleteconfirm')."');\">";
 136                      echo $themeObject->DisplayImage('icons/system/delete.gif', lang('delete'),'','','systemicon');
 137                      echo "</a></td>\n";
 138                  }
 139                  else
 140                  {
 141                      echo "<td>&nbsp;</td>";
 142                  }
 143                  echo '<td><input type="checkbox" name="multistylesheet-'.$one['css_id'].'" /></td>';
 144                  echo "</tr>\n";
 145  
 146                  ("row1" == $currow) ? $currow="row2" : $currow="row1";
 147              }
 148              $counter++;
 149          } ## foreach
 150  
 151          echo '</tbody>';
 152          echo "</table>\n";
 153  
 154      } # end if result
 155  
 156      # if user can add css
 157      if ($addcss)
 158      {
 159  ?>
 160      <div class="pageoptions">
 161          <p class="pageoptions">
 162              <span style="float: left;">
 163                  <a href="addcontent.php">
 164                      <?php 
 165                          echo $themeObject->DisplayImage('icons/system/newobject.gif', lang('addstylesheet'),'','','systemicon').'</a>';
 166                          echo ' <a class="pageoptions" href="addcss.php">'.lang("addstylesheet");
 167                      ?>
 168                  </a>
 169              </span>
 170              <span style="margin-right: 30px; float: right; text-align: right">
 171                  <?php echo lang("selecteditems"); ?>: <select name="multiaction">
 172                  <option value="delete"><?php echo lang('delete') ?></option>
 173                  <!--
 174                  <option value="active"><?php echo lang('active') ?></option>
 175                  <option value="inactive"><?php echo lang('inactive') ?></option>
 176                  -->
 177                  </select>
 178                  <input type="submit" value="<?php echo lang('submit') ?>" />
 179              </span>
 180              <br />
 181          </p>
 182      </div>
 183  </div>
 184  
 185  </form>
 186  <p class="pageback"><a class="pageback" href="<?php echo $themeObject->BackUrl(); ?>">&#171; <?php echo lang('back')?></a></p>
 187  
 188  <?php
 189      } # end if add css
 190  
 191  
 192  include_once ("footer.php");
 193  
 194  # vim:ts=4 sw=4 noet
 195  ?>


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