[ Index ]
 

Code source de XOOPS 2.0.17.1

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/htdocs/modules/system/admin/blocksadmin/ -> main.php (source)

   1  <?php
   2  // $Id: main.php 2 2005-11-02 18:23:29Z skalpa $

   3  //  ------------------------------------------------------------------------ //

   4  //                XOOPS - PHP Content Management System                      //

   5  //                    Copyright (c) 2000 XOOPS.org                           //

   6  //                       <http://www.xoops.org/>                             //

   7  //  ------------------------------------------------------------------------ //

   8  //  This program is free software; you can redistribute it and/or modify     //

   9  //  it under the terms of the GNU General Public License as published by     //

  10  //  the Free Software Foundation; either version 2 of the License, or        //

  11  //  (at your option) any later version.                                      //

  12  //                                                                           //

  13  //  You may not change or alter any portion of this comment or credits       //

  14  //  of supporting developers from this source code or any supporting         //

  15  //  source code which is considered copyrighted (c) material of the          //

  16  //  original comment or credit authors.                                      //

  17  //                                                                           //

  18  //  This program is distributed in the hope that it will be useful,          //

  19  //  but WITHOUT ANY WARRANTY; without even the implied warranty of           //

  20  //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //

  21  //  GNU General Public License for more details.                             //

  22  //                                                                           //

  23  //  You should have received a copy of the GNU General Public License        //

  24  //  along with this program; if not, write to the Free Software              //

  25  //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //

  26  //  ------------------------------------------------------------------------ //

  27  // Author: Kazumi Ono (AKA onokazu)                                          //

  28  // URL: http://www.myweb.ne.jp/, http://www.xoops.org/, http://jp.xoops.org/ //

  29  // Project: The XOOPS Project                                                //

  30  // ------------------------------------------------------------------------- //

  31  
  32  if ( !is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid()) ) {
  33      exit("Access Denied");
  34  }
  35  include_once  XOOPS_ROOT_PATH.'/class/xoopsblock.php';
  36  include XOOPS_ROOT_PATH."/modules/system/admin/blocksadmin/blocksadmin.php";
  37  
  38  $op = "list";
  39  if ( isset($_POST) ) {
  40      foreach ( $_POST as $k => $v ) {
  41          $$k = $v;
  42      }
  43  }
  44  
  45  if ( isset($_GET['op']) ) {
  46      if ($_GET['op'] == "edit" || $_GET['op'] == "delete" || $_GET['op'] == "delete_ok" || $_GET['op'] == "clone") {
  47          $op = $_GET['op'];
  48          $bid = isset($_GET['bid']) ? intval($_GET['bid']) : 0;
  49      }
  50  }
  51  
  52  if (isset($previewblock)) {
  53      if (!$GLOBALS['xoopsSecurity']->check()) {
  54          redirect_header("admin.php?fct=blocksadmin", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
  55          exit();
  56      }
  57      xoops_cp_header();
  58      include_once  XOOPS_ROOT_PATH.'/class/template.php';
  59      $xoopsTpl = new XoopsTpl();
  60      $xoopsTpl->xoops_setCaching(0);
  61      if (isset($bid)) {
  62          $block['bid'] = $bid;
  63          $block['form_title'] = _AM_EDITBLOCK;
  64          $myblock = new XoopsBlock($bid);
  65          $block['name'] = $myblock->getVar('name');
  66      } else {
  67          if ($op == 'save') {
  68              $block['form_title'] = _AM_ADDBLOCK;
  69          } else {
  70              $block['form_title'] = _AM_CLONEBLOCK;
  71          }
  72          $myblock = new XoopsBlock();
  73          $myblock->setVar('block_type', 'C');
  74      }
  75      $myts =& MyTextSanitizer::getInstance();
  76      $myblock->setVar('title', $myts->stripSlashesGPC($btitle));
  77      $myblock->setVar('content', $myts->stripSlashesGPC($bcontent));
  78      $dummyhtml = '<html><head><meta http-equiv="content-type" content="text/html; charset='._CHARSET.'" /><meta http-equiv="content-language" content="'._LANGCODE.'" /><title>'.$xoopsConfig['sitename'].'</title><link rel="stylesheet" type="text/css" media="all" href="'.getcss($xoopsConfig['theme_set']).'" /></head><body><table><tr><th>'.$myblock->getVar('title').'</th></tr><tr><td>'.$myblock->getContent('S', $bctype).'</td></tr></table></body></html>';
  79  
  80      $block['edit_form'] = false;
  81      $block['template'] = '';
  82      $block['op'] = $op;
  83      $block['side'] = $bside;
  84      $block['weight'] = $bweight;
  85      $block['visible'] = $bvisible;
  86      $block['title'] = $myblock->getVar('title', 'E');
  87      $block['content'] = $myblock->getVar('content', 'E');
  88      $block['modules'] =& $bmodule;
  89      $block['ctype'] = isset($bctype) ? $bctype : $myblock->getVar('c_type');
  90      $block['is_custom'] = true;
  91      $block['cachetime'] = intval($bcachetime);
  92      echo '<a href="admin.php?fct=blocksadmin">'. _AM_BADMIN .'</a>&nbsp;<span style="font-weight:bold;">&raquo;&raquo;</span>&nbsp;'.$block['form_title'].'<br /><br />';
  93      include XOOPS_ROOT_PATH.'/modules/system/admin/blocksadmin/blockform.php';
  94      $form->display();
  95      xoops_cp_footer();
  96      echo '<script type="text/javascript">
  97      <!--//
  98      win = openWithSelfMain("", "popup", 250, 200, true);
  99      win.document.clear();
 100      ';
 101      $lines = preg_split("/(\r\n|\r|\n)( *)/", $dummyhtml);
 102      foreach ($lines as $line) {
 103          echo 'win.document.writeln("'.str_replace('"', '\"', $line).'");';
 104      }
 105      echo '
 106      win.focus();
 107      win.document.close();
 108      //-->

 109      </script>';
 110      exit();
 111  }
 112  
 113  if ( $op == "list" ) {
 114      xoops_cp_header();
 115      list_blocks();
 116      xoops_cp_footer();
 117      exit();
 118  }
 119  
 120  if ( $op == "order" ) {
 121      if (!$GLOBALS['xoopsSecurity']->check()) {
 122          redirect_header("admin.php?fct=blocksadmin", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
 123          exit();
 124      }
 125      foreach (array_keys($bid) as $i) {
 126          if ( $oldweight[$i] != $weight[$i] || $oldvisible[$i] != $visible[$i] || $oldside[$i] != $side[$i] )
 127          order_block($bid[$i], $weight[$i], $visible[$i], $side[$i]);
 128      }
 129      redirect_header("admin.php?fct=blocksadmin",1,_AM_DBUPDATED);
 130      exit();
 131  }
 132  
 133  if ( $op == "save" ) {
 134      if (!$GLOBALS['xoopsSecurity']->check()) {
 135          redirect_header("admin.php?fct=blocksadmin", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
 136          exit();
 137      }
 138      save_block($bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bmodule, $bcachetime);
 139      exit();
 140  }
 141  
 142  if ( $op == "update" ) {
 143      if (!$GLOBALS['xoopsSecurity']->check()) {
 144          redirect_header("admin.php?fct=blocksadmin", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
 145          exit();
 146      }
 147      $bcachetime = isset($bcachetime) ? intval($bcachetime) : 0;
 148      $options = isset($options) ? $options : array();
 149      $bcontent = isset($bcontent) ? $bcontent : '';
 150      $bctype = isset($bctype) ? $bctype : '';
 151      update_block($bid, $bside, $bweight, $bvisible, $btitle, $bcontent, $bctype, $bcachetime, $bmodule, $options);
 152  }
 153  
 154  
 155  if ( $op == "delete_ok" ) {
 156      if (!$GLOBALS['xoopsSecurity']->check()) {
 157          redirect_header("admin.php?fct=blocksadmin", 3, implode('<br />', $GLOBALS['xoopsSecurity']->getErrors()));
 158          exit();
 159      }
 160      delete_block_ok($bid);
 161      exit();
 162  }
 163  
 164  if ( $op == "delete" ) {
 165      xoops_cp_header();
 166      delete_block($bid);
 167      xoops_cp_footer();
 168      exit();
 169  }
 170  
 171  if ( $op == "edit" ) {
 172      xoops_cp_header();
 173      edit_block($bid);
 174      xoops_cp_footer();
 175      exit();
 176  }
 177  /*

 178  if ($op == 'clone') {

 179      clone_block($bid);

 180  }

 181  

 182  if ($op == 'clone_ok') {

 183      clone_block_ok($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options);

 184  }

 185  */
 186  ?>


Généré le : Sun Nov 25 11:44:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics