[ Index ]
 

Code source de CMS made simple 1.0.5

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

title

Body

[fermer]

/admin/ -> listmodules.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: listmodules.php 3788 2007-02-15 21:26:05Z calguy1000 $
  20  
  21  $CMS_ADMIN_PAGE=1;
  22  $LOAD_ALL_MODULES=1;
  23  
  24  require_once ("../include.php");
  25  
  26  check_login();
  27  
  28  $module = "";
  29  if (isset($_GET["module"])) $module = $_GET["module"];
  30  
  31  $plugin = "";
  32  if (isset($_GET["plugin"])) $plugin = $_GET["plugin"];
  33  
  34  $action = "";
  35  if (isset($_GET["action"])) $action = $_GET["action"];
  36  
  37  $allowoverwritemodules = 0;
  38  if (isset($_POST["allowoverwrite"])) $allowoverwritemodules = $_POST["allowoverwrite"];
  39  
  40  $autoinstallupgrade = 0; // keep this here for a bit, just incase
  41  
  42  $userid = get_userid();
  43  $access = check_permission($userid, "Modify Modules");
  44  
  45  $smarty = new Smarty_CMS($gCms->config);
  46  $db =& $gCms->GetDb();
  47  
  48  //Messagestring (success) for module operations
  49  $modulemessage="";
  50  
  51  include_once ("header.php");
  52  
  53  if ($access)
  54  {
  55      if ($action == "chmod" )
  56      {
  57          $result = chmod_r( $config['root_path'].DIRECTORY_SEPARATOR.
  58          'modules'.DIRECTORY_SEPARATOR.$module, 0777 );
  59          if( !$result )
  60          {
  61              echo $themeObject->ShowErrors(lang('cantchmodfiles'));
  62          }
  63          else
  64          {
  65              redirect("listmodules.php");
  66          }
  67      }
  68  
  69      if ($action == "exportxml")
  70      {
  71          // get our xml
  72          $message = '';
  73          $files = 0;
  74          $modops =& $gCms->GetModuleOperations();
  75          $object = $gCms->modules[$module]['object'];
  76          $xmltxt = $modops->CreateXMLPackage($object,$message,$files);
  77          if( $files == 0 )
  78          {
  79              echo "<p class=\"error\">".lang('errornofilesexported')."</p>";
  80          }
  81          else 
  82          {
  83              $xmlname = $object->GetName().'-'.$object->GetVersion().'.xml';
  84  
  85              // and send the file
  86              ob_end_clean();
  87              header('Content-Description: File Transfer');
  88              header('Content-Type: application/force-download');
  89              header('Content-Disposition: attachment; filename='.$xmlname);
  90              //     header('Content-Type: text/xml');
  91              echo $xmltxt;
  92              exit();
  93          }
  94      }
  95  
  96      if ($action == "importxml" )
  97      {
  98          $fieldName = "browse_xml";
  99          if (!isset ($_FILES[$fieldName]) || !isset ($_FILES)
 100          || !is_array ($_FILES[$fieldName]) || !$_FILES[$fieldName]['name'])
 101          {
 102              echo $themeObject->ShowErrors(lang('noxmlfileuploaded'));
 103          }
 104          else
 105          {
 106              // normalize the file variable
 107              $file = $_FILES[$fieldName];
 108  
 109              // $file['tmp_name'] is the file we have to parse
 110              $xml = file_get_contents( $file['tmp_name'] );
 111  
 112              // and parse it
 113              $modops =& $gCms->GetModuleOperations();
 114              $result = $modops->ExpandXMLPackage( $xml, $allowoverwritemodules );
 115              // at this point, all of the files in that module may have become unusable
 116              // in the current version of cms.
 117              if( !$result )
 118              {
 119                  echo $themeObject->ShowErrors($modops->GetLastError());
 120              }
 121              else if( $autoinstallupgrade == 0 )
 122              {
 123                  // no auto install or upgrade
 124                  redirect("listmodules.php");
 125              }
 126              // note, wishy, when you dig in here next, everything below here
 127              // can probably go.
 128              /*
 129              else if( !isset( $gCms->modules[$result['name']] ) )
 130              {
 131                  // looks like we're installing this module
 132                  redirect("listmodules.php?action=install&module=".$result['name']);
 133              }
 134              else 
 135              { 
 136                  // allow the auto upgrade stuff to do it's thing
 137                  // need new version and old version
 138                  $oldversion = $gCms->modules[$result['name']]['object']->GetVersion();
 139                  $newversion = $result['version'];
 140                  redirect("listmodules.php?action=upgrade&module=".$result['name']."&oldversion=".$oldversion."&newversion=".$newversion);
 141              }
 142              */
 143          }  
 144      }
 145  
 146      if ($action == "install")
 147      {
 148          $modops =& $gCms->GetModuleOperations();
 149          $result = $modops->InstallModule($module,false);
 150          if( $result[0] == false )
 151          {
 152              echo '<div class="pagecontainer">';
 153              echo '<p class="pageheader">'.lang('moduleerrormessage', $module).'</p>';                    
 154              echo $result[1];
 155              echo "</div>";
 156              echo '<p class="pageback"><a class="pageback" href="listmodules.php">&#171; '.lang('back').'</a></p>';
 157              include_once ("footer.php");
 158              exit;
 159          }
 160          else
 161          {
 162              $content = $gCms->modules[$module]['object']->InstallPostMessage();
 163              if( $content != FALSE )
 164              {
 165                  //Redirect right away so that the installed module shows in the menu
 166                  redirect('listmodules.php?action=showpostinstall&module='.$module);
 167              }
 168              // all is good, but no postinstall message
 169              redirect("listmodules.php");
 170          }
 171      }
 172  
 173      if ($action == 'showpostinstall')
 174      {
 175          // this is probably dead code now
 176          if (isset($gCms->modules[$module]))
 177          {
 178              $modinstance = $gCms->modules[$module]['object'];
 179              if ($modinstance->InstallPostMessage() != FALSE)
 180              {
 181                  @ob_start();
 182                  echo $modinstance->InstallPostMessage();
 183                  $content = @ob_get_contents();
 184                  @ob_end_clean();
 185                  echo $themeObject->ShowMessage($content);
 186              }
 187          }
 188      }
 189  
 190      if ($action == 'remove')
 191      {
 192          $result = recursive_delete( $config['root_path'].DIRECTORY_SEPARATOR.
 193          'modules'.DIRECTORY_SEPARATOR.$module );
 194          if( !$result )
 195          {
 196              echo '<div class="pagecontainer">';
 197              echo '<p class="pageheader">'.lang('moduleerrormessage', array($module)).'</p>';                    
 198              echo lang('cantremovefiles');
 199              echo "</div>";
 200              echo '<p class="pageback"><a class="pageback" href="listmodules.php">&#171; '.lang('back').'</a></p>';
 201              include_once ("footer.php");
 202          }
 203          else
 204          {
 205              redirect("listmodules.php");
 206          }
 207      }
 208  
 209      if ($action == 'upgrade')
 210      {
 211          $modops =& $gCms->GetModuleOperations();
 212          $result = $modops->UpgradeModule( $module, $_GET['oldversion'], $_GET['newversion'] );      
 213          if( !$result )
 214          {
 215              @ob_start();
 216              echo $modops->GetLastError();
 217              $content = @ob_get_contents();
 218              @ob_end_clean();
 219              echo $themeObject->ShowErrors(lang('moduleupgradeerror'));
 220          }
 221          redirect("listmodules.php");
 222      }
 223  
 224  
 225      if ($action == "uninstall")
 226      {
 227          if (isset($gCms->modules[$module]))
 228          {
 229              $modinstance = $gCms->modules[$module]['object'];
 230              $result = $modinstance->Uninstall();
 231  
 232              #now insert a record
 233              if (!isset($result) || $result === FALSE)
 234              {
 235                  #now delete the record
 236                  $query = "DELETE FROM ".cms_db_prefix()."modules WHERE module_name = ?";
 237                  $db->Execute($query, array($module));
 238  
 239                  #delete any dependencies
 240                  $query = "DELETE FROM ".cms_db_prefix()."module_deps WHERE child_module = ?";
 241                  $db->Execute($query, array($module));
 242  
 243                  Events::SendEvent('Core', 'ModuleUninstalled', array('name' => $module));
 244  
 245                  #and show the uninstallpost if necessary...
 246                  if ($modinstance->UninstallPostMessage() != FALSE)
 247                  {
 248                      //Redirect right away so that the uninstalled module is removed from the menu
 249                      redirect('listmodules.php?action=showpostuninstall&module='.$module);
 250                  }
 251              }
 252              else
 253              {
 254                  //TODO: Echo error
 255              }
 256          }
 257  
 258          redirect("listmodules.php");
 259      }
 260  
 261      if ($action == 'showpostuninstall')
 262      {
 263          // this is probably dead code now
 264          if (isset($gCms->modules[$module]))
 265          {
 266              $modinstance = $gCms->modules[$module]['object'];
 267              if ($modinstance->UninstallPostMessage() != FALSE)
 268              {
 269                  @ob_start();
 270                  echo $modinstance->UninstallPostMessage();
 271                  $content = @ob_get_contents();
 272                  @ob_end_clean();
 273                  echo $themeObject->ShowMessage($content);
 274              }
 275          }
 276      }
 277  
 278      if ($action == "settrue")
 279      {
 280          $query = "UPDATE ".cms_db_prefix()."modules SET active = ? WHERE module_name = ?";
 281          $db->Execute($query, array(1,$module));
 282          redirect("listmodules.php");
 283      }
 284  
 285      if ($action == "setfalse")
 286      {
 287          $query = "UPDATE ".cms_db_prefix()."modules SET active = ? WHERE module_name = ?";
 288          $db->Execute($query, array(0,$module));
 289          redirect("listmodules.php");
 290      }
 291  }
 292  
 293  if ($action == "showmoduleabout")
 294  {
 295      if (isset($gCms->modules[$module]['object']))
 296      {
 297          echo '<div class="pagecontainer">';
 298          echo '<p class="pageheader">'.lang('moduleabout', array($module)).'</p>';
 299          echo $gCms->modules[$module]['object']->GetAbout();
 300          echo "</div>";
 301      }
 302      echo '<p class="pageback"><a class="pageback" href="listmodules.php">&#171; '.lang('back').'</a></p>';
 303  }
 304  else if ($action == "showmodulehelp")
 305  {
 306      if (isset($gCms->modules[$module]['object']))
 307      {
 308          echo '<div class="pagecontainer">';
 309          // Commented out because of bug #914 and had to use code extra below
 310          // echo $themeObject->ShowHeader(lang('modulehelp', array($module)), '', lang('wikihelp', $module), 'wiki');
 311  
 312          $header  = '<div class="pageheader">';
 313          $header .= lang('modulehelp', array($module));
 314          $wikiUrl = $config['wiki_url'];
 315          $module_name = $gCms->modules[$module]['object']->GetName();
 316          // Turn ModuleName into _Module_Name
 317          $moduleName =  preg_replace('/([A-Z])/', "_$1", $module_name);
 318          $moduleName =  preg_replace('/_([A-Z])_/', "$1", $moduleName);
 319          if ($moduleName{0} == '_')
 320          {
 321              $moduleName = substr($moduleName, 1);
 322          }
 323          // Include English translation of titles. (Can't find better way to get them)
 324          $dirname = dirname(__FILE__);
 325          include ($dirname.'/lang/en_US/admin.inc.php');
 326          $section = $lang['admin'][$gCms->modules[$module]['object']->GetAdminSection()];
 327          $wikiUrl .= '/'.$section.'/'.$moduleName;
 328          if (FALSE == get_preference($userid, 'hide_help_links'))
 329          {
 330              // Clean up URL
 331              $wikiUrl = str_replace(' ', '_', $wikiUrl);
 332              $wikiUrl = str_replace('&amp;', 'and', $wikiUrl);
 333  
 334              $help_title = lang('help_external');
 335  
 336              $image_help = $themeObject->DisplayImage('icons/system/info.gif', lang('help'),'','','systemicon');
 337              $image_help_external = $themeObject->DisplayImage('icons/system/info-external.gif', lang('help'),'','','systemicon');        
 338              $header .= '<span class="helptext"><a href="'.$wikiUrl.'" target="_blank">'.$image_help_external.'</a> <a href="'.$wikiUrl.'" target="_blank">'.lang('help').'</a> ('.lang('new_window').')</span>';
 339          }
 340  
 341          $header .= '</div>';
 342          echo $header;     
 343  
 344          echo $gCms->modules[$module]['object']->GetHelpPage();
 345          echo "</div>";
 346      }
 347  
 348      echo '<p class="pageback"><a class="pageback" href="listmodules.php">&#171; '.lang('back').'</a></p>';
 349  }
 350  else if ($action == 'missingdeps')
 351  {
 352      echo '<div class="pagecontainer">';
 353      echo '<p class="pageheader">'.lang('depsformodule', array($module)).'</p>';
 354      echo '<table cellspacing="0" class="AdminTable">';
 355      echo '<thead>';
 356      echo '<tr><th>'.lang('name').'</th><th>'.lang('minimumversion').'</th><th>'.lang('installed').'</th></tr>';
 357      echo '</thead>';
 358      echo '<tbody>';
 359  
 360      if (isset($gCms->modules[$module]))
 361      {
 362          $modinstance = $gCms->modules[$module]['object'];
 363          if (count($modinstance->GetDependencies()) > 0) #Check for any deps
 364          {
 365              $curclass = 'row1';
 366              #Now check to see if we can satisfy any deps
 367              debug_buffer($modinstance->GetDependencies(), 'deps in module');
 368              foreach ($modinstance->GetDependencies() as $onedepkey=>$onedepvalue)
 369              {
 370                  echo '<tr class="'.$curclass.'"><td>'.$onedepkey.'</td><td>'.$onedepvalue.'</td><td>';
 371  
 372                  $havedep = false;
 373  
 374                  if (isset($gCms->modules[$onedepkey]) && 
 375                  $gCms->modules[$onedepkey]['installed'] == true &&
 376                  $gCms->modules[$onedepkey]['active'] == true &&
 377                  version_compare($gCms->modules[$onedepkey]['object']->GetVersion(), $onedepvalue) > -1)
 378                  {
 379                      $havedep = true;
 380                  }
 381  
 382                  echo lang(($havedep?'true':'false'));
 383                  echo '</td></tr>';
 384                  ($curclass=="row1"?$curclass="row2":$curclass="row1");
 385              }
 386          }
 387      }
 388  
 389      echo '</tbody>';
 390      echo '</table>';
 391      echo '</div>';
 392      echo '<p class="pageback"><a class="pageback" href="listmodules.php">&#171; '.lang('back').'</a></p>';
 393  }
 394  else
 395  {
 396  
 397      if ($action != "" && !$access) {
 398          echo "<p class=\"error\">".lang('needpermissionto', array('Modify Modules'))."</p>";
 399      }
 400  
 401      if (count($gCms->modules) > 0) {
 402  
 403          $query = "SELECT * from ".cms_db_prefix()."modules";
 404          $result = $db->Execute($query);
 405          while ($result && $row = $result->FetchRow()) {
 406              $dbm[$row['module_name']]['Status'] = $row['status'];
 407              $dbm[$row['module_name']]['Version'] = $row['version'];
 408              $dbm[$row['module_name']]['Active'] = ($row['active'] == 1?true:false);
 409          }
 410  
 411          ?>
 412  
 413          <div class="pagecontainer">
 414          <div class="pageoverflow">
 415          <?php
 416  
 417          if (isset($_SESSION['modules_messages']) && count($_SESSION['modules_messages']) > 0)
 418          {
 419              echo '<ul class="messages">';
 420  
 421              // do we need to worry about this for XSS?
 422              foreach ($_SESSION['modules_messages'] as $onemessage)
 423              {
 424                  echo "<li>" . $onemessage . "</li>";
 425              }
 426              echo "</ul>";
 427              unset($_SESSION['modules_messages']);
 428          }
 429  
 430          ?>
 431  
 432          <?php echo $themeObject->ShowHeader('modules').'</div>'; ?>
 433          <table cellspacing="0" class="pagetable">
 434          <thead>
 435          <tr>
 436          <th><?php echo lang('name')?></th>
 437          <th><?php echo lang('version')?></th>
 438          <th><?php echo lang('status')?></th>
 439          <th class="pagepos"><?php echo lang('active')?></th>
 440          <th><?php echo lang('action')?></th>
 441          <th><?php echo lang('help')?></th>
 442          <th><?php echo lang('about')?></th>
 443          <th><?php echo lang('export')?></th>
 444          </tr>
 445          </thead>
 446          <tbody>
 447          <?php
 448  
 449          $curclass = "row1";
 450          // construct true/false button images
 451          $image_true = $themeObject->DisplayImage('icons/system/true.gif', lang('true'),'','','systemicon');
 452          $image_false = $themeObject->DisplayImage('icons/system/false.gif', lang('false'),'','','systemicon');
 453  
 454          foreach($gCms->modules as $key=>$value)
 455          {
 456              $modinstance = $value['object'];
 457              $is_sysmodule = (array_search( $key, $gCms->cmssystemmodules ) !== FALSE);
 458              $namecol = $key;
 459              $versioncol = "&nbsp;";
 460              $statuscol = "&nbsp;";
 461              $statusspans = false;
 462              $actioncol = "&nbsp;";
 463              $activecol = "&nbsp;";
 464              $helpcol = "&nbsp;";
 465              $aboutcol = "&nbsp;";
 466  
 467              $xmlcol = "&nbsp;";
 468  
 469              $xmlcol = '<a href="listmodules.php?action=exportxml&amp;module='.$key.'"><img border="0" src="../images/cms/xml_rss.gif" alt="'.lang('xml').'" /></a>';
 470  
 471              //Is there help?
 472              if ($modinstance->GetHelp() != '')
 473              {
 474                  $namecol = "<a href=\"listmodules.php?action=showmodulehelp&amp;module=".$key."\">".$key."</a>";
 475              }
 476  
 477              // check these modules permissions to see if we can uninstall this thing
 478              $permsok = is_directory_writable( $config['root_path'].DIRECTORY_SEPARATOR.
 479              'modules'.DIRECTORY_SEPARATOR.$key );
 480  
 481              #Make sure it's a valid module for this version of CMSMS
 482              if (version_compare($modinstance->MinimumCMSVersion(), $CMS_VERSION) == 1)
 483              {
 484                  // Fix undefined index error if module is not already installed.
 485                  if (FALSE == empty($dbm[$key]['Version'])) {
 486                      echo "<td>".$dbm[$key]['Version']."</td>";
 487                  }
 488                  $statuscol = '<span class="important">'.lang('minimumversionrequired').': '.$modinstance->MinimumCMSVersion().'</span>';
 489                  $xmlcol = "&nbsp;";
 490                  $statusspans = true;
 491              }
 492              else if (version_compare($modinstance->MaximumCMSVersion(), $CMS_VERSION) == -1)
 493              {
 494                  // Fix undefined index error if module is not already installed.
 495                  if (FALSE == empty($dbm[$key]['Version'])) {
 496                      echo "<td>".$dbm[$key]['Version']."</td>";
 497                  }
 498                  $statuspans = true;
 499                  $xmlcol = "&nbsp;";
 500                  $statuscol  = lang('maximumversionsupported').': '.$modinstance->MaximumCMSVersion();
 501              }
 502              else if (!isset($dbm[$key])) #Not installed, lets put up the install button
 503              {
 504                  $brokendeps = 0;
 505  
 506                  $dependencies = $modinstance->GetDependencies();
 507  
 508                  if (count($dependencies) > 0) #Check for any deps
 509                  {
 510                      #Now check to see if we can satisfy any deps
 511                      foreach ($dependencies as $onedepkey=>$onedepvalue)
 512                      {
 513                          if (!isset($gCms->modules[$onedepkey]) ||
 514                          $gCms->modules[$onedepkey]['installed'] != true ||
 515                          $gCms->modules[$onedepkey]['active'] != true ||
 516                          version_compare($gCms->modules[$onedepkey]['object']->GetVersion(), $onedepvalue) < 0)
 517                          {
 518                              $brokendeps++;
 519                          }
 520                      }
 521                  }
 522  
 523                  $versioncol = $modinstance->GetVersion();
 524                  $statuscol = lang('notinstalled');
 525  
 526                  if ($brokendeps > 0)
 527                  {
 528                      $actioncol = '<a href="listmodules.php?action=missingdeps&amp;module='.$key.'">'.lang('missingdependency').'</a>';
 529                  }
 530                  else
 531                  {
 532                      $actioncol = "<a href=\"listmodules.php?action=install&amp;module=".$key."\">".lang('install')."</a>";
 533                      $xmlcol = '&nbsp;';
 534                  }
 535  
 536                  if( !$is_sysmodule )
 537                  {
 538                      if( $permsok )
 539                      {
 540                          $actioncol .= "<br/><a href=\"listmodules.php?action=remove&amp;module=".$key."\" onclick=\"return confirm('".lang('removeconfirm')."');\">".lang('remove')."</a>";
 541                      }
 542                      else
 543                      {
 544                          $actioncol .= "<br/><a href=\"listmodules.php?action=chmod&amp;module=".$key."\" onclick=\"return confirm('".lang('changepermissionsconfirm')."');\">".lang('changepermissions')."</a>";
 545                      }
 546                  }
 547              }
 548              else if (version_compare($modinstance->GetVersion(), $dbm[$key]['Version']) == 1) #Check for an upgrade
 549              {
 550                  $versioncol = $dbm[$key]['Version'];
 551                  $statuscol  = '<span class="important">'.lang('needupgrade').'</span>';
 552                  $activecol  = ($dbm[$key]['Active']==true?"<a href='listmodules.php?action=setfalse&amp;module=".$key."'>".$image_true."</a>":"<a href='listmodules.php?action=settrue&amp;module=".$key."'>".$image_false."</a>");
 553                  $actioncol  = "<a href=\"listmodules.php?action=upgrade&amp;module=".$key."&amp;oldversion=".$dbm[$key]['Version']."&amp;newversion=".$modinstance->GetVersion()."\" onclick=\"return confirm('".lang('upgradeconfirm')."');\">".lang('upgrade')."</a>";
 554                  $xmlcol = '&nbsp;';
 555              }
 556              else #Must be installed
 557              {
 558                  $versioncol = $dbm[$key]['Version'];
 559                  $statuscol  = lang('installed');
 560                  $actioncol  = "&nbsp;";
 561  
 562                  #Can't be removed if it has a dependency...
 563                  if (!$modinstance->CheckForDependents())
 564                  {
 565                      $activecol = ($dbm[$key]['Active']==true?"<a href='listmodules.php?action=setfalse&amp;module=".$key."'>".$image_true."</a>":"<a href='listmodules.php?action=settrue&amp;module=".$key."'>".$image_false."</a>");
 566                      $actioncol = "<a href=\"listmodules.php?action=uninstall&amp;module=".$key."\" onclick=\"return confirm('".($modinstance->UninstallPreMessage() !== FALSE? cms_utf8entities($modinstance->UninstallPreMessage()):lang('uninstallconfirm').' '.$key)."');\">".lang('uninstall')."</a>";
 567                  }
 568                  else
 569                  {
 570                      // HAS DEPENDENTS ===============
 571                      $result = $db->Execute("SELECT child_module from
 572                      ".cms_db_prefix()."module_deps WHERE parent_module='$key'");
 573  
 574                      $dependentof = array();;
 575                      while ($result && $row = $result->FetchRow()) {
 576                          $dependentof[$row['child_module']] = "";
 577                      }
 578                      $str = implode(array_keys($dependentof),",");
 579                      $activecol = ($dbm[$key]['Active']==true?$image_true:"<a href='listmodules.php?action=settrue&amp;module=".$key."'>".$image_false."</a>");
 580                      $statuscol .= "<br/>".lang('hasdependents')." (<strong>$str</strong>)";
 581                      // END HAS DEPENDENTS ===========
 582                  }
 583  
 584                  if( !$permsok )
 585                  {
 586                      $statuscol .= "<br/>".lang('cantremove');
 587                      $actioncol .= "<br/><a href=\"listmodules.php?action=chmod&amp;module=".$key."\" onclick=\"return confirm('".lang('changepermissionsconfirm')."');\">".lang('changepermissions')."</a>";
 588                  }
 589              }
 590  
 591              //Is there help?
 592              if ($modinstance->GetHelp() != '')
 593              {
 594                  $helpcol = "<a href=\"listmodules.php?action=showmodulehelp&amp;module=".$key."\">".lang('help')."</a>";
 595              }
 596  
 597              //About is constructed from other details now
 598              $aboutcol = "<a href=\"listmodules.php?action=showmoduleabout&amp;module=".$key."\">".lang('about')."</a>";
 599  
 600              // row output
 601              echo "<tr class=\"".$curclass."\" onmouseover=\"this.className='".$curclass.'hover'."';\" onmouseout=\"this.className='".$curclass."';\">\n";
 602              echo "<td>$namecol</td>";
 603              echo "<td>$versioncol</td>";
 604              if( $statusspans )
 605              {
 606                  echo "<td colspan=\"3\">$statuscol</td>";
 607              }
 608              else
 609              {
 610                  echo "<td>$statuscol</td>";
 611                  echo '<td class="pagepos">'.$activecol.'</td>';
 612                  echo "<td>$actioncol</td>";
 613              }
 614              echo "<td>$helpcol</td>";
 615              echo "<td>$aboutcol</td>";
 616              echo "<td>$xmlcol</td>";
 617              echo "</tr>\n";
 618  
 619              ($curclass=="row1"?$curclass="row2":$curclass="row1");
 620          }
 621  
 622          ?>
 623  
 624          </tbody>
 625          </table>
 626          <?php
 627          // Only show XML upload form if the modules folder is writable
 628          //if (FALSE == is_writable($config['root_path'].DIRECTORY_SEPARATOR.'modules'))
 629              if (FALSE == can_admin_upload())
 630            {
 631              echo $themeObject->ShowErrors(lang('modulesnotwritable'));
 632            }
 633          else
 634            {
 635              ?>
 636              <form method="post" action="listmodules.php?action=importxml" enctype="multipart/form-data">
 637              <fieldset>
 638              <legend><?php echo lang('uploadxmlfile')?></legend>
 639              <div class="pageoverflow">
 640              <p class="pagetext"><?php echo lang('uploadfile')?>:</p>
 641              <p class="pageinput">
 642              <input type="file" name="browse_xml"/>
 643              </p>
 644              </div>
 645              <div class="pageoverflow">
 646              <p class="pagetext"><?php echo lang('overwritemodule')?>:</p>
 647              <p class="pageinput">
 648              <input type="checkbox" name="allowoverwrite" value="1" />
 649              </p>
 650              </div>
 651              <div class="pageoverflow">
 652              <p class="pagetext">&nbsp;</p>
 653              <p class="pageinput">
 654              <input type="submit" name="submit" value="<?php echo lang('submit')?>" />
 655              </p>
 656              </div>
 657              </fieldset>
 658              </form>
 659              <?php
 660          }
 661          echo '</div>';
 662      }
 663      echo '<p class="pageback"><a class="pageback" href="'.$themeObject->BackUrl().'">&#171; '.lang('back').'</a></p>';
 664  }
 665  
 666  include_once ("footer.php");
 667  
 668  # vim:ts=4 sw=4 noet
 669  ?>


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