Changeset 182 for trunk/export/index.php


Ignore:
Timestamp:
Apr 21, 2009, 6:54:35 PM (15 years ago)
Author:
maron
Message:

Vlastní nastavení a odkaz na něj

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/export/index.php

    r180 r182  
    3737}
    3838
    39 if(array_key_exists('UserID', $_SESSION) and ($_SESSION['UserID'] != ''))
    40 {
    41   $DbResult = $Database->SQLCommand('SELECT ExportSetting FROM user WHERE ID='.$_SESSION['UserID']);
    42   $DbRow = mysql_fetch_assoc($DbResult);
    43   $ExportSetting = unserialize($DbRow['ExportSetting']);
     39function WriteSetting($ExportSetting) {
     40        echo '<br /><br /><strong>Nastavení exportu:</strong><br />'.
     41        '<textarea rows="10" cols="100">'.serialize($ExportSetting).'</textarea><br />'.
     42        'Odkaz ke stažení s vlastním nastavením: '.
     43        '<a href="?action=result&ExportSetting='.htmlspecialchars(serialize($ExportSetting)).'">Odkaz vlastního exportu</a><br />'.
     44        'I když se nastavení ukládá, pro jistotu si jej můžete uložit nebo poslat příteli.';
     45}
     46
     47if (array_key_exists('ExportSetting',$_GET)) {
     48        $ExportSetting = unserialize(stripcslashes(stripcslashes($_GET['ExportSetting'])));
     49} else {
     50        if(array_key_exists('UserID', $_SESSION) and ($_SESSION['UserID'] != ''))
     51        {
     52                $DbResult = $Database->SQLCommand('SELECT ExportSetting FROM user WHERE ID='.$_SESSION['UserID']);
     53                $DbRow = mysql_fetch_assoc($DbResult);
     54                $ExportSetting = unserialize($DbRow['ExportSetting']);
    4455
    4556  //print_r($_POST);
    46 } else
    47 {
    48   $ExportSetting = unserialize($_SESSION['ExportSetting']);
     57        } else
     58        {
     59                $ExportSetting = unserialize($_SESSION['ExportSetting']);
     60        }
    4961}
    5062if(!isset($ExportSetting['users-selection'])) $ExportSetting['users-selection'] = array();
     
    7688{
    7789  case 'result':
    78     $ExportSetting['Export'] = @$_POST['Export'];
     90    if (array_key_exists('Export',$_POST)) $ExportSetting['Export'] = $_POST['Export'];
    7991        switch($ExportSetting['Export'])
    8092        {
     
    349361        }
    350362    WriteLog('Generování SQL výstupu: Typ exportu: <strong>'.$ExportSetting['Export'].'</strong>, Diakritika: <strong>'.$ExportSetting['Diacritics'].'</strong>', 2);
     363        WriteSetting($ExportSetting);
     364   
     365   
    351366    break;
    352367  case 'output':
Note: See TracChangeset for help on using the changeset viewer.