Ticket #1919: 1919.patch

File 1919.patch, 12.9 KB (added by Wiktor Walc, 16 years ago)
  • editor/filemanager/browser/default/browser.html

     
    2828                <link href="browser.css" type="text/css" rel="stylesheet">
    2929                <script type="text/javascript" src="js/fckxml.js"></script>
    3030                <script language="javascript">
     31// Automatically detect the correct document.domain (#1919).
     32(function()
     33{
     34        var d = document.domain ;
    3135
     36        while ( true )
     37        {
     38                // Test if we can access a parent property.
     39                try
     40                {
     41                        var test = window.opener.document.domain ;
     42                        break ;
     43                }
     44                catch( e ) {}
     45
     46                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
     47                d = d.replace( /.*?(?:\.|$)/, '' ) ;
     48
     49                if ( d.length == 0 )
     50                        break ;         // It was not able to detect the domain.
     51
     52                try
     53                {
     54                        document.domain = d ;
     55                }
     56                catch (e)
     57                {
     58                        break ;
     59                }
     60        }
     61})() ;
     62
    3263function GetUrlParam( paramName )
    3364{
    3465        var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ;
  • editor/filemanager/browser/default/frmactualfolder.html

     
    2626                <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    2727                <link href="browser.css" type="text/css" rel="stylesheet">
    2828                <script type="text/javascript">
     29// Automatically detect the correct document.domain (#1919).
     30(function()
     31{
     32        var d = document.domain ;
    2933
     34        while ( true )
     35        {
     36                // Test if we can access a parent property.
     37                try
     38                {
     39                        var test = window.top.opener.document.domain ;
     40                        break ;
     41                }
     42                catch( e ) {}
     43
     44                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
     45                d = d.replace( /.*?(?:\.|$)/, '' ) ;
     46
     47                if ( d.length == 0 )
     48                        break ;         // It was not able to detect the domain.
     49
     50                try
     51                {
     52                        document.domain = d ;
     53                }
     54                catch (e)
     55                {
     56                        break ;
     57                }
     58        }
     59})() ;
     60
    3061function OnResize()
    3162{
    3263        divName.style.width = "1px" ;
  • editor/filemanager/browser/default/js/common.js

     
    2222 * File Browser dialog window.
    2323 */
    2424
     25// Automatically detect the correct document.domain (#1919).
     26(function()
     27{
     28        var d = document.domain ;
     29
     30        while ( true )
     31        {
     32                // Test if we can access a parent property.
     33                try
     34                {
     35                        var test = window.top.opener.document.domain ;
     36                        break ;
     37                }
     38                catch( e ) {}
     39
     40                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
     41                d = d.replace( /.*?(?:\.|$)/, '' ) ;
     42
     43                if ( d.length == 0 )
     44                        break ;         // It was not able to detect the domain.
     45
     46                try
     47                {
     48                        document.domain = d ;
     49                }
     50                catch (e)
     51                {
     52                        break ;
     53                }
     54        }
     55})() ;
     56
    2557function AddSelectOption( selectElement, optionText, optionValue )
    2658{
    2759        var oOption = document.createElement("OPTION") ;
  • editor/filemanager/connectors/asp/io.asp

     
    214214Sub SendUploadResults( errorNumber, fileUrl, fileName, customMsg )
    215215        Response.Clear
    216216        Response.Write "<script type=""text/javascript"">"
     217        Response.Write "(function()"
     218        Response.Write "{"
     219        Response.Write "var d = document.domain ;"
     220
     221        Response.Write " while ( true )"
     222        Response.Write "        {"
     223        ' Test if we can access a parent property.
     224        Response.Write "                try"
     225        Response.Write "                {"
     226        Response.Write "                        var test = window.top.opener.document.domain ;"
     227        Response.Write "                        break ;"
     228        Response.Write "                }"
     229        Response.Write "                catch( e ) {}"
     230
     231        ' Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
     232        Response.Write "                d = d.replace( /.*?(?:\.|$)/, '' ) ;"
     233
     234        Response.Write "                if ( d.length == 0 )"
     235        ' It was not able to detect the domain.
     236        Response.Write "                        break ;"
     237        Response.Write ""
     238        Response.Write "                try"
     239        Response.Write "                {"
     240        Response.Write "                        document.domain = d ;"
     241        Response.Write "                }"
     242        Response.Write "                catch (e)"
     243        Response.Write "                {"
     244        Response.Write "                        break ;"
     245        Response.Write "                }"
     246        Response.Write "        }"
     247        Response.Write "})() ;"
     248
    217249        Response.Write "window.parent.OnUploadCompleted(" & errorNumber & ",""" & Replace( fileUrl, """", "\""" ) & """,""" & Replace( fileName, """", "\""" ) & """,""" & Replace( customMsg , """", "\""" ) & """) ;"
    218250        Response.Write "</script>"
    219251        Response.End
  • editor/filemanager/connectors/cfm/cf5_upload.cfm

     
    4747        function SendUploadResults(errorNumber, fileUrl, fileName, customMsg)
    4848        {
    4949                WriteOutput('<script type="text/javascript">');
     50                WriteOutput("(function()"&
     51"{"&
     52"       var d = document.domain ;"&
     53""&
     54"       while ( true )"&
     55"       {"&
     56                // Test if we can access a parent property.
     57"               try"&
     58"               {"&
     59"                       var test = window.top.opener.document.domain ;"&
     60"                       break ;"&
     61"               }"&
     62"               catch( e ) {}"&
     63""&
     64                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
     65"               d = d.replace( /.*?(?:\.|$)/, '' ) ;"&
     66""&
     67"               if ( d.length == 0 )"&
     68                        // It was not able to detect the domain.
     69"                       break ;"&
     70""&
     71"               try"&
     72"               {"&
     73"                       document.domain = d ;"&
     74"               }"&
     75"               catch (e)"&
     76"               {"&
     77"                       break ;"&
     78"               }"&
     79"       }"&
     80"})() ;");
     81
    5082                WriteOutput('window.parent.OnUploadCompleted(' & errorNumber & ', "' & JSStringFormat(fileUrl) & '", "' & JSStringFormat(fileName) & '", "' & JSStringFormat(customMsg) & '");' );
    5183                WriteOutput('</script>');
    5284        }
  • editor/filemanager/connectors/cfm/cf_io.cfm

     
    266266        <cfargument name="customMsg" required="false" type="String" default="">
    267267
    268268        <cfoutput>
    269                 <script type="text/javascript">
     269<script type="text/javascript">
     270(function()
     271{
     272        var d = document.domain ;
     273
     274        while ( true )
     275        {
     276                // Test if we can access a parent property.
     277                try
     278                {
     279                        var test = window.top.opener.document.domain ;
     280                        break ;
     281                }
     282                catch( e ) {}
     283
     284                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
     285                d = d.replace( /.*?(?:\.|$)/, '' ) ;
     286
     287                if ( d.length == 0 )
     288                        break ;         // It was not able to detect the domain.
     289
     290                try
     291                {
     292                        document.domain = d ;
     293                }
     294                catch (e)
     295                {
     296                        break ;
     297                }
     298        }
     299})() ;
     300
    270301                        window.parent.OnUploadCompleted( #errorNumber#, "#JSStringFormat(fileUrl)#", "#JSStringFormat(fileName)#", "#JSStringFormat(customMsg)#" );
    271302                </script>
    272303        </cfoutput>
  • editor/filemanager/connectors/lasso/connector.lasso

     
    203203                /*.........................................................
    204204                Set the HTML response.
    205205                */
    206                 if($uploadResult == '0' || $uploadResult == '201');
    207                                 $__html_reply__ = '\
     206                $__html_reply__ = '\
    208207<script type="text/javascript">
    209         window.parent.frames[\'frmUpload\'].OnUploadCompleted(' + $uploadResult + ',\'' + $NewFilePath + '\',\'' + $NewFilePath->split('/')->last + '\');
     208(function()
     209{
     210        var d = document.domain ;
     211
     212        while ( true )
     213        {
     214                // Test if we can access a parent property.
     215                try
     216                {
     217                        var test = window.top.opener.document.domain ;
     218                        break ;
     219                }
     220                catch( e ) {}
     221
     222                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
     223                d = d.replace( /.*?(?:\\.|$)/, "" ) ;
     224
     225                if ( d.length == 0 )
     226                        break ;         // It was not able to detect the domain.
     227
     228                try
     229                {
     230                        document.domain = d ;
     231                }
     232                catch (e)
     233                {
     234                        break ;
     235                }
     236        }
     237})() ;
     238';
     239                                if($uploadResult == '0' || $uploadResult == '201');
     240                                $__html_reply__ = $__html_reply__ + '\
     241        window.parent.OnUploadCompleted(' + $uploadResult + ',\'' + $NewFilePath + '\',\'' + $NewFilePath->split('/')->last + '\');
    210242</script>
    211243                                ';
    212                 else;
    213                                 $__html_reply__ = '\
    214 <script type="text/javascript">
    215         window.parent.frames[\'frmUpload\'].OnUploadCompleted(' + $uploadResult + ');
     244                                else;
     245                                $__html_reply__ = $__html_reply__ + '\
     246        window.parent.OnUploadCompleted(' + $uploadResult + ');
    216247</script>
    217248                                ';
    218249                                /if;
  • editor/filemanager/connectors/perl/commands.pl

     
    169169
    170170        local($sErrorNumber, $sFileUrl, $sFileName, $customMsg) = @_;
    171171
    172         print "Content-type: text/html\n\n";
    173         print '<script type="text/javascript">';
     172        print <<EOF;
     173Content-type: text/html
     174
     175<script type="text/javascript">
     176// Automatically detect the correct document.domain (#1919).
     177(function()
     178{
     179        var d = document.domain ;
     180
     181        while ( true )
     182        {
     183                // Test if we can access a parent property.
     184                try
     185                {
     186                        var test = window.top.opener.document.domain ;
     187                        break ;
     188                }
     189                catch( e ) {}
     190
     191                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
     192                d = d.replace( /.*?(?:\\.|\$)/, '' ) ;
     193
     194                if ( d.length == 0 )
     195                        break ;         // It was not able to detect the domain.
     196
     197                try
     198                {
     199                        document.domain = d ;
     200                }
     201                catch (e)
     202                {
     203                        break ;
     204                }
     205        }
     206})() ;
     207
     208EOF
    174209        print 'window.parent.OnUploadCompleted(' . $sErrorNumber . ',"' . JS_cnv($sFileUrl) . '","' . JS_cnv($sFileName) . '","' . JS_cnv($customMsg) . '") ;';
    175210        print '</script>';
    176211        exit ;
  • editor/filemanager/connectors/php/io.php

     
    277277// This is the function that sends the results of the uploading process.
    278278function SendUploadResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' )
    279279{
    280         echo '<script type="text/javascript">' ;
     280        echo <<<EOF
     281<script type="text/javascript">
     282(function()
     283{
     284        var d = document.domain ;
     285
     286        while ( true )
     287        {
     288                // Test if we can access a parent property.
     289                try
     290                {
     291                        var test = window.top.opener.document.domain ;
     292                        break ;
     293                }
     294                catch( e ) {}
     295
     296                // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
     297                d = d.replace( /.*?(?:\.|$)/, '' ) ;
     298
     299                if ( d.length == 0 )
     300                        break ;         // It was not able to detect the domain.
     301
     302                try
     303                {
     304                        document.domain = d ;
     305                }
     306                catch (e)
     307                {
     308                        break ;
     309                }
     310        }
     311})() ;
     312
     313EOF;
    281314        $rpl = array( '\\' => '\\\\', '"' => '\\"' ) ;
    282315        echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '") ;' ;
    283316        echo '</script>' ;
  • editor/filemanager/connectors/py/fckoutput.py

     
    102102                self.setHttpHeaders("text/html")
    103103                "This is the function that sends the results of the uploading process"
    104104                return """<script type="text/javascript">
     105                        (function()
     106                        {
     107                                var d = document.domain ;
     108
     109                                while ( true )
     110                                {
     111                                        // Test if we can access a parent property.
     112                                        try
     113                                        {
     114                                                var test = window.top.opener.document.domain ;
     115                                                break ;
     116                                        }
     117                                        catch( e ) {}
     118
     119                                        // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
     120                                        d = d.replace( /.*?(?:\.|$)/, '' ) ;
     121
     122                                        if ( d.length == 0 )
     123                                                break ;         // It was not able to detect the domain.
     124
     125                                        try
     126                                        {
     127                                                document.domain = d ;
     128                                        }
     129                                        catch (e)
     130                                        {
     131                                                break ;
     132                                        }
     133                                }
     134                        })() ;
     135
    105136                        window.parent.OnUploadCompleted(%(errorNumber)s,"%(fileUrl)s","%(fileName)s","%(customMsg)s");
    106137                        </script>""" % {
    107138                        'errorNumber': errorNo,
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy