[ Index ]
 

Code source de CMS made simple 1.0.5

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

title

Body

[fermer]

/admin/ -> copystylesheet.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: copystylesheet.php 3365 2006-08-22 16:58:26Z wishy $
  20  
  21  $CMS_ADMIN_PAGE=1;
  22  
  23  require_once ("../include.php");
  24  
  25  check_login();
  26  
  27  $error = "";
  28  
  29  $stylesheet = "";
  30  if (isset($_POST["stylesheet"])) $stylesheet = $_POST["stylesheet"];
  31  
  32  $stylesheet_id = -1;
  33  if (isset($_POST["stylesheet_id"])) $stylesheet_id = $_POST["stylesheet_id"];
  34  else if (isset($_GET["stylesheet_id"])) $stylesheet_id = $_GET["stylesheet_id"];
  35  
  36  $stylesheet_name = '';
  37  if (isset($_REQUEST["stylesheet_name"])) { $stylesheet_name = $_REQUEST["stylesheet_name"]; }
  38  
  39  if (isset($_POST["cancel"]))
  40  {
  41      redirect("listcss.php");
  42      return;
  43  }
  44  
  45  $userid = get_userid();
  46  $access = check_permission($userid, 'Add Stylesheets');
  47  
  48  if ($access)
  49  {
  50      if (isset($_POST["copystylesheet"]))
  51      {
  52          global $gCms;
  53          $styleops =& $gCms->GetStylesheetOperations();
  54          $validinfo = true;
  55          if ($stylesheet == "")
  56          {
  57              $error .= "<li>".lang('nofieldgiven',array(lang('name')))."</li>";
  58              $validinfo = false;
  59          }
  60          else
  61          {
  62              if ($styleops->CheckExistingStylesheetName($stylesheet))
  63              {
  64                  $error .= "<li>".lang('stylesheetexists')."</li>";
  65                  $validinfo = false;
  66              }
  67          }
  68  
  69          if ($validinfo)
  70          {
  71              $onestylesheet = $styleops->LoadStylesheetByID($stylesheet_id);
  72              $onestylesheet->id = -1; //Reset id so it will insert a new record
  73              $onestylesheet->name = $stylesheet; //Change name
  74              $result = $onestylesheet->Save();
  75  
  76              if ($result)
  77              {
  78                  audit($onestylesheet->id, $onestylesheet->name, 'Copied Stylesheet');
  79                  redirect("listcss.php");
  80                  return;
  81              }
  82              else
  83              {
  84                  $error .= "<li>".lang('errorcopyingstylesheet')."</li>";
  85              }
  86          }
  87  
  88      }
  89  }
  90  
  91  include_once ("header.php");
  92  
  93  if (!$access)
  94  {
  95      echo "<div class=\"pageerrorcontainer\"><p class=\"pageerror\">".lang('noaccessto',array(lang('copystylesheet')))."</p></div>";
  96  }
  97  else
  98  {
  99      if ($error != "")
 100      {
 101          echo "<div class=\"pageerrorcontainer\"><ul class=\"pageerror\">".$error."</ul></div>";        
 102      }
 103  
 104  ?>
 105  
 106  
 107  <div class="pagecontainer">
 108      <p class="pageheader"><?php echo lang('copystylesheet')?></p>
 109      <form method="post" action="copystylesheet.php">
 110          <div class="pageoverflow">
 111              <p class="pagetext"><?php echo lang('stylesheet'); ?>:</p>
 112              <p class="pageinput"><?php echo $stylesheet_name; ?></p>
 113          </div>
 114          <div class="pageoverflow">
 115              <p class="pagetext"><?php echo lang('newstylesheetname'); ?>:</p>
 116              <p class="pageinput"><input type="text" name="stylesheet" maxlength="255" value="<?php echo $stylesheet?>"></p>
 117          </div>
 118          <div class="pageoverflow">
 119              <p class="pagetext">&nbsp;</p>
 120              <p class="pageinput">
 121                  <input type="hidden" name="stylesheet_id" value="<?php echo $stylesheet_id?>" /><input type="hidden" name="copystylesheet" value="true" />
 122                  <input type="submit" value="<?php echo lang('submit')?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" />
 123                  <input type="submit" name="cancel" value="<?php echo lang('cancel')?>" class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" />
 124              </p>
 125          </div>
 126      </form>
 127  </div>
 128  
 129  <?php
 130  
 131  }
 132  
 133  echo '<p class="pageback"><a class="pageback" href="listcss.php">&#171; '.lang('back').'</a></p>';
 134  
 135  include_once ("footer.php");
 136  
 137  # vim:ts=4 sw=4 noet
 138  ?>


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