<?php
/* 
   ======================================================================
   Copyright © 2007 by Francisco Burzi
   http://phpnuke.org             
                                                                  
   AntiSlaed CMS based on:                                          
                                                                    
   RNuke (http://rusnuke.com)                                        
   EdogsNuke (http://edogs.ru)                                       
   XNuke (http://xnuke.info)                                         
   phpBB (http://phpbb.com)                                      
   Code modifications by AntiSlaed Team, March 2008                  
   http://antislaedcms.ru                                        
                                                                     
   Please contact us, if you have any questions about AntiSlaedCMS
   mailto: admin@antislaedcms.ru      
                                                                       
   AntiSlaed CMS is free software. You can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by 
   the Free Software Foundation; either version 2 of the License.
   ======================================================================
*/
/**
 * SPAW Editor v.2 Standard dialog window
 *
 * Standard dialog window 
 * @package spaw2
 * @subpackage Dialogs  
 * @author Alan Mendelevich <alan@solmetra.lt> 
 * @copyright UAB Solmetra
 */ 
error_reporting(E_ALL);
include_once("../spaw.inc.php");
$module = SpawVars::getGetVar("module");
if (strpos($module, '/') || strpos($module, "\\")) die("illegal module name");
$dialog = SpawVars::getGetVar("dialog");
if (strpos($dialog, '/') || strpos($dialog, "\\")) die("illegal dialog name");
$lang = new SpawLang(SpawVars::getGetVar("lang"));
$charset = $lang->getCharset(); 
if (SpawVars::getGetVar('charset') != '')
{
  $charset = SpawVars::getGetVar('charset'); 
  $lang->setOutputCharset($charset);
}

if (SpawVars::getGetVar("scid") != '' && session_id() == '')
  session_start();
$config = new SpawConfig();
$config->restoreSecureConfig(SpawVars::getGetVar("scid"));

$theme = SpawTheme::getTheme(SpawVars::getGetVar("theme"));
$htpl = $theme->getTemplateDialogHeader();
$htpl = str_replace('{SPAW DIALOG TITLE}', $lang->m('title', $dialog, $module), $htpl); 
$htpl = str_replace('{SPAW DIR}', SpawConfig::getStaticConfigValue('SPAW_DIR'), $htpl);
$ftpl = $theme->getTemplateDialogFooter(); 
$ftpl = str_replace('{SPAW DIR}', SpawConfig::getStaticConfigValue('SPAW_DIR'), $ftpl);

ob_start();
?>
<html>
<head>
<title><?php
/* 
   ======================================================================
   Copyright © 2007 by Francisco Burzi
   http://phpnuke.org             
                                                                  
   AntiSlaed CMS based on:                                          
                                                                    
   RNuke (http://rusnuke.com)                                        
   EdogsNuke (http://edogs.ru)                                       
   XNuke (http://xnuke.info)                                         
   phpBB (http://phpbb.com)                                      
   Code modifications by AntiSlaed Team, March 2008                  
   http://antislaedcms.ru                                        
                                                                     
   Please contact us, if you have any questions about AntiSlaedCMS
   mailto: admin@antislaedcms.ru      
                                                                       
   AntiSlaed CMS is free software. You can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by 
   the Free Software Foundation; either version 2 of the License.
   ======================================================================
*/ echo $lang->m('title', $dialog, $module) ?></title>
<meta http-equiv="content-type" content="text/html;charset=<?php
/* 
   ======================================================================
   Copyright © 2007 by Francisco Burzi
   http://phpnuke.org             
                                                                  
   AntiSlaed CMS based on:                                          
                                                                    
   RNuke (http://rusnuke.com)                                        
   EdogsNuke (http://edogs.ru)                                       
   XNuke (http://xnuke.info)                                         
   phpBB (http://phpbb.com)                                      
   Code modifications by AntiSlaed Team, March 2008                  
   http://antislaedcms.ru                                        
                                                                     
   Please contact us, if you have any questions about AntiSlaedCMS
   mailto: admin@antislaedcms.ru      
                                                                       
   AntiSlaed CMS is free software. You can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by 
   the Free Software Foundation; either version 2 of the License.
   ======================================================================
*/ echo $charset ?>" />
<script type="text/javascript" src="../js/spaw.js.php"></script>
<script type="text/javascript">
<!--
SpawEngine.spaw_dir = "<?php
/* 
   ======================================================================
   Copyright © 2007 by Francisco Burzi
   http://phpnuke.org             
                                                                  
   AntiSlaed CMS based on:                                          
                                                                    
   RNuke (http://rusnuke.com)                                        
   EdogsNuke (http://edogs.ru)                                       
   XNuke (http://xnuke.info)                                         
   phpBB (http://phpbb.com)                                      
   Code modifications by AntiSlaed Team, March 2008                  
   http://antislaedcms.ru                                        
                                                                     
   Please contact us, if you have any questions about AntiSlaedCMS
   mailto: admin@antislaedcms.ru      
                                                                       
   AntiSlaed CMS is free software. You can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by 
   the Free Software Foundation; either version 2 of the License.
   ======================================================================
*/ echo SpawConfig::getStaticConfigValue('SPAW_DIR') ?>";
SpawEngine.setPlatform('php');

function SpawDialog()
{
}
SpawDialog.resizeDialogToContent = function()
{
  if (window.sizeToContent)
  {
    // gecko
    window.sizeToContent();
  }
  else
  {
    // resize window so there are no scrollbars visible
    if (!spawEditor._dialog_chrome_width)
    {
      // do these calculations only once for each spaw instance on a page
      window.resizeTo(600, 500);
      spawEditor._dialog_chrome_width = 600 - document.body.clientWidth;
      spawEditor._dialog_chrome_height = 500 - document.body.clientHeight;
    }
    window.resizeTo(50, 40);
    window.resizeTo(document.body.scrollWidth + spawEditor._dialog_chrome_width, document.body.scrollHeight + spawEditor._dialog_chrome_height);
    
  }
}

var spawArgs;
var spawEditor;
var spawArguments;

SpawDialog.dialogInit = function()
{
  if (window.opener)
  {
    spawArgs = window.opener.dialogArguments;
    if (spawArgs == null)
      window.close();
    spawEditor = spawArgs.editor;
    spawArguments = spawArgs.arguments;
  }

  if (window.history.length == 0 || (window.sizeToContent && window.history.length == 1 /* Gecko */) || (navigator.vendor && navigator.vendor.indexOf('Apple')>-1 && window.history.length == 1) /* Safari */) // no need to resize and center on reloads
  {
    SpawDialog.resizeDialogToContent();
    // center according to new dimensions
    window.moveTo(screen.availWidth/2 - document.body.clientWidth/2, screen.availHeight/2 - document.body.clientHeight/2);
  }
}

SpawDialog.returnValue = function(result)
{
  if (spawArgs.callback)
  {
    eval('window.opener.'+spawArgs.callback + '(spawEditor, result, spawArgs.tbi, spawArgs.sender)');
  }
}
//-->
</script>
</head>
<body onload="SpawDialog.dialogInit();" dir="<?php
/* 
   ======================================================================
   Copyright © 2007 by Francisco Burzi
   http://phpnuke.org             
                                                                  
   AntiSlaed CMS based on:                                          
                                                                    
   RNuke (http://rusnuke.com)                                        
   EdogsNuke (http://edogs.ru)                                       
   XNuke (http://xnuke.info)                                         
   phpBB (http://phpbb.com)                                      
   Code modifications by AntiSlaed Team, March 2008                  
   http://antislaedcms.ru                                        
                                                                     
   Please contact us, if you have any questions about AntiSlaedCMS
   mailto: admin@antislaedcms.ru      
                                                                       
   AntiSlaed CMS is free software. You can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by 
   the Free Software Foundation; either version 2 of the License.
   ======================================================================
*/ echo $lang->getDir() ?>">
<?php
/* 
   ======================================================================
   Copyright © 2007 by Francisco Burzi
   http://phpnuke.org             
                                                                  
   AntiSlaed CMS based on:                                          
                                                                    
   RNuke (http://rusnuke.com)                                        
   EdogsNuke (http://edogs.ru)                                       
   XNuke (http://xnuke.info)                                         
   phpBB (http://phpbb.com)                                      
   Code modifications by AntiSlaed Team, March 2008                  
   http://antislaedcms.ru                                        
                                                                     
   Please contact us, if you have any questions about AntiSlaedCMS
   mailto: admin@antislaedcms.ru      
                                                                       
   AntiSlaed CMS is free software. You can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by 
   the Free Software Foundation; either version 2 of the License.
   ======================================================================
*/ echo $htpl ?>
<?php
/* 
   ======================================================================
   Copyright © 2007 by Francisco Burzi
   http://phpnuke.org             
                                                                  
   AntiSlaed CMS based on:                                          
                                                                    
   RNuke (http://rusnuke.com)                                        
   EdogsNuke (http://edogs.ru)                                       
   XNuke (http://xnuke.info)                                         
   phpBB (http://phpbb.com)                                      
   Code modifications by AntiSlaed Team, March 2008                  
   http://antislaedcms.ru                                        
                                                                     
   Please contact us, if you have any questions about AntiSlaedCMS
   mailto: admin@antislaedcms.ru      
                                                                       
   AntiSlaed CMS is free software. You can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by 
   the Free Software Foundation; either version 2 of the License.
   ======================================================================
*/ include(SpawConfig::getStaticConfigValue('SPAW_ROOT').'plugins/'.$module.'/dialogs/'.$dialog.'.inc.php'); ?>
<?php
/* 
   ======================================================================
   Copyright © 2007 by Francisco Burzi
   http://phpnuke.org             
                                                                  
   AntiSlaed CMS based on:                                          
                                                                    
   RNuke (http://rusnuke.com)                                        
   EdogsNuke (http://edogs.ru)                                       
   XNuke (http://xnuke.info)                                         
   phpBB (http://phpbb.com)                                      
   Code modifications by AntiSlaed Team, March 2008                  
   http://antislaedcms.ru                                        
                                                                     
   Please contact us, if you have any questions about AntiSlaedCMS
   mailto: admin@antislaedcms.ru      
                                                                       
   AntiSlaed CMS is free software. You can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by 
   the Free Software Foundation; either version 2 of the License.
   ======================================================================
*/ echo $ftpl ?>
</body>
</html>
<?php
/* 
   ======================================================================
   Copyright © 2007 by Francisco Burzi
   http://phpnuke.org             
                                                                  
   AntiSlaed CMS based on:                                          
                                                                    
   RNuke (http://rusnuke.com)                                        
   EdogsNuke (http://edogs.ru)                                       
   XNuke (http://xnuke.info)                                         
   phpBB (http://phpbb.com)                                      
   Code modifications by AntiSlaed Team, March 2008                  
   http://antislaedcms.ru                                        
                                                                     
   Please contact us, if you have any questions about AntiSlaedCMS
   mailto: admin@antislaedcms.ru      
                                                                       
   AntiSlaed CMS is free software. You can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by 
   the Free Software Foundation; either version 2 of the License.
   ======================================================================
*/
ob_end_flush();
?>
