Location: PHPKode > projects > PhpChrystal - An Open Intranet System > 0.071Alpha1/phpImExport.php
<?php
  session_start();
  session_set_cookie_params(32758);

  (!isset($_SESSION['active_login'])) ? (exit) : ($dummy);

  // XML::COMMENT (Datei exportieren)
  if ($_GET['cmd'] == 'do_export')
  {
    include("./classes/CImExport.php");
    $cimexport = new CImExport;
    $desTop = $cimexport->export($t_to_export);

	header("Content-Type: text/xml\r\n");
	print $desTop;
    exit;
  }
  else
  {
    include_once("./classes/CCore.php");
  }

  // XML::MODUL   (phpImExport)
  // XML::VERSION (0.071 Alpha1)
  // XML::AUTHOR  (::[CTH]Goldenhawk::)
  // XML::INFO    (phpImExport exportiert die Datenbank und dient als Login-Portal für den Administrationsbereich)


  // XML::COMMENT (Vesrion, Name und Autor festlege)
  $PLUGIN_VERSION = "0.071 Alpha1";
  $PLUGIN_NAME    = "phpImExport";
  $PLUGIN_AUTHOR  = "::[CTH]Goldenhawk::";

  // XML::FUNC::getInfo ($self->getInfo())
  // XML::DESC::getInfo (liefert Name, Autor und Version des Modules zurück)
  // XML::VERSION::getInfo  (1.0)
  // XML::RETURN::getInfo ($PLUGIN_NAME,$PLUGIN_AUTHOR,$PLUGIN_VERSION)
  function getInfo()
  {
    global $PLUGIN_VERSION,$PLUGIN_NAME,$PLUGIN_AUTHOR;

    return $PLUGIN_NAME;
    return $PLUGIN_AUTHOR;
    return $PLUGIN_VERSION;
  }

  // XML::COMMENT (Template initalisieren)
  $cdesign->initalizeTemplate($arNoOpts);

  if (!isset($_SESSION['active_userid']))
    $cfunc->faultExt($cxml->printString($lang_def["fault.not_loged_in"]));

  (!$csecure->verifyUserForAdminArea(array('iUserID' => $_SESSION['active_userid'], 'area' => $PLUGIN_NAME))) ? ($cfunc->faultExt($cxml->printString($lang_def['fault.not_authorized']))) : ($dummy);

  // XML::COMMENT (Datenbank in XML ausgeben)
  if ($_GET['cmd'] == 'admin_overview')
  {
	$desText[0][text]  = $cxml->printString($lang['admin.overview.hint']);

 	$cl->TableText($desText);
  }
  elseif ($_GET['cmd'] == 'admin_import')
  {
	$p_form[enctype] = "multipart/form-data";
	$p_form[action]  = "$PHP_SELF?cmd=admin_import";
	$cl->newForm($p_form);

	$cl->cells2Noopt($cxml->printString($lang['admin.import.file']),"<input type = 'file' name = 'in_file' class = 'submit' value = '".$in_file_name."' accept = 'text/*'>","out");
	$cl->cells2Noopt($cxml->printString($lang['admin.import.use_online_id']),$cl->createInput(array('type' => 'checkbox', 'name' => 'in_bImportUseOnlineID', 'value' => 1, 'checked' => $in_bImportUseOnlineID)),"out");
	$cl->cells2Noopt($cxml->printString($lang['admin.import.write_online_id']),$cl->createInput(array('type' => 'checkbox', 'name' => 'in_bImportWriteOnlineID', 'value' => 1, 'checked' => $in_bImportWriteOnlineID)),"out");
	$cl->cells2Noopt($cxml->printString($lang['admin.import.delete_user_if_exists']),$cl->createInput(array('type' => 'checkbox', 'name' => 'in_bImportDeleteUserIfExists', 'value' => 1, 'checked' => $in_bImportDeleteUserIfExists)),"out");
	$cl->FormSubmit(2,$cxml->printString($lang['admin.import.form']));

	if (isset($in_file))
	{
      // XML::COMMENT (Bugfix für: http://www.securityfocus.com/archive/1/80106)
      if (isset($HTTP_COOKIE_VARS["in_file"]) || isset($HTTP_POST_VARS  ["in_file"]) || isset($HTTP_GET_VARS["in_file"]))
      {
        $cfunc->faultExt($cxml->printString($lang['fault.no_secure']));
	  }
	  elseif (is_dir(realpath(".")."/tmp"))
      {
        $cimexport->bImportUseOnlineID 			= $_POST['in_bImportUseOnlineID'];
        $cimexport->bImportWriteOnlineID 		= $_POST['in_bImportWriteOnlineID'];
        $cimexport->bImportDeleteUserIfExists 	= $_POST['in_bImportDeleteUserIfExists'];

        if (!move_uploaded_file($in_file, realpath(".").$in_file))
          $desTop = $cxml->printString($lang['message.import_failed'],$in_file);

        ($cimexport->import(realpath(".").$in_file)) ? ($desTop .= $cxml->printString($lang['admin.import.success'],$in_file_name)) : ($desTop .= $cxml->printString($lang['message.import_failed'],$in_file_name));
        unlink(realpath(".").$in_file);
        $cl->cellsDummy(1,"out");
        $desText[0][text] = $desTop;
        $cl->TableText($desText);
      }
      else
      {
        $desTop = $cxml->printString($lang['message.import_notmpdir'],realpath(".").$in_file);
        $desText[0][text] = $desTop;
        $cl->TableText($desText);
      }
	}
  }
  elseif ($_GET['cmd'] == 'admin_avtables')
  {
	$ar_avexport = array("user","setting","article","seats","forum","events","text","files","games","modules","tourneys");
	$desText[0][text]  = $cxml->printString($lang['admin.avtables.hint'])."<ul>\n";

	for ($cnt = 0;$cnt<count($ar_avexport);$cnt++)
	  $desText[0][text] .= "<li><a href=\"$PHP_SELF?cmd=do_export&t_to_export=".$ar_avexport[$cnt]."\">".$cxml->printString($lang["admin.avtables.link.".$ar_avexport[$cnt]])."</a></li>\n";

    $desText[0][text] .= "<li><a href = 'phpTurnierAdmin.php?cmd=do_export&amp;type=ngl'>NGL-Daten</a></li>\n";
    $desText[0][text] .= "<li><a href = 'phpTurnierAdmin.php?cmd=do_export&amp;type=wwcl'>WWCL-Daten</a></li>\n";
    $desText[0][text] .= "</ul><p />Damit die WWCL-Daten mit dem offiziellen WWCL-Tool von Solariz benutzt werden können, muss im Order /wwcl-tool/Partys ein neuer Ordner mit dem Namen der Party erstellt werden.  Dieser Name muss identisch sein, mit dem Partynamen, den du bei phpChrystal unter Administration->Intranetoptionen->LAN-Daten angegeben hast.";
    $cl->TableText($desText);
  }
  // XML::COMMENT (Standard-Errorstring)
  else
  {
    $cfunc->faultExt($cxml->printString($lang_def['fault.not_registered']));
  }

  // XML::COMMENT (Seite abschließen)
  $cdesign->createSiteFooter($arOpts);
?>
Return current item: PhpChrystal - An Open Intranet System