code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
//////////////////////////////////////////////////// // wordWindow object //////////////////////////////////////////////////// function wordWindow() { // private properties this._forms = []; // private methods this._getWordObject = _getWordObject; //this._getSpellerObject = _getSpellerObject; this._wordInputStr = _wordInputStr; this._adjustIndexes = _adjustIndexes; this._isWordChar = _isWordChar; this._lastPos = _lastPos; // public properties this.wordChar = /[a-zA-Z]/; this.windowType = "wordWindow"; this.originalSpellings = new Array(); this.suggestions = new Array(); this.checkWordBgColor = "pink"; this.normWordBgColor = "white"; this.text = ""; this.textInputs = new Array(); this.indexes = new Array(); //this.speller = this._getSpellerObject(); // public methods this.resetForm = resetForm; this.totalMisspellings = totalMisspellings; this.totalWords = totalWords; this.totalPreviousWords = totalPreviousWords; //this.getTextObjectArray = getTextObjectArray; this.getTextVal = getTextVal; this.setFocus = setFocus; this.removeFocus = removeFocus; this.setText = setText; //this.getTotalWords = getTotalWords; this.writeBody = writeBody; this.printForHtml = printForHtml; } function resetForm() { if( this._forms ) { for( var i = 0; i < this._forms.length; i++ ) { this._forms[i].reset(); } } return true; } function totalMisspellings() { var total_words = 0; for( var i = 0; i < this.textInputs.length; i++ ) { total_words += this.totalWords( i ); } return total_words; } function totalWords( textIndex ) { return this.originalSpellings[textIndex].length; } function totalPreviousWords( textIndex, wordIndex ) { var total_words = 0; for( var i = 0; i <= textIndex; i++ ) { for( var j = 0; j < this.totalWords( i ); j++ ) { if( i == textIndex && j == wordIndex ) { break; } else { total_words++; } } } return total_words; } //function getTextObjectArray() { // return this._form.elements; //} function getTextVal( textIndex, wordIndex ) { var word = this._getWordObject( textIndex, wordIndex ); if( word ) { return word.value; } } function setFocus( textIndex, wordIndex ) { var word = this._getWordObject( textIndex, wordIndex ); if( word ) { if( word.type == "text" ) { word.focus(); word.style.backgroundColor = this.checkWordBgColor; } } } function removeFocus( textIndex, wordIndex ) { var word = this._getWordObject( textIndex, wordIndex ); if( word ) { if( word.type == "text" ) { word.blur(); word.style.backgroundColor = this.normWordBgColor; } } } function setText( textIndex, wordIndex, newText ) { var word = this._getWordObject( textIndex, wordIndex ); var beginStr; var endStr; if( word ) { var pos = this.indexes[textIndex][wordIndex]; var oldText = word.value; // update the text given the index of the string beginStr = this.textInputs[textIndex].substring( 0, pos ); endStr = this.textInputs[textIndex].substring( pos + oldText.length, this.textInputs[textIndex].length ); this.textInputs[textIndex] = beginStr + newText + endStr; // adjust the indexes on the stack given the differences in // length between the new word and old word. var lengthDiff = newText.length - oldText.length; this._adjustIndexes( textIndex, wordIndex, lengthDiff ); word.size = newText.length; word.value = newText; this.removeFocus( textIndex, wordIndex ); } } function writeBody() { var d = window.document; var is_html = false; d.open(); // iterate through each text input. for( var txtid = 0; txtid < this.textInputs.length; txtid++ ) { var end_idx = 0; var begin_idx = 0; d.writeln( '<form name="textInput'+txtid+'">' ); var wordtxt = this.textInputs[txtid]; this.indexes[txtid] = []; if( wordtxt ) { var orig = this.originalSpellings[txtid]; if( !orig ) break; //!!! plain text, or HTML mode? d.writeln( '<div class="plainText">' ); // iterate through each occurrence of a misspelled word. for( var i = 0; i < orig.length; i++ ) { // find the position of the current misspelled word, // starting at the last misspelled word. // and keep looking if it's a substring of another word do { begin_idx = wordtxt.indexOf( orig[i], end_idx ); end_idx = begin_idx + orig[i].length; // word not found? messed up! if( begin_idx == -1 ) break; // look at the characters immediately before and after // the word. If they are word characters we'll keep looking. var before_char = wordtxt.charAt( begin_idx - 1 ); var after_char = wordtxt.charAt( end_idx ); } while ( this._isWordChar( before_char ) || this._isWordChar( after_char ) ); // keep track of its position in the original text. this.indexes[txtid][i] = begin_idx; // write out the characters before the current misspelled word for( var j = this._lastPos( txtid, i ); j < begin_idx; j++ ) { // !!! html mode? make it html compatible d.write( this.printForHtml( wordtxt.charAt( j ))); } // write out the misspelled word. d.write( this._wordInputStr( orig[i] )); // if it's the last word, write out the rest of the text if( i == orig.length-1 ){ d.write( printForHtml( wordtxt.substr( end_idx ))); } } d.writeln( '</div>' ); } d.writeln( '</form>' ); } //for ( var j = 0; j < d.forms.length; j++ ) { // alert( d.forms[j].name ); // for( var k = 0; k < d.forms[j].elements.length; k++ ) { // alert( d.forms[j].elements[k].name + ": " + d.forms[j].elements[k].value ); // } //} // set the _forms property this._forms = d.forms; d.close(); } // return the character index in the full text after the last word we evaluated function _lastPos( txtid, idx ) { if( idx > 0 ) return this.indexes[txtid][idx-1] + this.originalSpellings[txtid][idx-1].length; else return 0; } function printForHtml( n ) { return n ; // by FredCK /* var htmlstr = n; if( htmlstr.length == 1 ) { // do simple case statement if it's just one character switch ( n ) { case "\n": htmlstr = '<br/>'; break; case "<": htmlstr = '&lt;'; break; case ">": htmlstr = '&gt;'; break; } return htmlstr; } else { htmlstr = htmlstr.replace( /</g, '&lt' ); htmlstr = htmlstr.replace( />/g, '&gt' ); htmlstr = htmlstr.replace( /\n/g, '<br/>' ); return htmlstr; } */ } function _isWordChar( letter ) { if( letter.search( this.wordChar ) == -1 ) { return false; } else { return true; } } function _getWordObject( textIndex, wordIndex ) { if( this._forms[textIndex] ) { if( this._forms[textIndex].elements[wordIndex] ) { return this._forms[textIndex].elements[wordIndex]; } } return null; } function _wordInputStr( word ) { var str = '<input readonly '; str += 'class="blend" type="text" value="' + word + '" size="' + word.length + '">'; return str; } function _adjustIndexes( textIndex, wordIndex, lengthDiff ) { for( var i = wordIndex + 1; i < this.originalSpellings[textIndex].length; i++ ) { this.indexes[textIndex][i] = this.indexes[textIndex][i] + lengthDiff; } }
zzshop
trunk/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js
JavaScript
asf20
7,402
//////////////////////////////////////////////////// // controlWindow object //////////////////////////////////////////////////// function controlWindow( controlForm ) { // private properties this._form = controlForm; // public properties this.windowType = "controlWindow"; // this.noSuggestionSelection = "- No suggestions -"; // by FredCK this.noSuggestionSelection = FCKLang.DlgSpellNoSuggestions ; // set up the properties for elements of the given control form this.suggestionList = this._form.sugg; this.evaluatedText = this._form.misword; this.replacementText = this._form.txtsugg; this.undoButton = this._form.btnUndo; // public methods this.addSuggestion = addSuggestion; this.clearSuggestions = clearSuggestions; this.selectDefaultSuggestion = selectDefaultSuggestion; this.resetForm = resetForm; this.setSuggestedText = setSuggestedText; this.enableUndo = enableUndo; this.disableUndo = disableUndo; } function resetForm() { if( this._form ) { this._form.reset(); } } function setSuggestedText() { var slct = this.suggestionList; var txt = this.replacementText; var str = ""; if( (slct.options[0].text) && slct.options[0].text != this.noSuggestionSelection ) { str = slct.options[slct.selectedIndex].text; } txt.value = str; } function selectDefaultSuggestion() { var slct = this.suggestionList; var txt = this.replacementText; if( slct.options.length == 0 ) { this.addSuggestion( this.noSuggestionSelection ); } else { slct.options[0].selected = true; } this.setSuggestedText(); } function addSuggestion( sugg_text ) { var slct = this.suggestionList; if( sugg_text ) { var i = slct.options.length; var newOption = new Option( sugg_text, 'sugg_text'+i ); slct.options[i] = newOption; } } function clearSuggestions() { var slct = this.suggestionList; for( var j = slct.length - 1; j > -1; j-- ) { if( slct.options[j] ) { slct.options[j] = null; } } } function enableUndo() { if( this.undoButton ) { if( this.undoButton.disabled == true ) { this.undoButton.disabled = false; } } } function disableUndo() { if( this.undoButton ) { if( this.undoButton.disabled == false ) { this.undoButton.disabled = true; } } }
zzshop
trunk/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js
JavaScript
asf20
2,305
#!/usr/bin/perl use CGI qw/ :standard /; use File::Temp qw/ tempfile tempdir /; # my $spellercss = '/speller/spellerStyle.css'; # by FredCK my $spellercss = '../spellerStyle.css'; # by FredCK # my $wordWindowSrc = '/speller/wordWindow.js'; # by FredCK my $wordWindowSrc = '../wordWindow.js'; # by FredCK my @textinputs = param( 'textinputs[]' ); # array # my $aspell_cmd = 'aspell'; # by FredCK (for Linux) my $aspell_cmd = '"C:\Program Files\Aspell\bin\aspell.exe"'; # by FredCK (for Windows) my $lang = 'en_US'; # my $aspell_opts = "-a --lang=$lang --encoding=utf-8"; # by FredCK my $aspell_opts = "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt"; # by FredCK my $input_separator = "A"; # set the 'wordtext' JavaScript variable to the submitted text. sub printTextVar { for( my $i = 0; $i <= $#textinputs; $i++ ) { print "textinputs[$i] = decodeURIComponent('" . escapeQuote( $textinputs[$i] ) . "')\n"; } } sub printTextIdxDecl { my $idx = shift; print "words[$idx] = [];\n"; print "suggs[$idx] = [];\n"; } sub printWordsElem { my( $textIdx, $wordIdx, $word ) = @_; print "words[$textIdx][$wordIdx] = '" . escapeQuote( $word ) . "';\n"; } sub printSuggsElem { my( $textIdx, $wordIdx, @suggs ) = @_; print "suggs[$textIdx][$wordIdx] = ["; for my $i ( 0..$#suggs ) { print "'" . escapeQuote( $suggs[$i] ) . "'"; if( $i < $#suggs ) { print ", "; } } print "];\n"; } sub printCheckerResults { my $textInputIdx = -1; my $wordIdx = 0; my $unhandledText; # create temp file my $dir = tempdir( CLEANUP => 1 ); my( $fh, $tmpfilename ) = tempfile( DIR => $dir ); # temp file was created properly? # open temp file, add the submitted text. for( my $i = 0; $i <= $#textinputs; $i++ ) { $text = url_decode( $textinputs[$i] ); # Strip all tags for the text. (by FredCK - #339 / #681) $text =~ s/<[^>]+>/ /g; @lines = split( /\n/, $text ); print $fh "\%\n"; # exit terse mode print $fh "^$input_separator\n"; print $fh "!\n"; # enter terse mode for my $line ( @lines ) { # use carat on each line to escape possible aspell commands print $fh "^$line\n"; } } # exec aspell command my $cmd = "$aspell_cmd $aspell_opts < $tmpfilename 2>&1"; open ASPELL, "$cmd |" or handleError( "Could not execute `$cmd`\\n$!" ) and return; # parse each line of aspell return for my $ret ( <ASPELL> ) { chomp( $ret ); # if '&', then not in dictionary but has suggestions # if '#', then not in dictionary and no suggestions # if '*', then it is a delimiter between text inputs if( $ret =~ /^\*/ ) { $textInputIdx++; printTextIdxDecl( $textInputIdx ); $wordIdx = 0; } elsif( $ret =~ /^(&|#)/ ) { my @tokens = split( " ", $ret, 5 ); printWordsElem( $textInputIdx, $wordIdx, $tokens[1] ); my @suggs = (); if( $tokens[4] ) { @suggs = split( ", ", $tokens[4] ); } printSuggsElem( $textInputIdx, $wordIdx, @suggs ); $wordIdx++; } else { $unhandledText .= $ret; } } close ASPELL or handleError( "Error executing `$cmd`\\n$unhandledText" ) and return; } sub escapeQuote { my $str = shift; $str =~ s/'/\\'/g; return $str; } sub handleError { my $err = shift; print "error = '" . escapeQuote( $err ) . "';\n"; } sub url_decode { local $_ = @_ ? shift : $_; defined or return; # change + signs to spaces tr/+/ /; # change hex escapes to the proper characters s/%([a-fA-F0-9]{2})/pack "H2", $1/eg; return $_; } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Display HTML # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print <<EOF; Content-type: text/html; charset=utf-8 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="$spellercss"/> <script src="$wordWindowSrc"></script> <script type="text/javascript"> var suggs = new Array(); var words = new Array(); var textinputs = new Array(); var error; EOF printTextVar(); printCheckerResults(); print <<EOF; var wordWindowObj = new wordWindow(); wordWindowObj.originalSpellings = words; wordWindowObj.suggestions = suggs; wordWindowObj.textInputs = textinputs; function init_spell() { // check if any error occured during server-side processing if( error ) { alert( error ); } else { // call the init_spell() function in the parent frameset if (parent.frames.length) { parent.init_spell( wordWindowObj ); } else { error = "This page was loaded outside of a frameset. "; error += "It might not display properly"; alert( error ); } } } </script> </head> <body onLoad="init_spell();"> <script type="text/javascript"> wordWindowObj.writeBody(); </script> </body> </html> EOF
zzshop
trunk/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl
Perl
asf20
4,927
<cfsetting enablecfoutputonly="true"> <!--- This code uses a CF User Defined Function and should work in CF version 5.0 and up without alteration. Also if you are hosting your site at an ISP, you will have to check with them to see if the use of <CFEXECUTE> is allowed. In most cases ISP will not allow the use of that tag for security reasons. Clients would be able to access each others files in certain cases. ---> <!--- The following variables values must reflect your installation. ---> <cfset aspell_dir = "C:\Program Files\Aspell\bin"> <cfset lang = "en_US"> <cfset aspell_opts = "-a --lang=#lang# --encoding=utf-8 -H --rem-sgml-check=alt"> <cfset tempfile_in = GetTempFile(GetTempDirectory(), "spell_")> <cfset tempfile_out = GetTempFile(GetTempDirectory(), "spell_")> <cfset spellercss = "../spellerStyle.css"> <cfset word_win_src = "../wordWindow.js"> <cfset form.checktext = form["textinputs[]"]> <!--- make no difference between URL and FORM scopes ---> <cfparam name="url.checktext" default=""> <cfparam name="form.checktext" default="#url.checktext#"> <!--- Takes care of those pesky smart quotes from MS apps, replaces them with regular quotes ---> <cfset submitted_text = ReplaceList(form.checktext,"%u201C,%u201D","%22,%22")> <!--- submitted_text now is ready for processing ---> <!--- use carat on each line to escape possible aspell commands ---> <cfset text = ""> <cfset CRLF = Chr(13) & Chr(10)> <cfloop list="#submitted_text#" index="field" delimiters=","> <cfset text = text & "%" & CRLF & "^A" & CRLF & "!" & CRLF> <!--- Strip all tags for the text. (by FredCK - #339 / #681) ---> <cfset field = REReplace(URLDecode(field), "<[^>]+>", " ", "all")> <cfloop list="#field#" index="line" delimiters="#CRLF#"> <cfset text = ListAppend(text, "^" & Trim(JSStringFormat(line)), CRLF)> </cfloop> </cfloop> <!--- create temp file from the submitted text, this will be passed to aspell to be check for misspelled words ---> <cffile action="write" file="#tempfile_in#" output="#text#" charset="utf-8"> <!--- execute aspell in an UTF-8 console and redirect output to a file. UTF-8 encoding is lost if done differently ---> <cfexecute name="cmd.exe" arguments='/c type "#tempfile_in#" | "#aspell_dir#\aspell.exe" #aspell_opts# > "#tempfile_out#"' timeout="100"/> <!--- read output file for further processing ---> <cffile action="read" file="#tempfile_out#" variable="food" charset="utf-8"> <!--- remove temp files ---> <cffile action="delete" file="#tempfile_in#"> <cffile action="delete" file="#tempfile_out#"> <cfset texts = StructNew()> <cfset texts.textinputs = ""> <cfset texts.words = ""> <cfset texts.abort = ""> <!--- Generate Text Inputs ---> <cfset i = 0> <cfloop list="#submitted_text#" index="textinput"> <cfset texts.textinputs = ListAppend(texts.textinputs, 'textinputs[#i#] = decodeURIComponent("#textinput#");', CRLF)> <cfset i = i + 1> </cfloop> <!--- Generate Words Lists ---> <cfset word_cnt = 0> <cfset input_cnt = -1> <cfloop list="#food#" index="aspell_line" delimiters="#CRLF#"> <cfset leftChar = Left(aspell_line, 1)> <cfif leftChar eq "*"> <cfset input_cnt = input_cnt + 1> <cfset word_cnt = 0> <cfset texts.words = ListAppend(texts.words, "words[#input_cnt#] = [];", CRLF)> <cfset texts.words = ListAppend(texts.words, "suggs[#input_cnt#] = [];", CRLF)> <cfelse> <cfif leftChar eq "&" or leftChar eq "##"> <!--- word that misspelled ---> <cfset bad_word = Trim(ListGetAt(aspell_line, 2, " "))> <cfset bad_word = Replace(bad_word, "'", "\'", "ALL")> <!--- sugestions ---> <cfset sug_list = Trim(ListRest(aspell_line, ":"))> <cfset sug_list = ListQualify(Replace(sug_list, "'", "\'", "ALL"), "'")> <!--- javascript ---> <cfset texts.words = ListAppend(texts.words, "words[#input_cnt#][#word_cnt#] = '#bad_word#';", CRLF)> <cfset texts.words = ListAppend(texts.words, "suggs[#input_cnt#][#word_cnt#] = [#sug_list#];", CRLF)> <cfset word_cnt = word_cnt + 1> </cfif> </cfif> </cfloop> <cfif texts.words eq ""> <cfset texts.abort = "alert('Spell check complete.\n\nNo misspellings found.'); top.window.close();"> </cfif> <cfcontent type="text/html; charset=utf-8"> <cfoutput><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="#spellercss#" /> <script language="javascript" src="#word_win_src#"></script> <script language="javascript"> var suggs = new Array(); var words = new Array(); var textinputs = new Array(); var error; #texts.textinputs##CRLF# #texts.words# #texts.abort# var wordWindowObj = new wordWindow(); wordWindowObj.originalSpellings = words; wordWindowObj.suggestions = suggs; wordWindowObj.textInputs = textinputs; function init_spell() { // check if any error occured during server-side processing if( error ) { alert( error ); } else { // call the init_spell() function in the parent frameset if (parent.frames.length) { parent.init_spell( wordWindowObj ); } else { alert('This page was loaded outside of a frameset. It might not display properly'); } } } </script> </head> <body onLoad="init_spell();"> <script type="text/javascript"> wordWindowObj.writeBody(); </script> </body> </html></cfoutput> <cfsetting enablecfoutputonly="false">
zzshop
trunk/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm
ColdFusion
asf20
5,538
#!/usr/bin/perl use CGI qw/ :standard /; use File::Temp qw/ tempfile tempdir /; # my $spellercss = '/speller/spellerStyle.css'; # by FredCK my $spellercss = '../spellerStyle.css'; # by FredCK # my $wordWindowSrc = '/speller/wordWindow.js'; # by FredCK my $wordWindowSrc = '../wordWindow.js'; # by FredCK my @textinputs = param( 'textinputs[]' ); # array # my $aspell_cmd = 'aspell'; # by FredCK (for Linux) my $aspell_cmd = '"C:\Program Files\Aspell\bin\aspell.exe"'; # by FredCK (for Windows) my $lang = 'en_US'; # my $aspell_opts = "-a --lang=$lang --encoding=utf-8"; # by FredCK my $aspell_opts = "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt"; # by FredCK my $input_separator = "A"; # set the 'wordtext' JavaScript variable to the submitted text. sub printTextVar { for( my $i = 0; $i <= $#textinputs; $i++ ) { print "textinputs[$i] = decodeURIComponent('" . escapeQuote( $textinputs[$i] ) . "')\n"; } } sub printTextIdxDecl { my $idx = shift; print "words[$idx] = [];\n"; print "suggs[$idx] = [];\n"; } sub printWordsElem { my( $textIdx, $wordIdx, $word ) = @_; print "words[$textIdx][$wordIdx] = '" . escapeQuote( $word ) . "';\n"; } sub printSuggsElem { my( $textIdx, $wordIdx, @suggs ) = @_; print "suggs[$textIdx][$wordIdx] = ["; for my $i ( 0..$#suggs ) { print "'" . escapeQuote( $suggs[$i] ) . "'"; if( $i < $#suggs ) { print ", "; } } print "];\n"; } sub printCheckerResults { my $textInputIdx = -1; my $wordIdx = 0; my $unhandledText; # create temp file my $dir = tempdir( CLEANUP => 1 ); my( $fh, $tmpfilename ) = tempfile( DIR => $dir ); # temp file was created properly? # open temp file, add the submitted text. for( my $i = 0; $i <= $#textinputs; $i++ ) { $text = url_decode( $textinputs[$i] ); # Strip all tags for the text. (by FredCK - #339 / #681) $text =~ s/<[^>]+>/ /g; @lines = split( /\n/, $text ); print $fh "\%\n"; # exit terse mode print $fh "^$input_separator\n"; print $fh "!\n"; # enter terse mode for my $line ( @lines ) { # use carat on each line to escape possible aspell commands print $fh "^$line\n"; } } # exec aspell command my $cmd = "$aspell_cmd $aspell_opts < $tmpfilename 2>&1"; open ASPELL, "$cmd |" or handleError( "Could not execute `$cmd`\\n$!" ) and return; # parse each line of aspell return for my $ret ( <ASPELL> ) { chomp( $ret ); # if '&', then not in dictionary but has suggestions # if '#', then not in dictionary and no suggestions # if '*', then it is a delimiter between text inputs if( $ret =~ /^\*/ ) { $textInputIdx++; printTextIdxDecl( $textInputIdx ); $wordIdx = 0; } elsif( $ret =~ /^(&|#)/ ) { my @tokens = split( " ", $ret, 5 ); printWordsElem( $textInputIdx, $wordIdx, $tokens[1] ); my @suggs = (); if( $tokens[4] ) { @suggs = split( ", ", $tokens[4] ); } printSuggsElem( $textInputIdx, $wordIdx, @suggs ); $wordIdx++; } else { $unhandledText .= $ret; } } close ASPELL or handleError( "Error executing `$cmd`\\n$unhandledText" ) and return; } sub escapeQuote { my $str = shift; $str =~ s/'/\\'/g; return $str; } sub handleError { my $err = shift; print "error = '" . escapeQuote( $err ) . "';\n"; } sub url_decode { local $_ = @_ ? shift : $_; defined or return; # change + signs to spaces tr/+/ /; # change hex escapes to the proper characters s/%([a-fA-F0-9]{2})/pack "H2", $1/eg; return $_; } # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Display HTML # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # print <<EOF; Content-type: text/html; charset=utf-8 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="$spellercss"/> <script src="$wordWindowSrc"></script> <script type="text/javascript"> var suggs = new Array(); var words = new Array(); var textinputs = new Array(); var error; EOF printTextVar(); printCheckerResults(); print <<EOF; var wordWindowObj = new wordWindow(); wordWindowObj.originalSpellings = words; wordWindowObj.suggestions = suggs; wordWindowObj.textInputs = textinputs; function init_spell() { // check if any error occured during server-side processing if( error ) { alert( error ); } else { // call the init_spell() function in the parent frameset if (parent.frames.length) { parent.init_spell( wordWindowObj ); } else { error = "This page was loaded outside of a frameset. "; error += "It might not display properly"; alert( error ); } } } </script> </head> <body onLoad="init_spell();"> <script type="text/javascript"> wordWindowObj.writeBody(); </script> </body> </html> EOF
zzshop
trunk/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/.svn/text-base/spellchecker.pl.svn-base
Perl
asf20
4,927
<?php error_reporting(0); header('Content-type: text/html; charset=utf-8'); // The following variables values must reflect your installation needs. $aspell_prog = '"C:\Program Files\Aspell\bin\aspell.exe"'; // by FredCK (for Windows) //$aspell_prog = 'aspell'; // by FredCK (for Linux) $lang = 'en_US'; $aspell_opts = "-a --lang=$lang --encoding=utf-8 -H --rem-sgml-check=alt"; // by FredCK $tempfiledir = "./"; $spellercss = '../spellerStyle.css'; // by FredCK $word_win_src = '../wordWindow.js'; // by FredCK $textinputs = $_POST['textinputs']; # array $input_separator = "A"; # set the JavaScript variable to the submitted text. # textinputs is an array, each element corresponding to the (url-encoded) # value of the text control submitted for spell-checking function print_textinputs_var() { global $textinputs; foreach( $textinputs as $key=>$val ) { # $val = str_replace( "'", "%27", $val ); echo "textinputs[$key] = decodeURIComponent(\"" . $val . "\");\n"; } } # make declarations for the text input index function print_textindex_decl( $text_input_idx ) { echo "words[$text_input_idx] = [];\n"; echo "suggs[$text_input_idx] = [];\n"; } # set an element of the JavaScript 'words' array to a misspelled word function print_words_elem( $word, $index, $text_input_idx ) { echo "words[$text_input_idx][$index] = '" . escape_quote( $word ) . "';\n"; } # set an element of the JavaScript 'suggs' array to a list of suggestions function print_suggs_elem( $suggs, $index, $text_input_idx ) { echo "suggs[$text_input_idx][$index] = ["; foreach( $suggs as $key=>$val ) { if( $val ) { echo "'" . escape_quote( $val ) . "'"; if ( $key+1 < count( $suggs )) { echo ", "; } } } echo "];\n"; } # escape single quote function escape_quote( $str ) { return preg_replace ( "/'/", "\\'", $str ); } # handle a server-side error. function error_handler( $err ) { echo "error = '" . preg_replace( "/['\\\\]/", "\\\\$0", $err ) . "';\n"; } ## get the list of misspelled words. Put the results in the javascript words array ## for each misspelled word, get suggestions and put in the javascript suggs array function print_checker_results() { global $aspell_prog; global $aspell_opts; global $tempfiledir; global $textinputs; global $input_separator; $aspell_err = ""; # create temp file $tempfile = tempnam( $tempfiledir, 'aspell_data_' ); # open temp file, add the submitted text. if( $fh = fopen( $tempfile, 'w' )) { for( $i = 0; $i < count( $textinputs ); $i++ ) { $text = urldecode( $textinputs[$i] ); // Strip all tags for the text. (by FredCK - #339 / #681) $text = preg_replace( "/<[^>]+>/", " ", $text ) ; $lines = explode( "\n", $text ); fwrite ( $fh, "%\n" ); # exit terse mode fwrite ( $fh, "^$input_separator\n" ); fwrite ( $fh, "!\n" ); # enter terse mode foreach( $lines as $key=>$value ) { # use carat on each line to escape possible aspell commands fwrite( $fh, "^$value\n" ); } } fclose( $fh ); # exec aspell command - redirect STDERR to STDOUT $cmd = "$aspell_prog $aspell_opts < $tempfile 2>&1"; if( $aspellret = shell_exec( $cmd )) { $linesout = explode( "\n", $aspellret ); $index = 0; $text_input_index = -1; # parse each line of aspell return foreach( $linesout as $key=>$val ) { $chardesc = substr( $val, 0, 1 ); # if '&', then not in dictionary but has suggestions # if '#', then not in dictionary and no suggestions # if '*', then it is a delimiter between text inputs # if '@' then version info if( $chardesc == '&' || $chardesc == '#' ) { $line = explode( " ", $val, 5 ); print_words_elem( $line[1], $index, $text_input_index ); if( isset( $line[4] )) { $suggs = explode( ", ", $line[4] ); } else { $suggs = array(); } print_suggs_elem( $suggs, $index, $text_input_index ); $index++; } elseif( $chardesc == '*' ) { $text_input_index++; print_textindex_decl( $text_input_index ); $index = 0; } elseif( $chardesc != '@' && $chardesc != "" ) { # assume this is error output $aspell_err .= $val; } } if( $aspell_err ) { $aspell_err = "Error executing"; error_handler( $aspell_err ); } } else { error_handler( "System error" ); } } else { error_handler( "System error" ); } # close temp file, delete file unlink( $tempfile ); } ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" type="text/css" href="<?php echo $spellercss ?>" /> <script language="javascript" src="<?php echo $word_win_src ?>"></script> <script language="javascript"> var suggs = new Array(); var words = new Array(); var textinputs = new Array(); var error; <?php print_textinputs_var(); print_checker_results(); ?> var wordWindowObj = new wordWindow(); wordWindowObj.originalSpellings = words; wordWindowObj.suggestions = suggs; wordWindowObj.textInputs = textinputs; function init_spell() { // check if any error occured during server-side processing if( error ) { alert( error ); } else { // call the init_spell() function in the parent frameset if (parent.frames.length) { parent.init_spell( wordWindowObj ); } else { alert('This page was loaded outside of a frameset. It might not display properly'); } } } </script> </head> <!-- <body onLoad="init_spell();"> by FredCK --> <body onLoad="init_spell();" bgcolor="#ffffff"> <script type="text/javascript"> wordWindowObj.writeBody(); </script> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php
PHP
asf20
6,676
.blend { font-family: courier new; font-size: 10pt; border: 0; margin-bottom:-1; } .normalLabel { font-size:8pt; } .normalText { font-family:arial, helvetica, sans-serif; font-size:10pt; color:000000; background-color:FFFFFF; } .plainText { font-family: courier new, courier, monospace; font-size: 10pt; color:000000; background-color:FFFFFF; } .controlWindowBody { font-family:arial, helvetica, sans-serif; font-size:8pt; padding: 7px ; /* by FredCK */ margin: 0px ; /* by FredCK */ /* color:000000; by FredCK */ /* background-color:DADADA; by FredCK */ } .readonlyInput { background-color:DADADA; color:000000; font-size:8pt; width:392px; } .textDefault { font-size:8pt; width: 200px; } .buttonDefault { width:90px; height:22px; font-size:8pt; } .suggSlct { width:200px; margin-top:2; font-size:8pt; }
zzshop
trunk/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle.css
CSS
asf20
890
<script> var wordWindow = null; var controlWindow = null; function init_spell( spellerWindow ) { if( spellerWindow ) { if( spellerWindow.windowType == "wordWindow" ) { wordWindow = spellerWindow; } else if ( spellerWindow.windowType == "controlWindow" ) { controlWindow = spellerWindow; } } if( controlWindow && wordWindow ) { // populate the speller object and start it off! var speller = opener.speller; wordWindow.speller = speller; speller.startCheck( wordWindow, controlWindow ); } } // encodeForPost function encodeForPost( str ) { var s = new String( str ); s = encodeURIComponent( s ); // additionally encode single quotes to evade any PHP // magic_quotes_gpc setting (it inserts escape characters and // therefore skews the btye positions of misspelled words) return s.replace( /\'/g, '%27' ); } // post the text area data to the script that populates the speller function postWords() { var bodyDoc = window.frames[0].document; bodyDoc.open(); bodyDoc.write('<html>'); bodyDoc.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'); bodyDoc.write('<link rel="stylesheet" type="text/css" href="spellerStyle.css"/>'); if (opener) { var speller = opener.speller; bodyDoc.write('<body class="normalText" onLoad="document.forms[0].submit();">'); bodyDoc.write('<p>' + window.parent.FCKLang.DlgSpellProgress + '<\/p>'); // by FredCK bodyDoc.write('<form action="'+speller.spellCheckScript+'" method="post">'); for( var i = 0; i < speller.textInputs.length; i++ ) { bodyDoc.write('<input type="hidden" name="textinputs[]" value="'+encodeForPost(speller.textInputs[i].value)+'">'); } bodyDoc.write('<\/form>'); bodyDoc.write('<\/body>'); } else { bodyDoc.write('<body class="normalText">'); bodyDoc.write('<p><b>This page cannot be displayed<\/b><\/p><p>The window was not opened from another window.<\/p>'); bodyDoc.write('<\/body>'); } bodyDoc.write('<\/html>'); bodyDoc.close(); } </script> <html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <head> <title>Speller Pages</title> </head> <frameset rows="*,201" onLoad="postWords();"> <frame src="blank.html"> <frame src="controls.html"> </frameset> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellchecker.html
HTML
asf20
2,300
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Color Selection dialog window. --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <style TYPE="text/css"> #ColorTable { cursor: pointer ; cursor: hand ; } #hicolor { height: 74px ; width: 74px ; border-width: 1px ; border-style: solid ; } #hicolortext { width: 75px ; text-align: right ; margin-bottom: 7px ; } #selhicolor { height: 20px ; width: 74px ; border-width: 1px ; border-style: solid ; } #selcolor { width: 75px ; height: 20px ; margin-top: 0px ; margin-bottom: 7px ; } #btnClear { width: 75px ; height: 22px ; margin-bottom: 6px ; } .ColorCell { height: 15px ; width: 15px ; } </style> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var oEditor = window.parent.InnerDialogLoaded() ; function OnLoad() { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; CreateColorTable() ; window.parent.SetOkButton( true ) ; window.parent.SetAutoSize( true ) ; } function CreateColorTable() { // Get the target table. var oTable = document.getElementById('ColorTable') ; // Create the base colors array. var aColors = ['00','33','66','99','cc','ff'] ; // This function combines two ranges of three values from the color array into a row. function AppendColorRow( rangeA, rangeB ) { for ( var i = rangeA ; i < rangeA + 3 ; i++ ) { var oRow = oTable.insertRow(-1) ; for ( var j = rangeB ; j < rangeB + 3 ; j++ ) { for ( var n = 0 ; n < 6 ; n++ ) { AppendColorCell( oRow, '#' + aColors[j] + aColors[n] + aColors[i] ) ; } } } } // This function create a single color cell in the color table. function AppendColorCell( targetRow, color ) { var oCell = targetRow.insertCell(-1) ; oCell.className = 'ColorCell' ; oCell.bgColor = color ; oCell.onmouseover = function() { document.getElementById('hicolor').style.backgroundColor = this.bgColor ; document.getElementById('hicolortext').innerHTML = this.bgColor ; } oCell.onclick = function() { document.getElementById('selhicolor').style.backgroundColor = this.bgColor ; document.getElementById('selcolor').value = this.bgColor ; } } AppendColorRow( 0, 0 ) ; AppendColorRow( 3, 0 ) ; AppendColorRow( 0, 3 ) ; AppendColorRow( 3, 3 ) ; // Create the last row. var oRow = oTable.insertRow(-1) ; // Create the gray scale colors cells. for ( var n = 0 ; n < 6 ; n++ ) { AppendColorCell( oRow, '#' + aColors[n] + aColors[n] + aColors[n] ) ; } // Fill the row with black cells. for ( var i = 0 ; i < 12 ; i++ ) { AppendColorCell( oRow, '#000000' ) ; } } function Clear() { document.getElementById('selhicolor').style.backgroundColor = '' ; document.getElementById('selcolor').value = '' ; } function ClearActual() { document.getElementById('hicolor').style.backgroundColor = '' ; document.getElementById('hicolortext').innerHTML = '&nbsp;' ; } function UpdateColor() { try { document.getElementById('selhicolor').style.backgroundColor = document.getElementById('selcolor').value ; } catch (e) { Clear() ; } } function Ok() { if ( typeof(window.parent.Args().CustomValue) == 'function' ) window.parent.Args().CustomValue( document.getElementById('selcolor').value ) ; return true ; } </script> </head> <body onload="OnLoad()" scroll="no" style="OVERFLOW: hidden"> <table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%"> <tr> <td align="center" valign="middle"> <table border="0" cellspacing="5" cellpadding="0" width="100%"> <tr> <td valign="top" align="center" nowrap width="100%"> <table id="ColorTable" border="0" cellspacing="0" cellpadding="0" width="270" onmouseout="ClearActual();"> </table> </td> <td valign="top" align="left" nowrap> <span fckLang="DlgColorHighlight">Highlight</span> <div id="hicolor"></div> <div id="hicolortext">&nbsp;</div> <span fckLang="DlgColorSelected">Selected</span> <div id="selhicolor"></div> <input id="selcolor" type="text" maxlength="20" onchange="UpdateColor();"> <br> <input id="btnClear" type="button" fckLang="DlgColorBtnClear" value="Clear" onclick="Clear();" /> </td> </tr> </table> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_colorselector.html
HTML
asf20
5,289
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * "Find" and "Replace" dialog box window. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta content="noindex, nofollow" name="robots" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var dialogArguments = dialog.Args() ; var FCKLang = oEditor.FCKLang ; var FCKDomTools = oEditor.FCKDomTools ; var FCKDomRange = oEditor.FCKDomRange ; var FCKListsLib = oEditor.FCKListsLib ; var FCKTools = oEditor.FCKTools ; var EditorDocument = oEditor.FCK.EditorDocument ; var HighlightStyle = oEditor.FCKStyles.GetStyle( '_FCK_SelectionHighlight' ) ; dialog.AddTab( 'Find', FCKLang.DlgFindTitle ) ; dialog.AddTab( 'Replace', FCKLang.DlgReplaceTitle ) ; var idMap = {} ; function OnDialogTabChange( tabCode ) { ShowE( 'divFind', ( tabCode == 'Find' ) ) ; ShowE( 'divReplace', ( tabCode == 'Replace' ) ) ; idMap['FindText'] = 'txtFind' + tabCode ; idMap['CheckCase'] = 'chkCase' + tabCode ; idMap['CheckWord'] = 'chkWord' + tabCode ; if ( tabCode == 'Replace' ) dialog.SetAutoSize( true ) ; } GetNextNonEmptyTextNode = function( node, stopNode ) { while ( ( node = FCKDomTools.GetNextSourceNode( node, false, 3, stopNode ) ) && node && node.length < 1 ) 1 ; return node ; } CharacterCursor = function( arg ) { if ( arg.nodeType && arg.nodeType == 9 ) { this._textNode = GetNextNonEmptyTextNode( arg.body, arg.documentElement ) ; this._offset = 0 ; this._doc = arg ; } else { this._textNode = arguments[0] ; this._offset = arguments[1] ; this._doc = FCKTools.GetElementDocument( arguments[0] ) ; } } CharacterCursor.prototype = { GetCharacter : function() { return ( this._textNode && this._textNode.nodeValue.charAt( this._offset ) ) || null ; }, // Non-normalized. GetTextNode : function() { return this._textNode ; }, // Non-normalized. GetIndex : function() { return this._offset ; }, // Return value means whehther we've crossed a line break or a paragraph boundary. MoveNext : function() { if ( this._offset < this._textNode.length - 1 ) { this._offset++ ; return false ; } var crossed = false ; var curNode = this._textNode ; while ( ( curNode = FCKDomTools.GetNextSourceNode( curNode ) ) && curNode && ( curNode.nodeType != 3 || curNode.length < 1 ) ) { var tag = curNode.nodeName.toLowerCase() ; if ( FCKListsLib.BlockElements[tag] || tag == 'br' ) crossed = true ; } this._textNode = curNode ; this._offset = 0 ; return crossed ; }, // Return value means whehther we've crossed a line break or a paragraph boundary. MoveBack : function() { if ( this._offset > 0 && this._textNode.length > 0 ) { this._offset = Math.min( this._offset - 1, this._textNode.length - 1 ) ; return false ; } var crossed = false ; var curNode = this._textNode ; while ( ( curNode = FCKDomTools.GetPreviousSourceNode( curNode ) ) && curNode && ( curNode.nodeType != 3 || curNode.length < 1 ) ) { var tag = curNode.nodeName.toLowerCase() ; if ( FCKListsLib.BlockElements[tag] || tag == 'br' ) crossed = true ; } this._textNode = curNode ; this._offset = curNode.length - 1 ; return crossed ; }, Clone : function() { return new CharacterCursor( this._textNode, this._offset ) ; } } ; CharacterRange = function( initCursor, maxLength ) { this._cursors = initCursor.push ? initCursor : [initCursor] ; this._maxLength = maxLength ; this._highlightRange = null ; } CharacterRange.prototype = { ToDomRange : function() { var firstCursor = this._cursors[0] ; var lastCursor = this._cursors[ this._cursors.length - 1 ] ; var domRange = new FCKDomRange( FCKTools.GetElementWindow( firstCursor.GetTextNode() ) ) ; var w3cRange = domRange._Range = domRange.CreateRange() ; w3cRange.setStart( firstCursor.GetTextNode(), firstCursor.GetIndex() ) ; w3cRange.setEnd( lastCursor.GetTextNode(), lastCursor.GetIndex() + 1 ) ; domRange._UpdateElementInfo() ; return domRange ; }, Highlight : function() { if ( this._cursors.length < 1 ) return ; var domRange = this.ToDomRange() ; HighlightStyle.ApplyToRange( domRange, false, true ) ; this._highlightRange = domRange ; var charRange = CharacterRange.CreateFromDomRange( domRange ) ; var focusNode = domRange.StartNode ; if ( focusNode.nodeType != 1 ) focusNode = focusNode.parentNode ; FCKDomTools.ScrollIntoView( focusNode, false ) ; this._cursors = charRange._cursors ; }, RemoveHighlight : function() { if ( this._highlightRange ) { HighlightStyle.RemoveFromRange( this._highlightRange, false, true ) ; var charRange = CharacterRange.CreateFromDomRange( this._highlightRange ) ; this._cursors = charRange._cursors ; this._highlightRange = null ; } }, GetHighlightDomRange : function() { return this._highlightRange; }, MoveNext : function() { var next = this._cursors[ this._cursors.length - 1 ].Clone() ; var retval = next.MoveNext() ; if ( retval ) this._cursors = [] ; this._cursors.push( next ) ; if ( this._cursors.length > this._maxLength ) this._cursors.shift() ; return retval ; }, MoveBack : function() { var prev = this._cursors[0].Clone() ; var retval = prev.MoveBack() ; if ( retval ) this._cursors = [] ; this._cursors.unshift( prev ) ; if ( this._cursors.length > this._maxLength ) this._cursors.pop() ; return retval ; }, GetEndCharacter : function() { if ( this._cursors.length < 1 ) return null ; var retval = this._cursors[ this._cursors.length - 1 ].GetCharacter() ; return retval ; }, GetNextRange : function( len ) { if ( this._cursors.length == 0 ) return null ; var cur = this._cursors[ this._cursors.length - 1 ].Clone() ; cur.MoveNext() ; return new CharacterRange( cur, len ) ; }, GetCursors : function() { return this._cursors ; } } ; CharacterRange.CreateFromDomRange = function( domRange ) { var w3cRange = domRange._Range ; var startContainer = w3cRange.startContainer ; var endContainer = w3cRange.endContainer ; var startTextNode, startIndex, endTextNode, endIndex ; if ( startContainer.nodeType == 3 ) { startTextNode = startContainer ; startIndex = w3cRange.startOffset ; } else if ( domRange.StartNode.nodeType == 3 ) { startTextNode = domRange.StartNode ; startIndex = 0 ; } else { startTextNode = GetNextNonEmptyTextNode( domRange.StartNode, domRange.StartNode.parentNode ) ; if ( !startTextNode ) return null ; startIndex = 0 ; } if ( endContainer.nodeType == 3 && w3cRange.endOffset > 0 ) { endTextNode = endContainer ; endIndex = w3cRange.endOffset - 1 ; } else { endTextNode = domRange.EndNode ; while ( endTextNode.nodeType != 3 ) endTextNode = endTextNode.lastChild ; endIndex = endTextNode.length - 1 ; } var cursors = [] ; var current = new CharacterCursor( startTextNode, startIndex ) ; cursors.push( current ) ; if ( !( current.GetTextNode() == endTextNode && current.GetIndex() == endIndex ) && !domRange.CheckIsEmpty() ) { do { current = current.Clone() ; current.MoveNext() ; cursors.push( current ) ; } while ( !( current.GetTextNode() == endTextNode && current.GetIndex() == endIndex ) ) ; } return new CharacterRange( cursors, cursors.length ) ; } // Knuth-Morris-Pratt Algorithm for stream input KMP_NOMATCH = 0 ; KMP_ADVANCED = 1 ; KMP_MATCHED = 2 ; KmpMatch = function( pattern, ignoreCase ) { var overlap = [ -1 ] ; for ( var i = 0 ; i < pattern.length ; i++ ) { overlap.push( overlap[i] + 1 ) ; while ( overlap[ i + 1 ] > 0 && pattern.charAt( i ) != pattern.charAt( overlap[ i + 1 ] - 1 ) ) overlap[ i + 1 ] = overlap[ overlap[ i + 1 ] - 1 ] + 1 ; } this._Overlap = overlap ; this._State = 0 ; this._IgnoreCase = ( ignoreCase === true ) ; if ( ignoreCase ) this.Pattern = pattern.toLowerCase(); else this.Pattern = pattern ; } KmpMatch.prototype = { FeedCharacter : function( c ) { if ( this._IgnoreCase ) c = c.toLowerCase(); while ( true ) { if ( c == this.Pattern.charAt( this._State ) ) { this._State++ ; if ( this._State == this.Pattern.length ) { // found a match, start over, don't care about partial matches involving the current match this._State = 0; return KMP_MATCHED; } return KMP_ADVANCED ; } else if ( this._State == 0 ) return KMP_NOMATCH; else this._State = this._Overlap[ this._State ]; } return null ; }, Reset : function() { this._State = 0 ; } }; // Place a range at the start of document. function OnLoad() { // First of all, translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage( document ) ; // Show the appropriate tab at startup. if ( dialogArguments.CustomValue == 'Find' ) { dialog.SetSelectedTab( 'Find' ) ; dialog.SetAutoSize( true ) ; } else dialog.SetSelectedTab( 'Replace' ) ; SelectField( 'txtFind' + dialogArguments.CustomValue ) ; } function btnStat() { GetE('btnReplace').disabled = GetE('btnReplaceAll').disabled = GetE('btnFind').disabled = ( GetE(idMap["FindText"]).value.length == 0 ) ; } function btnStatDelayed() { setTimeout( btnStat, 1 ) ; } function GetSearchString() { return GetE(idMap['FindText']).value ; } function GetReplaceString() { return GetE("txtReplace").value ; } function GetCheckCase() { return !! ( GetE(idMap['CheckCase']).checked ) ; } function GetMatchWord() { return !! ( GetE(idMap['CheckWord']).checked ) ; } /* Is this character a unicode whitespace or a punctuation mark? * References: * http://unicode.org/Public/UNIDATA/PropList.txt (whitespaces) * http://php.chinaunix.net/manual/tw/ref.regex.php (punctuation marks) */ function CheckIsWordSeparator( c ) { var code = c.charCodeAt( 0 ); if ( code >= 9 && code <= 0xd ) return true; if ( code >= 0x2000 && code <= 0x200a ) return true; switch ( code ) { case 0x20: case 0x85: case 0xa0: case 0x1680: case 0x180e: case 0x2028: case 0x2029: case 0x202f: case 0x205f: case 0x3000: return true; default: } return /[.,"'?!;:]/.test( c ) ; } FindRange = null ; function _Find() { var searchString = GetSearchString() ; if ( !FindRange ) FindRange = new CharacterRange( new CharacterCursor( EditorDocument ), searchString.length ) ; else { FindRange.RemoveHighlight() ; FindRange = FindRange.GetNextRange( searchString.length ) ; } var matcher = new KmpMatch( searchString, ! GetCheckCase() ) ; var matchState = KMP_NOMATCH ; var character = '%' ; while ( character != null ) { while ( ( character = FindRange.GetEndCharacter() ) ) { matchState = matcher.FeedCharacter( character ) ; if ( matchState == KMP_MATCHED ) break ; if ( FindRange.MoveNext() ) matcher.Reset() ; } if ( matchState == KMP_MATCHED ) { if ( GetMatchWord() ) { var cursors = FindRange.GetCursors() ; var head = cursors[ cursors.length - 1 ].Clone() ; var tail = cursors[0].Clone() ; if ( !head.MoveNext() && !CheckIsWordSeparator( head.GetCharacter() ) ) continue ; if ( !tail.MoveBack() && !CheckIsWordSeparator( tail.GetCharacter() ) ) continue ; } FindRange.Highlight() ; return true ; } } FindRange = null ; return false ; } function Find() { if ( ! _Find() ) alert( FCKLang.DlgFindNotFoundMsg ) ; } function Replace() { var saveUndoStep = function( selectRange ) { var ieRange ; if ( oEditor.FCKBrowserInfo.IsIE ) ieRange = document.selection.createRange() ; selectRange.Select() ; oEditor.FCKUndo.SaveUndoStep() ; var cloneRange = selectRange.Clone() ; cloneRange.Collapse( false ) ; cloneRange.Select() ; if ( ieRange ) setTimeout( function(){ ieRange.select() ; }, 1 ) ; } if ( FindRange && FindRange.GetHighlightDomRange() ) { var range = FindRange.GetHighlightDomRange() ; var bookmark = range.CreateBookmark() ; FindRange.RemoveHighlight() ; range.MoveToBookmark( bookmark ) ; saveUndoStep( range ) ; range.DeleteContents() ; range.InsertNode( EditorDocument.createTextNode( GetReplaceString() ) ) ; range._UpdateElementInfo() ; FindRange = CharacterRange.CreateFromDomRange( range ) ; } else { if ( ! _Find() ) { FindRange && FindRange.RemoveHighlight() ; alert( FCKLang.DlgFindNotFoundMsg ) ; } } } function ReplaceAll() { oEditor.FCKUndo.SaveUndoStep() ; var replaceCount = 0 ; while ( _Find() ) { var range = FindRange.GetHighlightDomRange() ; var bookmark = range.CreateBookmark() ; FindRange.RemoveHighlight() ; range.MoveToBookmark( bookmark) ; range.DeleteContents() ; range.InsertNode( EditorDocument.createTextNode( GetReplaceString() ) ) ; range._UpdateElementInfo() ; FindRange = CharacterRange.CreateFromDomRange( range ) ; replaceCount++ ; } if ( replaceCount == 0 ) { FindRange && FindRange.RemoveHighlight() ; alert( FCKLang.DlgFindNotFoundMsg ) ; } dialog.Cancel() ; } window.onunload = function() { if ( FindRange ) { FindRange.RemoveHighlight() ; FindRange.ToDomRange().Select() ; } } </script> </head> <body onload="OnLoad()" style="overflow: hidden"> <div id="divFind" style="display: none"> <table cellspacing="3" cellpadding="2" width="100%" border="0"> <tr> <td nowrap="nowrap"> <label for="txtFindFind" fcklang="DlgReplaceFindLbl"> Find what:</label> </td> <td width="100%"> <input id="txtFindFind" onkeyup="btnStat()" oninput="btnStat()" onpaste="btnStatDelayed()" style="width: 100%" tabindex="1" type="text" /> </td> <td> <input id="btnFind" style="width: 80px" disabled="disabled" onclick="Find();" type="button" value="Find" fcklang="DlgFindFindBtn" /> </td> </tr> <tr> <td valign="bottom" colspan="3"> &nbsp;<input id="chkCaseFind" tabindex="3" type="checkbox" /><label for="chkCaseFind" fcklang="DlgReplaceCaseChk">Match case</label> <br /> &nbsp;<input id="chkWordFind" tabindex="4" type="checkbox" /><label for="chkWordFind" fcklang="DlgReplaceWordChk">Match whole word</label> </td> </tr> </table> </div> <div id="divReplace" style="display:none"> <table cellspacing="3" cellpadding="2" width="100%" border="0"> <tr> <td nowrap="nowrap"> <label for="txtFindReplace" fcklang="DlgReplaceFindLbl"> Find what:</label> </td> <td width="100%"> <input id="txtFindReplace" onkeyup="btnStat()" oninput="btnStat()" onpaste="btnStatDelayed()" style="width: 100%" tabindex="1" type="text" /> </td> <td> <input id="btnReplace" style="width: 80px" disabled="disabled" onclick="Replace();" type="button" value="Replace" fcklang="DlgReplaceReplaceBtn" /> </td> </tr> <tr> <td valign="top" nowrap="nowrap"> <label for="txtReplace" fcklang="DlgReplaceReplaceLbl"> Replace with:</label> </td> <td valign="top"> <input id="txtReplace" style="width: 100%" tabindex="2" type="text" /> </td> <td> <input id="btnReplaceAll" style="width: 80px" disabled="disabled" onclick="ReplaceAll()" type="button" value="Replace All" fcklang="DlgReplaceReplAllBtn" /> </td> </tr> <tr> <td valign="bottom" colspan="3"> &nbsp;<input id="chkCaseReplace" tabindex="3" type="checkbox" /><label for="chkCaseReplace" fcklang="DlgReplaceCaseChk">Match case</label> <br /> &nbsp;<input id="chkWordReplace" tabindex="4" type="checkbox" /><label for="chkWordReplace" fcklang="DlgReplaceWordChk">Match whole word</label> </td> </tr> </table> </div> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_replace.html
HTML
asf20
17,051
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Source editor dialog window. --> <html> <head> <title>Source</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex, nofollow"> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script language="javascript"> var oEditor = window.parent.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKConfig = oEditor.FCKConfig ; var FCKTools = oEditor.FCKTools ; document.write( FCKTools.GetStyleHtml( GetCommonDialogCss() ) ) ; window.onload = function() { // EnableXHTML and EnableSourceXHTML has been deprecated // document.getElementById('txtSource').value = ( FCKConfig.EnableXHTML && FCKConfig.EnableSourceXHTML ? FCK.GetXHTML( FCKConfig.FormatSource ) : FCK.GetHTML( FCKConfig.FormatSource ) ) ; document.getElementById('txtSource').value = FCK.GetXHTML( FCKConfig.FormatSource ) ; // Activate the "OK" button. window.parent.SetOkButton( true ) ; } //#### The OK button was hit. function Ok() { if ( oEditor.FCKBrowserInfo.IsIE ) oEditor.FCKUndo.SaveUndoStep() ; FCK.SetData( document.getElementById('txtSource').value, false ) ; return true ; } </script> </head> <body scroll="no" style="OVERFLOW: hidden"> <table width="100%" height="100%"> <tr> <td height="100%"><textarea id="txtSource" dir="ltr" style="PADDING-RIGHT: 5px; PADDING-LEFT: 5px; FONT-SIZE: 14px; PADDING-BOTTOM: 5px; WIDTH: 100%; PADDING-TOP: 5px; FONT-FAMILY: Monospace; HEIGHT: 100%">Loading. Please wait...</textarea></td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_source.html
HTML
asf20
2,297
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Image Properties dialog window. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Image Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script src="fck_image/fck_image.js" type="text/javascript"></script> <script type="text/javascript"> document.write( FCKTools.GetStyleHtml( GetCommonDialogCss() ) ) ; </script> </head> <body scroll="no" style="overflow: hidden"> <div id="divInfo"> <table cellspacing="1" cellpadding="1" border="0" width="100%" height="100%"> <tr> <td> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td width="100%"> <span fcklang="DlgImgURL">URL</span> </td> <td id="tdBrowse" style="display: none" nowrap="nowrap" rowspan="2"> &nbsp; <input id="btnBrowse" onclick="BrowseServer();" type="button" value="Browse Server" fcklang="DlgBtnBrowseServer" /> </td> </tr> <tr> <td valign="top"> <input id="txtUrl" style="width: 100%" type="text" onblur="UpdatePreview();" /> </td> </tr> </table> </td> </tr> <tr> <td> <span fcklang="DlgImgAlt">Short Description</span><br /> <input id="txtAlt" style="width: 100%" type="text" /><br /> </td> </tr> <tr height="100%"> <td valign="top"> <table cellspacing="0" cellpadding="0" width="100%" border="0" height="100%"> <tr> <td valign="top"> <br /> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td nowrap="nowrap"> <span fcklang="DlgImgWidth">Width</span>&nbsp;</td> <td> <input type="text" size="3" id="txtWidth" onkeyup="OnSizeChanged('Width',this.value);" /></td> <td rowspan="2"> <div id="btnLockSizes" class="BtnLocked" onmouseover="this.className = (bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ) + ' BtnOver';" onmouseout="this.className = (bLockRatio ? 'BtnLocked' : 'BtnUnlocked' );" title="Lock Sizes" onclick="SwitchLock(this);"> </div> </td> <td rowspan="2"> <div id="btnResetSize" class="BtnReset" onmouseover="this.className='BtnReset BtnOver';" onmouseout="this.className='BtnReset';" title="Reset Size" onclick="ResetSizes();"> </div> </td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgImgHeight">Height</span>&nbsp;</td> <td> <input type="text" size="3" id="txtHeight" onkeyup="OnSizeChanged('Height',this.value);" /></td> </tr> </table> <br /> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td nowrap="nowrap"> <span fcklang="DlgImgBorder">Border</span>&nbsp;</td> <td> <input type="text" size="2" value="" id="txtBorder" onkeyup="UpdatePreview();" /></td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgImgHSpace">HSpace</span>&nbsp;</td> <td> <input type="text" size="2" id="txtHSpace" onkeyup="UpdatePreview();" /></td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgImgVSpace">VSpace</span>&nbsp;</td> <td> <input type="text" size="2" id="txtVSpace" onkeyup="UpdatePreview();" /></td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgImgAlign">Align</span>&nbsp;</td> <td> <select id="cmbAlign" onchange="UpdatePreview();"> <option value="" selected="selected"></option> <option fcklang="DlgImgAlignLeft" value="left">Left</option> <option fcklang="DlgImgAlignAbsBottom" value="absBottom">Abs Bottom</option> <option fcklang="DlgImgAlignAbsMiddle" value="absMiddle">Abs Middle</option> <option fcklang="DlgImgAlignBaseline" value="baseline">Baseline</option> <option fcklang="DlgImgAlignBottom" value="bottom">Bottom</option> <option fcklang="DlgImgAlignMiddle" value="middle">Middle</option> <option fcklang="DlgImgAlignRight" value="right">Right</option> <option fcklang="DlgImgAlignTextTop" value="textTop">Text Top</option> <option fcklang="DlgImgAlignTop" value="top">Top</option> </select> </td> </tr> </table> </td> <td> &nbsp;&nbsp;&nbsp;</td> <td width="100%" valign="top"> <table cellpadding="0" cellspacing="0" width="100%" style="table-layout: fixed"> <tr> <td> <span fcklang="DlgImgPreview">Preview</span></td> </tr> <tr> <td valign="top"> <iframe class="ImagePreviewArea" src="fck_image/fck_image_preview.html" frameborder="0" marginheight="0" marginwidth="0"></iframe> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </div> <div id="divUpload" style="display: none"> <form id="frmUpload" method="post" target="UploadWindow" enctype="multipart/form-data" action="" onsubmit="return CheckUpload();"> <span fcklang="DlgLnkUpload">Upload</span><br /> <input id="txtUploadFile" style="width: 100%" type="file" size="40" name="NewFile" /><br /> <br /> <input id="btnUpload" type="submit" value="Send it to the Server" fcklang="DlgLnkBtnUpload" /> <script type="text/javascript"> document.write( '<iframe name="UploadWindow" style="display: none" src="' + FCKTools.GetVoidUrl() + '"><\/iframe>' ) ; </script> </form> </div> <div id="divLink" style="display: none"> <table cellspacing="1" cellpadding="1" border="0" width="100%"> <tr> <td> <div> <span fcklang="DlgLnkURL">URL</span><br /> <input id="txtLnkUrl" style="width: 100%" type="text" onblur="UpdatePreview();" /> </div> <div id="divLnkBrowseServer" align="right"> <input type="button" value="Browse Server" fcklang="DlgBtnBrowseServer" onclick="LnkBrowseServer();" /> </div> <div> <span fcklang="DlgLnkTarget">Target</span><br /> <select id="cmbLnkTarget"> <option value="" fcklang="DlgGenNotSet" selected="selected">&lt;not set&gt;</option> <option value="_blank" fcklang="DlgLnkTargetBlank">New Window (_blank)</option> <option value="_top" fcklang="DlgLnkTargetTop">Topmost Window (_top)</option> <option value="_self" fcklang="DlgLnkTargetSelf">Same Window (_self)</option> <option value="_parent" fcklang="DlgLnkTargetParent">Parent Window (_parent)</option> </select> </div> </td> </tr> </table> </div> <div id="divAdvanced" style="display: none"> <table cellspacing="0" cellpadding="0" width="100%" align="center" border="0"> <tr> <td valign="top" width="50%"> <span fcklang="DlgGenId">Id</span><br /> <input id="txtAttId" style="width: 100%" type="text" /> </td> <td width="1"> &nbsp;&nbsp;</td> <td valign="top"> <table cellspacing="0" cellpadding="0" width="100%" align="center" border="0"> <tr> <td width="60%"> <span fcklang="DlgGenLangDir">Language Direction</span><br /> <select id="cmbAttLangDir" style="width: 100%"> <option value="" fcklang="DlgGenNotSet" selected="selected">&lt;not set&gt;</option> <option value="ltr" fcklang="DlgGenLangDirLtr">Left to Right (LTR)</option> <option value="rtl" fcklang="DlgGenLangDirRtl">Right to Left (RTL)</option> </select> </td> <td width="1%"> &nbsp;&nbsp;</td> <td nowrap="nowrap"> <span fcklang="DlgGenLangCode">Language Code</span><br /> <input id="txtAttLangCode" style="width: 100%" type="text" />&nbsp; </td> </tr> </table> </td> </tr> <tr> <td colspan="3"> &nbsp;</td> </tr> <tr> <td colspan="3"> <span fcklang="DlgGenLongDescr">Long Description URL</span><br /> <input id="txtLongDesc" style="width: 100%" type="text" /> </td> </tr> <tr> <td colspan="3"> &nbsp;</td> </tr> <tr> <td valign="top"> <span fcklang="DlgGenClass">Stylesheet Classes</span><br /> <input id="txtAttClasses" style="width: 100%" type="text" /> </td> <td> </td> <td valign="top"> &nbsp;<span fcklang="DlgGenTitle">Advisory Title</span><br /> <input id="txtAttTitle" style="width: 100%" type="text" /> </td> </tr> </table> <span fcklang="DlgGenStyle">Style</span><br /> <input id="txtAttStyle" style="width: 100%" type="text" /> </div> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_image.html
HTML
asf20
9,785
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Checkbox dialog window. --> <html> <head> <title>Checkbox Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta content="noindex, nofollow" name="robots"> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; // Gets the document DOM var oDOM = oEditor.FCK.EditorDocument ; var oActiveEl = dialog.Selection.GetSelectedElement() ; window.onload = function() { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; if ( oActiveEl && oActiveEl.tagName == 'INPUT' && oActiveEl.type == 'checkbox' ) { GetE('txtName').value = oActiveEl.name ; GetE('txtValue').value = oEditor.FCKBrowserInfo.IsIE ? oActiveEl.value : GetAttribute( oActiveEl, 'value' ) ; GetE('txtSelected').checked = oActiveEl.checked ; } else oActiveEl = null ; dialog.SetOkButton( true ) ; dialog.SetAutoSize( true ) ; SelectField( 'txtName' ) ; } function Ok() { oEditor.FCKUndo.SaveUndoStep() ; oActiveEl = CreateNamedElement( oEditor, oActiveEl, 'INPUT', {name: GetE('txtName').value, type: 'checkbox' } ) ; if ( oEditor.FCKBrowserInfo.IsIE ) oActiveEl.value = GetE('txtValue').value ; else SetAttribute( oActiveEl, 'value', GetE('txtValue').value ) ; var bIsChecked = GetE('txtSelected').checked ; SetAttribute( oActiveEl, 'checked', bIsChecked ? 'checked' : null ) ; // For Firefox oActiveEl.checked = bIsChecked ; return true ; } </script> </head> <body style="OVERFLOW: hidden" scroll="no"> <table height="100%" width="100%"> <tr> <td align="center"> <table border="0" cellpadding="0" cellspacing="0" width="80%"> <tr> <td> <span fckLang="DlgCheckboxName">Name</span><br> <input type="text" size="20" id="txtName" style="WIDTH: 100%"> </td> </tr> <tr> <td> <span fckLang="DlgCheckboxValue">Value</span><br> <input type="text" size="20" id="txtValue" style="WIDTH: 100%"> </td> </tr> <tr> <td><input type="checkbox" id="txtSelected"><label for="txtSelected" fckLang="DlgCheckboxSelected">Checked</label></td> </tr> </table> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_checkbox.html
HTML
asf20
3,109
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Preview page for the Flash dialog window. --> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex, nofollow"> <script src="../common/fck_dialog_common.js" type="text/javascript"></script> <script language="javascript"> var FCKTools = window.parent.FCKTools ; var FCKConfig = window.parent.FCKConfig ; // Sets the Skin CSS document.write( FCKTools.GetStyleHtml( FCKConfig.SkinDialogCSS ) ) ; document.write( FCKTools.GetStyleHtml( GetCommonDialogCss( '../' ) ) ) ; if ( window.parent.FCKConfig.BaseHref.length > 0 ) document.write( '<base href="' + window.parent.FCKConfig.BaseHref + '">' ) ; window.onload = function() { window.parent.SetPreviewElement( document.body ) ; } </script> </head> <body style="COLOR: #000000; BACKGROUND-COLOR: #ffffff"></body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_flash/fck_flash_preview.html
HTML
asf20
1,593
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Scripts related to the Flash dialog window (see fck_flash.html). */ var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKTools = oEditor.FCKTools ; //#### Dialog Tabs // Set the dialog tabs. dialog.AddTab( 'Info', oEditor.FCKLang.DlgInfoTab ) ; if ( FCKConfig.FlashUpload ) dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; if ( !FCKConfig.FlashDlgHideAdvanced ) dialog.AddTab( 'Advanced', oEditor.FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; } // Get the selected flash embed (if available). var oFakeImage = dialog.Selection.GetSelectedElement() ; var oEmbed ; if ( oFakeImage ) { if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fckflash') ) oEmbed = FCK.GetRealElement( oFakeImage ) ; else oFakeImage = null ; } window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; // Load the selected element information (if any). LoadSelection() ; // Show/Hide the "Browse Server" button. GetE('tdBrowse').style.display = FCKConfig.FlashBrowser ? '' : 'none' ; // Set the actual uploader URL. if ( FCKConfig.FlashUpload ) GetE('frmUpload').action = FCKConfig.FlashUploadURL ; dialog.SetAutoSize( true ) ; // Activate the "OK" button. dialog.SetOkButton( true ) ; SelectField( 'txtUrl' ) ; } function LoadSelection() { if ( ! oEmbed ) return ; GetE('txtUrl').value = GetAttribute( oEmbed, 'src', '' ) ; GetE('txtWidth').value = GetAttribute( oEmbed, 'width', '' ) ; GetE('txtHeight').value = GetAttribute( oEmbed, 'height', '' ) ; // Get Advances Attributes GetE('txtAttId').value = oEmbed.id ; GetE('chkAutoPlay').checked = GetAttribute( oEmbed, 'play', 'true' ) == 'true' ; GetE('chkLoop').checked = GetAttribute( oEmbed, 'loop', 'true' ) == 'true' ; GetE('chkMenu').checked = GetAttribute( oEmbed, 'menu', 'true' ) == 'true' ; GetE('cmbScale').value = GetAttribute( oEmbed, 'scale', '' ).toLowerCase() ; GetE('txtAttTitle').value = oEmbed.title ; if ( oEditor.FCKBrowserInfo.IsIE ) { GetE('txtAttClasses').value = oEmbed.getAttribute('className') || '' ; GetE('txtAttStyle').value = oEmbed.style.cssText ; } else { GetE('txtAttClasses').value = oEmbed.getAttribute('class',2) || '' ; GetE('txtAttStyle').value = oEmbed.getAttribute('style',2) || '' ; } UpdatePreview() ; } //#### The OK button was hit. function Ok() { if ( GetE('txtUrl').value.length == 0 ) { dialog.SetSelectedTab( 'Info' ) ; GetE('txtUrl').focus() ; alert( oEditor.FCKLang.DlgAlertUrl ) ; return false ; } oEditor.FCKUndo.SaveUndoStep() ; if ( !oEmbed ) { oEmbed = FCK.EditorDocument.createElement( 'EMBED' ) ; oFakeImage = null ; } UpdateEmbed( oEmbed ) ; if ( !oFakeImage ) { oFakeImage = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ; oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ; oFakeImage = FCK.InsertElement( oFakeImage ) ; } oEditor.FCKEmbedAndObjectProcessor.RefreshView( oFakeImage, oEmbed ) ; return true ; } function UpdateEmbed( e ) { SetAttribute( e, 'type' , 'application/x-shockwave-flash' ) ; SetAttribute( e, 'pluginspage' , 'http://www.macromedia.com/go/getflashplayer' ) ; SetAttribute( e, 'src', GetE('txtUrl').value ) ; SetAttribute( e, "width" , GetE('txtWidth').value ) ; SetAttribute( e, "height", GetE('txtHeight').value ) ; // Advances Attributes SetAttribute( e, 'id' , GetE('txtAttId').value ) ; SetAttribute( e, 'scale', GetE('cmbScale').value ) ; SetAttribute( e, 'play', GetE('chkAutoPlay').checked ? 'true' : 'false' ) ; SetAttribute( e, 'loop', GetE('chkLoop').checked ? 'true' : 'false' ) ; SetAttribute( e, 'menu', GetE('chkMenu').checked ? 'true' : 'false' ) ; SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) { SetAttribute( e, 'className', GetE('txtAttClasses').value ) ; e.style.cssText = GetE('txtAttStyle').value ; } else { SetAttribute( e, 'class', GetE('txtAttClasses').value ) ; SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; } } var ePreview ; function SetPreviewElement( previewEl ) { ePreview = previewEl ; if ( GetE('txtUrl').value.length > 0 ) UpdatePreview() ; } function UpdatePreview() { if ( !ePreview ) return ; while ( ePreview.firstChild ) ePreview.removeChild( ePreview.firstChild ) ; if ( GetE('txtUrl').value.length == 0 ) ePreview.innerHTML = '&nbsp;' ; else { var oDoc = ePreview.ownerDocument || ePreview.document ; var e = oDoc.createElement( 'EMBED' ) ; SetAttribute( e, 'src', GetE('txtUrl').value ) ; SetAttribute( e, 'type', 'application/x-shockwave-flash' ) ; SetAttribute( e, 'width', '100%' ) ; SetAttribute( e, 'height', '100%' ) ; ePreview.appendChild( e ) ; } } // <embed id="ePreview" src="fck_flash/claims.swf" width="100%" height="100%" style="visibility:hidden" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"> function BrowseServer() { OpenFileBrowser( FCKConfig.FlashBrowserURL, FCKConfig.FlashBrowserWindowWidth, FCKConfig.FlashBrowserWindowHeight ) ; } function SetUrl( url, width, height ) { GetE('txtUrl').value = url ; if ( width ) GetE('txtWidth').value = width ; if ( height ) GetE('txtHeight').value = height ; UpdatePreview() ; dialog.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { // Remove animation window.parent.Throbber.Hide() ; GetE( 'divUpload' ).style.display = '' ; switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; case 500 : alert( 'The connector is disabled' ) ; break ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.FlashUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.FlashUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.FlashUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.FlashUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } // Show animation window.parent.Throbber.Show( 100 ) ; GetE( 'divUpload' ).style.display = 'none' ; return true ; }
zzshop
trunk/includes/fckeditor/editor/dialog/fck_flash/fck_flash.js
JavaScript
asf20
8,279
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * "About" dialog window. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var oEditor = window.parent.InnerDialogLoaded() ; var FCKLang = oEditor.FCKLang ; window.parent.AddTab( 'About', FCKLang.DlgAboutAboutTab ) ; window.parent.AddTab( 'License', FCKLang.DlgAboutLicenseTab ) ; window.parent.AddTab( 'BrowserInfo', FCKLang.DlgAboutBrowserInfoTab ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divAbout', ( tabCode == 'About' ) ) ; ShowE('divLicense', ( tabCode == 'License' ) ) ; ShowE('divInfo' , ( tabCode == 'BrowserInfo' ) ) ; } function SendEMail() { var eMail = 'mailto:' ; eMail += 'fredck' ; eMail += '@' ; eMail += 'fckeditor' ; eMail += '.' ; eMail += 'net' ; window.location = eMail ; } window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; window.parent.SetAutoSize( true ) ; } </script> </head> <body style="overflow: hidden"> <div id="divAbout"> <table cellpadding="0" cellspacing="0" border="0" width="100%" style="height: 100%"> <tr> <td colspan="2"> <img alt="" src="fck_about/logo_fckeditor.gif" width="236" height="41" align="left" /> <table width="80" border="0" cellspacing="0" cellpadding="5" bgcolor="#ffffff" align="right"> <tr> <td align="center" nowrap="nowrap" style="border-right: #000000 1px solid; border-top: #000000 1px solid; border-left: #000000 1px solid; border-bottom: #000000 1px solid"> <span fcklang="DlgAboutVersion">version</span> <br /> <b>2.6.3</b><br /> Build 19836</td> </tr> </table> </td> </tr> <tr style="height: 100%"> <td align="center" valign="middle"> <span style="font-size: 14px" dir="ltr"> <b><a href="http://www.fckeditor.net/?about" target="_blank" title="Visit the FCKeditor web site"> Support <b>Open Source</b> Software</a></b> </span> <div style="padding-top:15px"> <img alt="" src="fck_about/logo_fredck.gif" width="87" height="36" /> </div> </td> <td align="center" nowrap="nowrap" valign="middle"> <div> <div style="margin-bottom:5px" dir="ltr">Selected Sponsor</div> <a href="http://www.spellchecker.net/fckeditor/" target="_blank"><img alt="Selected Sponsor" border="0" src="fck_about/sponsors/spellchecker_net.gif" width="75" height="75" /></a> </div> </td> </tr> <tr> <td width="100%" nowrap="nowrap"> <span fcklang="DlgAboutInfo">For further information go to</span> <a href="http://www.fckeditor.net/?About" target="_blank">http://www.fckeditor.net/</a>. <br /> Copyright &copy; 2003-2008 <a href="#" onclick="SendEMail();">Frederico Caldeira Knabben</a> </td> <td align="center"> <a href="http://www.fckeditor.net/sponsors/apply" target="_blank">Become a Sponsor</a> </td> </tr> </table> </div> <div id="divLicense" style="display: none"> <p> Licensed under the terms of any of the following licenses at your choice: </p> <ul> <li style="margin-bottom:15px"> <b>GNU General Public License</b> Version 2 or later (the "GPL")<br /> <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">http://www.gnu.org/licenses/gpl.html</a> </li> <li style="margin-bottom:15px"> <b>GNU Lesser General Public License</b> Version 2.1 or later (the "LGPL")<br /> <a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">http://www.gnu.org/licenses/lgpl.html</a> </li> <li> <b>Mozilla Public License</b> Version 1.1 or later (the "MPL")<br /> <a href="http://www.mozilla.org/MPL/MPL-1.1.html" target="_blank">http://www.mozilla.org/MPL/MPL-1.1.html</a> </li> </ul> </div> <div id="divInfo" style="display: none" dir="ltr"> <table align="center" width="80%" border="0"> <tr> <td> <script type="text/javascript"> <!-- document.write( '<b>User Agent<\/b><br />' + window.navigator.userAgent + '<br /><br />' ) ; document.write( '<b>Browser<\/b><br />' + window.navigator.appName + ' ' + window.navigator.appVersion + '<br /><br />' ) ; document.write( '<b>Platform<\/b><br />' + window.navigator.platform + '<br /><br />' ) ; var sUserLang = '?' ; if ( window.navigator.language ) sUserLang = window.navigator.language.toLowerCase() ; else if ( window.navigator.userLanguage ) sUserLang = window.navigator.userLanguage.toLowerCase() ; document.write( '<b>User Language<\/b><br />' + sUserLang ) ; //--> </script> </td> </tr> </table> </div> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_about.html
HTML
asf20
5,684
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Link dialog window. --> <html> <head> <title>Link Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script src="fck_link/fck_link.js" type="text/javascript"></script> </head> <body scroll="no" style="OVERFLOW: hidden"> <div id="divInfo" style="DISPLAY: none"> <span fckLang="DlgLnkType">Link Type</span><br /> <select id="cmbLinkType" onchange="SetLinkType(this.value);"> <option value="url" fckLang="DlgLnkTypeURL" selected="selected">URL</option> <option value="anchor" fckLang="DlgLnkTypeAnchor">Anchor in this page</option> <option value="email" fckLang="DlgLnkTypeEMail">E-Mail</option> </select> <br /> <br /> <div id="divLinkTypeUrl"> <table cellspacing="0" cellpadding="0" width="100%" border="0" dir="ltr"> <tr> <td nowrap="nowrap"> <span fckLang="DlgLnkProto">Protocol</span><br /> <select id="cmbLinkProtocol"> <option value="http://" selected="selected">http://</option> <option value="https://">https://</option> <option value="ftp://">ftp://</option> <option value="news://">news://</option> <option value="" fckLang="DlgLnkProtoOther">&lt;other&gt;</option> </select> </td> <td nowrap="nowrap">&nbsp;</td> <td nowrap="nowrap" width="100%"> <span fckLang="DlgLnkURL">URL</span><br /> <input id="txtUrl" style="WIDTH: 100%" type="text" onkeyup="OnUrlChange();" onchange="OnUrlChange();" /> </td> </tr> </table> <br /> <div id="divBrowseServer"> <input type="button" value="Browse Server" fckLang="DlgBtnBrowseServer" onclick="BrowseServer();" /> </div> </div> <div id="divLinkTypeAnchor" style="DISPLAY: none" align="center"> <div id="divSelAnchor" style="DISPLAY: none"> <table cellspacing="0" cellpadding="0" border="0" width="70%"> <tr> <td colspan="3"> <span fckLang="DlgLnkAnchorSel">Select an Anchor</span> </td> </tr> <tr> <td width="50%"> <span fckLang="DlgLnkAnchorByName">By Anchor Name</span><br /> <select id="cmbAnchorName" onchange="GetE('cmbAnchorId').value='';" style="WIDTH: 100%"> <option value="" selected="selected"></option> </select> </td> <td>&nbsp;&nbsp;&nbsp;</td> <td width="50%"> <span fckLang="DlgLnkAnchorById">By Element Id</span><br /> <select id="cmbAnchorId" onchange="GetE('cmbAnchorName').value='';" style="WIDTH: 100%"> <option value="" selected="selected"></option> </select> </td> </tr> </table> </div> <div id="divNoAnchor" style="DISPLAY: none"> <span fckLang="DlgLnkNoAnchors">&lt;No anchors available in the document&gt;</span> </div> </div> <div id="divLinkTypeEMail" style="DISPLAY: none"> <span fckLang="DlgLnkEMail">E-Mail Address</span><br /> <input id="txtEMailAddress" style="WIDTH: 100%" type="text" /><br /> <span fckLang="DlgLnkEMailSubject">Message Subject</span><br /> <input id="txtEMailSubject" style="WIDTH: 100%" type="text" /><br /> <span fckLang="DlgLnkEMailBody">Message Body</span><br /> <textarea id="txtEMailBody" style="WIDTH: 100%" rows="3" cols="20"></textarea> </div> </div> <div id="divUpload" style="DISPLAY: none"> <form id="frmUpload" method="post" target="UploadWindow" enctype="multipart/form-data" action="" onsubmit="return CheckUpload();"> <span fckLang="DlgLnkUpload">Upload</span><br /> <input id="txtUploadFile" style="WIDTH: 100%" type="file" size="40" name="NewFile" /><br /> <br /> <input id="btnUpload" type="submit" value="Send it to the Server" fckLang="DlgLnkBtnUpload" /> <script type="text/javascript"> document.write( '<iframe name="UploadWindow" style="display: none" src="' + FCKTools.GetVoidUrl() + '"><\/iframe>' ) ; </script> </form> </div> <div id="divTarget" style="DISPLAY: none"> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td nowrap="nowrap"> <span fckLang="DlgLnkTarget">Target</span><br /> <select id="cmbTarget" onchange="SetTarget(this.value);"> <option value="" fckLang="DlgGenNotSet" selected="selected">&lt;not set&gt;</option> <option value="frame" fckLang="DlgLnkTargetFrame">&lt;frame&gt;</option> <option value="popup" fckLang="DlgLnkTargetPopup">&lt;popup window&gt;</option> <option value="_blank" fckLang="DlgLnkTargetBlank">New Window (_blank)</option> <option value="_top" fckLang="DlgLnkTargetTop">Topmost Window (_top)</option> <option value="_self" fckLang="DlgLnkTargetSelf">Same Window (_self)</option> <option value="_parent" fckLang="DlgLnkTargetParent">Parent Window (_parent)</option> </select> </td> <td>&nbsp;</td> <td id="tdTargetFrame" nowrap="nowrap" width="100%"> <span fckLang="DlgLnkTargetFrameName">Target Frame Name</span><br /> <input id="txtTargetFrame" style="WIDTH: 100%" type="text" onkeyup="OnTargetNameChange();" onchange="OnTargetNameChange();" /> </td> <td id="tdPopupName" style="DISPLAY: none" nowrap="nowrap" width="100%"> <span fckLang="DlgLnkPopWinName">Popup Window Name</span><br /> <input id="txtPopupName" style="WIDTH: 100%" type="text" /> </td> </tr> </table> <br /> <table id="tablePopupFeatures" style="DISPLAY: none" cellspacing="0" cellpadding="0" align="center" border="0"> <tr> <td> <span fckLang="DlgLnkPopWinFeat">Popup Window Features</span><br /> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td valign="top" nowrap="nowrap" width="50%"> <input id="chkPopupResizable" name="chkFeature" value="resizable" type="checkbox" /><label for="chkPopupResizable" fckLang="DlgLnkPopResize">Resizable</label><br /> <input id="chkPopupLocationBar" name="chkFeature" value="location" type="checkbox" /><label for="chkPopupLocationBar" fckLang="DlgLnkPopLocation">Location Bar</label><br /> <input id="chkPopupManuBar" name="chkFeature" value="menubar" type="checkbox" /><label for="chkPopupManuBar" fckLang="DlgLnkPopMenu">Menu Bar</label><br /> <input id="chkPopupScrollBars" name="chkFeature" value="scrollbars" type="checkbox" /><label for="chkPopupScrollBars" fckLang="DlgLnkPopScroll">Scroll Bars</label> </td> <td></td> <td valign="top" nowrap="nowrap" width="50%"> <input id="chkPopupStatusBar" name="chkFeature" value="status" type="checkbox" /><label for="chkPopupStatusBar" fckLang="DlgLnkPopStatus">Status Bar</label><br /> <input id="chkPopupToolbar" name="chkFeature" value="toolbar" type="checkbox" /><label for="chkPopupToolbar" fckLang="DlgLnkPopToolbar">Toolbar</label><br /> <input id="chkPopupFullScreen" name="chkFeature" value="fullscreen" type="checkbox" /><label for="chkPopupFullScreen" fckLang="DlgLnkPopFullScrn">Full Screen (IE)</label><br /> <input id="chkPopupDependent" name="chkFeature" value="dependent" type="checkbox" /><label for="chkPopupDependent" fckLang="DlgLnkPopDependent">Dependent (Netscape)</label> </td> </tr> <tr> <td valign="top" nowrap="nowrap" width="50%">&nbsp;</td> <td></td> <td valign="top" nowrap="nowrap" width="50%"></td> </tr> <tr> <td valign="top"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td nowrap="nowrap"><span fckLang="DlgLnkPopWidth">Width</span></td> <td>&nbsp;<input id="txtPopupWidth" type="text" maxlength="4" size="4" /></td> </tr> <tr> <td nowrap="nowrap"><span fckLang="DlgLnkPopHeight">Height</span></td> <td>&nbsp;<input id="txtPopupHeight" type="text" maxlength="4" size="4" /></td> </tr> </table> </td> <td>&nbsp;&nbsp;</td> <td valign="top"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td nowrap="nowrap"><span fckLang="DlgLnkPopLeft">Left Position</span></td> <td>&nbsp;<input id="txtPopupLeft" type="text" maxlength="4" size="4" /></td> </tr> <tr> <td nowrap="nowrap"><span fckLang="DlgLnkPopTop">Top Position</span></td> <td>&nbsp;<input id="txtPopupTop" type="text" maxlength="4" size="4" /></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </div> <div id="divAttribs" style="DISPLAY: none"> <table cellspacing="0" cellpadding="0" width="100%" align="center" border="0"> <tr> <td valign="top" width="50%"> <span fckLang="DlgGenId">Id</span><br /> <input id="txtAttId" style="WIDTH: 100%" type="text" /> </td> <td width="1"></td> <td valign="top"> <table cellspacing="0" cellpadding="0" width="100%" align="center" border="0"> <tr> <td width="60%"> <span fckLang="DlgGenLangDir">Language Direction</span><br /> <select id="cmbAttLangDir" style="WIDTH: 100%"> <option value="" fckLang="DlgGenNotSet" selected>&lt;not set&gt;</option> <option value="ltr" fckLang="DlgGenLangDirLtr">Left to Right (LTR)</option> <option value="rtl" fckLang="DlgGenLangDirRtl">Right to Left (RTL)</option> </select> </td> <td width="1%">&nbsp;&nbsp;&nbsp;</td> <td nowrap="nowrap"><span fckLang="DlgGenAccessKey">Access Key</span><br /> <input id="txtAttAccessKey" style="WIDTH: 100%" type="text" maxlength="1" size="1" /> </td> </tr> </table> </td> </tr> <tr> <td valign="top" width="50%"> <span fckLang="DlgGenName">Name</span><br /> <input id="txtAttName" style="WIDTH: 100%" type="text" /> </td> <td width="1"></td> <td valign="top"> <table cellspacing="0" cellpadding="0" width="100%" align="center" border="0"> <tr> <td width="60%"> <span fckLang="DlgGenLangCode">Language Code</span><br /> <input id="txtAttLangCode" style="WIDTH: 100%" type="text" /> </td> <td width="1%">&nbsp;&nbsp;&nbsp;</td> <td nowrap="nowrap"> <span fckLang="DlgGenTabIndex">Tab Index</span><br /> <input id="txtAttTabIndex" style="WIDTH: 100%" type="text" maxlength="5" size="5" /> </td> </tr> </table> </td> </tr> <tr> <td valign="top" width="50%">&nbsp;</td> <td width="1"></td> <td valign="top"></td> </tr> <tr> <td valign="top" width="50%"> <span fckLang="DlgGenTitle">Advisory Title</span><br /> <input id="txtAttTitle" style="WIDTH: 100%" type="text" /> </td> <td width="1">&nbsp;&nbsp;&nbsp;</td> <td valign="top"> <span fckLang="DlgGenContType">Advisory Content Type</span><br /> <input id="txtAttContentType" style="WIDTH: 100%" type="text" /> </td> </tr> <tr> <td valign="top"> <span fckLang="DlgGenClass">Stylesheet Classes</span><br /> <input id="txtAttClasses" style="WIDTH: 100%" type="text" /> </td> <td></td> <td valign="top"> <span fckLang="DlgGenLinkCharset">Linked Resource Charset</span><br /> <input id="txtAttCharSet" style="WIDTH: 100%" type="text" /> </td> </tr> </table> <table cellspacing="0" cellpadding="0" width="100%" align="center" border="0"> <tr> <td> <span fckLang="DlgGenStyle">Style</span><br /> <input id="txtAttStyle" style="WIDTH: 100%" type="text" /> </td> </tr> </table> </div> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_link.html
HTML
asf20
12,885
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Text Area dialog window. --> <html> <head> <title>Text Area Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta content="noindex, nofollow" name="robots"> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; // Gets the document DOM var oDOM = oEditor.FCK.EditorDocument ; var oActiveEl = dialog.Selection.GetSelectedElement() ; window.onload = function() { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; if ( oActiveEl && oActiveEl.tagName == 'TEXTAREA' ) { GetE('txtName').value = oActiveEl.name ; GetE('txtCols').value = GetAttribute( oActiveEl, 'cols' ) ; GetE('txtRows').value = GetAttribute( oActiveEl, 'rows' ) ; } else oActiveEl = null ; dialog.SetOkButton( true ) ; dialog.SetAutoSize( true ) ; SelectField( 'txtName' ) ; } function Ok() { oEditor.FCKUndo.SaveUndoStep() ; oActiveEl = CreateNamedElement( oEditor, oActiveEl, 'TEXTAREA', {name: GetE('txtName').value} ) ; SetAttribute( oActiveEl, 'cols', GetE('txtCols').value ) ; SetAttribute( oActiveEl, 'rows', GetE('txtRows').value ) ; return true ; } </script> </head> <body style="overflow: hidden"> <table height="100%" width="100%"> <tr> <td align="center"> <table border="0" cellpadding="0" cellspacing="0" width="80%"> <tr> <td> <span fckLang="DlgTextareaName">Name</span><br> <input type="text" id="txtName" style="WIDTH: 100%"> <span fckLang="DlgTextareaCols">Collumns</span><br> <input id="txtCols" type="text" size="5"> <br> <span fckLang="DlgTextareaRows">Rows</span><br> <input id="txtRows" type="text" size="5"> </td> </tr> </table> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_textarea.html
HTML
asf20
2,697
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>File Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script src="fck_UpFileBtn/fck_UpFileBtn.js" type="text/javascript"></script> </head> <body scroll="no" style="OVERFLOW: hidden"> <!----> <div id="divUpload" style="DISPLAY: ''"> <form id="frmUpload" method="post" target="UploadWindow" enctype="multipart/form-data" action="" onSubmit="return CheckUpload();"> <span fckLang="DlgLnkUpload">Upload</span><br /> <input id="txtUploadFile_0" style="WIDTH: 100%" type="file" size="40" name="NewFile[]" /><br /> <input id="txtUploadFile_1" style="WIDTH: 100%" type="file" size="40" name="NewFile[]" /><br /> <input id="txtUploadFile_2" style="WIDTH: 100%" type="file" size="40" name="NewFile[]" /><br /> <input id="txtUploadFile_3" style="WIDTH: 100%" type="file" size="40" name="NewFile[]" /><br /> <input id="txtUploadFile_4" style="WIDTH: 100%" type="file" size="40" name="NewFile[]" /><br /> <br /> <input id="btnUpload" type="submit" value="Send it to the Server" fckLang="DlgLnkBtnUpload" /> <script type="text/javascript"> document.write( '<iframe name="UploadWindow" style="display: none" src="' + FCKTools.GetVoidUrl() + '"><\/iframe>' ) ; </script> </form> </div> <!--end!--> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_UpFileBtn.html
HTML
asf20
1,571
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Link dialog window. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta content="noindex, nofollow" name="robots" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var oEditor = window.parent.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; //#### Dialog Tabs // Set the dialog tabs. window.parent.AddTab( 'General' , FCKLang.DlgDocGeneralTab ) ; window.parent.AddTab( 'Background' , FCKLang.DlgDocBackTab ) ; window.parent.AddTab( 'Colors' , FCKLang.DlgDocColorsTab ) ; window.parent.AddTab( 'Meta' , FCKLang.DlgDocMetaTab ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE( 'divGeneral' , ( tabCode == 'General' ) ) ; ShowE( 'divBackground' , ( tabCode == 'Background' ) ) ; ShowE( 'divColors' , ( tabCode == 'Colors' ) ) ; ShowE( 'divMeta' , ( tabCode == 'Meta' ) ) ; ShowE( 'ePreview' , ( tabCode == 'Background' || tabCode == 'Colors' ) ) ; } //#### Get Base elements from the document: BEGIN // The HTML element of the document. var oHTML = FCK.EditorDocument.getElementsByTagName('html')[0] ; // The HEAD element of the document. var oHead = oHTML.getElementsByTagName('head')[0] ; var oBody = FCK.EditorDocument.body ; // This object contains all META tags defined in the document. var oMetaTags = new Object() ; // Get all META tags defined in the document. AppendMetaCollection( oMetaTags, oHead.getElementsByTagName('meta') ) ; AppendMetaCollection( oMetaTags, oHead.getElementsByTagName('fck:meta') ) ; function AppendMetaCollection( targetObject, metaCollection ) { // Loop throw all METAs and put it in the HashTable. for ( var i = 0 ; i < metaCollection.length ; i++ ) { // Try to get the "name" attribute. var sName = GetAttribute( metaCollection[i], 'name', GetAttribute( metaCollection[i], '___fcktoreplace:name', '' ) ) ; // If no "name", try with the "http-equiv" attribute. if ( sName.length == 0 ) { if ( oEditor.FCKBrowserInfo.IsIE ) { // Get the http-equiv value from the outerHTML. var oHttpEquivMatch = metaCollection[i].outerHTML.match( oEditor.FCKRegexLib.MetaHttpEquiv ) ; if ( oHttpEquivMatch ) sName = oHttpEquivMatch[1] ; } else sName = GetAttribute( metaCollection[i], 'http-equiv', '' ) ; } if ( sName.length > 0 ) targetObject[ sName.toLowerCase() ] = metaCollection[i] ; } } //#### END // Set a META tag in the document. function SetMetadata( name, content, isHttp ) { if ( content.length == 0 ) { RemoveMetadata( name ) ; return ; } var oMeta = oMetaTags[ name.toLowerCase() ] ; if ( !oMeta ) { oMeta = oHead.appendChild( FCK.EditorDocument.createElement('META') ) ; if ( isHttp ) SetAttribute( oMeta, 'http-equiv', name ) ; else { // On IE, it is not possible to set the "name" attribute of the META tag. // So a temporary attribute is used and it is replaced when getting the // editor's HTML/XHTML value. This is sad, I know :( if ( oEditor.FCKBrowserInfo.IsIE ) SetAttribute( oMeta, '___fcktoreplace:name', name ) ; else SetAttribute( oMeta, 'name', name ) ; } oMetaTags[ name.toLowerCase() ] = oMeta ; } SetAttribute( oMeta, 'content', content ) ; // oMeta.content = content ; } function RemoveMetadata( name ) { var oMeta = oMetaTags[ name.toLowerCase() ] ; if ( oMeta && oMeta != null ) { oMeta.parentNode.removeChild( oMeta ) ; oMetaTags[ name.toLowerCase() ] = null ; } } function GetMetadata( name ) { var oMeta = oMetaTags[ name.toLowerCase() ] ; if ( oMeta && oMeta != null ) return oMeta.getAttribute( 'content', 2 ) ; else return '' ; } window.onload = function () { // Show/Hide the "Browse Server" button. GetE('tdBrowse').style.display = oEditor.FCKConfig.ImageBrowser ? "" : "none"; // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage( document ) ; FillFields() ; UpdatePreview() ; // Show the "Ok" button. window.parent.SetOkButton( true ) ; window.parent.SetAutoSize( true ) ; } function FillFields() { // ### General Info GetE('txtPageTitle').value = FCK.EditorDocument.title ; GetE('selDirection').value = GetAttribute( oHTML, 'dir', '' ) ; GetE('txtLang').value = GetAttribute( oHTML, 'xml:lang', GetAttribute( oHTML, 'lang', '' ) ) ; // "xml:lang" takes precedence to "lang". // Character Set Encoding. // if ( oEditor.FCKBrowserInfo.IsIE ) // var sCharSet = FCK.EditorDocument.charset ; // else var sCharSet = GetMetadata( 'Content-Type' ) ; if ( sCharSet != null && sCharSet.length > 0 ) { // if ( !oEditor.FCKBrowserInfo.IsIE ) sCharSet = sCharSet.match( /[^=]*$/ ) ; GetE('selCharSet').value = sCharSet ; if ( GetE('selCharSet').selectedIndex == -1 ) { GetE('selCharSet').value = '...' ; GetE('txtCustomCharSet').value = sCharSet ; CheckOther( GetE('selCharSet'), 'txtCustomCharSet' ) ; } } // Document Type. if ( FCK.DocTypeDeclaration && FCK.DocTypeDeclaration.length > 0 ) { GetE('selDocType').value = FCK.DocTypeDeclaration ; if ( GetE('selDocType').selectedIndex == -1 ) { GetE('selDocType').value = '...' ; GetE('txtDocType').value = FCK.DocTypeDeclaration ; CheckOther( GetE('selDocType'), 'txtDocType' ) ; } } // Document Type. GetE('chkIncXHTMLDecl').checked = ( FCK.XmlDeclaration && FCK.XmlDeclaration.length > 0 ) ; // ### Background GetE('txtBackColor').value = GetAttribute( oBody, 'bgColor' , '' ) ; GetE('txtBackImage').value = GetAttribute( oBody, 'background' , '' ) ; GetE('chkBackNoScroll').checked = ( GetAttribute( oBody, 'bgProperties', '' ).toLowerCase() == 'fixed' ) ; // ### Colors GetE('txtColorText').value = GetAttribute( oBody, 'text' , '' ) ; GetE('txtColorLink').value = GetAttribute( oBody, 'link' , '' ) ; GetE('txtColorVisited').value = GetAttribute( oBody, 'vLink' , '' ) ; GetE('txtColorActive').value = GetAttribute( oBody, 'aLink' , '' ) ; // ### Margins GetE('txtMarginTop').value = GetAttribute( oBody, 'topMargin' , '' ) ; GetE('txtMarginLeft').value = GetAttribute( oBody, 'leftMargin' , '' ) ; GetE('txtMarginRight').value = GetAttribute( oBody, 'rightMargin' , '' ) ; GetE('txtMarginBottom').value = GetAttribute( oBody, 'bottomMargin' , '' ) ; // ### Meta Data GetE('txtMetaKeywords').value = GetMetadata( 'keywords' ) ; GetE('txtMetaDescription').value = GetMetadata( 'description' ) ; GetE('txtMetaAuthor').value = GetMetadata( 'author' ) ; GetE('txtMetaCopyright').value = GetMetadata( 'copyright' ) ; } // Called when the "Ok" button is clicked. function Ok() { // ### General Info FCK.EditorDocument.title = GetE('txtPageTitle').value ; var oHTML = FCK.EditorDocument.getElementsByTagName('html')[0] ; SetAttribute( oHTML, 'dir' , GetE('selDirection').value ) ; SetAttribute( oHTML, 'lang' , GetE('txtLang').value ) ; SetAttribute( oHTML, 'xml:lang' , GetE('txtLang').value ) ; // Character Set Enconding. var sCharSet = GetE('selCharSet').value ; if ( sCharSet == '...' ) sCharSet = GetE('txtCustomCharSet').value ; if ( sCharSet.length > 0 ) sCharSet = 'text/html; charset=' + sCharSet ; // if ( oEditor.FCKBrowserInfo.IsIE ) // FCK.EditorDocument.charset = sCharSet ; // else SetMetadata( 'Content-Type', sCharSet, true ) ; // Document Type var sDocType = GetE('selDocType').value ; if ( sDocType == '...' ) sDocType = GetE('txtDocType').value ; FCK.DocTypeDeclaration = sDocType ; // XHTML Declarations. if ( GetE('chkIncXHTMLDecl').checked ) { if ( sCharSet.length == 0 ) sCharSet = 'utf-8' ; FCK.XmlDeclaration = '<' + '?xml version="1.0" encoding="' + sCharSet + '"?>' ; SetAttribute( oHTML, 'xmlns', 'http://www.w3.org/1999/xhtml' ) ; } else { FCK.XmlDeclaration = null ; oHTML.removeAttribute( 'xmlns', 0 ) ; } // ### Background SetAttribute( oBody, 'bgcolor' , GetE('txtBackColor').value ) ; SetAttribute( oBody, 'background' , GetE('txtBackImage').value ) ; SetAttribute( oBody, 'bgproperties' , GetE('chkBackNoScroll').checked ? 'fixed' : '' ) ; // ### Colors SetAttribute( oBody, 'text' , GetE('txtColorText').value ) ; SetAttribute( oBody, 'link' , GetE('txtColorLink').value ) ; SetAttribute( oBody, 'vlink', GetE('txtColorVisited').value ) ; SetAttribute( oBody, 'alink', GetE('txtColorActive').value ) ; // ### Margins SetAttribute( oBody, 'topmargin' , GetE('txtMarginTop').value ) ; SetAttribute( oBody, 'leftmargin' , GetE('txtMarginLeft').value ) ; SetAttribute( oBody, 'rightmargin' , GetE('txtMarginRight').value ) ; SetAttribute( oBody, 'bottommargin' , GetE('txtMarginBottom').value ) ; // ### Meta data SetMetadata( 'keywords' , GetE('txtMetaKeywords').value ) ; SetMetadata( 'description' , GetE('txtMetaDescription').value ) ; SetMetadata( 'author' , GetE('txtMetaAuthor').value ) ; SetMetadata( 'copyright' , GetE('txtMetaCopyright').value ) ; return true ; } var bPreviewIsLoaded = false ; var oPreviewWindow ; var oPreviewBody ; // Called by the Preview page when loaded. function OnPreviewLoad( previewWindow, previewBody ) { oPreviewWindow = previewWindow ; oPreviewBody = previewBody ; bPreviewIsLoaded = true ; UpdatePreview() ; } function UpdatePreview() { if ( !bPreviewIsLoaded ) return ; // ### Background SetAttribute( oPreviewBody, 'bgcolor' , GetE('txtBackColor').value ) ; SetAttribute( oPreviewBody, 'background' , GetE('txtBackImage').value ) ; SetAttribute( oPreviewBody, 'bgproperties' , GetE('chkBackNoScroll').checked ? 'fixed' : '' ) ; // ### Colors SetAttribute( oPreviewBody, 'text', GetE('txtColorText').value ) ; oPreviewWindow.SetLinkColor( GetE('txtColorLink').value ) ; oPreviewWindow.SetVisitedColor( GetE('txtColorVisited').value ) ; oPreviewWindow.SetActiveColor( GetE('txtColorActive').value ) ; } function CheckOther( combo, txtField ) { var bNotOther = ( combo.value != '...' ) ; GetE(txtField).style.backgroundColor = ( bNotOther ? '#cccccc' : '' ) ; GetE(txtField).disabled = bNotOther ; } function SetColor( inputId, color ) { GetE( inputId ).value = color + '' ; UpdatePreview() ; } function SelectBackColor( color ) { SetColor('txtBackColor', color ) ; } function SelectColorText( color ) { SetColor('txtColorText', color ) ; } function SelectColorLink( color ) { SetColor('txtColorLink', color ) ; } function SelectColorVisited( color ) { SetColor('txtColorVisited', color ) ; } function SelectColorActive( color ) { SetColor('txtColorActive', color ) ; } function SelectColor( wich ) { switch ( wich ) { case 'Back' : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, SelectBackColor, window ) ; return ; case 'ColorText' : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, SelectColorText, window ) ; return ; case 'ColorLink' : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, SelectColorLink, window ) ; return ; case 'ColorVisited' : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, SelectColorVisited, window ) ; return ; case 'ColorActive' : oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, SelectColorActive, window ) ; return ; } } function BrowseServerBack() { OpenFileBrowser( FCKConfig.ImageBrowserURL, FCKConfig.ImageBrowserWindowWidth, FCKConfig.ImageBrowserWindowHeight ) ; } function SetUrl( url ) { GetE('txtBackImage').value = url ; UpdatePreview() ; } </script> </head> <body style="overflow: hidden"> <table cellspacing="0" cellpadding="0" width="100%" border="0" style="height: 100%"> <tr> <td valign="top" style="height: 100%"> <div id="divGeneral"> <span fcklang="DlgDocPageTitle">Page Title</span><br /> <input id="txtPageTitle" style="width: 100%" type="text" /> <br /> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td> <span fcklang="DlgDocLangDir">Language Direction</span><br /> <select id="selDirection"> <option value="" selected="selected"></option> <option value="ltr" fcklang="DlgDocLangDirLTR">Left to Right (LTR)</option> <option value="rtl" fcklang="DlgDocLangDirRTL">Right to Left (RTL)</option> </select> </td> <td> &nbsp;&nbsp;&nbsp;</td> <td> <span fcklang="DlgDocLangCode">Language Code</span><br /> <input id="txtLang" type="text" /> </td> </tr> </table> <br /> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td style="white-space: nowrap"> <span fcklang="DlgDocCharSet">Character Set Encoding</span><br /> <select id="selCharSet" onchange="CheckOther( this, 'txtCustomCharSet' );"> <option value="" selected="selected"></option> <option value="us-ascii">ASCII</option> <option fcklang="DlgDocCharSetCE" value="iso-8859-2">Central European</option> <option fcklang="DlgDocCharSetCT" value="big5">Chinese Traditional (Big5)</option> <option fcklang="DlgDocCharSetCR" value="iso-8859-5">Cyrillic</option> <option fcklang="DlgDocCharSetGR" value="iso-8859-7">Greek</option> <option fcklang="DlgDocCharSetJP" value="iso-2022-jp">Japanese</option> <option fcklang="DlgDocCharSetKR" value="iso-2022-kr">Korean</option> <option fcklang="DlgDocCharSetTR" value="iso-8859-9">Turkish</option> <option fcklang="DlgDocCharSetUN" value="utf-8">Unicode (UTF-8)</option> <option fcklang="DlgDocCharSetWE" value="iso-8859-1">Western European</option> <option fcklang="DlgOpOther" value="...">&lt;Other&gt;</option> </select> </td> <td> &nbsp;&nbsp;&nbsp;</td> <td width="100%"> <span fcklang="DlgDocCharSetOther">Other Character Set Encoding</span><br /> <input id="txtCustomCharSet" style="width: 100%; background-color: #cccccc" disabled="disabled" type="text" /> </td> </tr> <tr> <td colspan="3"> &nbsp;</td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgDocDocType">Document Type Heading</span><br /> <select id="selDocType" name="selDocType" onchange="CheckOther( this, 'txtDocType' );"> <option value="" selected="selected"></option> <option value='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">'>HTML 4.01 Transitional</option> <option value='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">'> HTML 4.01 Strict</option> <option value='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">'> HTML 4.01 Frameset</option> <option value='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'> XHTML 1.0 Transitional</option> <option value='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'> XHTML 1.0 Strict</option> <option value='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">'> XHTML 1.0 Frameset</option> <option value='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">'> XHTML 1.1</option> <option value='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">'>HTML 3.2</option> <option value='<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">'>HTML 2.0</option> <option value="..." fcklang="DlgOpOther">&lt;Other&gt;</option> </select> </td> <td> </td> <td width="100%"> <span fcklang="DlgDocDocTypeOther">Other Document Type Heading</span><br /> <input id="txtDocType" style="width: 100%; background-color: #cccccc" disabled="disabled" type="text" /> </td> </tr> </table> <br /> <input id="chkIncXHTMLDecl" type="checkbox" /> <label for="chkIncXHTMLDecl" fcklang="DlgDocIncXHTML"> Include XHTML Declarations</label> </div> <div id="divBackground" style="display: none"> <span fcklang="DlgDocBgColor">Background Color</span><br /> <input id="txtBackColor" type="text" onchange="UpdatePreview();" onkeyup="UpdatePreview();" />&nbsp;<input id="btnSelBackColor" onclick="SelectColor( 'Back' )" type="button" value="Select..." fcklang="DlgCellBtnSelect" /><br /> <br /> <span fcklang="DlgDocBgImage">Background Image URL</span><br /> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td width="100%"> <input id="txtBackImage" style="width: 100%" type="text" onchange="UpdatePreview();" onkeyup="UpdatePreview();" /></td> <td id="tdBrowse" nowrap="nowrap"> &nbsp;<input id="btnBrowse" onclick="BrowseServerBack();" type="button" fcklang="DlgBtnBrowseServer" value="Browse Server" /></td> </tr> </table> <input id="chkBackNoScroll" type="checkbox" onclick="UpdatePreview();" /> <label for="chkBackNoScroll" fcklang="DlgDocBgNoScroll"> Nonscrolling Background</label> </div> <div id="divColors" style="display: none"> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td> <span fcklang="DlgDocCText">Text</span><br /> <input id="txtColorText" type="text" onchange="UpdatePreview();" onkeyup="UpdatePreview();" /><input onclick="SelectColor( 'ColorText' )" type="button" value="Select..." fcklang="DlgCellBtnSelect" /> <br /> <span fcklang="DlgDocCLink">Link</span><br /> <input id="txtColorLink" type="text" onchange="UpdatePreview();" onkeyup="UpdatePreview();" /><input onclick="SelectColor( 'ColorLink' )" type="button" value="Select..." fcklang="DlgCellBtnSelect" /> <br /> <span fcklang="DlgDocCVisited">Visited Link</span><br /> <input id="txtColorVisited" type="text" onchange="UpdatePreview();" onkeyup="UpdatePreview();" /><input onclick="SelectColor( 'ColorVisited' )" type="button" value="Select..." fcklang="DlgCellBtnSelect" /> <br /> <span fcklang="DlgDocCActive">Active Link</span><br /> <input id="txtColorActive" type="text" onchange="UpdatePreview();" onkeyup="UpdatePreview();" /><input onclick="SelectColor( 'ColorActive' )" type="button" value="Select..." fcklang="DlgCellBtnSelect" /> </td> <td valign="middle" align="center"> <table cellspacing="2" cellpadding="0" border="0"> <tr> <td> <span fcklang="DlgDocMargins">Page Margins</span></td> </tr> <tr> <td style="border: #000000 1px solid; padding: 5px"> <table cellpadding="0" cellspacing="0" border="0" dir="ltr"> <tr> <td align="center" colspan="3"> <span fcklang="DlgDocMaTop">Top</span><br /> <input id="txtMarginTop" type="text" size="3" /> </td> </tr> <tr> <td align="left"> <span fcklang="DlgDocMaLeft">Left</span><br /> <input id="txtMarginLeft" type="text" size="3" /> </td> <td> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td> <td align="right"> <span fcklang="DlgDocMaRight">Right</span><br /> <input id="txtMarginRight" type="text" size="3" /> </td> </tr> <tr> <td align="center" colspan="3"> <span fcklang="DlgDocMaBottom">Bottom</span><br /> <input id="txtMarginBottom" type="text" size="3" /> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </div> <div id="divMeta" style="display: none"> <span fcklang="DlgDocMeIndex">Document Indexing Keywords (comma separated)</span><br /> <textarea id="txtMetaKeywords" style="width: 100%" rows="2" cols="20"></textarea> <br /> <span fcklang="DlgDocMeDescr">Document Description</span><br /> <textarea id="txtMetaDescription" style="width: 100%" rows="4" cols="20"></textarea> <br /> <span fcklang="DlgDocMeAuthor">Author</span><br /> <input id="txtMetaAuthor" style="width: 100%" type="text" /><br /> <br /> <span fcklang="DlgDocMeCopy">Copyright</span><br /> <input id="txtMetaCopyright" type="text" style="width: 100%" /> </div> </td> </tr> <tr id="ePreview" style="display: none"> <td> <span fcklang="DlgDocPreview">Preview</span><br /> <iframe id="frmPreview" src="fck_docprops/fck_document_preview.html" width="100%" height="100"></iframe> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_docprops.html
HTML
asf20
22,645
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Scripts related to the Link dialog window (see fck_link.html). */ var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKRegexLib = oEditor.FCKRegexLib ; var FCKTools = oEditor.FCKTools ; //#### Dialog Tabs // Set the dialog tabs. dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; dialog.SetAutoSize( true ) ; } // oLink: The actual selected link in the editor. var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ; if ( oLink ) FCK.Selection.SelectNode( oLink ) ; window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; // Show the initial dialog content. GetE('divUpload').style.display = '' ; // Set the actual uploader URL. if ( FCKConfig.FilesUploadURL ) GetE('frmUpload').action = FCKConfig.FilesUploadURL ; // Activate the "OK" button. dialog.SetOkButton( true ) ; } //#### The OK button was hit. function Ok() { oEditor.FCKUndo.SaveUndoStep() ; return true ; } function BrowseServer() { OpenFileBrowser( FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ; } function SetUrl( url ) { dialog.SetSelectedTab( 'Upload' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { // Remove animation window.parent.Throbber.Hide() ; GetE( 'divUpload' ).style.display = '' ; switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; case 500 : alert( 'The connector is disabled' ) ; break ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.LinkUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.LinkUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile; var sFile_count = 0; for (var i = 0; i <= 4; i++) { var sFile = GetE('txtUploadFile_' + i).value ; if ( sFile.length == 0 ) { continue; } sFile_count ++; // if ( ( FCKConfig.LinkUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || // ( FCKConfig.LinkUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) // { // OnUploadCompleted( 202 ) ; // return false ; // } } if ( sFile_count == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } // Show animation window.parent.Throbber.Show( 100 ) ; GetE( 'divUpload' ).style.display = 'none' ; return true ; }
zzshop
trunk/includes/fckeditor/editor/dialog/fck_UpFileBtn/fck_UpFileBtn.js
JavaScript
asf20
4,198
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Scripts related to the Image dialog window (see fck_image.html). */ var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKDebug = oEditor.FCKDebug ; var FCKTools = oEditor.FCKTools ; var bImageButton = ( document.location.search.length > 0 && document.location.search.substr(1) == 'ImageButton' ) ; //#### Dialog Tabs // Set the dialog tabs. dialog.AddTab( 'Info', FCKLang.DlgImgInfoTab ) ; if ( !bImageButton && !FCKConfig.ImageDlgHideLink ) dialog.AddTab( 'Link', FCKLang.DlgImgLinkTab ) ; if ( FCKConfig.ImageUpload ) dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload ) ; if ( !FCKConfig.ImageDlgHideAdvanced ) dialog.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divLink' , ( tabCode == 'Link' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAdvanced' , ( tabCode == 'Advanced' ) ) ; } // Get the selected image (if available). var oImage = dialog.Selection.GetSelectedElement() ; if ( oImage && oImage.tagName != 'IMG' && !( oImage.tagName == 'INPUT' && oImage.type == 'image' ) ) oImage = null ; // Get the active link. var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ; var oImageOriginal ; function UpdateOriginal( resetSize ) { if ( !eImgPreview ) return ; if ( GetE('txtUrl').value.length == 0 ) { oImageOriginal = null ; return ; } oImageOriginal = document.createElement( 'IMG' ) ; // new Image() ; if ( resetSize ) { oImageOriginal.onload = function() { this.onload = null ; ResetSizes() ; } } oImageOriginal.src = eImgPreview.src ; } var bPreviewInitialized ; window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; GetE('btnLockSizes').title = FCKLang.DlgImgLockRatio ; GetE('btnResetSize').title = FCKLang.DlgBtnResetSize ; // Load the selected element information (if any). LoadSelection() ; // Show/Hide the "Browse Server" button. GetE('tdBrowse').style.display = FCKConfig.ImageBrowser ? '' : 'none' ; GetE('divLnkBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; UpdateOriginal() ; // Set the actual uploader URL. if ( FCKConfig.ImageUpload ) GetE('frmUpload').action = FCKConfig.ImageUploadURL ; dialog.SetAutoSize( true ) ; // Activate the "OK" button. dialog.SetOkButton( true ) ; SelectField( 'txtUrl' ) ; } function LoadSelection() { if ( ! oImage ) return ; var sUrl = oImage.getAttribute( '_fcksavedurl' ) ; if ( sUrl == null ) sUrl = GetAttribute( oImage, 'src', '' ) ; GetE('txtUrl').value = sUrl ; GetE('txtAlt').value = GetAttribute( oImage, 'alt', '' ) ; GetE('txtVSpace').value = GetAttribute( oImage, 'vspace', '' ) ; GetE('txtHSpace').value = GetAttribute( oImage, 'hspace', '' ) ; GetE('txtBorder').value = GetAttribute( oImage, 'border', '' ) ; GetE('cmbAlign').value = GetAttribute( oImage, 'align', '' ) ; var iWidth, iHeight ; var regexSize = /^\s*(\d+)px\s*$/i ; if ( oImage.style.width ) { var aMatchW = oImage.style.width.match( regexSize ) ; if ( aMatchW ) { iWidth = aMatchW[1] ; oImage.style.width = '' ; SetAttribute( oImage, 'width' , iWidth ) ; } } if ( oImage.style.height ) { var aMatchH = oImage.style.height.match( regexSize ) ; if ( aMatchH ) { iHeight = aMatchH[1] ; oImage.style.height = '' ; SetAttribute( oImage, 'height', iHeight ) ; } } GetE('txtWidth').value = iWidth ? iWidth : GetAttribute( oImage, "width", '' ) ; GetE('txtHeight').value = iHeight ? iHeight : GetAttribute( oImage, "height", '' ) ; // Get Advances Attributes GetE('txtAttId').value = oImage.id ; GetE('cmbAttLangDir').value = oImage.dir ; GetE('txtAttLangCode').value = oImage.lang ; GetE('txtAttTitle').value = oImage.title ; GetE('txtLongDesc').value = oImage.longDesc ; if ( oEditor.FCKBrowserInfo.IsIE ) { GetE('txtAttClasses').value = oImage.className || '' ; GetE('txtAttStyle').value = oImage.style.cssText ; } else { GetE('txtAttClasses').value = oImage.getAttribute('class',2) || '' ; GetE('txtAttStyle').value = oImage.getAttribute('style',2) ; } if ( oLink ) { var sLinkUrl = oLink.getAttribute( '_fcksavedurl' ) ; if ( sLinkUrl == null ) sLinkUrl = oLink.getAttribute('href',2) ; GetE('txtLnkUrl').value = sLinkUrl ; GetE('cmbLnkTarget').value = oLink.target ; } UpdatePreview() ; } //#### The OK button was hit. function Ok() { if ( GetE('txtUrl').value.length == 0 ) { dialog.SetSelectedTab( 'Info' ) ; GetE('txtUrl').focus() ; alert( FCKLang.DlgImgAlertUrl ) ; return false ; } var bHasImage = ( oImage != null ) ; if ( bHasImage && bImageButton && oImage.tagName == 'IMG' ) { if ( confirm( 'Do you want to transform the selected image on a image button?' ) ) oImage = null ; } else if ( bHasImage && !bImageButton && oImage.tagName == 'INPUT' ) { if ( confirm( 'Do you want to transform the selected image button on a simple image?' ) ) oImage = null ; } oEditor.FCKUndo.SaveUndoStep() ; if ( !bHasImage ) { if ( bImageButton ) { oImage = FCK.EditorDocument.createElement( 'input' ) ; oImage.type = 'image' ; oImage = FCK.InsertElement( oImage ) ; } else oImage = FCK.InsertElement( 'img' ) ; } UpdateImage( oImage ) ; var sLnkUrl = GetE('txtLnkUrl').value.Trim() ; if ( sLnkUrl.length == 0 ) { if ( oLink ) FCK.ExecuteNamedCommand( 'Unlink' ) ; } else { if ( oLink ) // Modifying an existent link. oLink.href = sLnkUrl ; else // Creating a new link. { if ( !bHasImage ) oEditor.FCKSelection.SelectNode( oImage ) ; oLink = oEditor.FCK.CreateLink( sLnkUrl )[0] ; if ( !bHasImage ) { oEditor.FCKSelection.SelectNode( oLink ) ; oEditor.FCKSelection.Collapse( false ) ; } } SetAttribute( oLink, '_fcksavedurl', sLnkUrl ) ; SetAttribute( oLink, 'target', GetE('cmbLnkTarget').value ) ; } return true ; } function UpdateImage( e, skipId ) { e.src = GetE('txtUrl').value ; SetAttribute( e, "_fcksavedurl", GetE('txtUrl').value ) ; SetAttribute( e, "alt" , GetE('txtAlt').value ) ; SetAttribute( e, "width" , GetE('txtWidth').value ) ; SetAttribute( e, "height", GetE('txtHeight').value ) ; SetAttribute( e, "vspace", GetE('txtVSpace').value ) ; SetAttribute( e, "hspace", GetE('txtHSpace').value ) ; SetAttribute( e, "border", GetE('txtBorder').value ) ; SetAttribute( e, "align" , GetE('cmbAlign').value ) ; // Advances Attributes if ( ! skipId ) SetAttribute( e, 'id', GetE('txtAttId').value ) ; SetAttribute( e, 'dir' , GetE('cmbAttLangDir').value ) ; SetAttribute( e, 'lang' , GetE('txtAttLangCode').value ) ; SetAttribute( e, 'title' , GetE('txtAttTitle').value ) ; SetAttribute( e, 'longDesc' , GetE('txtLongDesc').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) { e.className = GetE('txtAttClasses').value ; e.style.cssText = GetE('txtAttStyle').value ; } else { SetAttribute( e, 'class' , GetE('txtAttClasses').value ) ; SetAttribute( e, 'style', GetE('txtAttStyle').value ) ; } } var eImgPreview ; var eImgPreviewLink ; function SetPreviewElements( imageElement, linkElement ) { eImgPreview = imageElement ; eImgPreviewLink = linkElement ; UpdatePreview() ; UpdateOriginal() ; bPreviewInitialized = true ; } function UpdatePreview() { if ( !eImgPreview || !eImgPreviewLink ) return ; if ( GetE('txtUrl').value.length == 0 ) eImgPreviewLink.style.display = 'none' ; else { UpdateImage( eImgPreview, true ) ; if ( GetE('txtLnkUrl').value.Trim().length > 0 ) eImgPreviewLink.href = 'javascript:void(null);' ; else SetAttribute( eImgPreviewLink, 'href', '' ) ; eImgPreviewLink.style.display = '' ; } } var bLockRatio = true ; function SwitchLock( lockButton ) { bLockRatio = !bLockRatio ; lockButton.className = bLockRatio ? 'BtnLocked' : 'BtnUnlocked' ; lockButton.title = bLockRatio ? 'Lock sizes' : 'Unlock sizes' ; if ( bLockRatio ) { if ( GetE('txtWidth').value.length > 0 ) OnSizeChanged( 'Width', GetE('txtWidth').value ) ; else OnSizeChanged( 'Height', GetE('txtHeight').value ) ; } } // Fired when the width or height input texts change function OnSizeChanged( dimension, value ) { // Verifies if the aspect ration has to be maintained if ( oImageOriginal && bLockRatio ) { var e = dimension == 'Width' ? GetE('txtHeight') : GetE('txtWidth') ; if ( value.length == 0 || isNaN( value ) ) { e.value = '' ; return ; } if ( dimension == 'Width' ) value = value == 0 ? 0 : Math.round( oImageOriginal.height * ( value / oImageOriginal.width ) ) ; else value = value == 0 ? 0 : Math.round( oImageOriginal.width * ( value / oImageOriginal.height ) ) ; if ( !isNaN( value ) ) e.value = value ; } UpdatePreview() ; } // Fired when the Reset Size button is clicked function ResetSizes() { if ( ! oImageOriginal ) return ; if ( oEditor.FCKBrowserInfo.IsGecko && !oImageOriginal.complete ) { setTimeout( ResetSizes, 50 ) ; return ; } GetE('txtWidth').value = oImageOriginal.width ; GetE('txtHeight').value = oImageOriginal.height ; UpdatePreview() ; } function BrowseServer() { OpenServerBrowser( 'Image', FCKConfig.ImageBrowserURL, FCKConfig.ImageBrowserWindowWidth, FCKConfig.ImageBrowserWindowHeight ) ; } function LnkBrowseServer() { OpenServerBrowser( 'Link', FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ; } function OpenServerBrowser( type, url, width, height ) { sActualBrowser = type ; OpenFileBrowser( url, width, height ) ; } var sActualBrowser ; function SetUrl( url, width, height, alt ) { if ( sActualBrowser == 'Link' ) { GetE('txtLnkUrl').value = url ; UpdatePreview() ; } else { GetE('txtUrl').value = url ; GetE('txtWidth').value = width ? width : '' ; GetE('txtHeight').value = height ? height : '' ; if ( alt ) GetE('txtAlt').value = alt; UpdatePreview() ; UpdateOriginal( true ) ; } dialog.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { // Remove animation window.parent.Throbber.Hide() ; GetE( 'divUpload' ).style.display = '' ; switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; case 500 : alert( 'The connector is disabled' ) ; break ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } sActualBrowser = '' ; SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.ImageUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.ImageUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.ImageUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.ImageUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } // Show animation window.parent.Throbber.Show( 100 ) ; GetE( 'divUpload' ).style.display = 'none' ; return true ; }
zzshop
trunk/includes/fckeditor/editor/dialog/fck_image/fck_image.js
JavaScript
asf20
13,079
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Preview page for the Image dialog window. * * Curiosity: http://en.wikipedia.org/wiki/Lorem_ipsum --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <script src="../common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var FCKTools = window.parent.FCKTools ; var FCKConfig = window.parent.FCKConfig ; // Set the preview CSS document.write( FCKTools.GetStyleHtml( FCKConfig.EditorAreaCSS ) ) ; document.write( FCKTools.GetStyleHtml( FCKConfig.EditorAreaStyles ) ) ; if ( window.parent.FCKConfig.BaseHref.length > 0 ) document.write( '<base href="' + window.parent.FCKConfig.BaseHref + '">' ) ; window.onload = function() { window.parent.SetPreviewElements( document.getElementById( 'imgPreview' ), document.getElementById( 'lnkPreview' ) ) ; } </script> </head> <body> <div> <a id="lnkPreview" onclick="return false;" style="cursor: default"> <img id="imgPreview" onload="window.parent.UpdateOriginal();" style="display: none" alt="" /></a>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris. </div> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_image/fck_image_preview.html
HTML
asf20
2,975
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Cell properties dialog window. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Table Cell Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; // Gets the document DOM var oDOM = oEditor.FCK.EditorDocument ; // Array of selected Cells var aCells = oEditor.FCKTableHandler.GetSelectedCells() ; window.onload = function() { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage( document ) ; SetStartupValue() ; dialog.SetOkButton( true ) ; dialog.SetAutoSize( true ) ; SelectField( 'txtWidth' ) ; } function SetStartupValue() { if ( aCells.length > 0 ) { var oCell = aCells[0] ; var iWidth = GetAttribute( oCell, 'width' ) ; if ( iWidth.indexOf && iWidth.indexOf( '%' ) >= 0 ) { iWidth = iWidth.substr( 0, iWidth.length - 1 ) ; GetE('selWidthType').value = 'percent' ; } if ( oCell.attributes['noWrap'] != null && oCell.attributes['noWrap'].specified ) GetE('selWordWrap').value = !oCell.noWrap ; GetE('txtWidth').value = iWidth ; GetE('txtHeight').value = GetAttribute( oCell, 'height' ) ; GetE('selHAlign').value = GetAttribute( oCell, 'align' ) ; GetE('selVAlign').value = GetAttribute( oCell, 'vAlign' ) ; GetE('txtRowSpan').value = GetAttribute( oCell, 'rowSpan' ) ; GetE('txtCollSpan').value = GetAttribute( oCell, 'colSpan' ) ; GetE('txtBackColor').value = GetAttribute( oCell, 'bgColor' ) ; GetE('txtBorderColor').value = GetAttribute( oCell, 'borderColor' ) ; // GetE('cmbFontStyle').value = oCell.className ; } } // Fired when the user press the OK button function Ok() { for( i = 0 ; i < aCells.length ; i++ ) { if ( GetE('txtWidth').value.length > 0 ) aCells[i].width = GetE('txtWidth').value + ( GetE('selWidthType').value == 'percent' ? '%' : '') ; else aCells[i].removeAttribute( 'width', 0 ) ; if ( GetE('selWordWrap').value == 'false' ) SetAttribute( aCells[i], 'noWrap', 'nowrap' ) ; else aCells[i].removeAttribute( 'noWrap' ) ; SetAttribute( aCells[i], 'height' , GetE('txtHeight').value ) ; SetAttribute( aCells[i], 'align' , GetE('selHAlign').value ) ; SetAttribute( aCells[i], 'vAlign' , GetE('selVAlign').value ) ; SetAttribute( aCells[i], 'rowSpan' , GetE('txtRowSpan').value ) ; SetAttribute( aCells[i], 'colSpan' , GetE('txtCollSpan').value ) ; SetAttribute( aCells[i], 'bgColor' , GetE('txtBackColor').value ) ; SetAttribute( aCells[i], 'borderColor' , GetE('txtBorderColor').value ) ; // SetAttribute( aCells[i], 'className' , GetE('cmbFontStyle').value ) ; } return true ; } function SelectBackColor( color ) { if ( color && color.length > 0 ) GetE('txtBackColor').value = color ; } function SelectBorderColor( color ) { if ( color && color.length > 0 ) GetE('txtBorderColor').value = color ; } function SelectColor( wich ) { oEditor.FCKDialog.OpenDialog( 'FCKDialog_Color', oEditor.FCKLang.DlgColorTitle, 'dialog/fck_colorselector.html', 410, 320, wich == 'Back' ? SelectBackColor : SelectBorderColor, window ) ; } </script> </head> <body scroll="no" style="overflow: hidden"> <table cellspacing="0" cellpadding="0" width="100%" border="0" height="100%"> <tr> <td> <table cellspacing="1" cellpadding="1" width="100%" border="0"> <tr> <td> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td nowrap="nowrap"> <span fcklang="DlgCellWidth">Width</span>:</td> <td> &nbsp;<input onkeypress="return IsDigit(event);" id="txtWidth" type="text" maxlength="4" size="3" name="txtWidth" />&nbsp;<select id="selWidthType" name="selWidthType"> <option fcklang="DlgCellWidthPx" value="pixels" selected="selected">pixels</option> <option fcklang="DlgCellWidthPc" value="percent">percent</option> </select></td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgCellHeight">Height</span>:</td> <td> &nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" name="txtHeight" onkeypress="return IsDigit(event);" />&nbsp;<span fcklang="DlgCellWidthPx">pixels</span></td> </tr> <tr> <td> &nbsp;</td> <td> &nbsp;</td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgCellWordWrap">Word Wrap</span>:</td> <td> &nbsp;<select id="selWordWrap" name="selAlignment"> <option fcklang="DlgCellWordWrapYes" value="true" selected="selected">Yes</option> <option fcklang="DlgCellWordWrapNo" value="false">No</option> </select></td> </tr> <tr> <td> &nbsp;</td> <td> &nbsp;</td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgCellHorAlign">Horizontal Alignment</span>:</td> <td> &nbsp;<select id="selHAlign" name="selAlignment"> <option fcklang="DlgCellHorAlignNotSet" value="" selected>&lt;Not set&gt;</option> <option fcklang="DlgCellHorAlignLeft" value="left">Left</option> <option fcklang="DlgCellHorAlignCenter" value="center">Center</option> <option fcklang="DlgCellHorAlignRight" value="right">Right</option> </select></td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgCellVerAlign">Vertical Alignment</span>:</td> <td> &nbsp;<select id="selVAlign" name="selAlignment"> <option fcklang="DlgCellVerAlignNotSet" value="" selected>&lt;Not set&gt;</option> <option fcklang="DlgCellVerAlignTop" value="top">Top</option> <option fcklang="DlgCellVerAlignMiddle" value="middle">Middle</option> <option fcklang="DlgCellVerAlignBottom" value="bottom">Bottom</option> <option fcklang="DlgCellVerAlignBaseline" value="baseline">Baseline</option> </select></td> </tr> </table> </td> <td> &nbsp;&nbsp;&nbsp;</td> <td align="right"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td nowrap="nowrap"> <span fcklang="DlgCellRowSpan">Rows Span</span>:</td> <td> &nbsp; <input onkeypress="return IsDigit(event);" id="txtRowSpan" type="text" maxlength="3" size="2" name="txtRows"></td> <td> </td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgCellCollSpan">Columns Span</span>:</td> <td> &nbsp; <input onkeypress="return IsDigit(event);" id="txtCollSpan" type="text" maxlength="2" size="2" name="txtColumns"></td> <td> </td> </tr> <tr> <td> &nbsp;</td> <td> &nbsp;</td> <td> &nbsp;</td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgCellBackColor">Background Color</span>:</td> <td> &nbsp;<input id="txtBackColor" type="text" size="8" name="txtCellSpacing"></td> <td> &nbsp; <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Back' )"></td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgCellBorderColor">Border Color</span>:</td> <td> &nbsp;<input id="txtBorderColor" type="text" size="8" name="txtCellPadding" /></td> <td> &nbsp; <input type="button" fcklang="DlgCellBtnSelect" value="Select..." onclick="SelectColor( 'Border' )" /></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_tablecell.html
HTML
asf20
8,963
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Table dialog window. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Table Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var dialogArguments = dialog.Args() ; // Gets the document DOM var oDOM = oEditor.FCK.EditorDocument ; // Gets the table if there is one selected. var table ; var e = dialog.Selection.GetSelectedElement() ; if ( ( !e && document.location.search.substr(1) == 'Parent' ) || ( e && e.tagName != 'TABLE' ) ) e = oEditor.FCKSelection.MoveToAncestorNode( 'TABLE' ) ; if ( e && e.tagName == "TABLE" ) table = e ; // Fired when the window loading process is finished. It sets the fields with the // actual values if a table is selected in the editor. window.onload = function() { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; if (table) { document.getElementById('txtRows').value = table.rows.length ; document.getElementById('txtColumns').value = table.rows[0].cells.length ; // Gets the value from the Width or the Style attribute var iWidth = (table.style.width ? table.style.width : table.width ) ; var iHeight = (table.style.height ? table.style.height : table.height ) ; if (iWidth.indexOf('%') >= 0) // Percentual = % { iWidth = parseInt( iWidth.substr(0,iWidth.length - 1), 10 ) ; document.getElementById('selWidthType').value = "percent" ; } else if (iWidth.indexOf('px') >= 0) // Style Pixel = px { // iWidth = iWidth.substr(0,iWidth.length - 2); document.getElementById('selWidthType').value = "pixels" ; } if (iHeight && iHeight.indexOf('px') >= 0) // Style Pixel = px iHeight = iHeight.substr(0,iHeight.length - 2); document.getElementById('txtWidth').value = iWidth || '' ; document.getElementById('txtHeight').value = iHeight || '' ; document.getElementById('txtBorder').value = GetAttribute( table, 'border', '' ) ; document.getElementById('selAlignment').value = GetAttribute( table, 'align', '' ) ; document.getElementById('txtCellPadding').value = GetAttribute( table, 'cellPadding', '' ) ; document.getElementById('txtCellSpacing').value = GetAttribute( table, 'cellSpacing', '' ) ; document.getElementById('txtSummary').value = GetAttribute( table, 'summary', '' ) ; // document.getElementById('cmbFontStyle').value = table.className ; var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ; if ( eCaption ) document.getElementById('txtCaption').value = eCaption.innerHTML ; document.getElementById('txtRows').disabled = true ; document.getElementById('txtColumns').disabled = true ; SelectField( 'txtWidth' ) ; } else SelectField( 'txtRows' ) ; dialog.SetOkButton( true ) ; dialog.SetAutoSize( true ) ; } // Fired when the user press the OK button function Ok() { var bExists = ( table != null ) ; if ( ! bExists ) table = oEditor.FCK.EditorDocument.createElement( "TABLE" ) ; // Removes the Width and Height styles if ( bExists && table.style.width ) table.style.width = null ; //.removeAttribute("width") ; if ( bExists && table.style.height ) table.style.height = null ; //.removeAttribute("height") ; var sWidth = GetE('txtWidth').value ; if ( sWidth.length > 0 && GetE('selWidthType').value == 'percent' ) sWidth += '%' ; SetAttribute( table, 'width' , sWidth ) ; SetAttribute( table, 'height' , GetE('txtHeight').value ) ; SetAttribute( table, 'border' , GetE('txtBorder').value ) ; SetAttribute( table, 'align' , GetE('selAlignment').value ) ; SetAttribute( table, 'cellPadding' , GetE('txtCellPadding').value ) ; SetAttribute( table, 'cellSpacing' , GetE('txtCellSpacing').value ) ; SetAttribute( table, 'summary' , GetE('txtSummary').value ) ; var eCaption = oEditor.FCKDomTools.GetFirstChild( table, 'CAPTION' ) ; if ( document.getElementById('txtCaption').value != '') { if ( !eCaption ) { eCaption = oEditor.FCK.EditorDocument.createElement( 'CAPTION' ) ; table.insertBefore( eCaption, table.firstChild ) ; } eCaption.innerHTML = document.getElementById('txtCaption').value ; } else if ( bExists && eCaption ) { // TODO: It causes an IE internal error if using removeChild or // table.deleteCaption() (see #505). if ( oEditor.FCKBrowserInfo.IsIE ) eCaption.innerHTML = '' ; else eCaption.parentNode.removeChild( eCaption ) ; } if (! bExists) { var iRows = document.getElementById('txtRows').value ; var iCols = document.getElementById('txtColumns').value ; for ( var r = 0 ; r < iRows ; r++ ) { var oRow = table.insertRow(-1) ; for ( var c = 0 ; c < iCols ; c++ ) { var oCell = oRow.insertCell(-1) ; if ( oEditor.FCKBrowserInfo.IsGeckoLike ) oEditor.FCKTools.AppendBogusBr( oCell ) ; } } oEditor.FCKUndo.SaveUndoStep() ; oEditor.FCK.InsertElement( table ) ; } return true ; } </script> </head> <body style="overflow: hidden"> <table id="otable" cellspacing="0" cellpadding="0" width="100%" border="0" style="height: 100%"> <tr> <td> <table cellspacing="1" cellpadding="1" width="100%" border="0"> <tr> <td valign="top"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td> <span fcklang="DlgTableRows">Rows</span>:</td> <td> &nbsp;<input id="txtRows" type="text" maxlength="3" size="2" value="3" name="txtRows" onkeypress="return IsDigit(event);" /></td> </tr> <tr> <td> <span fcklang="DlgTableColumns">Columns</span>:</td> <td> &nbsp;<input id="txtColumns" type="text" maxlength="2" size="2" value="2" name="txtColumns" onkeypress="return IsDigit(event);" /></td> </tr> <tr> <td> &nbsp;</td> <td> &nbsp;</td> </tr> <tr> <td> <span fcklang="DlgTableBorder">Border size</span>:</td> <td> &nbsp;<input id="txtBorder" type="text" maxlength="2" size="2" value="1" name="txtBorder" onkeypress="return IsDigit(event);" /></td> </tr> <tr> <td> <span fcklang="DlgTableAlign">Alignment</span>:</td> <td> &nbsp;<select id="selAlignment" name="selAlignment"> <option fcklang="DlgTableAlignNotSet" value="" selected="selected">&lt;Not set&gt;</option> <option fcklang="DlgTableAlignLeft" value="left">Left</option> <option fcklang="DlgTableAlignCenter" value="center">Center</option> <option fcklang="DlgTableAlignRight" value="right">Right</option> </select></td> </tr> </table> </td> <td> &nbsp;&nbsp;&nbsp;</td> <td align="right" valign="top"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td> <span fcklang="DlgTableWidth">Width</span>:</td> <td> &nbsp;<input id="txtWidth" type="text" maxlength="4" size="3" value="200" name="txtWidth" onkeypress="return IsDigit(event);" /></td> <td> &nbsp;<select id="selWidthType" name="selWidthType"> <option fcklang="DlgTableWidthPx" value="pixels" selected="selected">pixels</option> <option fcklang="DlgTableWidthPc" value="percent">percent</option> </select></td> </tr> <tr> <td> <span fcklang="DlgTableHeight">Height</span>:</td> <td> &nbsp;<input id="txtHeight" type="text" maxlength="4" size="3" name="txtHeight" onkeypress="return IsDigit(event);" /></td> <td> &nbsp;<span fcklang="DlgTableWidthPx">pixels</span></td> </tr> <tr> <td> &nbsp;</td> <td> &nbsp;</td> <td> &nbsp;</td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgTableCellSpace">Cell spacing</span>:</td> <td> &nbsp;<input id="txtCellSpacing" type="text" maxlength="2" size="2" value="1" name="txtCellSpacing" onkeypress="return IsDigit(event);" /></td> <td> &nbsp;</td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgTableCellPad">Cell padding</span>:</td> <td> &nbsp;<input id="txtCellPadding" type="text" maxlength="2" size="2" value="1" name="txtCellPadding" onkeypress="return IsDigit(event);" /></td> <td> &nbsp;</td> </tr> </table> </td> </tr> </table> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td nowrap="nowrap"> <span fcklang="DlgTableCaption">Caption</span>:&nbsp;</td> <td> &nbsp;</td> <td width="100%" nowrap="nowrap"> <input id="txtCaption" type="text" style="width: 100%" /></td> </tr> <tr> <td nowrap="nowrap"> <span fcklang="DlgTableSummary">Summary</span>:&nbsp;</td> <td> &nbsp;</td> <td width="100%" nowrap="nowrap"> <input id="txtSummary" type="text" style="width: 100%" /></td> </tr> </table> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_table.html
HTML
asf20
10,431
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Flash Properties dialog window. --> <html> <head> <title>Flash Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta content="noindex, nofollow" name="robots"> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script src="fck_flash/fck_flash.js" type="text/javascript"></script> <script type="text/javascript"> document.write( FCKTools.GetStyleHtml( GetCommonDialogCss() ) ) ; </script> </head> <body scroll="no" style="OVERFLOW: hidden"> <div id="divInfo"> <table cellSpacing="1" cellPadding="1" width="100%" border="0"> <tr> <td> <table cellSpacing="0" cellPadding="0" width="100%" border="0"> <tr> <td width="100%"><span fckLang="DlgImgURL">URL</span> </td> <td id="tdBrowse" style="DISPLAY: none" noWrap rowSpan="2">&nbsp; <input id="btnBrowse" onclick="BrowseServer();" type="button" value="Browse Server" fckLang="DlgBtnBrowseServer"> </td> </tr> <tr> <td vAlign="top"><input id="txtUrl" onblur="UpdatePreview();" style="WIDTH: 100%" type="text"> </td> </tr> </table> </td> </tr> <TR> <TD> <table cellSpacing="0" cellPadding="0" border="0"> <TR> <TD nowrap> <span fckLang="DlgImgWidth">Width</span><br> <input id="txtWidth" onkeypress="return IsDigit(event);" type="text" size="3"> </TD> <TD>&nbsp;</TD> <TD> <span fckLang="DlgImgHeight">Height</span><br> <input id="txtHeight" onkeypress="return IsDigit(event);" type="text" size="3"> </TD> </TR> </table> </TD> </TR> <tr> <td vAlign="top"> <table cellSpacing="0" cellPadding="0" width="100%" border="0"> <tr> <td valign="top" width="100%"> <table cellSpacing="0" cellPadding="0" width="100%"> <tr> <td><span fckLang="DlgImgPreview">Preview</span></td> </tr> <tr> <td id="ePreviewCell" valign="top" class="FlashPreviewArea"><iframe src="fck_flash/fck_flash_preview.html" frameborder="0" marginheight="0" marginwidth="0"></iframe></td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </div> <div id="divUpload" style="DISPLAY: none"> <form id="frmUpload" method="post" target="UploadWindow" enctype="multipart/form-data" action="" onsubmit="return CheckUpload();"> <span fckLang="DlgLnkUpload">Upload</span><br /> <input id="txtUploadFile" style="WIDTH: 100%" type="file" size="40" name="NewFile" /><br /> <br /> <input id="btnUpload" type="submit" value="Send it to the Server" fckLang="DlgLnkBtnUpload" /> <script type="text/javascript"> document.write( '<iframe name="UploadWindow" style="DISPLAY: none" src="' + FCKTools.GetVoidUrl() + '"><\/iframe>' ) ; </script> </form> </div> <div id="divAdvanced" style="DISPLAY: none"> <TABLE cellSpacing="0" cellPadding="0" border="0"> <TR> <TD nowrap> <span fckLang="DlgFlashScale">Scale</span><BR> <select id="cmbScale"> <option value="" selected></option> <option value="showall" fckLang="DlgFlashScaleAll">Show all</option> <option value="noborder" fckLang="DlgFlashScaleNoBorder">No Border</option> <option value="exactfit" fckLang="DlgFlashScaleFit">Exact Fit</option> </select></TD> <TD>&nbsp;&nbsp;&nbsp; &nbsp; </TD> <td valign="bottom"> <table> <tr> <td><input id="chkAutoPlay" type="checkbox" checked></td> <td><label for="chkAutoPlay" nowrap fckLang="DlgFlashChkPlay">Auto Play</label>&nbsp;&nbsp;</td> <td><input id="chkLoop" type="checkbox" checked></td> <td><label for="chkLoop" nowrap fckLang="DlgFlashChkLoop">Loop</label>&nbsp;&nbsp;</td> <td><input id="chkMenu" type="checkbox" checked></td> <td><label for="chkMenu" nowrap fckLang="DlgFlashChkMenu">Enable Flash Menu</label></td> </tr> </table> </td> </TR> </TABLE> <br> &nbsp; <table cellSpacing="0" cellPadding="0" width="100%" align="center" border="0"> <tr> <td vAlign="top" width="50%"><span fckLang="DlgGenId">Id</span><br> <input id="txtAttId" style="WIDTH: 100%" type="text"> </td> <td>&nbsp;&nbsp;</td> <td vAlign="top" nowrap><span fckLang="DlgGenClass">Stylesheet Classes</span><br> <input id="txtAttClasses" style="WIDTH: 100%" type="text"> </td> <td>&nbsp;&nbsp;</td> <td vAlign="top" nowrap width="50%">&nbsp;<span fckLang="DlgGenTitle">Advisory Title</span><br> <input id="txtAttTitle" style="WIDTH: 100%" type="text"> </td> </tr> </table> <span fckLang="DlgGenStyle">Style</span><br> <input id="txtAttStyle" style="WIDTH: 100%" type="text"> </div> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_flash.html
HTML
asf20
5,732
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Button dialog window. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Button Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta content="noindex, nofollow" name="robots" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; // Gets the document DOM var oDOM = oEditor.FCK.EditorDocument ; var oActiveEl = dialog.Selection.GetSelectedElement() ; window.onload = function() { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; if ( oActiveEl && oActiveEl.tagName.toUpperCase() == "INPUT" && ( oActiveEl.type == "button" || oActiveEl.type == "submit" || oActiveEl.type == "reset" ) ) { GetE('txtName').value = oActiveEl.name ; GetE('txtValue').value = oActiveEl.value ; GetE('txtType').value = oActiveEl.type ; } else oActiveEl = null ; dialog.SetOkButton( true ) ; dialog.SetAutoSize( true ) ; SelectField( 'txtName' ) ; } function Ok() { oEditor.FCKUndo.SaveUndoStep() ; oActiveEl = CreateNamedElement( oEditor, oActiveEl, 'INPUT', {name: GetE('txtName').value, type: GetE('txtType').value } ) ; SetAttribute( oActiveEl, 'value', GetE('txtValue').value ) ; return true ; } </script> </head> <body style="overflow: hidden"> <table width="100%" style="height: 100%"> <tr> <td align="center"> <table border="0" cellpadding="0" cellspacing="0" width="80%"> <tr> <td colspan=""> <span fcklang="DlgCheckboxName">Name</span><br /> <input type="text" size="20" id="txtName" style="width: 100%" /> </td> </tr> <tr> <td> <span fcklang="DlgButtonText">Text (Value)</span><br /> <input type="text" id="txtValue" style="width: 100%" /> </td> </tr> <tr> <td> <span fcklang="DlgButtonType">Type</span><br /> <select id="txtType"> <option fcklang="DlgButtonTypeBtn" value="button" selected="selected">Button</option> <option fcklang="DlgButtonTypeSbm" value="submit">Submit</option> <option fcklang="DlgButtonTypeRst" value="reset">Reset</option> </select> </td> </tr> </table> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_button.html
HTML
asf20
3,110
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Bulleted List dialog window. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta content="noindex, nofollow" name="robots" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; // Gets the document DOM var oDOM = oEditor.FCK.EditorDocument ; var sListType = ( location.search == '?OL' ? 'OL' : 'UL' ) ; var oActiveEl = dialog.Selection.GetSelection().MoveToAncestorNode( sListType ) ; var oActiveSel ; window.onload = function() { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; if ( sListType == 'UL' ) oActiveSel = GetE('selBulleted') ; else { if ( oActiveEl ) { oActiveSel = GetE('selNumbered') ; GetE('eStart').style.display = '' ; GetE('txtStartPosition').value = GetAttribute( oActiveEl, 'start' ) ; } } oActiveSel.style.display = '' ; if ( oActiveEl ) { if ( oActiveEl.getAttribute('type') ) oActiveSel.value = oActiveEl.getAttribute('type') ; } dialog.SetOkButton( true ) ; dialog.SetAutoSize( true ) ; SelectField( sListType == 'OL' ? 'txtStartPosition' : 'selBulleted' ) ; } function Ok() { if ( oActiveEl ){ SetAttribute( oActiveEl, 'type' , oActiveSel.value ) ; if(oActiveEl.tagName == 'OL') SetAttribute( oActiveEl, 'start', GetE('txtStartPosition').value ) ; } return true ; } </script> </head> <body style="overflow: hidden"> <table width="100%" style="height: 100%"> <tr> <td style="text-align:center"> <table cellspacing="0" cellpadding="0" border="0" style="margin-left: auto; margin-right: auto;"> <tr> <td id="eStart" style="display: none; padding-right: 5px; padding-left: 5px"> <span fcklang="DlgLstStart">Start</span><br /> <input type="text" id="txtStartPosition" size="5" /> </td> <td style="padding-right: 5px; padding-left: 5px"> <span fcklang="DlgLstType">List Type</span><br /> <select id="selBulleted" style="display: none"> <option value="" selected="selected"></option> <option value="circle" fcklang="DlgLstTypeCircle">Circle</option> <option value="disc" fcklang="DlgLstTypeDisc">Disc</option> <option value="square" fcklang="DlgLstTypeSquare">Square</option> </select> <select id="selNumbered" style="display: none"> <option value="" selected="selected"></option> <option value="1" fcklang="DlgLstTypeNumbers">Numbers (1, 2, 3)</option> <option value="a" fcklang="DlgLstTypeLCase">Lowercase Letters (a, b, c)</option> <option value="A" fcklang="DlgLstTypeUCase">Uppercase Letters (A, B, C)</option> <option value="i" fcklang="DlgLstTypeSRoman">Small Roman Numerals (i, ii, iii)</option> <option value="I" fcklang="DlgLstTypeLRoman">Large Roman Numerals (I, II, III)</option> </select> &nbsp; </td> </tr> </table> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_listprop.html
HTML
asf20
3,909
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Template selection dialog window. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <style type="text/css"> .TplList { border: #dcdcdc 2px solid; background-color: #ffffff; overflow: auto; width: 90%; } .TplItem { margin: 5px; padding: 7px; border: #eeeeee 1px solid; } .TplItem TABLE { display: inline; } .TplTitle { font-weight: bold; } </style> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var oEditor = window.parent.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; window.onload = function() { // Set the right box height (browser dependent). GetE('eList').style.height = document.all ? '100%' : '295px' ; // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; GetE('xChkReplaceAll').checked = ( FCKConfig.TemplateReplaceAll !== false ) ; if ( FCKConfig.TemplateReplaceCheckbox !== false ) GetE('xReplaceBlock').style.display = '' ; window.parent.SetAutoSize( true ) ; LoadTemplatesXml() ; } function LoadTemplatesXml() { var oTemplate ; if ( !FCK._Templates ) { GetE('eLoading').style.display = '' ; // Create the Templates array. FCK._Templates = new Array() ; // Load the XML file. var oXml = new oEditor.FCKXml() ; oXml.LoadUrl( FCKConfig.TemplatesXmlPath ) ; // Get the Images Base Path. var oAtt = oXml.SelectSingleNode( 'Templates/@imagesBasePath' ) ; var sImagesBasePath = oAtt ? oAtt.value : '' ; // Get the "Template" nodes defined in the XML file. var aTplNodes = oXml.SelectNodes( 'Templates/Template' ) ; for ( var i = 0 ; i < aTplNodes.length ; i++ ) { var oNode = aTplNodes[i] ; oTemplate = new Object() ; var oPart ; // Get the Template Title. if ( (oPart = oNode.attributes.getNamedItem('title')) ) oTemplate.Title = oPart.value ; else oTemplate.Title = 'Template ' + ( i + 1 ) ; // Get the Template Description. if ( (oPart = oXml.SelectSingleNode( 'Description', oNode )) ) oTemplate.Description = oPart.text ? oPart.text : oPart.textContent ; // Get the Template Image. if ( (oPart = oNode.attributes.getNamedItem('image')) ) oTemplate.Image = sImagesBasePath + oPart.value ; // Get the Template HTML. if ( (oPart = oXml.SelectSingleNode( 'Html', oNode )) ) oTemplate.Html = oPart.text ? oPart.text : oPart.textContent ; else { alert( 'No HTML defined for template index ' + i + '. Please review the "' + FCKConfig.TemplatesXmlPath + '" file.' ) ; continue ; } FCK._Templates[ FCK._Templates.length ] = oTemplate ; } GetE('eLoading').style.display = 'none' ; } if ( FCK._Templates.length == 0 ) GetE('eEmpty').style.display = '' ; else { for ( var j = 0 ; j < FCK._Templates.length ; j++ ) { oTemplate = FCK._Templates[j] ; var oItemDiv = GetE('eList').appendChild( document.createElement( 'DIV' ) ) ; oItemDiv.TplIndex = j ; oItemDiv.className = 'TplItem' ; // Build the inner HTML of our new item DIV. var sInner = '<table><tr>' ; if ( oTemplate.Image ) sInner += '<td valign="top"><img src="' + oTemplate.Image + '"><\/td>' ; sInner += '<td valign="top"><div class="TplTitle">' + oTemplate.Title + '<\/div>' ; if ( oTemplate.Description ) sInner += '<div>' + oTemplate.Description + '<\/div>' ; sInner += '<\/td><\/tr><\/table>' ; oItemDiv.innerHTML = sInner ; oItemDiv.onmouseover = ItemDiv_OnMouseOver ; oItemDiv.onmouseout = ItemDiv_OnMouseOut ; oItemDiv.onclick = ItemDiv_OnClick ; } } } function ItemDiv_OnMouseOver() { this.className += ' PopupSelectionBox' ; } function ItemDiv_OnMouseOut() { this.className = this.className.replace( /\s*PopupSelectionBox\s*/, '' ) ; } function ItemDiv_OnClick() { SelectTemplate( this.TplIndex ) ; } function SelectTemplate( index ) { oEditor.FCKUndo.SaveUndoStep() ; if ( GetE('xChkReplaceAll').checked ) FCK.SetData( FCK._Templates[index].Html ) ; else FCK.InsertHtml( FCK._Templates[index].Html ) ; window.parent.Cancel( true ) ; } </script> </head> <body style="overflow: hidden"> <table width="100%" style="height: 100%"> <tr> <td align="center"> <span fcklang="DlgTemplatesSelMsg">Please select the template to open in the editor<br /> (the actual contents will be lost):</span> </td> </tr> <tr> <td height="100%" align="center"> <div id="eList" align="left" class="TplList"> <div id="eLoading" align="center" style="display: none"> <br /> <span fcklang="DlgTemplatesLoading">Loading templates list. Please wait...</span> </div> <div id="eEmpty" align="center" style="display: none"> <br /> <span fcklang="DlgTemplatesNoTpl">(No templates defined)</span> </div> </div> </td> </tr> <tr id="xReplaceBlock" style="display: none"> <td> <table cellpadding="0" cellspacing="0"> <tr> <td> <input id="xChkReplaceAll" type="checkbox" /></td> <td> &nbsp;</td> <td> <label for="xChkReplaceAll" fcklang="DlgTemplatesReplace"> Replace actual contents</label></td> </tr> </table> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_template.html
HTML
asf20
6,374
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Smileys (emoticons) dialog window. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <style type="text/css"> .Hand { cursor: pointer; cursor: hand; } </style> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; window.onload = function () { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; dialog.SetAutoSize( true ) ; } function InsertSmiley( url ) { oEditor.FCKUndo.SaveUndoStep() ; var oImg = oEditor.FCK.InsertElement( 'img' ) ; oImg.src = url ; oImg.setAttribute( '_fcksavedurl', url ) ; // For long smileys list, it seams that IE continues loading the images in // the background when you quickly select one image. so, let's clear // everything before closing. document.body.innerHTML = '' ; dialog.Cancel() ; } function over(td) { td.className = 'LightBackground Hand' ; } function out(td) { td.className = 'DarkBackground Hand' ; } </script> </head> <body style="overflow: hidden"> <table cellpadding="2" cellspacing="2" align="center" border="0" width="100%" height="100%"> <script type="text/javascript"> var FCKConfig = oEditor.FCKConfig ; var sBasePath = FCKConfig.SmileyPath ; var aImages = FCKConfig.SmileyImages ; var iCols = FCKConfig.SmileyColumns ; var iColWidth = parseInt( 100 / iCols, 10 ) ; var i = 0 ; while (i < aImages.length) { document.write( '<tr>' ) ; for(var j = 0 ; j < iCols ; j++) { if (aImages[i]) { var sUrl = sBasePath + aImages[i] ; document.write( '<td width="' + iColWidth + '%" align="center" class="DarkBackground Hand" onclick="InsertSmiley(\'' + sUrl.replace(/'/g, "\\'" ) + '\')" onmouseover="over(this)" onmouseout="out(this)">' ) ; document.write( '<img src="' + sUrl + '" border="0" />' ) ; } else document.write( '<td width="' + iColWidth + '%" class="DarkBackground">&nbsp;' ) ; document.write( '<\/td>' ) ; i++ ; } document.write('<\/tr>') ; } </script> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_smiley.html
HTML
asf20
3,020
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This dialog is shown when, for some reason (usually security settings), * the user is not able to paste data from the clipboard to the editor using * the toolbar buttons or the context menu. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="robots" content="noindex, nofollow" /> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript"> var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var FCK = oEditor.FCK; var FCKTools = oEditor.FCKTools ; var FCKConfig = oEditor.FCKConfig ; var FCKBrowserInfo = oEditor.FCKBrowserInfo ; window.onload = function () { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; var sPastingType = dialog.Args().CustomValue ; if ( sPastingType == 'Word' || sPastingType == 'Security' ) { if ( sPastingType == 'Security' ) document.getElementById( 'xSecurityMsg' ).style.display = '' ; // For document.domain compatibility (#123) we must do all the magic in // the URL for IE. var sFrameUrl = !oEditor.FCK_IS_CUSTOM_DOMAIN || !FCKBrowserInfo.IsIE ? 'javascript:void(0)' : 'javascript:void( (function(){' + 'document.open() ;' + 'document.domain=\'' + document.domain + '\' ;' + 'document.write(\'<html><head><script>window.onerror = function() { return true ; };<\/script><\/head><body><\/body><\/html>\') ;' + 'document.close() ;' + 'document.body.contentEditable = true ;' + 'window.focus() ;' + '})() )' ; var eFrameSpace = document.getElementById( 'xFrameSpace' ) ; eFrameSpace.innerHTML = '<iframe id="frmData" src="' + sFrameUrl + '" ' + 'height="98%" width="99%" frameborder="0" style="border: #000000 1px; background-color: #ffffff"><\/iframe>' ; var oFrame = eFrameSpace.firstChild ; if ( !oEditor.FCK_IS_CUSTOM_DOMAIN || !FCKBrowserInfo.IsIE ) { // Avoid errors if the pasted content has any script that fails: #389 var oDoc = oFrame.contentWindow.document ; oDoc.open() ; oDoc.write('<html><head><script>window.onerror = function() { return true ; };<\/script><\/head><body><\/body><\/html>') ; oDoc.close() ; if ( FCKBrowserInfo.IsIE ) oDoc.body.contentEditable = true ; else oDoc.designMode = 'on' ; oFrame.contentWindow.focus(); } } else { document.getElementById('txtData').style.display = '' ; } if ( sPastingType != 'Word' ) document.getElementById('oWordCommands').style.display = 'none' ; dialog.SetOkButton( true ) ; dialog.SetAutoSize( true ) ; } function Ok() { // Before doing anything, save undo snapshot. oEditor.FCKUndo.SaveUndoStep() ; var sHtml ; var sPastingType = dialog.Args().CustomValue ; if ( sPastingType == 'Word' || sPastingType == 'Security' ) { var oFrame = document.getElementById('frmData') ; var oBody ; if ( oFrame.contentDocument ) oBody = oFrame.contentDocument.body ; else oBody = oFrame.contentWindow.document.body ; if ( sPastingType == 'Word' ) { // If a plugin creates a FCK.CustomCleanWord function it will be called instead of the default one if ( typeof( FCK.CustomCleanWord ) == 'function' ) sHtml = FCK.CustomCleanWord( oBody, document.getElementById('chkRemoveFont').checked, document.getElementById('chkRemoveStyles').checked ) ; else sHtml = CleanWord( oBody, document.getElementById('chkRemoveFont').checked, document.getElementById('chkRemoveStyles').checked ) ; } else sHtml = oBody.innerHTML ; // Fix relative anchor URLs (IE automatically adds the current page URL). var re = new RegExp( window.location + "#", "g" ) ; sHtml = sHtml.replace( re, '#') ; } else { sHtml = oEditor.FCKTools.HTMLEncode( document.getElementById('txtData').value ) ; sHtml = FCKTools.ProcessLineBreaks( oEditor, FCKConfig, sHtml ) ; // FCK.InsertHtml() does not work for us, since document fragments cannot contain node fragments. :( // Use the marker method instead. It's primitive, but it works. var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ; var oDoc = oEditor.FCK.EditorDocument ; dialog.Selection.EnsureSelection() ; range.MoveToSelection() ; range.DeleteContents() ; var marker = [] ; for ( var i = 0 ; i < 5 ; i++ ) marker.push( parseInt(Math.random() * 100000, 10 ) ) ; marker = marker.join( "" ) ; range.InsertNode ( oDoc.createTextNode( marker ) ) ; var bookmark = range.CreateBookmark() ; // Now we've got a marker indicating the paste position in the editor document. // Find its position in the HTML code. var htmlString = oDoc.body.innerHTML ; var index = htmlString.indexOf( marker ) ; // Split it the HTML code up, add the code we generated, and put them back together. var htmlList = [] ; htmlList.push( htmlString.substr( 0, index ) ) ; htmlList.push( sHtml ) ; htmlList.push( htmlString.substr( index + marker.length ) ) ; htmlString = htmlList.join( "" ) ; if ( oEditor.FCKBrowserInfo.IsIE ) oEditor.FCK.SetInnerHtml( htmlString ) ; else oDoc.body.innerHTML = htmlString ; range.MoveToBookmark( bookmark ) ; range.Collapse( false ) ; range.Select() ; range.Release() ; return true ; } oEditor.FCK.InsertHtml( sHtml ) ; return true ; } // This function will be called from the PasteFromWord dialog (fck_paste.html) // Input: oNode a DOM node that contains the raw paste from the clipboard // bIgnoreFont, bRemoveStyles booleans according to the values set in the dialog // Output: the cleaned string function CleanWord( oNode, bIgnoreFont, bRemoveStyles ) { var html = oNode.innerHTML ; html = html.replace(/<o:p>\s*<\/o:p>/g, '') ; html = html.replace(/<o:p>[\s\S]*?<\/o:p>/g, '&nbsp;') ; // Remove mso-xxx styles. html = html.replace( /\s*mso-[^:]+:[^;"]+;?/gi, '' ) ; // Remove margin styles. html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*;/gi, '' ) ; html = html.replace( /\s*MARGIN: 0cm 0cm 0pt\s*"/gi, "\"" ) ; html = html.replace( /\s*TEXT-INDENT: 0cm\s*;/gi, '' ) ; html = html.replace( /\s*TEXT-INDENT: 0cm\s*"/gi, "\"" ) ; html = html.replace( /\s*TEXT-ALIGN: [^\s;]+;?"/gi, "\"" ) ; html = html.replace( /\s*PAGE-BREAK-BEFORE: [^\s;]+;?"/gi, "\"" ) ; html = html.replace( /\s*FONT-VARIANT: [^\s;]+;?"/gi, "\"" ) ; html = html.replace( /\s*tab-stops:[^;"]*;?/gi, '' ) ; html = html.replace( /\s*tab-stops:[^"]*/gi, '' ) ; // Remove FONT face attributes. if ( bIgnoreFont ) { html = html.replace( /\s*face="[^"]*"/gi, '' ) ; html = html.replace( /\s*face=[^ >]*/gi, '' ) ; html = html.replace( /\s*FONT-FAMILY:[^;"]*;?/gi, '' ) ; } // Remove Class attributes html = html.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3") ; // Remove styles. if ( bRemoveStyles ) html = html.replace( /<(\w[^>]*) style="([^\"]*)"([^>]*)/gi, "<$1$3" ) ; // Remove style, meta and link tags html = html.replace( /<STYLE[^>]*>[\s\S]*?<\/STYLE[^>]*>/gi, '' ) ; html = html.replace( /<(?:META|LINK)[^>]*>\s*/gi, '' ) ; // Remove empty styles. html = html.replace( /\s*style="\s*"/gi, '' ) ; html = html.replace( /<SPAN\s*[^>]*>\s*&nbsp;\s*<\/SPAN>/gi, '&nbsp;' ) ; html = html.replace( /<SPAN\s*[^>]*><\/SPAN>/gi, '' ) ; // Remove Lang attributes html = html.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3") ; html = html.replace( /<SPAN\s*>([\s\S]*?)<\/SPAN>/gi, '$1' ) ; html = html.replace( /<FONT\s*>([\s\S]*?)<\/FONT>/gi, '$1' ) ; // Remove XML elements and declarations html = html.replace(/<\\?\?xml[^>]*>/gi, '' ) ; // Remove w: tags with contents. html = html.replace( /<w:[^>]*>[\s\S]*?<\/w:[^>]*>/gi, '' ) ; // Remove Tags with XML namespace declarations: <o:p><\/o:p> html = html.replace(/<\/?\w+:[^>]*>/gi, '' ) ; // Remove comments [SF BUG-1481861]. html = html.replace(/<\!--[\s\S]*?-->/g, '' ) ; html = html.replace( /<(U|I|STRIKE)>&nbsp;<\/\1>/g, '&nbsp;' ) ; html = html.replace( /<H\d>\s*<\/H\d>/gi, '' ) ; // Remove "display:none" tags. html = html.replace( /<(\w+)[^>]*\sstyle="[^"]*DISPLAY\s?:\s?none[\s\S]*?<\/\1>/ig, '' ) ; // Remove language tags html = html.replace( /<(\w[^>]*) language=([^ |>]*)([^>]*)/gi, "<$1$3") ; // Remove onmouseover and onmouseout events (from MS Word comments effect) html = html.replace( /<(\w[^>]*) onmouseover="([^\"]*)"([^>]*)/gi, "<$1$3") ; html = html.replace( /<(\w[^>]*) onmouseout="([^\"]*)"([^>]*)/gi, "<$1$3") ; if ( FCKConfig.CleanWordKeepsStructure ) { // The original <Hn> tag send from Word is something like this: <Hn style="margin-top:0px;margin-bottom:0px"> html = html.replace( /<H(\d)([^>]*)>/gi, '<h$1>' ) ; // Word likes to insert extra <font> tags, when using MSIE. (Wierd). html = html.replace( /<(H\d)><FONT[^>]*>([\s\S]*?)<\/FONT><\/\1>/gi, '<$1>$2<\/$1>' ); html = html.replace( /<(H\d)><EM>([\s\S]*?)<\/EM><\/\1>/gi, '<$1>$2<\/$1>' ); } else { html = html.replace( /<H1([^>]*)>/gi, '<div$1><b><font size="6">' ) ; html = html.replace( /<H2([^>]*)>/gi, '<div$1><b><font size="5">' ) ; html = html.replace( /<H3([^>]*)>/gi, '<div$1><b><font size="4">' ) ; html = html.replace( /<H4([^>]*)>/gi, '<div$1><b><font size="3">' ) ; html = html.replace( /<H5([^>]*)>/gi, '<div$1><b><font size="2">' ) ; html = html.replace( /<H6([^>]*)>/gi, '<div$1><b><font size="1">' ) ; html = html.replace( /<\/H\d>/gi, '<\/font><\/b><\/div>' ) ; // Transform <P> to <DIV> var re = new RegExp( '(<P)([^>]*>[\\s\\S]*?)(<\/P>)', 'gi' ) ; // Different because of a IE 5.0 error html = html.replace( re, '<div$2<\/div>' ) ; // Remove empty tags (three times, just to be sure). // This also removes any empty anchor html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' ) ; html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' ) ; html = html.replace( /<([^\s>]+)(\s[^>]*)?>\s*<\/\1>/g, '' ) ; } return html ; } </script> </head> <body style="overflow: hidden"> <table cellspacing="0" cellpadding="0" width="100%" border="0" style="height: 98%"> <tr> <td> <div id="xSecurityMsg" style="display: none"> <span fcklang="DlgPasteSec">Because of your browser security settings, the editor is not able to access your clipboard data directly. You are required to paste it again in this window.</span><br /> &nbsp; </div> <div> <span fcklang="DlgPasteMsg2">Please paste inside the following box using the keyboard (<strong>Ctrl+V</strong>) and hit <strong>OK</strong>.</span><br /> &nbsp; </div> </td> </tr> <tr> <td id="xFrameSpace" valign="top" height="100%" style="border: #000000 1px solid"> <textarea id="txtData" cols="80" rows="5" style="border: #000000 1px; display: none; width: 99%; height: 98%"></textarea> </td> </tr> <tr id="oWordCommands"> <td> <input id="chkRemoveFont" type="checkbox" checked="checked" /> <label for="chkRemoveFont" fcklang="DlgPasteIgnoreFont"> Ignore Font Face definitions</label> <br /> <input id="chkRemoveStyles" type="checkbox" /> <label for="chkRemoveStyles" fcklang="DlgPasteRemoveStyles"> Remove Styles definitions</label> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_paste.html
HTML
asf20
12,261
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Scripts related to the Link dialog window (see fck_link.html). */ var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; var FCK = oEditor.FCK ; var FCKLang = oEditor.FCKLang ; var FCKConfig = oEditor.FCKConfig ; var FCKRegexLib = oEditor.FCKRegexLib ; var FCKTools = oEditor.FCKTools ; //#### Dialog Tabs // Set the dialog tabs. dialog.AddTab( 'Info', FCKLang.DlgLnkInfoTab ) ; if ( !FCKConfig.LinkDlgHideTarget ) dialog.AddTab( 'Target', FCKLang.DlgLnkTargetTab, true ) ; if ( FCKConfig.LinkUpload ) dialog.AddTab( 'Upload', FCKLang.DlgLnkUpload, true ) ; if ( !FCKConfig.LinkDlgHideAdvanced ) dialog.AddTab( 'Advanced', FCKLang.DlgAdvancedTag ) ; // Function called when a dialog tag is selected. function OnDialogTabChange( tabCode ) { ShowE('divInfo' , ( tabCode == 'Info' ) ) ; ShowE('divTarget' , ( tabCode == 'Target' ) ) ; ShowE('divUpload' , ( tabCode == 'Upload' ) ) ; ShowE('divAttribs' , ( tabCode == 'Advanced' ) ) ; dialog.SetAutoSize( true ) ; } //#### Regular Expressions library. var oRegex = new Object() ; oRegex.UriProtocol = /^(((http|https|ftp|news):\/\/)|mailto:)/gi ; oRegex.UrlOnChangeProtocol = /^(http|https|ftp|news):\/\/(?=.)/gi ; oRegex.UrlOnChangeTestOther = /^((javascript:)|[#\/\.])/gi ; oRegex.ReserveTarget = /^_(blank|self|top|parent)$/i ; oRegex.PopupUri = /^javascript:void\(\s*window.open\(\s*'([^']+)'\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*\)\s*$/ ; // Accessible popups oRegex.OnClickPopup = /^\s*on[cC]lick="\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*"$/ ; oRegex.PopupFeatures = /(?:^|,)([^=]+)=(\d+|yes|no)/gi ; //#### Parser Functions var oParser = new Object() ; // This method simply returns the two inputs in numerical order. You can even // provide strings, as the method would parseInt() the values. oParser.SortNumerical = function(a, b) { return parseInt( a, 10 ) - parseInt( b, 10 ) ; } oParser.ParseEMailParams = function(sParams) { // Initialize the oEMailParams object. var oEMailParams = new Object() ; oEMailParams.Subject = '' ; oEMailParams.Body = '' ; var aMatch = sParams.match( /(^|^\?|&)subject=([^&]+)/i ) ; if ( aMatch ) oEMailParams.Subject = decodeURIComponent( aMatch[2] ) ; aMatch = sParams.match( /(^|^\?|&)body=([^&]+)/i ) ; if ( aMatch ) oEMailParams.Body = decodeURIComponent( aMatch[2] ) ; return oEMailParams ; } // This method returns either an object containing the email info, or FALSE // if the parameter is not an email link. oParser.ParseEMailUri = function( sUrl ) { // Initializes the EMailInfo object. var oEMailInfo = new Object() ; oEMailInfo.Address = '' ; oEMailInfo.Subject = '' ; oEMailInfo.Body = '' ; var aLinkInfo = sUrl.match( /^(\w+):(.*)$/ ) ; if ( aLinkInfo && aLinkInfo[1] == 'mailto' ) { // This seems to be an unprotected email link. var aParts = aLinkInfo[2].match( /^([^\?]+)\??(.+)?/ ) ; if ( aParts ) { // Set the e-mail address. oEMailInfo.Address = aParts[1] ; // Look for the optional e-mail parameters. if ( aParts[2] ) { var oEMailParams = oParser.ParseEMailParams( aParts[2] ) ; oEMailInfo.Subject = oEMailParams.Subject ; oEMailInfo.Body = oEMailParams.Body ; } } return oEMailInfo ; } else if ( aLinkInfo && aLinkInfo[1] == 'javascript' ) { // This may be a protected email. // Try to match the url against the EMailProtectionFunction. var func = FCKConfig.EMailProtectionFunction ; if ( func != null ) { try { // Escape special chars. func = func.replace( /([\/^$*+.?()\[\]])/g, '\\$1' ) ; // Define the possible keys. var keys = new Array('NAME', 'DOMAIN', 'SUBJECT', 'BODY') ; // Get the order of the keys (hold them in the array <pos>) and // the function replaced by regular expression patterns. var sFunc = func ; var pos = new Array() ; for ( var i = 0 ; i < keys.length ; i ++ ) { var rexp = new RegExp( keys[i] ) ; var p = func.search( rexp ) ; if ( p >= 0 ) { sFunc = sFunc.replace( rexp, '\'([^\']*)\'' ) ; pos[pos.length] = p + ':' + keys[i] ; } } // Sort the available keys. pos.sort( oParser.SortNumerical ) ; // Replace the excaped single quotes in the url, such they do // not affect the regexp afterwards. aLinkInfo[2] = aLinkInfo[2].replace( /\\'/g, '###SINGLE_QUOTE###' ) ; // Create the regexp and execute it. var rFunc = new RegExp( '^' + sFunc + '$' ) ; var aMatch = rFunc.exec( aLinkInfo[2] ) ; if ( aMatch ) { var aInfo = new Array(); for ( var i = 1 ; i < aMatch.length ; i ++ ) { var k = pos[i-1].match(/^\d+:(.+)$/) ; aInfo[k[1]] = aMatch[i].replace(/###SINGLE_QUOTE###/g, '\'') ; } // Fill the EMailInfo object that will be returned oEMailInfo.Address = aInfo['NAME'] + '@' + aInfo['DOMAIN'] ; oEMailInfo.Subject = decodeURIComponent( aInfo['SUBJECT'] ) ; oEMailInfo.Body = decodeURIComponent( aInfo['BODY'] ) ; return oEMailInfo ; } } catch (e) { } } // Try to match the email against the encode protection. var aMatch = aLinkInfo[2].match( /^location\.href='mailto:'\+(String\.fromCharCode\([\d,]+\))\+'(.*)'$/ ) ; if ( aMatch ) { // The link is encoded oEMailInfo.Address = eval( aMatch[1] ) ; if ( aMatch[2] ) { var oEMailParams = oParser.ParseEMailParams( aMatch[2] ) ; oEMailInfo.Subject = oEMailParams.Subject ; oEMailInfo.Body = oEMailParams.Body ; } return oEMailInfo ; } } return false; } oParser.CreateEMailUri = function( address, subject, body ) { // Switch for the EMailProtection setting. switch ( FCKConfig.EMailProtection ) { case 'function' : var func = FCKConfig.EMailProtectionFunction ; if ( func == null ) { if ( FCKConfig.Debug ) { alert('EMailProtection alert!\nNo function defined. Please set "FCKConfig.EMailProtectionFunction"') ; } return ''; } // Split the email address into name and domain parts. var aAddressParts = address.split( '@', 2 ) ; if ( aAddressParts[1] == undefined ) { aAddressParts[1] = '' ; } // Replace the keys by their values (embedded in single quotes). func = func.replace(/NAME/g, "'" + aAddressParts[0].replace(/'/g, '\\\'') + "'") ; func = func.replace(/DOMAIN/g, "'" + aAddressParts[1].replace(/'/g, '\\\'') + "'") ; func = func.replace(/SUBJECT/g, "'" + encodeURIComponent( subject ).replace(/'/g, '\\\'') + "'") ; func = func.replace(/BODY/g, "'" + encodeURIComponent( body ).replace(/'/g, '\\\'') + "'") ; return 'javascript:' + func ; case 'encode' : var aParams = [] ; var aAddressCode = [] ; if ( subject.length > 0 ) aParams.push( 'subject='+ encodeURIComponent( subject ) ) ; if ( body.length > 0 ) aParams.push( 'body=' + encodeURIComponent( body ) ) ; for ( var i = 0 ; i < address.length ; i++ ) aAddressCode.push( address.charCodeAt( i ) ) ; return 'javascript:location.href=\'mailto:\'+String.fromCharCode(' + aAddressCode.join( ',' ) + ')+\'?' + aParams.join( '&' ) + '\'' ; } // EMailProtection 'none' var sBaseUri = 'mailto:' + address ; var sParams = '' ; if ( subject.length > 0 ) sParams = '?subject=' + encodeURIComponent( subject ) ; if ( body.length > 0 ) { sParams += ( sParams.length == 0 ? '?' : '&' ) ; sParams += 'body=' + encodeURIComponent( body ) ; } return sBaseUri + sParams ; } //#### Initialization Code // oLink: The actual selected link in the editor. var oLink = dialog.Selection.GetSelection().MoveToAncestorNode( 'A' ) ; if ( oLink ) FCK.Selection.SelectNode( oLink ) ; window.onload = function() { // Translate the dialog box texts. oEditor.FCKLanguageManager.TranslatePage(document) ; // Fill the Anchor Names and Ids combos. LoadAnchorNamesAndIds() ; // Load the selected link information (if any). LoadSelection() ; // Update the dialog box. SetLinkType( GetE('cmbLinkType').value ) ; // Show/Hide the "Browse Server" button. GetE('divBrowseServer').style.display = FCKConfig.LinkBrowser ? '' : 'none' ; // Show the initial dialog content. GetE('divInfo').style.display = '' ; // Set the actual uploader URL. if ( FCKConfig.LinkUpload ) GetE('frmUpload').action = FCKConfig.LinkUploadURL ; // Set the default target (from configuration). SetDefaultTarget() ; // Activate the "OK" button. dialog.SetOkButton( true ) ; // Select the first field. switch( GetE('cmbLinkType').value ) { case 'url' : SelectField( 'txtUrl' ) ; break ; case 'email' : SelectField( 'txtEMailAddress' ) ; break ; case 'anchor' : if ( GetE('divSelAnchor').style.display != 'none' ) SelectField( 'cmbAnchorName' ) ; else SelectField( 'cmbLinkType' ) ; } } var bHasAnchors ; function LoadAnchorNamesAndIds() { // Since version 2.0, the anchors are replaced in the DOM by IMGs so the user see the icon // to edit them. So, we must look for that images now. var aAnchors = new Array() ; var i ; var oImages = oEditor.FCK.EditorDocument.getElementsByTagName( 'IMG' ) ; for( i = 0 ; i < oImages.length ; i++ ) { if ( oImages[i].getAttribute('_fckanchor') ) aAnchors[ aAnchors.length ] = oEditor.FCK.GetRealElement( oImages[i] ) ; } // Add also real anchors var oLinks = oEditor.FCK.EditorDocument.getElementsByTagName( 'A' ) ; for( i = 0 ; i < oLinks.length ; i++ ) { if ( oLinks[i].name && ( oLinks[i].name.length > 0 ) ) aAnchors[ aAnchors.length ] = oLinks[i] ; } var aIds = FCKTools.GetAllChildrenIds( oEditor.FCK.EditorDocument.body ) ; bHasAnchors = ( aAnchors.length > 0 || aIds.length > 0 ) ; for ( i = 0 ; i < aAnchors.length ; i++ ) { var sName = aAnchors[i].name ; if ( sName && sName.length > 0 ) FCKTools.AddSelectOption( GetE('cmbAnchorName'), sName, sName ) ; } for ( i = 0 ; i < aIds.length ; i++ ) { FCKTools.AddSelectOption( GetE('cmbAnchorId'), aIds[i], aIds[i] ) ; } ShowE( 'divSelAnchor' , bHasAnchors ) ; ShowE( 'divNoAnchor' , !bHasAnchors ) ; } function LoadSelection() { if ( !oLink ) return ; var sType = 'url' ; // Get the actual Link href. var sHRef = oLink.getAttribute( '_fcksavedurl' ) ; if ( sHRef == null ) sHRef = oLink.getAttribute( 'href' , 2 ) || '' ; // Look for a popup javascript link. var oPopupMatch = oRegex.PopupUri.exec( sHRef ) ; if( oPopupMatch ) { GetE('cmbTarget').value = 'popup' ; sHRef = oPopupMatch[1] ; FillPopupFields( oPopupMatch[2], oPopupMatch[3] ) ; SetTarget( 'popup' ) ; } // Accessible popups, the popup data is in the onclick attribute if ( !oPopupMatch ) { var onclick = oLink.getAttribute( 'onclick_fckprotectedatt' ) ; if ( onclick ) { // Decode the protected string onclick = decodeURIComponent( onclick ) ; oPopupMatch = oRegex.OnClickPopup.exec( onclick ) ; if( oPopupMatch ) { GetE( 'cmbTarget' ).value = 'popup' ; FillPopupFields( oPopupMatch[1], oPopupMatch[2] ) ; SetTarget( 'popup' ) ; } } } // Search for the protocol. var sProtocol = oRegex.UriProtocol.exec( sHRef ) ; // Search for a protected email link. var oEMailInfo = oParser.ParseEMailUri( sHRef ); if ( oEMailInfo ) { sType = 'email' ; GetE('txtEMailAddress').value = oEMailInfo.Address ; GetE('txtEMailSubject').value = oEMailInfo.Subject ; GetE('txtEMailBody').value = oEMailInfo.Body ; } else if ( sProtocol ) { sProtocol = sProtocol[0].toLowerCase() ; GetE('cmbLinkProtocol').value = sProtocol ; // Remove the protocol and get the remaining URL. var sUrl = sHRef.replace( oRegex.UriProtocol, '' ) ; sType = 'url' ; GetE('txtUrl').value = sUrl ; } else if ( sHRef.substr(0,1) == '#' && sHRef.length > 1 ) // It is an anchor link. { sType = 'anchor' ; GetE('cmbAnchorName').value = GetE('cmbAnchorId').value = sHRef.substr(1) ; } else // It is another type of link. { sType = 'url' ; GetE('cmbLinkProtocol').value = '' ; GetE('txtUrl').value = sHRef ; } if ( !oPopupMatch ) { // Get the target. var sTarget = oLink.target ; if ( sTarget && sTarget.length > 0 ) { if ( oRegex.ReserveTarget.test( sTarget ) ) { sTarget = sTarget.toLowerCase() ; GetE('cmbTarget').value = sTarget ; } else GetE('cmbTarget').value = 'frame' ; GetE('txtTargetFrame').value = sTarget ; } } // Get Advances Attributes GetE('txtAttId').value = oLink.id ; GetE('txtAttName').value = oLink.name ; GetE('cmbAttLangDir').value = oLink.dir ; GetE('txtAttLangCode').value = oLink.lang ; GetE('txtAttAccessKey').value = oLink.accessKey ; GetE('txtAttTabIndex').value = oLink.tabIndex <= 0 ? '' : oLink.tabIndex ; GetE('txtAttTitle').value = oLink.title ; GetE('txtAttContentType').value = oLink.type ; GetE('txtAttCharSet').value = oLink.charset ; var sClass ; if ( oEditor.FCKBrowserInfo.IsIE ) { sClass = oLink.getAttribute('className',2) || '' ; // Clean up temporary classes for internal use: sClass = sClass.replace( FCKRegexLib.FCK_Class, '' ) ; GetE('txtAttStyle').value = oLink.style.cssText ; } else { sClass = oLink.getAttribute('class',2) || '' ; GetE('txtAttStyle').value = oLink.getAttribute('style',2) || '' ; } GetE('txtAttClasses').value = sClass ; // Update the Link type combo. GetE('cmbLinkType').value = sType ; } //#### Link type selection. function SetLinkType( linkType ) { ShowE('divLinkTypeUrl' , (linkType == 'url') ) ; ShowE('divLinkTypeAnchor' , (linkType == 'anchor') ) ; ShowE('divLinkTypeEMail' , (linkType == 'email') ) ; if ( !FCKConfig.LinkDlgHideTarget ) dialog.SetTabVisibility( 'Target' , (linkType == 'url') ) ; if ( FCKConfig.LinkUpload ) dialog.SetTabVisibility( 'Upload' , (linkType == 'url') ) ; if ( !FCKConfig.LinkDlgHideAdvanced ) dialog.SetTabVisibility( 'Advanced' , (linkType != 'anchor' || bHasAnchors) ) ; if ( linkType == 'email' ) dialog.SetAutoSize( true ) ; } //#### Target type selection. function SetTarget( targetType ) { GetE('tdTargetFrame').style.display = ( targetType == 'popup' ? 'none' : '' ) ; GetE('tdPopupName').style.display = GetE('tablePopupFeatures').style.display = ( targetType == 'popup' ? '' : 'none' ) ; switch ( targetType ) { case "_blank" : case "_self" : case "_parent" : case "_top" : GetE('txtTargetFrame').value = targetType ; break ; case "" : GetE('txtTargetFrame').value = '' ; break ; } if ( targetType == 'popup' ) dialog.SetAutoSize( true ) ; } //#### Called while the user types the URL. function OnUrlChange() { var sUrl = GetE('txtUrl').value ; var sProtocol = oRegex.UrlOnChangeProtocol.exec( sUrl ) ; if ( sProtocol ) { sUrl = sUrl.substr( sProtocol[0].length ) ; GetE('txtUrl').value = sUrl ; GetE('cmbLinkProtocol').value = sProtocol[0].toLowerCase() ; } else if ( oRegex.UrlOnChangeTestOther.test( sUrl ) ) { GetE('cmbLinkProtocol').value = '' ; } } //#### Called while the user types the target name. function OnTargetNameChange() { var sFrame = GetE('txtTargetFrame').value ; if ( sFrame.length == 0 ) GetE('cmbTarget').value = '' ; else if ( oRegex.ReserveTarget.test( sFrame ) ) GetE('cmbTarget').value = sFrame.toLowerCase() ; else GetE('cmbTarget').value = 'frame' ; } // Accessible popups function BuildOnClickPopup() { var sWindowName = "'" + GetE('txtPopupName').value.replace(/\W/gi, "") + "'" ; var sFeatures = '' ; var aChkFeatures = document.getElementsByName( 'chkFeature' ) ; for ( var i = 0 ; i < aChkFeatures.length ; i++ ) { if ( i > 0 ) sFeatures += ',' ; sFeatures += aChkFeatures[i].value + '=' + ( aChkFeatures[i].checked ? 'yes' : 'no' ) ; } if ( GetE('txtPopupWidth').value.length > 0 ) sFeatures += ',width=' + GetE('txtPopupWidth').value ; if ( GetE('txtPopupHeight').value.length > 0 ) sFeatures += ',height=' + GetE('txtPopupHeight').value ; if ( GetE('txtPopupLeft').value.length > 0 ) sFeatures += ',left=' + GetE('txtPopupLeft').value ; if ( GetE('txtPopupTop').value.length > 0 ) sFeatures += ',top=' + GetE('txtPopupTop').value ; if ( sFeatures != '' ) sFeatures = sFeatures + ",status" ; return ( "window.open(this.href," + sWindowName + ",'" + sFeatures + "'); return false" ) ; } //#### Fills all Popup related fields. function FillPopupFields( windowName, features ) { if ( windowName ) GetE('txtPopupName').value = windowName ; var oFeatures = new Object() ; var oFeaturesMatch ; while( ( oFeaturesMatch = oRegex.PopupFeatures.exec( features ) ) != null ) { var sValue = oFeaturesMatch[2] ; if ( sValue == ( 'yes' || '1' ) ) oFeatures[ oFeaturesMatch[1] ] = true ; else if ( ! isNaN( sValue ) && sValue != 0 ) oFeatures[ oFeaturesMatch[1] ] = sValue ; } // Update all features check boxes. var aChkFeatures = document.getElementsByName('chkFeature') ; for ( var i = 0 ; i < aChkFeatures.length ; i++ ) { if ( oFeatures[ aChkFeatures[i].value ] ) aChkFeatures[i].checked = true ; } // Update position and size text boxes. if ( oFeatures['width'] ) GetE('txtPopupWidth').value = oFeatures['width'] ; if ( oFeatures['height'] ) GetE('txtPopupHeight').value = oFeatures['height'] ; if ( oFeatures['left'] ) GetE('txtPopupLeft').value = oFeatures['left'] ; if ( oFeatures['top'] ) GetE('txtPopupTop').value = oFeatures['top'] ; } //#### The OK button was hit. function Ok() { var sUri, sInnerHtml ; oEditor.FCKUndo.SaveUndoStep() ; switch ( GetE('cmbLinkType').value ) { case 'url' : sUri = GetE('txtUrl').value ; if ( sUri.length == 0 ) { alert( FCKLang.DlnLnkMsgNoUrl ) ; return false ; } sUri = GetE('cmbLinkProtocol').value + sUri ; break ; case 'email' : sUri = GetE('txtEMailAddress').value ; if ( sUri.length == 0 ) { alert( FCKLang.DlnLnkMsgNoEMail ) ; return false ; } sUri = oParser.CreateEMailUri( sUri, GetE('txtEMailSubject').value, GetE('txtEMailBody').value ) ; break ; case 'anchor' : var sAnchor = GetE('cmbAnchorName').value ; if ( sAnchor.length == 0 ) sAnchor = GetE('cmbAnchorId').value ; if ( sAnchor.length == 0 ) { alert( FCKLang.DlnLnkMsgNoAnchor ) ; return false ; } sUri = '#' + sAnchor ; break ; } // If no link is selected, create a new one (it may result in more than one link creation - #220). var aLinks = oLink ? [ oLink ] : oEditor.FCK.CreateLink( sUri, true ) ; // If no selection, no links are created, so use the uri as the link text (by dom, 2006-05-26) var aHasSelection = ( aLinks.length > 0 ) ; if ( !aHasSelection ) { sInnerHtml = sUri; // Built a better text for empty links. switch ( GetE('cmbLinkType').value ) { // anchor: use old behavior --> return true case 'anchor': sInnerHtml = sInnerHtml.replace( /^#/, '' ) ; break ; // url: try to get path case 'url': var oLinkPathRegEx = new RegExp("//?([^?\"']+)([?].*)?$") ; var asLinkPath = oLinkPathRegEx.exec( sUri ) ; if (asLinkPath != null) sInnerHtml = asLinkPath[1]; // use matched path break ; // mailto: try to get email address case 'email': sInnerHtml = GetE('txtEMailAddress').value ; break ; } // Create a new (empty) anchor. aLinks = [ oEditor.FCK.InsertElement( 'a' ) ] ; } for ( var i = 0 ; i < aLinks.length ; i++ ) { oLink = aLinks[i] ; if ( aHasSelection ) sInnerHtml = oLink.innerHTML ; // Save the innerHTML (IE changes it if it is like an URL). oLink.href = sUri ; SetAttribute( oLink, '_fcksavedurl', sUri ) ; var onclick; // Accessible popups if( GetE('cmbTarget').value == 'popup' ) { onclick = BuildOnClickPopup() ; // Encode the attribute onclick = encodeURIComponent( " onclick=\"" + onclick + "\"" ) ; SetAttribute( oLink, 'onclick_fckprotectedatt', onclick ) ; } else { // Check if the previous onclick was for a popup: // In that case remove the onclick handler. onclick = oLink.getAttribute( 'onclick_fckprotectedatt' ) ; if ( onclick ) { // Decode the protected string onclick = decodeURIComponent( onclick ) ; if( oRegex.OnClickPopup.test( onclick ) ) SetAttribute( oLink, 'onclick_fckprotectedatt', '' ) ; } } oLink.innerHTML = sInnerHtml ; // Set (or restore) the innerHTML // Target if( GetE('cmbTarget').value != 'popup' ) SetAttribute( oLink, 'target', GetE('txtTargetFrame').value ) ; else SetAttribute( oLink, 'target', null ) ; // Let's set the "id" only for the first link to avoid duplication. if ( i == 0 ) SetAttribute( oLink, 'id', GetE('txtAttId').value ) ; // Advances Attributes SetAttribute( oLink, 'name' , GetE('txtAttName').value ) ; SetAttribute( oLink, 'dir' , GetE('cmbAttLangDir').value ) ; SetAttribute( oLink, 'lang' , GetE('txtAttLangCode').value ) ; SetAttribute( oLink, 'accesskey', GetE('txtAttAccessKey').value ) ; SetAttribute( oLink, 'tabindex' , ( GetE('txtAttTabIndex').value > 0 ? GetE('txtAttTabIndex').value : null ) ) ; SetAttribute( oLink, 'title' , GetE('txtAttTitle').value ) ; SetAttribute( oLink, 'type' , GetE('txtAttContentType').value ) ; SetAttribute( oLink, 'charset' , GetE('txtAttCharSet').value ) ; if ( oEditor.FCKBrowserInfo.IsIE ) { var sClass = GetE('txtAttClasses').value ; // If it's also an anchor add an internal class if ( GetE('txtAttName').value.length != 0 ) sClass += ' FCK__AnchorC' ; SetAttribute( oLink, 'className', sClass ) ; oLink.style.cssText = GetE('txtAttStyle').value ; } else { SetAttribute( oLink, 'class', GetE('txtAttClasses').value ) ; SetAttribute( oLink, 'style', GetE('txtAttStyle').value ) ; } } // Select the (first) link. oEditor.FCKSelection.SelectNode( aLinks[0] ); return true ; } function BrowseServer() { OpenFileBrowser( FCKConfig.LinkBrowserURL, FCKConfig.LinkBrowserWindowWidth, FCKConfig.LinkBrowserWindowHeight ) ; } function SetUrl( url ) { GetE('txtUrl').value = url ; OnUrlChange() ; dialog.SetSelectedTab( 'Info' ) ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { // Remove animation window.parent.Throbber.Hide() ; GetE( 'divUpload' ).style.display = '' ; switch ( errorNumber ) { case 0 : // No errors alert( 'Your file has been successfully uploaded' ) ; break ; case 1 : // Custom error alert( customMsg ) ; return ; case 101 : // Custom warning alert( customMsg ) ; break ; case 201 : alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + fileName + '"' ) ; break ; case 202 : alert( 'Invalid file type' ) ; return ; case 203 : alert( "Security error. You probably don't have enough permissions to upload. Please check your server." ) ; return ; case 500 : alert( 'The connector is disabled' ) ; break ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; return ; } SetUrl( fileUrl ) ; GetE('frmUpload').reset() ; } var oUploadAllowedExtRegex = new RegExp( FCKConfig.LinkUploadAllowedExtensions, 'i' ) ; var oUploadDeniedExtRegex = new RegExp( FCKConfig.LinkUploadDeniedExtensions, 'i' ) ; function CheckUpload() { var sFile = GetE('txtUploadFile').value ; if ( sFile.length == 0 ) { alert( 'Please select a file to upload' ) ; return false ; } if ( ( FCKConfig.LinkUploadAllowedExtensions.length > 0 && !oUploadAllowedExtRegex.test( sFile ) ) || ( FCKConfig.LinkUploadDeniedExtensions.length > 0 && oUploadDeniedExtRegex.test( sFile ) ) ) { OnUploadCompleted( 202 ) ; return false ; } // Show animation window.parent.Throbber.Show( 100 ) ; GetE( 'divUpload' ).style.display = 'none' ; return true ; } function SetDefaultTarget() { var target = FCKConfig.DefaultLinkTarget || '' ; if ( oLink || target.length == 0 ) return ; switch ( target ) { case '_blank' : case '_self' : case '_parent' : case '_top' : GetE('cmbTarget').value = target ; break ; default : GetE('cmbTarget').value = 'frame' ; break ; } GetE('txtTargetFrame').value = target ; }
zzshop
trunk/includes/fckeditor/editor/dialog/fck_link/fck_link.js
JavaScript
asf20
25,609
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Preview shown in the "Document Properties" dialog window. --> <html> <head> <title>Document Properties - Preview</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="robots" content="noindex, nofollow"> <script language="javascript"> var eBase = parent.FCK.EditorDocument.getElementsByTagName( 'BASE' ) ; if ( eBase.length > 0 && eBase[0].href.length > 0 ) { document.write( '<base href="' + eBase[0].href + '">' ) ; } window.onload = function() { if ( typeof( parent.OnPreviewLoad ) == 'function' ) parent.OnPreviewLoad( window, document.body ) ; } function SetBaseHRef( baseHref ) { var eBase = document.createElement( 'BASE' ) ; eBase.href = baseHref ; var eHead = document.getElementsByTagName( 'HEAD' )[0] ; eHead.appendChild( eBase ) ; } function SetLinkColor( color ) { if ( color && color.length > 0 ) document.getElementById('eLink').style.color = color ; else document.getElementById('eLink').style.color = window.document.linkColor ; } function SetVisitedColor( color ) { if ( color && color.length > 0 ) document.getElementById('eVisited').style.color = color ; else document.getElementById('eVisited').style.color = window.document.vlinkColor ; } function SetActiveColor( color ) { if ( color && color.length > 0 ) document.getElementById('eActive').style.color = color ; else document.getElementById('eActive').style.color = window.document.alinkColor ; } </script> </head> <body> <table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td align="center" valign="middle"> Normal Text </td> <td id="eLink" align="center" valign="middle"> <u>Link Text</u> </td> </tr> <tr> <td id="eVisited" valign="middle" align="center"> <u>Visited Link</u> </td> <td id="eActive" valign="middle" align="center"> <u>Active Link</u> </td> </tr> </table> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_docprops/fck_document_preview.html
HTML
asf20
2,843
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Spell Check dialog window. --> <html> <head> <title>Spell Check</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta content="noindex, nofollow" name="robots"> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script src="fck_spellerpages/spellerpages/spellChecker.js"></script> <script type="text/javascript"> var oEditor = window.parent.InnerDialogLoaded() ; var FCKLang = oEditor.FCKLang ; window.onload = function() { document.getElementById('txtHtml').value = oEditor.FCK.EditorDocument.body.innerHTML ; var oSpeller = new spellChecker( document.getElementById('txtHtml') ) ; oSpeller.spellCheckScript = oEditor.FCKConfig.SpellerPagesServerScript || 'server-scripts/spellchecker.php' ; oSpeller.OnFinished = oSpeller_OnFinished ; oSpeller.openChecker() ; } function OnSpellerControlsLoad( controlsWindow ) { // Translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage( controlsWindow.document ) ; } function oSpeller_OnFinished( numberOCorrections ) { if ( numberOCorrections > 0 ) { oEditor.FCKUndo.SaveUndoStep() ; oEditor.FCK.EditorDocument.body.innerHTML = document.getElementById('txtHtml').value ; if ( oEditor.FCKBrowserInfo.IsIE ) oEditor.FCKSelection.Collapse( true ) ; } window.parent.Cancel() ; } </script> </head> <body style="OVERFLOW: hidden" scroll="no" style="padding:0px;"> <input type="hidden" id="txtHtml" value=""> <iframe id="frmSpell" src="javascript:void(0)" name="spellchecker" width="100%" height="100%" frameborder="0"></iframe> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_spellerpages.html
HTML
asf20
2,339
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Useful functions used by almost all dialog window pages. * Dialogs should link to this file as the very first script on the page. */ // Automatically detect the correct document.domain (#123). (function() { var d = document.domain ; while ( true ) { // Test if we can access a parent property. try { var test = window.parent.document.domain ; break ; } catch( e ) {} // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... d = d.replace( /.*?(?:\.|$)/, '' ) ; if ( d.length == 0 ) break ; // It was not able to detect the domain. try { document.domain = d ; } catch (e) { break ; } } })() ; // Attention: FCKConfig must be available in the page. function GetCommonDialogCss( prefix ) { // CSS minified by http://iceyboard.no-ip.org/projects/css_compressor (see _dev/css_compression.txt). return FCKConfig.BasePath + 'dialog/common/' + '|.ImagePreviewArea{border:#000 1px solid;overflow:auto;width:100%;height:170px;background-color:#fff}.FlashPreviewArea{border:#000 1px solid;padding:5px;overflow:auto;width:100%;height:170px;background-color:#fff}.BtnReset{float:left;background-position:center center;background-image:url(images/reset.gif);width:16px;height:16px;background-repeat:no-repeat;border:1px none;font-size:1px}.BtnLocked,.BtnUnlocked{float:left;background-position:center center;background-image:url(images/locked.gif);width:16px;height:16px;background-repeat:no-repeat;border:none 1px;font-size:1px}.BtnUnlocked{background-image:url(images/unlocked.gif)}.BtnOver{border:outset 1px;cursor:pointer;cursor:hand}' ; } // Gets a element by its Id. Used for shorter coding. function GetE( elementId ) { return document.getElementById( elementId ) ; } function ShowE( element, isVisible ) { if ( typeof( element ) == 'string' ) element = GetE( element ) ; element.style.display = isVisible ? '' : 'none' ; } function SetAttribute( element, attName, attValue ) { if ( attValue == null || attValue.length == 0 ) element.removeAttribute( attName, 0 ) ; // 0 : Case Insensitive else element.setAttribute( attName, attValue, 0 ) ; // 0 : Case Insensitive } function GetAttribute( element, attName, valueIfNull ) { var oAtt = element.attributes[attName] ; if ( oAtt == null || !oAtt.specified ) return valueIfNull ? valueIfNull : '' ; var oValue = element.getAttribute( attName, 2 ) ; if ( oValue == null ) oValue = oAtt.nodeValue ; return ( oValue == null ? valueIfNull : oValue ) ; } function SelectField( elementId ) { var element = GetE( elementId ) ; element.focus() ; // element.select may not be available for some fields (like <select>). if ( element.select ) element.select() ; } // Functions used by text fields to accept numbers only. var IsDigit = ( function() { var KeyIdentifierMap = { End : 35, Home : 36, Left : 37, Right : 39, 'U+00007F' : 46 // Delete } ; return function ( e ) { if ( !e ) e = event ; var iCode = ( e.keyCode || e.charCode ) ; if ( !iCode && e.keyIdentifier && ( e.keyIdentifier in KeyIdentifierMap ) ) iCode = KeyIdentifierMap[ e.keyIdentifier ] ; return ( ( iCode >= 48 && iCode <= 57 ) // Numbers || (iCode >= 35 && iCode <= 40) // Arrows, Home, End || iCode == 8 // Backspace || iCode == 46 // Delete || iCode == 9 // Tab ) ; } } )() ; String.prototype.Trim = function() { return this.replace( /(^\s*)|(\s*$)/g, '' ) ; } String.prototype.StartsWith = function( value ) { return ( this.substr( 0, value.length ) == value ) ; } String.prototype.Remove = function( start, length ) { var s = '' ; if ( start > 0 ) s = this.substring( 0, start ) ; if ( start + length < this.length ) s += this.substring( start + length , this.length ) ; return s ; } String.prototype.ReplaceAll = function( searchArray, replaceArray ) { var replaced = this ; for ( var i = 0 ; i < searchArray.length ; i++ ) { replaced = replaced.replace( searchArray[i], replaceArray[i] ) ; } return replaced ; } function OpenFileBrowser( url, width, height ) { // oEditor must be defined. var iLeft = ( oEditor.FCKConfig.ScreenWidth - width ) / 2 ; var iTop = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ; var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ; sOptions += ",width=" + width ; sOptions += ",height=" + height ; sOptions += ",left=" + iLeft ; sOptions += ",top=" + iTop ; window.open( url, 'FCKBrowseWindow', sOptions ) ; } /** Utility function to create/update an element with a name attribute in IE, so it behaves properly when moved around It also allows to change the name or other special attributes in an existing node oEditor : instance of FCKeditor where the element will be created oOriginal : current element being edited or null if it has to be created nodeName : string with the name of the element to create oAttributes : Hash object with the attributes that must be set at creation time in IE Those attributes will be set also after the element has been created for any other browser to avoid redudant code */ function CreateNamedElement( oEditor, oOriginal, nodeName, oAttributes ) { var oNewNode ; // IE doesn't allow easily to change properties of an existing object, // so remove the old and force the creation of a new one. var oldNode = null ; if ( oOriginal && oEditor.FCKBrowserInfo.IsIE ) { // Force the creation only if some of the special attributes have changed: var bChanged = false; for( var attName in oAttributes ) bChanged |= ( oOriginal.getAttribute( attName, 2) != oAttributes[attName] ) ; if ( bChanged ) { oldNode = oOriginal ; oOriginal = null ; } } // If the node existed (and it's not IE), then we just have to update its attributes if ( oOriginal ) { oNewNode = oOriginal ; } else { // #676, IE doesn't play nice with the name or type attribute if ( oEditor.FCKBrowserInfo.IsIE ) { var sbHTML = [] ; sbHTML.push( '<' + nodeName ) ; for( var prop in oAttributes ) { sbHTML.push( ' ' + prop + '="' + oAttributes[prop] + '"' ) ; } sbHTML.push( '>' ) ; if ( !oEditor.FCKListsLib.EmptyElements[nodeName.toLowerCase()] ) sbHTML.push( '</' + nodeName + '>' ) ; oNewNode = oEditor.FCK.EditorDocument.createElement( sbHTML.join('') ) ; // Check if we are just changing the properties of an existing node: copy its properties if ( oldNode ) { CopyAttributes( oldNode, oNewNode, oAttributes ) ; oEditor.FCKDomTools.MoveChildren( oldNode, oNewNode ) ; oldNode.parentNode.removeChild( oldNode ) ; oldNode = null ; if ( oEditor.FCK.Selection.SelectionData ) { // Trick to refresh the selection object and avoid error in // fckdialog.html Selection.EnsureSelection var oSel = oEditor.FCK.EditorDocument.selection ; oEditor.FCK.Selection.SelectionData = oSel.createRange() ; // Now oSel.type will be 'None' reflecting the real situation } } oNewNode = oEditor.FCK.InsertElement( oNewNode ) ; // FCK.Selection.SelectionData is broken by now since we've // deleted the previously selected element. So we need to reassign it. if ( oEditor.FCK.Selection.SelectionData ) { var range = oEditor.FCK.EditorDocument.body.createControlRange() ; range.add( oNewNode ) ; oEditor.FCK.Selection.SelectionData = range ; } } else { oNewNode = oEditor.FCK.InsertElement( nodeName ) ; } } // Set the basic attributes for( var attName in oAttributes ) oNewNode.setAttribute( attName, oAttributes[attName], 0 ) ; // 0 : Case Insensitive return oNewNode ; } // Copy all the attributes from one node to the other, kinda like a clone // But oSkipAttributes is an object with the attributes that must NOT be copied function CopyAttributes( oSource, oDest, oSkipAttributes ) { var aAttributes = oSource.attributes ; for ( var n = 0 ; n < aAttributes.length ; n++ ) { var oAttribute = aAttributes[n] ; if ( oAttribute.specified ) { var sAttName = oAttribute.nodeName ; // We can set the type only once, so do it with the proper value, not copying it. if ( sAttName in oSkipAttributes ) continue ; var sAttValue = oSource.getAttribute( sAttName, 2 ) ; if ( sAttValue == null ) sAttValue = oAttribute.nodeValue ; oDest.setAttribute( sAttName, sAttValue, 0 ) ; // 0 : Case Insensitive } } // The style: oDest.style.cssText = oSource.style.cssText ; }
zzshop
trunk/includes/fckeditor/editor/dialog/common/fck_dialog_common.js
JavaScript
asf20
9,468
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the CSS file used for interface details in some dialog * windows. */ /* ######### * WARNING * ######### * When changing this file, the minified version of it must be updated in the * fck_dialog_common.js file (see GetCommonDialogCss). */ .ImagePreviewArea { border: #000000 1px solid; overflow: auto; width: 100%; height: 170px; background-color: #ffffff; } .FlashPreviewArea { border: #000000 1px solid; padding: 5px; overflow: auto; width: 100%; height: 170px; background-color: #ffffff; } .BtnReset { float: left; background-position: center center; background-image: url(images/reset.gif); width: 16px; height: 16px; background-repeat: no-repeat; border: 1px none; font-size: 1px ; } .BtnLocked, .BtnUnlocked { float: left; background-position: center center; background-image: url(images/locked.gif); width: 16px; height: 16px; background-repeat: no-repeat; border: none 1px; font-size: 1px ; } .BtnUnlocked { background-image: url(images/unlocked.gif); } .BtnOver { border: outset 1px; cursor: pointer; cursor: hand; }
zzshop
trunk/includes/fckeditor/editor/dialog/common/fck_dialog_common.css
CSS
asf20
1,773
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Select dialog window. --> <html> <head> <title>Select Properties</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta content="noindex, nofollow" name="robots"> <script src="common/fck_dialog_common.js" type="text/javascript"></script> <script type="text/javascript" src="fck_select/fck_select.js"></script> <script type="text/javascript"> var dialog = window.parent ; var oEditor = dialog.InnerDialogLoaded() ; // Gets the document DOM var oDOM = oEditor.FCK.EditorDocument ; var oActiveEl = dialog.Selection.GetSelectedElement() ; var oListText ; var oListValue ; window.onload = function() { // First of all, translate the dialog box texts oEditor.FCKLanguageManager.TranslatePage(document) ; oListText = document.getElementById( 'cmbText' ) ; oListValue = document.getElementById( 'cmbValue' ) ; // Fix the lists widths. (Bug #970) oListText.style.width = oListText.offsetWidth ; oListValue.style.width = oListValue.offsetWidth ; if ( oActiveEl && oActiveEl.tagName == 'SELECT' ) { GetE('txtName').value = oActiveEl.name ; GetE('txtSelValue').value = oActiveEl.value ; GetE('txtLines').value = GetAttribute( oActiveEl, 'size' ) ; GetE('chkMultiple').checked = oActiveEl.multiple ; // Load the actual options for ( var i = 0 ; i < oActiveEl.options.length ; i++ ) { var sText = HTMLDecode( oActiveEl.options[i].innerHTML ) ; var sValue = oActiveEl.options[i].value ; AddComboOption( oListText, sText, sText ) ; AddComboOption( oListValue, sValue, sValue ) ; } } else oActiveEl = null ; dialog.SetOkButton( true ) ; dialog.SetAutoSize( true ) ; SelectField( 'txtName' ) ; } function Ok() { oEditor.FCKUndo.SaveUndoStep() ; var sSize = GetE('txtLines').value ; if ( sSize == null || isNaN( sSize ) || sSize <= 1 ) sSize = '' ; oActiveEl = CreateNamedElement( oEditor, oActiveEl, 'SELECT', {name: GetE('txtName').value} ) ; SetAttribute( oActiveEl, 'size' , sSize ) ; oActiveEl.multiple = ( sSize.length > 0 && GetE('chkMultiple').checked ) ; // Remove all options. while ( oActiveEl.options.length > 0 ) oActiveEl.remove(0) ; // Add all available options. for ( var i = 0 ; i < oListText.options.length ; i++ ) { var sText = oListText.options[i].value ; var sValue = oListValue.options[i].value ; if ( sValue.length == 0 ) sValue = sText ; var oOption = AddComboOption( oActiveEl, sText, sValue, oDOM ) ; if ( sValue == GetE('txtSelValue').value ) { SetAttribute( oOption, 'selected', 'selected' ) ; oOption.selected = true ; } } return true ; } </script> </head> <body style="overflow: hidden"> <table width="100%" height="100%"> <tr> <td> <table width="100%"> <tr> <td nowrap><span fckLang="DlgSelectName">Name</span>&nbsp;</td> <td width="100%" colSpan="2"><input id="txtName" style="WIDTH: 100%" type="text"></td> </tr> <tr> <td nowrap><span fckLang="DlgSelectValue">Value</span>&nbsp;</td> <td width="100%" colSpan="2"><input id="txtSelValue" style="WIDTH: 100%; BACKGROUND-COLOR: buttonface" type="text" readonly></td> </tr> <tr> <td nowrap><span fckLang="DlgSelectSize">Size</span>&nbsp;</td> <td nowrap><input id="txtLines" type="text" size="2" value="">&nbsp;<span fckLang="DlgSelectLines">lines</span></td> <td nowrap align="right"><input id="chkMultiple" name="chkMultiple" type="checkbox"><label for="chkMultiple" fckLang="DlgSelectChkMulti">Allow multiple selections</label></td> </tr> </table> <br> <hr style="POSITION: absolute"> <span style="LEFT: 10px; POSITION: relative; TOP: -7px" class="BackColor">&nbsp;<span fckLang="DlgSelectOpAvail">Available Options</span>&nbsp;</span> <table width="100%"> <tr> <td width="50%"><span fckLang="DlgSelectOpText">Text</span><br> <input id="txtText" style="WIDTH: 100%" type="text" name="txtText"> </td> <td width="50%"><span fckLang="DlgSelectOpValue">Value</span><br> <input id="txtValue" style="WIDTH: 100%" type="text" name="txtValue"> </td> <td vAlign="bottom"><input onclick="Add();" type="button" fckLang="DlgSelectBtnAdd" value="Add"></td> <td vAlign="bottom"><input onclick="Modify();" type="button" fckLang="DlgSelectBtnModify" value="Modify"></td> </tr> <tr> <td rowSpan="2"><select id="cmbText" style="WIDTH: 100%" onchange="GetE('cmbValue').selectedIndex = this.selectedIndex;Select(this);" size="5" name="cmbText"></select> </td> <td rowSpan="2"><select id="cmbValue" style="WIDTH: 100%" onchange="GetE('cmbText').selectedIndex = this.selectedIndex;Select(this);" size="5" name="cmbValue"></select> </td> <td vAlign="top" colSpan="2"> </td> </tr> <tr> <td vAlign="bottom" colSpan="2"><input style="WIDTH: 100%" onclick="Move(-1);" type="button" fckLang="DlgSelectBtnUp" value="Up"> <br> <input style="WIDTH: 100%" onclick="Move(1);" type="button" fckLang="DlgSelectBtnDown" value="Down"> </td> </tr> <TR> <TD vAlign="bottom" colSpan="4"><INPUT onclick="SetSelectedValue();" type="button" fckLang="DlgSelectBtnSetValue" value="Set as selected value">&nbsp;&nbsp; <input onclick="Delete();" type="button" fckLang="DlgSelectBtnDelete" value="Delete"></TD> </TR> </table> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/dialog/fck_select.html
HTML
asf20
6,356
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Page used to upload new files in the current folder. --> <html> <head> <title>File Upload</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="browser.css" type="text/css" rel="stylesheet" > <script type="text/javascript" src="js/common.js"></script> <script type="text/javascript"> function SetCurrentFolder( resourceType, folderPath ) { var sUrl = oConnector.ConnectorUrl + 'Command=FileUpload' ; sUrl += '&Type=' + resourceType ; sUrl += '&CurrentFolder=' + encodeURIComponent( folderPath ) ; document.getElementById('frmUpload').action = sUrl ; } function OnSubmit() { if ( document.getElementById('NewFile').value.length == 0 ) { alert( 'Please select a file from your computer' ) ; return false ; } // Set the interface elements. document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder (Upload in progress, please wait...)' ; document.getElementById('btnUpload').disabled = true ; return true ; } function OnUploadCompleted( errorNumber, data ) { // Reset the Upload Worker Frame. window.parent.frames['frmUploadWorker'].location = 'javascript:void(0)' ; // Reset the upload form (On IE we must do a little trick to avoid problems). if ( document.all ) document.getElementById('NewFile').outerHTML = '<input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file">' ; else document.getElementById('frmUpload').reset() ; // Reset the interface elements. document.getElementById('eUploadMessage').innerHTML = 'Upload a new file in this folder' ; document.getElementById('btnUpload').disabled = false ; switch ( errorNumber ) { case 0 : window.parent.frames['frmResourcesList'].Refresh() ; break ; case 1 : // Custom error. alert( data ) ; break ; case 201 : window.parent.frames['frmResourcesList'].Refresh() ; alert( 'A file with the same name is already available. The uploaded file has been renamed to "' + data + '"' ) ; break ; case 202 : alert( 'Invalid file' ) ; break ; default : alert( 'Error on file upload. Error number: ' + errorNumber ) ; break ; } } window.onload = function() { window.top.IsLoadedUpload = true ; } </script> </head> <body> <form id="frmUpload" action="" target="frmUploadWorker" method="post" enctype="multipart/form-data" onsubmit="return OnSubmit();"> <table class="fullHeight" cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td nowrap="nowrap"> <span id="eUploadMessage">Upload a new file in this folder</span><br> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td width="100%"><input id="NewFile" name="NewFile" style="WIDTH: 100%" type="file"></td> <td nowrap="nowrap">&nbsp;<input id="btnUpload" type="submit" value="Upload"></td> </tr> </table> </td> </tr> </table> </form> </body> </html>
zzshop
trunk/includes/fckeditor/editor/filemanager/browser/default/frmupload.html
HTML
asf20
3,707
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This page shows the list of folders available in the parent folder * of the current folder. --> <html> <head> <title>Folders</title> <link href="browser.css" type="text/css" rel="stylesheet"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="js/common.js"></script> <script type="text/javascript"> var sActiveFolder ; var bIsLoaded = false ; var iIntervalId ; var oListManager = new Object() ; oListManager.Init = function() { this.Table = document.getElementById('tableFiles') ; this.UpRow = document.getElementById('trUp') ; this.TableRows = new Object() ; } oListManager.Clear = function() { // Remove all other rows available. while ( this.Table.rows.length > 1 ) this.Table.deleteRow(1) ; // Reset the TableRows collection. this.TableRows = new Object() ; } oListManager.AddItem = function( folderName, folderPath ) { // Create the new row. var oRow = this.Table.insertRow(-1) ; oRow.className = 'FolderListFolder' ; // Build the link to view the folder. var sLink = '<a href="#" onclick="OpenFolder(\'' + folderPath + '\');return false;">' ; // Add the folder icon cell. var oCell = oRow.insertCell(-1) ; oCell.width = 16 ; oCell.innerHTML = sLink + '<img alt="" src="images/spacer.gif" width="16" height="16" border="0"><\/a>' ; // Add the folder name cell. oCell = oRow.insertCell(-1) ; oCell.noWrap = true ; oCell.innerHTML = '&nbsp;' + sLink + folderName + '<\/a>' ; this.TableRows[ folderPath ] = oRow ; } oListManager.ShowUpFolder = function( upFolderPath ) { this.UpRow.style.display = ( upFolderPath != null ? '' : 'none' ) ; if ( upFolderPath != null ) { document.getElementById('linkUpIcon').onclick = document.getElementById('linkUp').onclick = function() { LoadFolders( upFolderPath ) ; return false ; } } } function CheckLoaded() { if ( window.top.IsLoadedActualFolder && window.top.IsLoadedCreateFolder && window.top.IsLoadedUpload && window.top.IsLoadedResourcesList ) { window.clearInterval( iIntervalId ) ; bIsLoaded = true ; OpenFolder( sActiveFolder ) ; } } function OpenFolder( folderPath ) { sActiveFolder = folderPath ; if ( ! bIsLoaded ) { if ( ! iIntervalId ) iIntervalId = window.setInterval( CheckLoaded, 100 ) ; return ; } // Change the style for the select row (to show the opened folder). for ( var sFolderPath in oListManager.TableRows ) { oListManager.TableRows[ sFolderPath ].className = ( sFolderPath == folderPath ? 'FolderListCurrentFolder' : 'FolderListFolder' ) ; } // Set the current folder in all frames. window.parent.frames['frmActualFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ; window.parent.frames['frmCreateFolder'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ; window.parent.frames['frmUpload'].SetCurrentFolder( oConnector.ResourceType, folderPath ) ; // Load the resources list for this folder. window.parent.frames['frmResourcesList'].LoadResources( oConnector.ResourceType, folderPath ) ; } function LoadFolders( folderPath ) { // Clear the folders list. oListManager.Clear() ; // Get the parent folder path. var sParentFolderPath ; if ( folderPath != '/' ) sParentFolderPath = folderPath.substring( 0, folderPath.lastIndexOf( '/', folderPath.length - 2 ) + 1 ) ; // Show/Hide the Up Folder. oListManager.ShowUpFolder( sParentFolderPath ) ; if ( folderPath != '/' ) { sActiveFolder = folderPath ; oConnector.CurrentFolder = sParentFolderPath ; oConnector.SendCommand( 'GetFolders', null, GetFoldersCallBack ) ; } else OpenFolder( '/' ) ; } function GetFoldersCallBack( fckXml ) { if ( oConnector.CheckError( fckXml ) != 0 ) return ; // Get the current folder path. var oNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ; var sCurrentFolderPath = oNode.attributes.getNamedItem('path').value ; var oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ; for ( var i = 0 ; i < oNodes.length ; i++ ) { var sFolderName = oNodes[i].attributes.getNamedItem('name').value ; oListManager.AddItem( sFolderName, sCurrentFolderPath + sFolderName + '/' ) ; } OpenFolder( sActiveFolder ) ; } function SetResourceType( type ) { oConnector.ResourceType = type ; LoadFolders( '/' ) ; } window.onload = function() { oListManager.Init() ; LoadFolders( '/' ) ; } </script> </head> <body class="FileArea"> <table id="tableFiles" cellSpacing="0" cellPadding="0" width="100%" border="0"> <tr id="trUp" style="DISPLAY: none"> <td width="16"><a id="linkUpIcon" href="#"><img alt="" src="images/FolderUp.gif" width="16" height="16" border="0"></a></td> <td nowrap width="100%">&nbsp;<a id="linkUp" href="#">..</a></td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/filemanager/browser/default/frmfolders.html
HTML
asf20
5,640
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This page compose the File Browser dialog frameset. --> <html> <head> <title>FCKeditor - Resources Browser</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="browser.css" type="text/css" rel="stylesheet"> <script type="text/javascript" src="js/fckxml.js"></script> <script type="text/javascript"> // Automatically detect the correct document.domain (#1919). (function() { var d = document.domain ; while ( true ) { // Test if we can access a parent property. try { var test = window.opener.document.domain ; break ; } catch( e ) {} // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... d = d.replace( /.*?(?:\.|$)/, '' ) ; if ( d.length == 0 ) break ; // It was not able to detect the domain. try { document.domain = d ; } catch (e) { break ; } } })() ; function GetUrlParam( paramName ) { var oRegex = new RegExp( '[\?&]' + paramName + '=([^&]+)', 'i' ) ; var oMatch = oRegex.exec( window.top.location.search ) ; if ( oMatch && oMatch.length > 1 ) return decodeURIComponent( oMatch[1] ) ; else return '' ; } var oConnector = new Object() ; oConnector.CurrentFolder = '/' ; var sConnUrl = GetUrlParam( 'Connector' ) ; // Gecko has some problems when using relative URLs (not starting with slash). if ( sConnUrl.substr(0,1) != '/' && sConnUrl.indexOf( '://' ) < 0 ) sConnUrl = window.location.href.replace( /browser.html.*$/, '' ) + sConnUrl ; oConnector.ConnectorUrl = sConnUrl + ( sConnUrl.indexOf('?') != -1 ? '&' : '?' ) ; var sServerPath = GetUrlParam( 'ServerPath' ) ; if ( sServerPath.length > 0 ) oConnector.ConnectorUrl += 'ServerPath=' + encodeURIComponent( sServerPath ) + '&' ; oConnector.ResourceType = GetUrlParam( 'Type' ) ; oConnector.ShowAllTypes = ( oConnector.ResourceType.length == 0 ) ; if ( oConnector.ShowAllTypes ) oConnector.ResourceType = 'File' ; oConnector.SendCommand = function( command, params, callBackFunction ) { var sUrl = this.ConnectorUrl + 'Command=' + command ; sUrl += '&Type=' + this.ResourceType ; sUrl += '&CurrentFolder=' + encodeURIComponent( this.CurrentFolder ) ; if ( params ) sUrl += '&' + params ; // Add a random salt to avoid getting a cached version of the command execution sUrl += '&uuid=' + new Date().getTime() ; var oXML = new FCKXml() ; if ( callBackFunction ) oXML.LoadUrl( sUrl, callBackFunction ) ; // Asynchronous load. else return oXML.LoadUrl( sUrl ) ; return null ; } oConnector.CheckError = function( responseXml ) { var iErrorNumber = 0 ; var oErrorNode = responseXml.SelectSingleNode( 'Connector/Error' ) ; if ( oErrorNode ) { iErrorNumber = parseInt( oErrorNode.attributes.getNamedItem('number').value, 10 ) ; switch ( iErrorNumber ) { case 0 : break ; case 1 : // Custom error. Message placed in the "text" attribute. alert( oErrorNode.attributes.getNamedItem('text').value ) ; break ; case 101 : alert( 'Folder already exists' ) ; break ; case 102 : alert( 'Invalid folder name' ) ; break ; case 103 : alert( 'You have no permissions to create the folder' ) ; break ; case 110 : alert( 'Unknown error creating folder' ) ; break ; default : alert( 'Error on your request. Error number: ' + iErrorNumber ) ; break ; } } return iErrorNumber ; } var oIcons = new Object() ; oIcons.AvailableIconsArray = [ 'ai','avi','bmp','cs','dll','doc','exe','fla','gif','htm','html','jpg','js', 'mdb','mp3','pdf','png','ppt','rdp','swf','swt','txt','vsd','xls','xml','zip' ] ; oIcons.AvailableIcons = new Object() ; for ( var i = 0 ; i < oIcons.AvailableIconsArray.length ; i++ ) oIcons.AvailableIcons[ oIcons.AvailableIconsArray[i] ] = true ; oIcons.GetIcon = function( fileName ) { var sExtension = fileName.substr( fileName.lastIndexOf('.') + 1 ).toLowerCase() ; if ( this.AvailableIcons[ sExtension ] == true ) return sExtension ; else return 'default.icon' ; } function OnUploadCompleted( errorNumber, fileUrl, fileName, customMsg ) { if (errorNumber == "1") window.frames['frmUpload'].OnUploadCompleted( errorNumber, customMsg ) ; else window.frames['frmUpload'].OnUploadCompleted( errorNumber, fileName ) ; } </script> </head> <frameset cols="150,*" class="Frame" framespacing="3" bordercolor="#f1f1e3" frameborder="1"> <frameset rows="50,*" framespacing="0"> <frame src="frmresourcetype.html" scrolling="no" frameborder="0"> <frame name="frmFolders" src="frmfolders.html" scrolling="auto" frameborder="1"> </frameset> <frameset rows="50,*,50" framespacing="0"> <frame name="frmActualFolder" src="frmactualfolder.html" scrolling="no" frameborder="0"> <frame name="frmResourcesList" src="frmresourceslist.html" scrolling="auto" frameborder="1"> <frameset cols="150,*,0" framespacing="0" frameborder="0"> <frame name="frmCreateFolder" src="frmcreatefolder.html" scrolling="no" frameborder="0"> <frame name="frmUpload" src="frmupload.html" scrolling="no" frameborder="0"> <frame name="frmUploadWorker" src="javascript:void(0)" scrolling="no" frameborder="0"> </frameset> </frameset> </frameset> </html>
zzshop
trunk/includes/fckeditor/editor/filemanager/browser/default/browser.html
HTML
asf20
6,113
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This page shows the actual folder path. --> <html> <head> <title>Folder path</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="browser.css" type="text/css" rel="stylesheet"> <script type="text/javascript"> // Automatically detect the correct document.domain (#1919). (function() { var d = document.domain ; while ( true ) { // Test if we can access a parent property. try { var test = window.top.opener.document.domain ; break ; } catch( e ) {} // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... d = d.replace( /.*?(?:\.|$)/, '' ) ; if ( d.length == 0 ) break ; // It was not able to detect the domain. try { document.domain = d ; } catch (e) { break ; } } })() ; function SetCurrentFolder( resourceType, folderPath ) { document.getElementById('tdName').innerHTML = folderPath ; } window.onload = function() { window.top.IsLoadedActualFolder = true ; } </script> </head> <body> <table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0"> <tr> <td> <button style="WIDTH: 100%" type="button"> <table cellSpacing="0" cellPadding="0" width="100%" border="0"> <tr> <td><img height="32" alt="" src="images/FolderOpened32.gif" width="32"></td> <td>&nbsp;</td> <td id="tdName" width="100%" nowrap class="ActualFolder">/</td> <td>&nbsp;</td> <td><img height="8" src="images/ButtonArrow.gif" width="12" alt=""></td> <td>&nbsp;</td> </tr> </table> </button> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/filemanager/browser/default/frmactualfolder.html
HTML
asf20
2,427
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Defines the FCKXml object that is used for XML data calls * and XML processing. * * This script is shared by almost all pages that compose the * File Browser frameset. */ var FCKXml = function() {} FCKXml.prototype.GetHttpRequest = function() { // Gecko / IE7 try { return new XMLHttpRequest(); } catch(e) {} // IE6 try { return new ActiveXObject( 'Msxml2.XMLHTTP' ) ; } catch(e) {} // IE5 try { return new ActiveXObject( 'Microsoft.XMLHTTP' ) ; } catch(e) {} return null ; } FCKXml.prototype.LoadUrl = function( urlToCall, asyncFunctionPointer ) { var oFCKXml = this ; var bAsync = ( typeof(asyncFunctionPointer) == 'function' ) ; var oXmlHttp = this.GetHttpRequest() ; oXmlHttp.open( "GET", urlToCall, bAsync ) ; if ( bAsync ) { oXmlHttp.onreadystatechange = function() { if ( oXmlHttp.readyState == 4 ) { var oXml ; try { // this is the same test for an FF2 bug as in fckxml_gecko.js // but we've moved the responseXML assignment into the try{} // so we don't even have to check the return status codes. var test = oXmlHttp.responseXML.firstChild ; oXml = oXmlHttp.responseXML ; } catch ( e ) { try { oXml = (new DOMParser()).parseFromString( oXmlHttp.responseText, 'text/xml' ) ; } catch ( e ) {} } if ( !oXml || !oXml.firstChild || oXml.firstChild.nodeName == 'parsererror' ) { alert( 'The server didn\'t send back a proper XML response. Please contact your system administrator.\n\n' + 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')\n\n' + 'Requested URL:\n' + urlToCall + '\n\n' + 'Response text:\n' + oXmlHttp.responseText ) ; return ; } oFCKXml.DOMDocument = oXml ; asyncFunctionPointer( oFCKXml ) ; } } } oXmlHttp.send( null ) ; if ( ! bAsync ) { if ( oXmlHttp.status == 200 || oXmlHttp.status == 304 ) this.DOMDocument = oXmlHttp.responseXML ; else { alert( 'XML request error: ' + oXmlHttp.statusText + ' (' + oXmlHttp.status + ')' ) ; } } } FCKXml.prototype.SelectNodes = function( xpath ) { if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE return this.DOMDocument.selectNodes( xpath ) ; else // Gecko { var aNodeArray = new Array(); var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument, this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), XPathResult.ORDERED_NODE_ITERATOR_TYPE, null) ; if ( xPathResult ) { var oNode = xPathResult.iterateNext() ; while( oNode ) { aNodeArray[aNodeArray.length] = oNode ; oNode = xPathResult.iterateNext(); } } return aNodeArray ; } } FCKXml.prototype.SelectSingleNode = function( xpath ) { if ( navigator.userAgent.indexOf('MSIE') >= 0 ) // IE return this.DOMDocument.selectSingleNode( xpath ) ; else // Gecko { var xPathResult = this.DOMDocument.evaluate( xpath, this.DOMDocument, this.DOMDocument.createNSResolver(this.DOMDocument.documentElement), 9, null); if ( xPathResult && xPathResult.singleNodeValue ) return xPathResult.singleNodeValue ; else return null ; } }
zzshop
trunk/includes/fckeditor/editor/filemanager/browser/default/js/fckxml.js
JavaScript
asf20
3,925
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Common objects and functions shared by all pages that compose the * File Browser dialog window. */ // Automatically detect the correct document.domain (#1919). (function() { var d = document.domain ; while ( true ) { // Test if we can access a parent property. try { var test = window.top.opener.document.domain ; break ; } catch( e ) {} // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ... d = d.replace( /.*?(?:\.|$)/, '' ) ; if ( d.length == 0 ) break ; // It was not able to detect the domain. try { document.domain = d ; } catch (e) { break ; } } })() ; function AddSelectOption( selectElement, optionText, optionValue ) { var oOption = document.createElement("OPTION") ; oOption.text = optionText ; oOption.value = optionValue ; selectElement.options.add(oOption) ; return oOption ; } var oConnector = window.parent.oConnector ; var oIcons = window.parent.oIcons ; function StringBuilder( value ) { this._Strings = new Array( value || '' ) ; } StringBuilder.prototype.Append = function( value ) { if ( value ) this._Strings.push( value ) ; } StringBuilder.prototype.ToString = function() { return this._Strings.join( '' ) ; }
zzshop
trunk/includes/fckeditor/editor/filemanager/browser/default/js/common.js
JavaScript
asf20
1,960
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Page used to create new folders in the current folder. --> <html> <head> <title>Create Folder</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="browser.css" type="text/css" rel="stylesheet"> <script type="text/javascript" src="js/common.js"></script> <script type="text/javascript"> function SetCurrentFolder( resourceType, folderPath ) { oConnector.ResourceType = resourceType ; oConnector.CurrentFolder = folderPath ; } function CreateFolder() { var sFolderName ; while ( true ) { sFolderName = prompt( 'Type the name of the new folder:', '' ) ; if ( sFolderName == null ) return ; else if ( sFolderName.length == 0 ) alert( 'Please type the folder name' ) ; else break ; } oConnector.SendCommand( 'CreateFolder', 'NewFolderName=' + encodeURIComponent( sFolderName) , CreateFolderCallBack ) ; } function CreateFolderCallBack( fckXml ) { if ( oConnector.CheckError( fckXml ) == 0 ) window.parent.frames['frmResourcesList'].Refresh() ; /* // Get the current folder path. var oNode = fckXml.SelectSingleNode( 'Connector/Error' ) ; var iErrorNumber = parseInt( oNode.attributes.getNamedItem('number').value ) ; switch ( iErrorNumber ) { case 0 : window.parent.frames['frmResourcesList'].Refresh() ; break ; case 101 : alert( 'Folder already exists' ) ; break ; case 102 : alert( 'Invalid folder name' ) ; break ; case 103 : alert( 'You have no permissions to create the folder' ) ; break ; case 110 : alert( 'Unknown error creating folder' ) ; break ; default : alert( 'Error creating folder. Error number: ' + iErrorNumber ) ; break ; } */ } window.onload = function() { window.top.IsLoadedCreateFolder = true ; } </script> </head> <body> <table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0"> <tr> <td> <button type="button" style="WIDTH: 100%" onclick="CreateFolder();"> <table cellSpacing="0" cellPadding="0" border="0"> <tr> <td><img height="16" alt="" src="images/Folder.gif" width="16"></td> <td>&nbsp;</td> <td nowrap>Create New Folder</td> </tr> </table> </button> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/filemanager/browser/default/frmcreatefolder.html
HTML
asf20
3,050
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This page shows the list of available resource types. --> <html> <head> <title>Available types</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link href="browser.css" type="text/css" rel="stylesheet"> <script type="text/javascript" src="js/common.js"></script> <script type="text/javascript"> function SetResourceType( type ) { window.parent.frames["frmFolders"].SetResourceType( type ) ; } var aTypes = [ ['File','File'], ['Image','Image'], ['Flash','Flash'], ['Media','Media'] ] ; window.onload = function() { var oCombo = document.getElementById('cmbType') ; oCombo.innerHTML = '' ; for ( var i = 0 ; i < aTypes.length ; i++ ) { if ( oConnector.ShowAllTypes || aTypes[i][0] == oConnector.ResourceType ) AddSelectOption( oCombo, aTypes[i][1], aTypes[i][0] ) ; } } </script> </head> <body> <table class="fullHeight" cellSpacing="0" cellPadding="0" width="100%" border="0"> <tr> <td nowrap> Resource Type<BR> <select id="cmbType" style="WIDTH: 100%" onchange="SetResourceType(this.value);"> <option>&nbsp; </select> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/filemanager/browser/default/frmresourcetype.html
HTML
asf20
1,899
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This page shows all resources available in a folder in the File Browser. --> <html> <head> <title>Resources</title> <link href="browser.css" type="text/css" rel="stylesheet"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="js/common.js"></script> <script type="text/javascript"> var oListManager = new Object() ; oListManager.Clear = function() { document.body.innerHTML = '' ; } function ProtectPath(path) { path = path.replace( /\\/g, '\\\\') ; path = path.replace( /'/g, '\\\'') ; return path ; } oListManager.GetFolderRowHtml = function( folderName, folderPath ) { // Build the link to view the folder. var sLink = '<a href="#" onclick="OpenFolder(\'' + ProtectPath( folderPath ) + '\');return false;">' ; return '<tr>' + '<td width="16">' + sLink + '<img alt="" src="images/Folder.gif" width="16" height="16" border="0"><\/a>' + '<\/td><td nowrap colspan="2">&nbsp;' + sLink + folderName + '<\/a>' + '<\/td><\/tr>' ; } oListManager.GetFileRowHtml = function( fileName, fileUrl, fileSize ) { // Build the link to view the folder. var sLink = '<a href="#" onclick="OpenFile(\'' + ProtectPath( fileUrl ) + '\');return false;">' ; // Get the file icon. var sIcon = oIcons.GetIcon( fileName ) ; return '<tr>' + '<td width="16">' + sLink + '<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"><\/a>' + '<\/td><td>&nbsp;' + sLink + fileName + '<\/a>' + '<\/td><td align="right" nowrap>&nbsp;' + fileSize + ' KB' + '<\/td><\/tr>' ; } function OpenFolder( folderPath ) { // Load the resources list for this folder. window.parent.frames['frmFolders'].LoadFolders( folderPath ) ; } function OpenFile( fileUrl ) { window.top.opener.SetUrl( encodeURI( fileUrl ).replace( '#', '%23' ) ) ; window.top.close() ; window.top.opener.focus() ; } function LoadResources( resourceType, folderPath ) { oListManager.Clear() ; oConnector.ResourceType = resourceType ; oConnector.CurrentFolder = folderPath ; oConnector.SendCommand( 'GetFoldersAndFiles', null, GetFoldersAndFilesCallBack ) ; } function Refresh() { LoadResources( oConnector.ResourceType, oConnector.CurrentFolder ) ; } function GetFoldersAndFilesCallBack( fckXml ) { if ( oConnector.CheckError( fckXml ) != 0 ) return ; // Get the current folder path. var oFolderNode = fckXml.SelectSingleNode( 'Connector/CurrentFolder' ) ; if ( oFolderNode == null ) { alert( 'The server didn\'t reply with a proper XML data. Please check your configuration.' ) ; return ; } var sCurrentFolderPath = oFolderNode.attributes.getNamedItem('path').value ; var sCurrentFolderUrl = oFolderNode.attributes.getNamedItem('url').value ; // var dTimer = new Date() ; var oHtml = new StringBuilder( '<table id="tableFiles" cellspacing="1" cellpadding="0" width="100%" border="0">' ) ; // Add the Folders. var oNodes ; oNodes = fckXml.SelectNodes( 'Connector/Folders/Folder' ) ; for ( var i = 0 ; i < oNodes.length ; i++ ) { var sFolderName = oNodes[i].attributes.getNamedItem('name').value ; oHtml.Append( oListManager.GetFolderRowHtml( sFolderName, sCurrentFolderPath + sFolderName + "/" ) ) ; } // Add the Files. oNodes = fckXml.SelectNodes( 'Connector/Files/File' ) ; for ( var j = 0 ; j < oNodes.length ; j++ ) { var oNode = oNodes[j] ; var sFileName = oNode.attributes.getNamedItem('name').value ; var sFileSize = oNode.attributes.getNamedItem('size').value ; // Get the optional "url" attribute. If not available, build the url. var oFileUrlAtt = oNodes[j].attributes.getNamedItem('url') ; var sFileUrl = oFileUrlAtt != null ? oFileUrlAtt.value : sCurrentFolderUrl + sFileName ; oHtml.Append( oListManager.GetFileRowHtml( sFileName, sFileUrl, sFileSize ) ) ; } oHtml.Append( '<\/table>' ) ; document.body.innerHTML = oHtml.ToString() ; // window.top.document.title = 'Finished processing in ' + ( ( ( new Date() ) - dTimer ) / 1000 ) + ' seconds' ; } window.onload = function() { window.top.IsLoadedResourcesList = true ; } </script> </head> <body class="FileArea"> </body> </html>
zzshop
trunk/includes/fckeditor/editor/filemanager/browser/default/frmresourceslist.html
HTML
asf20
5,004
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * CSS styles used by all pages that compose the File Browser. */ body { background-color: #f1f1e3; margin-top:0; margin-bottom:0; } form { margin: 0; padding: 0; } .Frame { background-color: #f1f1e3; border: thin inset #f1f1e3; } body.FileArea { background-color: #ffffff; margin: 10px; } body, td, input, select { font-size: 11px; font-family: 'Microsoft Sans Serif' , Arial, Helvetica, Verdana; } .ActualFolder { font-weight: bold; font-size: 14px; } .PopupButtons { border-top: #d5d59d 1px solid; background-color: #e3e3c7; padding: 7px 10px 7px 10px; } .Button, button { color: #3b3b1f; border: #737357 1px solid; background-color: #c7c78f; } .FolderListCurrentFolder img { background-image: url(images/FolderOpened.gif); } .FolderListFolder img { background-image: url(images/Folder.gif); } .fullHeight { height: 100%; }
zzshop
trunk/includes/fckeditor/editor/filemanager/browser/default/browser.css
CSS
asf20
1,554
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the "File Uploader" for PHP. */ require('./config.php') ; require('./util.php') ; require('./io.php') ; require('./commands.php') ; require('./phpcompat.php') ; function SendError( $number, $text ) { SendUploadResults( $number, '', '', $text ) ; } // Check if this uploader has been enabled. if ( !$Config['Enabled'] ) SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ; $sCommand = 'QuickUpload' ; // The file type (from the QueryString, by default 'File'). $sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ; $sCurrentFolder = GetCurrentFolder() ; // Is enabled the upload? if ( ! IsAllowedCommand( $sCommand ) ) SendUploadResults( '1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed' ) ; // Check if it is an allowed type. if ( !IsAllowedType( $sType ) ) SendUploadResults( 1, '', '', 'Invalid type specified' ) ; FileUpload( $sType, $sCurrentFolder, $sCommand ) ?>
zzshop
trunk/includes/fckeditor/editor/filemanager/connectors/php/upload.php
PHP
asf20
1,688
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the File Manager Connector for PHP. */ ob_start() ; require('./config.php') ; require('./util.php') ; require('./io.php') ; require('./basexml.php') ; require('./commands.php') ; require('./phpcompat.php') ; if ( !$Config['Enabled'] ) SendError( 1, 'This connector is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ; DoResponse() ; function DoResponse() { if (!isset($_GET)) { global $_GET; } if ( !isset( $_GET['Command'] ) || !isset( $_GET['Type'] ) || !isset( $_GET['CurrentFolder'] ) ) return ; // Get the main request informaiton. $sCommand = $_GET['Command'] ; $sResourceType = $_GET['Type'] ; $sCurrentFolder = GetCurrentFolder() ; // Check if it is an allowed command if ( ! IsAllowedCommand( $sCommand ) ) SendError( 1, 'The "' . $sCommand . '" command isn\'t allowed' ) ; // Check if it is an allowed type. if ( !IsAllowedType( $sResourceType ) ) SendError( 1, 'Invalid type specified' ) ; // File Upload doesn't have to Return XML, so it must be intercepted before anything. if ( $sCommand == 'FileUpload' ) { FileUpload( $sResourceType, $sCurrentFolder, $sCommand ) ; return ; } CreateXmlHeader( $sCommand, $sResourceType, $sCurrentFolder ) ; // Execute the required command. switch ( $sCommand ) { case 'GetFolders' : GetFolders( $sResourceType, $sCurrentFolder ) ; break ; case 'GetFoldersAndFiles' : GetFoldersAndFiles( $sResourceType, $sCurrentFolder ) ; break ; case 'CreateFolder' : CreateFolder( $sResourceType, $sCurrentFolder ) ; break ; } CreateXmlFooter() ; exit ; } ?>
zzshop
trunk/includes/fckeditor/editor/filemanager/connectors/php/connector.php
PHP
asf20
2,501
<?php if ( !isset( $_SERVER ) ) { $_SERVER = $HTTP_SERVER_VARS ; } if ( !isset( $_GET ) ) { $_GET = $HTTP_GET_VARS ; } if ( !isset( $_FILES ) ) { $_FILES = $HTTP_POST_FILES ; } if ( !defined( 'DIRECTORY_SEPARATOR' ) ) { define( 'DIRECTORY_SEPARATOR', strtoupper(substr(PHP_OS, 0, 3) == 'WIN') ? '\\' : '/' ) ; }
zzshop
trunk/includes/fckeditor/editor/filemanager/connectors/php/phpcompat.php
PHP
asf20
359
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * These functions define the base of the XML response sent by the PHP * connector. */ function SetXmlHeaders() { ob_end_clean() ; // Prevent the browser from caching the result. // Date in the past header('Expires: Mon, 26 Jul 1997 05:00:00 GMT') ; // always modified header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT') ; // HTTP/1.1 header('Cache-Control: no-store, no-cache, must-revalidate') ; header('Cache-Control: post-check=0, pre-check=0', false) ; // HTTP/1.0 header('Pragma: no-cache') ; // Set the response format. header( 'Content-Type: text/xml; charset=utf-8' ) ; } function CreateXmlHeader( $command, $resourceType, $currentFolder ) { SetXmlHeaders() ; // Create the XML document header. echo '<?xml version="1.0" encoding="utf-8" ?>' ; // Create the main "Connector" node. echo '<Connector command="' . $command . '" resourceType="' . $resourceType . '">' ; // Add the current folder node. echo '<CurrentFolder path="' . ConvertToXmlAttribute( $currentFolder ) . '" url="' . ConvertToXmlAttribute( GetUrlFromPath( $resourceType, $currentFolder, $command ) ) . '" />' ; $GLOBALS['HeaderSent'] = true ; } function CreateXmlFooter() { echo '</Connector>' ; } function SendError( $number, $text ) { if ( isset( $GLOBALS['HeaderSent'] ) && $GLOBALS['HeaderSent'] ) { SendErrorNode( $number, $text ) ; CreateXmlFooter() ; } else { SetXmlHeaders() ; // Create the XML document header echo '<?xml version="1.0" encoding="utf-8" ?>' ; echo '<Connector>' ; SendErrorNode( $number, $text ) ; echo '</Connector>' ; } exit ; } function SendErrorNode( $number, $text ) { echo '<Error number="' . $number . '" text="' . htmlspecialchars( $text ) . '" />' ; } ?>
zzshop
trunk/includes/fckeditor/editor/filemanager/connectors/php/basexml.php
PHP
asf20
2,581
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the File Manager Connector for PHP. */ function CombinePaths( $sBasePath, $sFolder ) { return RemoveFromEnd( $sBasePath, '/' ) . '/' . RemoveFromStart( $sFolder, '/' ) ; } function GetResourceTypePath( $resourceType, $sCommand ) { global $Config ; if ( $sCommand == "QuickUpload") return $Config['QuickUploadPath'][$resourceType] ; else return $Config['FileTypesPath'][$resourceType] ; } function GetResourceTypeDirectory( $resourceType, $sCommand ) { global $Config ; if ( $sCommand == "QuickUpload") { if ( strlen( $Config['QuickUploadAbsolutePath'][$resourceType] ) > 0 ) return $Config['QuickUploadAbsolutePath'][$resourceType] ; // Map the "UserFiles" path to a local directory. return Server_MapPath( $Config['QuickUploadPath'][$resourceType] ) ; } else { if ( strlen( $Config['FileTypesAbsolutePath'][$resourceType] ) > 0 ) return $Config['FileTypesAbsolutePath'][$resourceType] ; // Map the "UserFiles" path to a local directory. return Server_MapPath( $Config['FileTypesPath'][$resourceType] ) ; } } function GetUrlFromPath( $resourceType, $folderPath, $sCommand ) { return CombinePaths( GetResourceTypePath( $resourceType, $sCommand ), $folderPath ) ; } function RemoveExtension( $fileName ) { return substr( $fileName, 0, strrpos( $fileName, '.' ) ) ; } function ServerMapFolder( $resourceType, $folderPath, $sCommand ) { // Get the resource type directory. $sResourceTypePath = GetResourceTypeDirectory( $resourceType, $sCommand ) ; // Ensure that the directory exists. $sErrorMsg = CreateServerFolder( $sResourceTypePath ) ; if ( $sErrorMsg != '' ) SendError( 1, "Error creating folder \"{$sResourceTypePath}\" ({$sErrorMsg})" ) ; // Return the resource type directory combined with the required path. return CombinePaths( $sResourceTypePath , $folderPath ) ; } function GetParentFolder( $folderPath ) { $sPattern = "-[/\\\\][^/\\\\]+[/\\\\]?$-" ; return preg_replace( $sPattern, '', $folderPath ) ; } function CreateServerFolder( $folderPath, $lastFolder = null ) { global $Config ; $sParent = GetParentFolder( $folderPath ) ; // Ensure the folder path has no double-slashes, or mkdir may fail on certain platforms while ( strpos($folderPath, '//') !== false ) { $folderPath = str_replace( '//', '/', $folderPath ) ; } // Check if the parent exists, or create it. if ( !file_exists( $sParent ) ) { //prevents agains infinite loop when we can't create root folder if ( !is_null( $lastFolder ) && $lastFolder === $sParent) { return "Can't create $folderPath directory" ; } $sErrorMsg = CreateServerFolder( $sParent, $folderPath ) ; if ( $sErrorMsg != '' ) return $sErrorMsg ; } if ( !file_exists( $folderPath ) ) { // Turn off all error reporting. error_reporting( 0 ) ; $php_errormsg = '' ; // Enable error tracking to catch the error. ini_set( 'track_errors', '1' ) ; if ( isset( $Config['ChmodOnFolderCreate'] ) && !$Config['ChmodOnFolderCreate'] ) { mkdir( $folderPath ) ; } else { $permissions = 0777 ; if ( isset( $Config['ChmodOnFolderCreate'] ) ) { $permissions = $Config['ChmodOnFolderCreate'] ; } // To create the folder with 0777 permissions, we need to set umask to zero. $oldumask = umask(0) ; mkdir( $folderPath, $permissions ) ; umask( $oldumask ) ; } $sErrorMsg = $php_errormsg ; // Restore the configurations. ini_restore( 'track_errors' ) ; ini_restore( 'error_reporting' ) ; return $sErrorMsg ; } else return '' ; } function GetRootPath() { if (!isset($_SERVER)) { global $_SERVER; } $sRealPath = realpath( './' ) ; // #2124 ensure that no slash is at the end $sRealPath = rtrim($sRealPath,"\\/"); $sSelfPath = $_SERVER['PHP_SELF'] ; $sSelfPath = substr( $sSelfPath, 0, strrpos( $sSelfPath, '/' ) ) ; $sSelfPath = str_replace( '/', DIRECTORY_SEPARATOR, $sSelfPath ) ; $position = strpos( $sRealPath, $sSelfPath ) ; // This can check only that this script isn't run from a virtual dir // But it avoids the problems that arise if it isn't checked if ( $position === false || $position <> strlen( $sRealPath ) - strlen( $sSelfPath ) ) SendError( 1, 'Sorry, can\'t map "UserFilesPath" to a physical path. You must set the "UserFilesAbsolutePath" value in "editor/filemanager/connectors/php/config.php".' ) ; return substr( $sRealPath, 0, $position ) ; } // Emulate the asp Server.mapPath function. // given an url path return the physical directory that it corresponds to function Server_MapPath( $path ) { // This function is available only for Apache if ( function_exists( 'apache_lookup_uri' ) ) { $info = apache_lookup_uri( $path ) ; return $info->filename . $info->path_info ; } // This isn't correct but for the moment there's no other solution // If this script is under a virtual directory or symlink it will detect the problem and stop return GetRootPath() . $path ; } function IsAllowedExt( $sExtension, $resourceType ) { global $Config ; // Get the allowed and denied extensions arrays. $arAllowed = $Config['AllowedExtensions'][$resourceType] ; $arDenied = $Config['DeniedExtensions'][$resourceType] ; if ( count($arAllowed) > 0 && !in_array( $sExtension, $arAllowed ) ) return false ; if ( count($arDenied) > 0 && in_array( $sExtension, $arDenied ) ) return false ; return true ; } function IsAllowedType( $resourceType ) { global $Config ; if ( !in_array( $resourceType, $Config['ConfigAllowedTypes'] ) ) return false ; return true ; } function IsAllowedCommand( $sCommand ) { global $Config ; if ( !in_array( $sCommand, $Config['ConfigAllowedCommands'] ) ) return false ; return true ; } function GetCurrentFolder() { if (!isset($_GET)) { global $_GET; } $sCurrentFolder = isset( $_GET['CurrentFolder'] ) ? $_GET['CurrentFolder'] : '/' ; // Check the current folder syntax (must begin and start with a slash). if ( !preg_match( '|/$|', $sCurrentFolder ) ) $sCurrentFolder .= '/' ; if ( strpos( $sCurrentFolder, '/' ) !== 0 ) $sCurrentFolder = '/' . $sCurrentFolder ; // Ensure the folder path has no double-slashes while ( strpos ($sCurrentFolder, '//') !== false ) { $sCurrentFolder = str_replace ('//', '/', $sCurrentFolder) ; } // Check for invalid folder paths (..) if ( strpos( $sCurrentFolder, '..' ) || strpos( $sCurrentFolder, "\\" )) SendError( 102, '' ) ; return $sCurrentFolder ; } // Do a cleanup of the folder name to avoid possible problems function SanitizeFolderName( $sNewFolderName ) { $sNewFolderName = stripslashes( $sNewFolderName ) ; // Remove . \ / | : ? * " < > $sNewFolderName = preg_replace( '/\\.|\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFolderName ) ; return $sNewFolderName ; } // Do a cleanup of the file name to avoid possible problems function SanitizeFileName( $sNewFileName ) { global $Config ; $sNewFileName = stripslashes( $sNewFileName ) ; // Replace dots in the name with underscores (only one dot can be there... security issue). if ( $Config['ForceSingleExtension'] ) $sNewFileName = preg_replace( '/\\.(?![^.]*$)/', '_', $sNewFileName ) ; // Remove \ / | : ? * " < > $sNewFileName = preg_replace( '/\\\\|\\/|\\||\\:|\\?|\\*|"|<|>|[[:cntrl:]]/', '_', $sNewFileName ) ; return $sNewFileName ; } // This is the function that sends the results of the uploading process. function SendUploadResults( $errorNumber, $fileUrl = '', $fileName = '', $customMsg = '' ) { // Minified version of the document.domain automatic fix script (#1919). // The original script can be found at _dev/domain_fix_template.js echo <<<EOF <script type="text/javascript"> (function(){var d=document.domain;while (true){try{var A=window.parent.document.domain;break;}catch(e) {};d=d.replace(/.*?(?:\.|$)/,'');if (d.length==0) break;try{document.domain=d;}catch (e){break;}}})(); EOF; $rpl = array( '\\' => '\\\\', '"' => '\\"' ) ; echo 'window.parent.OnUploadCompleted(' . $errorNumber . ',"' . strtr( $fileUrl, $rpl ) . '","' . strtr( $fileName, $rpl ) . '", "' . strtr( $customMsg, $rpl ) . '") ;' ; echo '</script>' ; exit ; } ?>
zzshop
trunk/includes/fckeditor/editor/filemanager/connectors/php/io.php
PHP
asf20
9,718
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Utility functions for the File Manager Connector for PHP. */ function RemoveFromStart( $sourceString, $charToRemove ) { $sPattern = '|^' . $charToRemove . '+|' ; return preg_replace( $sPattern, '', $sourceString ) ; } function RemoveFromEnd( $sourceString, $charToRemove ) { $sPattern = '|' . $charToRemove . '+$|' ; return preg_replace( $sPattern, '', $sourceString ) ; } function FindBadUtf8( $string ) { $regex = '([\x00-\x7F]'. '|[\xC2-\xDF][\x80-\xBF]'. '|\xE0[\xA0-\xBF][\x80-\xBF]'. '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}'. '|\xED[\x80-\x9F][\x80-\xBF]'. '|\xF0[\x90-\xBF][\x80-\xBF]{2}'. '|[\xF1-\xF3][\x80-\xBF]{3}'. '|\xF4[\x80-\x8F][\x80-\xBF]{2}'. '|(.{1}))'; while (preg_match('/'.$regex.'/S', $string, $matches)) { if ( isset($matches[2])) { return true; } $string = substr($string, strlen($matches[0])); } return false; } function ConvertToXmlAttribute( $value ) { if ( defined( 'PHP_OS' ) ) { $os = PHP_OS ; } else { $os = php_uname() ; } if ( strtoupper( substr( $os, 0, 3 ) ) === 'WIN' || FindBadUtf8( $value ) ) { return ( utf8_encode( htmlspecialchars( $value ) ) ) ; } else { return ( htmlspecialchars( $value ) ) ; } } /** * Check whether given extension is in html etensions list * * @param string $ext * @param array $htmlExtensions * @return boolean */ function IsHtmlExtension( $ext, $htmlExtensions ) { if ( !$htmlExtensions || !is_array( $htmlExtensions ) ) { return false ; } $lcaseHtmlExtensions = array() ; foreach ( $htmlExtensions as $key => $val ) { $lcaseHtmlExtensions[$key] = strtolower( $val ) ; } return in_array( $ext, $lcaseHtmlExtensions ) ; } /** * Detect HTML in the first KB to prevent against potential security issue with * IE/Safari/Opera file type auto detection bug. * Returns true if file contain insecure HTML code at the beginning. * * @param string $filePath absolute path to file * @return boolean */ function DetectHtml( $filePath ) { $fp = @fopen( $filePath, 'rb' ) ; //open_basedir restriction, see #1906 if ( $fp === false || !flock( $fp, LOCK_SH ) ) { return -1 ; } $chunk = fread( $fp, 1024 ) ; flock( $fp, LOCK_UN ) ; fclose( $fp ) ; $chunk = strtolower( $chunk ) ; if (!$chunk) { return false ; } $chunk = trim( $chunk ) ; if ( preg_match( "/<!DOCTYPE\W*X?HTML/sim", $chunk ) ) { return true; } $tags = array( '<body', '<head', '<html', '<img', '<pre', '<script', '<table', '<title' ) ; foreach( $tags as $tag ) { if( false !== strpos( $chunk, $tag ) ) { return true ; } } //type = javascript if ( preg_match( '!type\s*=\s*[\'"]?\s*(?:\w*/)?(?:ecma|java)!sim', $chunk ) ) { return true ; } //href = javascript //src = javascript //data = javascript if ( preg_match( '!(?:href|src|data)\s*=\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) ) { return true ; } //url(javascript if ( preg_match( '!url\s*\(\s*[\'"]?\s*(?:ecma|java)script:!sim', $chunk ) ) { return true ; } return false ; } /** * Check file content. * Currently this function validates only image files. * Returns false if file is invalid. * * @param string $filePath absolute path to file * @param string $extension file extension * @param integer $detectionLevel 0 = none, 1 = use getimagesize for images, 2 = use DetectHtml for images * @return boolean */ function IsImageValid( $filePath, $extension ) { if (!@is_readable($filePath)) { return -1; } $imageCheckExtensions = array('gif', 'jpeg', 'jpg', 'png', 'swf', 'psd', 'bmp', 'iff'); // version_compare is available since PHP4 >= 4.0.7 if ( function_exists( 'version_compare' ) ) { $sCurrentVersion = phpversion(); if ( version_compare( $sCurrentVersion, "4.2.0" ) >= 0 ) { $imageCheckExtensions[] = "tiff"; $imageCheckExtensions[] = "tif"; } if ( version_compare( $sCurrentVersion, "4.3.0" ) >= 0 ) { $imageCheckExtensions[] = "swc"; } if ( version_compare( $sCurrentVersion, "4.3.2" ) >= 0 ) { $imageCheckExtensions[] = "jpc"; $imageCheckExtensions[] = "jp2"; $imageCheckExtensions[] = "jpx"; $imageCheckExtensions[] = "jb2"; $imageCheckExtensions[] = "xbm"; $imageCheckExtensions[] = "wbmp"; } } if ( !in_array( $extension, $imageCheckExtensions ) ) { return true; } if ( @getimagesize( $filePath ) === false ) { return false ; } return true; } ?>
zzshop
trunk/includes/fckeditor/editor/filemanager/connectors/php/util.php
PHP
asf20
5,704
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the File Manager Connector for PHP. */ function GetFolders( $resourceType, $currentFolder ) { // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFolders' ) ; // Array that will hold the folders names. $aFolders = array() ; $oCurrentFolder = opendir( $sServerDir ) ; while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' && is_dir( $sServerDir . $sFile ) ) $aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ; } closedir( $oCurrentFolder ) ; // Open the "Folders" node. echo "<Folders>" ; natcasesort( $aFolders ) ; foreach ( $aFolders as $sFolder ) echo $sFolder ; // Close the "Folders" node. echo "</Folders>" ; } function GetFoldersAndFiles( $resourceType, $currentFolder ) { // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'GetFoldersAndFiles' ) ; // Arrays that will hold the folders and files names. $aFolders = array() ; $aFiles = array() ; $oCurrentFolder = opendir( $sServerDir ) ; while ( $sFile = readdir( $oCurrentFolder ) ) { if ( $sFile != '.' && $sFile != '..' ) { if ( is_dir( $sServerDir . $sFile ) ) $aFolders[] = '<Folder name="' . ConvertToXmlAttribute( $sFile ) . '" />' ; else { $iFileSize = @filesize( $sServerDir . $sFile ) ; if ( !$iFileSize ) { $iFileSize = 0 ; } if ( $iFileSize > 0 ) { $iFileSize = round( $iFileSize / 1024 ) ; if ( $iFileSize < 1 ) $iFileSize = 1 ; } $aFiles[] = '<File name="' . ConvertToXmlAttribute( $sFile ) . '" size="' . $iFileSize . '" />' ; } } } // Send the folders natcasesort( $aFolders ) ; echo '<Folders>' ; foreach ( $aFolders as $sFolder ) echo $sFolder ; echo '</Folders>' ; // Send the files natcasesort( $aFiles ) ; echo '<Files>' ; foreach ( $aFiles as $sFiles ) echo $sFiles ; echo '</Files>' ; } function CreateFolder( $resourceType, $currentFolder ) { if (!isset($_GET)) { global $_GET; } $sErrorNumber = '0' ; $sErrorMsg = '' ; if ( isset( $_GET['NewFolderName'] ) ) { $sNewFolderName = $_GET['NewFolderName'] ; $sNewFolderName = SanitizeFolderName( $sNewFolderName ) ; if ( strpos( $sNewFolderName, '..' ) !== FALSE ) $sErrorNumber = '102' ; // Invalid folder name. else { // Map the virtual path to the local server path of the current folder. $sServerDir = ServerMapFolder( $resourceType, $currentFolder, 'CreateFolder' ) ; if ( is_writable( $sServerDir ) ) { $sServerDir .= $sNewFolderName ; $sErrorMsg = CreateServerFolder( $sServerDir ) ; switch ( $sErrorMsg ) { case '' : $sErrorNumber = '0' ; break ; case 'Invalid argument' : case 'No such file or directory' : $sErrorNumber = '102' ; // Path too long. break ; default : $sErrorNumber = '110' ; break ; } } else $sErrorNumber = '103' ; } } else $sErrorNumber = '102' ; // Create the "Error" node. echo '<Error number="' . $sErrorNumber . '" originalDescription="' . ConvertToXmlAttribute( $sErrorMsg ) . '" />' ; } function FileUpload( $resourceType, $currentFolder, $sCommand ) { if (!isset($_FILES)) { global $_FILES; } $sErrorNumber = '0' ; $sFileName = '' ; if ( isset( $_FILES['NewFile'] ) && !is_null( $_FILES['NewFile']['tmp_name'] ) ) { global $Config ; $oFile = $_FILES['NewFile'] ; // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ; // Get the uploaded file name. $sFileName = $oFile['name'] ; $sFileName = SanitizeFileName( $sFileName ) ; $sOriginalFileName = $sFileName ; // Get the extension. $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; $sExtension = strtolower( $sExtension ) ; if ( isset( $Config['SecureImageUploads'] ) ) { if ( ( $isImageValid = IsImageValid( $oFile['tmp_name'], $sExtension ) ) === false ) { $sErrorNumber = '202' ; } } if ( isset( $Config['HtmlExtensions'] ) ) { if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) && ( $detectHtml = DetectHtml( $oFile['tmp_name'] ) ) === true ) { $sErrorNumber = '202' ; } } // Check if it is an allowed extension. if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) ) { $iCounter = 0 ; while ( true ) { $sFilePath = $sServerDir . $sFileName ; if ( is_file( $sFilePath ) ) { $iCounter++ ; $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; $sErrorNumber = '201' ; } else { move_uploaded_file( $oFile['tmp_name'], $sFilePath ) ; //判断并给符合条件图片加上水印 if ($sExtension == 'jpg' || $sExtension == 'jpeg' || $sExtension == 'png' || $sExtension == 'gif' || $sExtension == 'bmp' ) { require_once(ROOT_PATH . '/includes/cls_image.php'); $image = new cls_image($GLOBALS['_CFG']['bgcolor']); if (intval($GLOBALS['_CFG']['watermark_place']) > 0 && !empty($GLOBALS['_CFG']['watermark'])) { $image->add_watermark($sFilePath,'','../../../../../'.$GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']); } } if ( is_file( $sFilePath ) ) { if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] ) { break ; } $permissions = 0777; if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] ) { $permissions = $Config['ChmodOnUpload'] ; } $oldumask = umask(0) ; chmod( $sFilePath, $permissions ) ; umask( $oldumask ) ; } break ; } } if ( file_exists( $sFilePath ) ) { //previous checks failed, try once again if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false ) { @unlink( $sFilePath ) ; $sErrorNumber = '202' ; } else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true ) { @unlink( $sFilePath ) ; $sErrorNumber = '202' ; } } } else $sErrorNumber = '202' ; } else $sErrorNumber = '202' ; $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ) ; $sFileUrl = CombinePaths( $sFileUrl, $sFileName ) ; SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ; exit ; } function MoreFileUpload( $resourceType, $currentFolder, $sCommand ) { if (!isset($_FILES)) { global $_FILES; } global $Config ; $sErrorNumber = '0' ; $sFileName = '' ; if ( is_array($_FILES['NewFile']['name']) ) { foreach ( $_FILES['NewFile']['name'] as $key => $value ) { if ( !empty ( $_FILES['NewFile']['tmp_name'][$key] ) ) { // Map the virtual path to the local server path. $sServerDir = ServerMapFolder( $resourceType, $currentFolder, $sCommand ) ; // Get the uploaded file name. $sFileName = $_FILES['NewFile']['name'][$key] ; $sFileName = SanitizeFileName( $sFileName ) ; $sOriginalFileName = $sFileName ; // Get the extension. $sExtension = substr( $sFileName, ( strrpos($sFileName, '.') + 1 ) ) ; $sExtension = strtolower( $sExtension ) ; if ( isset( $Config['SecureImageUploads'] ) ) { if ( ( $isImageValid = IsImageValid( $_FILES['NewFile']['tmp_name'][$key], $sExtension ) ) === false ) { $sErrorNumber = '202' ; } } if ( isset( $Config['HtmlExtensions'] ) ) { if ( !IsHtmlExtension( $sExtension, $Config['HtmlExtensions'] ) && ( $detectHtml = DetectHtml( $_FILES['NewFile']['tmp_name'][$key] ) ) === true ) { $sErrorNumber = '202' ; } } // Check if it is an allowed extension. if ( !$sErrorNumber && IsAllowedExt( $sExtension, $resourceType ) ) { $iCounter = 0 ; while ( true ) { $sFilePath = $sServerDir . $sFileName ; if ( is_file( $sFilePath ) ) { $iCounter++ ; $sFileName = RemoveExtension( $sOriginalFileName ) . '(' . $iCounter . ').' . $sExtension ; $sErrorNumber = '201' ; } else { move_uploaded_file( $_FILES['NewFile']['tmp_name'][$key], $sFilePath ) ; //判断并给符合条件图片加上水印 if ($sExtension == 'jpg' || $sExtension == 'jpeg' || $sExtension == 'png' || $sExtension == 'gif' || $sExtension == 'bmp' ) { require_once(ROOT_PATH . '/includes/cls_image.php'); $image = new cls_image($GLOBALS['_CFG']['bgcolor']); if (intval($GLOBALS['_CFG']['watermark_place']) > 0 && !empty($GLOBALS['_CFG']['watermark'])) { $image->add_watermark($sFilePath,'','../../../../../'.$GLOBALS['_CFG']['watermark'], $GLOBALS['_CFG']['watermark_place'], $GLOBALS['_CFG']['watermark_alpha']); } } if ( is_file( $sFilePath ) ) { if ( isset( $Config['ChmodOnUpload'] ) && !$Config['ChmodOnUpload'] ) { break ; } $permissions = 0777; if ( isset( $Config['ChmodOnUpload'] ) && $Config['ChmodOnUpload'] ) { $permissions = $Config['ChmodOnUpload'] ; } $oldumask = umask(0) ; chmod( $sFilePath, $permissions ) ; umask( $oldumask ) ; } break ; } } if ( file_exists( $sFilePath ) ) { //previous checks failed, try once again if ( isset( $isImageValid ) && $isImageValid === -1 && IsImageValid( $sFilePath, $sExtension ) === false ) { @unlink( $sFilePath ) ; $sErrorNumber = '202' ; } else if ( isset( $detectHtml ) && $detectHtml === -1 && DetectHtml( $sFilePath ) === true ) { @unlink( $sFilePath ) ; $sErrorNumber = '202' ; } } } else $sErrorNumber = '202' ; if ( $sErrorNumber == '202' ) { $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ) ; $sFileUrl = CombinePaths( $sFileUrl, $sFileName ) ; SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName) ; } } else { continue; } } $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ) ; $sFileUrl = CombinePaths( $sFileUrl, $sFileName ) ; SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName, $key) ; } else { $sErrorNumber = '202' ; $sFileUrl = CombinePaths( GetResourceTypePath( $resourceType, $sCommand ) , $currentFolder ) ; $sFileUrl = CombinePaths( $sFileUrl, $sFileName ) ; SendUploadResults( $sErrorNumber, $sFileUrl, $sFileName ) ; } exit ; } ?>
zzshop
trunk/includes/fckeditor/editor/filemanager/connectors/php/commands.php
PHP
asf20
15,479
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the "File More Uploader" for PHP. */ require('./config.php') ; require('./util.php') ; require('./io.php') ; require('./commands.php') ; require('./phpcompat.php') ; function SendError( $number, $text ) { SendUploadResults( $number, '', '', $text ) ; } // Check if this uploader has been enabled. if ( !$Config['Enabled'] ) SendUploadResults( '1', '', '', 'This file uploader is disabled. Please check the "editor/filemanager/connectors/php/config.php" file' ) ; $sCommand = 'QuickUpload' ; // The file type (from the QueryString, by default 'File'). $sType = isset( $_GET['Type'] ) ? $_GET['Type'] : 'File' ; $sCurrentFolder = GetCurrentFolder() ; // Is enabled the upload? if ( ! IsAllowedCommand( $sCommand ) ) SendUploadResults( '1', '', '', 'The ""' . $sCommand . '"" command isn\'t allowed' ) ; // Check if it is an allowed type. if ( !IsAllowedType( $sType ) ) SendUploadResults( 1, '', '', 'Invalid type specified' ) ; MoreFileUpload( $sType, $sCurrentFolder, $sCommand ); ?>
zzshop
trunk/includes/fckeditor/editor/filemanager/connectors/php/upload_more.php
PHP
asf20
1,698
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This CSS Style Sheet defines the rules to show table borders on Gecko. */ /* ######### * WARNING * ######### * When changing this file, the minified version of it must be updated in the * fckeditor.html file (see FCK_ShowTableBordersCSS). */ /* For tables with the "border" attribute set to "0" */ table[border="0"], table[border="0"] > tr > td, table[border="0"] > tr > th, table[border="0"] > tbody > tr > td, table[border="0"] > tbody > tr > th, table[border="0"] > thead > tr > td, table[border="0"] > thead > tr > th, table[border="0"] > tfoot > tr > td, table[border="0"] > tfoot > tr > th { border: #d3d3d3 1px dotted ; } /* For tables with no "border" attribute set */ table:not([border]), table:not([border]) > tr > td, table:not([border]) > tr > th, table:not([border]) > tbody > tr > td, table:not([border]) > tbody > tr > th, table:not([border]) > thead > tr > td, table:not([border]) > thead > tr > th, table:not([border]) > tfoot > tr > td, table:not([border]) > tfoot > tr > th { border: #d3d3d3 1px dotted ; }
zzshop
trunk/includes/fckeditor/editor/css/fck_showtableborders_gecko.css
CSS
asf20
1,696
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This CSS Style Sheet defines rules used by the editor for its internal use. */ /* ######### * WARNING * ######### * When changing this file, the minified version of it must be updated in the * fckeditor.html file (see FCK_InternalCSS). */ /* Fix to allow putting the caret at the end of the content in Firefox if clicking below the content. */ html { min-height: 100%; } table.FCK__ShowTableBorders, table.FCK__ShowTableBorders td, table.FCK__ShowTableBorders th { border: #d3d3d3 1px solid; } form { border: 1px dotted #FF0000; padding: 2px; } .FCK__Flash { border: #a9a9a9 1px solid; background-position: center center; background-image: url(images/fck_flashlogo.gif); background-repeat: no-repeat; width: 80px; height: 80px; } .FCK__UnknownObject { border: #a9a9a9 1px solid; background-position: center center; background-image: url(images/fck_plugin.gif); background-repeat: no-repeat; width: 80px; height: 80px; } /* Empty anchors images */ .FCK__Anchor { border: 1px dotted #00F; background-position: center center; background-image: url(images/fck_anchor.gif); background-repeat: no-repeat; width: 16px; height: 15px; vertical-align: middle; } /* Anchors with content */ .FCK__AnchorC { border: 1px dotted #00F; background-position: 1px center; background-image: url(images/fck_anchor.gif); background-repeat: no-repeat; padding-left: 18px; } /* Any anchor for non-IE, if we combine it with the previous rule IE ignores all. */ a[name] { border: 1px dotted #00F; background-position: 0 center; background-image: url(images/fck_anchor.gif); background-repeat: no-repeat; padding-left: 18px; } .FCK__PageBreak { background-position: center center; background-image: url(images/fck_pagebreak.gif); background-repeat: no-repeat; clear: both; display: block; float: none; width: 100%; border-top: #999999 1px dotted; border-bottom: #999999 1px dotted; border-right: 0px; border-left: 0px; height: 5px; } /* Hidden fields */ .FCK__InputHidden { width: 19px; height: 18px; background-image: url(images/fck_hiddenfield.gif); background-repeat: no-repeat; vertical-align: text-bottom; background-position: center center; } .FCK__ShowBlocks p, .FCK__ShowBlocks div, .FCK__ShowBlocks pre, .FCK__ShowBlocks address, .FCK__ShowBlocks blockquote, .FCK__ShowBlocks h1, .FCK__ShowBlocks h2, .FCK__ShowBlocks h3, .FCK__ShowBlocks h4, .FCK__ShowBlocks h5, .FCK__ShowBlocks h6 { background-repeat: no-repeat; border: 1px dotted gray; padding-top: 8px; padding-left: 8px; } .FCK__ShowBlocks p { background-image: url(images/block_p.png); } .FCK__ShowBlocks div { background-image: url(images/block_div.png); } .FCK__ShowBlocks pre { background-image: url(images/block_pre.png); } .FCK__ShowBlocks address { background-image: url(images/block_address.png); } .FCK__ShowBlocks blockquote { background-image: url(images/block_blockquote.png); } .FCK__ShowBlocks h1 { background-image: url(images/block_h1.png); } .FCK__ShowBlocks h2 { background-image: url(images/block_h2.png); } .FCK__ShowBlocks h3 { background-image: url(images/block_h3.png); } .FCK__ShowBlocks h4 { background-image: url(images/block_h4.png); } .FCK__ShowBlocks h5 { background-image: url(images/block_h5.png); } .FCK__ShowBlocks h6 { background-image: url(images/block_h6.png); }
zzshop
trunk/includes/fckeditor/editor/css/fck_internal.css
CSS
asf20
4,145
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the default CSS file used by the editor area. It defines the * initial font of the editor and background color. * * A user can configure the editor to use another CSS file. Just change * the value of the FCKConfig.EditorAreaCSS key in the configuration * file. */ /** * The "body" styles should match your editor web site, mainly regarding * background color and font family and size. */ body { background-color: #ffffff; padding: 5px 5px 5px 5px; margin: 0px; } body, td { font-family: Arial, Verdana, sans-serif; font-size: 12px; } a[href] { color: -moz-hyperlinktext !important; /* For Firefox... mark as important, otherwise it becomes black */ text-decoration: -moz-anchor-decoration; /* For Firefox 3, otherwise no underline will be used */ } /** * Just uncomment the following block if you want to avoid spaces between * paragraphs. Remember to apply the same style in your output front end page. */ /* p, ul, li { margin-top: 0px; margin-bottom: 0px; } */ /** * Uncomment the following block, or only selected lines if appropriate, * if you have some style items that would break the styles combo box. * You can also write other CSS overrides inside the style block below * as needed and they will be applied to inside the style combo only. */ /* .SC_Item *, .SC_ItemSelected * { margin: 0px !important; padding: 0px !important; text-indent: 0px !important; clip: auto !important; position: static !important; } */ /** * The following are some sample styles used in the "Styles" toolbar command. * You should instead remove them, and include the styles used by the site * you are using the editor in. */ .Bold { font-weight: bold; } .Title { font-weight: bold; font-size: 18px; color: #cc3300; } .Code { border: #8b4513 1px solid; padding-right: 5px; padding-left: 5px; color: #000066; font-family: 'Courier New' , Monospace; background-color: #ff9933; }
zzshop
trunk/includes/fckeditor/editor/css/fck_editorarea.css
CSS
asf20
2,648
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the Debug window. * It automatically popups if the Debug = true in the configuration file. --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>FCKeditor Debug Window</title> <meta name="robots" content="noindex, nofollow" /> <script type="text/javascript"> var oWindow ; var oDiv ; if ( !window.FCKMessages ) window.FCKMessages = new Array() ; window.onload = function() { oWindow = document.getElementById('xOutput').contentWindow ; oWindow.document.open() ; oWindow.document.write( '<div id="divMsg"><\/div>' ) ; oWindow.document.close() ; oDiv = oWindow.document.getElementById('divMsg') ; } function Output( message, color, noParse ) { if ( !noParse && message != null && isNaN( message ) ) message = message.replace(/</g, "&lt;") ; if ( color ) message = '<font color="' + color + '">' + message + '<\/font>' ; window.FCKMessages[ window.FCKMessages.length ] = message ; StartTimer() ; } function OutputObject( anyObject, color ) { var message ; if ( anyObject != null ) { message = 'Properties of: ' + anyObject + '</b><blockquote>' ; for (var prop in anyObject) { try { var sVal = anyObject[ prop ] != null ? anyObject[ prop ] + '' : '[null]' ; message += '<b>' + prop + '</b> : ' + sVal.replace(/</g, '&lt;') + '<br>' ; } catch (e) { try { message += '<b>' + prop + '</b> : [' + typeof( anyObject[ prop ] ) + ']<br>' ; } catch (e) { message += '<b>' + prop + '</b> : [-error-]<br>' ; } } } message += '</blockquote><b>' ; } else message = 'OutputObject : Object is "null".' ; Output( message, color, true ) ; } function StartTimer() { window.setTimeout( 'CheckMessages()', 100 ) ; } function CheckMessages() { if ( window.FCKMessages.length > 0 ) { // Get the first item in the queue var sMessage = window.FCKMessages[0] ; // Removes the first item from the queue var oTempArray = new Array() ; for ( i = 1 ; i < window.FCKMessages.length ; i++ ) oTempArray[ i - 1 ] = window.FCKMessages[ i ] ; window.FCKMessages = oTempArray ; var d = new Date() ; var sTime = ( d.getHours() + 100 + '' ).substr( 1,2 ) + ':' + ( d.getMinutes() + 100 + '' ).substr( 1,2 ) + ':' + ( d.getSeconds() + 100 + '' ).substr( 1,2 ) + ':' + ( d.getMilliseconds() + 1000 + '' ).substr( 1,3 ) ; var oMsgDiv = oWindow.document.createElement( 'div' ) ; oMsgDiv.innerHTML = sTime + ': <b>' + sMessage + '<\/b>' ; oDiv.appendChild( oMsgDiv ) ; oMsgDiv.scrollIntoView() ; } } function Clear() { oDiv.innerHTML = '' ; } </script> </head> <body style="margin: 10px"> <table style="height: 100%" cellspacing="5" cellpadding="0" width="100%" border="0"> <tr> <td> <table cellspacing="0" cellpadding="0" width="100%" border="0"> <tr> <td style="font-weight: bold; font-size: 1.2em;"> FCKeditor Debug Window</td> <td align="right"> <input type="button" value="Clear" onclick="Clear();" /></td> </tr> </table> </td> </tr> <tr style="height: 100%"> <td style="border: #696969 1px solid"> <iframe id="xOutput" width="100%" height="100%" scrolling="auto" src="javascript:void(0)" frameborder="0"></iframe> </td> </tr> </table> </body> </html>
zzshop
trunk/includes/fckeditor/editor/fckdebug.html
HTML
asf20
4,086
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * Editor configuration settings. * * Follow this link for more information: * http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Configuration_Options */ FCKConfig.CustomConfigurationsPath = '' ; FCKConfig.EditorAreaCSS = FCKConfig.BasePath + 'css/fck_editorarea.css' ; FCKConfig.EditorAreaStyles = '' ; FCKConfig.ToolbarComboPreviewCSS = '' ; FCKConfig.DocType = '' ; FCKConfig.BaseHref = '' ; FCKConfig.FullPage = false ; // The following option determines whether the "Show Blocks" feature is enabled or not at startup. FCKConfig.StartupShowBlocks = false ; FCKConfig.Debug = false ; FCKConfig.AllowQueryStringDebug = true ; FCKConfig.SkinPath = FCKConfig.BasePath + 'skins/default/' ; FCKConfig.SkinEditorCSS = '' ; // FCKConfig.SkinPath + "|<minified css>" ; FCKConfig.SkinDialogCSS = '' ; // FCKConfig.SkinPath + "|<minified css>" ; FCKConfig.PreloadImages = [ FCKConfig.SkinPath + 'images/toolbar.start.gif', FCKConfig.SkinPath + 'images/toolbar.buttonarrow.gif' ] ; FCKConfig.PluginsPath = FCKConfig.BasePath + 'plugins/' ; // FCKConfig.Plugins.Add( 'autogrow' ) ; // FCKConfig.Plugins.Add( 'dragresizetable' ); FCKConfig.AutoGrowMax = 400 ; // FCKConfig.ProtectedSource.Add( /<%[\s\S]*?%>/g ) ; // ASP style server side code <%...%> // FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ; // PHP style server side code // FCKConfig.ProtectedSource.Add( /(<asp:[^\>]+>[\s|\S]*?<\/asp:[^\>]+>)|(<asp:[^\>]+\/>)/gi ) ; // ASP.Net style tags <asp:control> FCKConfig.AutoDetectLanguage = true ; FCKConfig.DefaultLanguage = 'zh-cn' ; FCKConfig.ContentLangDirection = 'ltr' ; FCKConfig.ProcessHTMLEntities = true ; FCKConfig.IncludeLatinEntities = true ; FCKConfig.IncludeGreekEntities = true ; FCKConfig.ProcessNumericEntities = false ; FCKConfig.AdditionalNumericEntities = '' ; // Single Quote: "'" FCKConfig.FillEmptyBlocks = true ; FCKConfig.FormatSource = true ; FCKConfig.FormatOutput = true ; FCKConfig.FormatIndentator = ' ' ; FCKConfig.EMailProtection = 'encode' ; // none | encode | function FCKConfig.EMailProtectionFunction = 'mt(NAME,DOMAIN,SUBJECT,BODY)' ; FCKConfig.StartupFocus = false ; FCKConfig.ForcePasteAsPlainText = false ; FCKConfig.AutoDetectPasteFromWord = true ; // IE only. FCKConfig.ShowDropDialog = true ; FCKConfig.ForceSimpleAmpersand = false ; FCKConfig.TabSpaces = 0 ; FCKConfig.ShowBorders = true ; FCKConfig.SourcePopup = false ; FCKConfig.ToolbarStartExpanded = true ; FCKConfig.ToolbarCanCollapse = true ; FCKConfig.IgnoreEmptyParagraphValue = true ; FCKConfig.FloatingPanelsZIndex = 10000 ; FCKConfig.HtmlEncodeOutput = false ; FCKConfig.PreserveSessionOnFileBrowser = false ; FCKConfig.TemplateReplaceAll = true ; FCKConfig.TemplateReplaceCheckbox = true ; FCKConfig.ToolbarLocation = 'In' ; FCKConfig.ToolbarSets["Default"] = [ ['Source','DocProps','-','Save','NewPage','Preview','-','Templates'], ['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'], ['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'], ['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField'], '/', ['Bold','Italic','Underline','StrikeThrough','-','Subscript','Superscript'], ['OrderedList','UnorderedList','-','Outdent','Indent','Blockquote','CreateDiv'], ['JustifyLeft','JustifyCenter','JustifyRight','JustifyFull'], ['Link','Unlink','Anchor'], ['Image','Flash','UpFileBtn','Table','Rule','Smiley','SpecialChar','PageBreak'], '/', ['Style','FontFormat','FontName','FontSize'], ['TextColor','BGColor'], ['FitWindow','ShowBlocks','-','About'] // No comma for the last row. ] ; FCKConfig.ToolbarSets["Basic"] = [ ['Bold','Italic','-','OrderedList','UnorderedList','-','Link','Unlink','-','About'] ] ; FCKConfig.ToolbarSets["Normal"] = [ ['Cut','Copy','Paste','PasteText','PasteWord','-','Undo','Redo','-','Find','Replace','-','RemoveFormat'], ['Link','Unlink','-','Image','Flash','UpFileBtn','Table'], ['FitWindow','-','Source'], '/', ['FontFormat','FontSize'], ['Bold','Italic','Underline'], ['OrderedList','UnorderedList','-','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight'], ['TextColor','BGColor'] ] ; FCKConfig.ToolbarSets["Mail"] = [ ['Cut','Copy','Paste','PasteText','PasteWord','-','Undo','Redo','-','Find','Replace','-','RemoveFormat'], ['Table'], ['FitWindow','-','Source'], '/', ['FontFormat','FontSize'], ['Bold','Italic','Underline'], ['OrderedList','UnorderedList','-','Outdent','Indent'], ['JustifyLeft','JustifyCenter','JustifyRight'], ['TextColor','BGColor'] ]; FCKConfig.EnterMode = 'p' ; // p | div | br FCKConfig.ShiftEnterMode = 'br' ; // p | div | br FCKConfig.Keystrokes = [ [ CTRL + 65 /*A*/, true ], [ CTRL + 67 /*C*/, true ], [ CTRL + 70 /*F*/, true ], [ CTRL + 83 /*S*/, true ], [ CTRL + 84 /*T*/, true ], [ CTRL + 88 /*X*/, true ], [ CTRL + 86 /*V*/, 'Paste' ], [ CTRL + 45 /*INS*/, true ], [ SHIFT + 45 /*INS*/, 'Paste' ], [ CTRL + 88 /*X*/, 'Cut' ], [ SHIFT + 46 /*DEL*/, 'Cut' ], [ CTRL + 90 /*Z*/, 'Undo' ], [ CTRL + 89 /*Y*/, 'Redo' ], [ CTRL + SHIFT + 90 /*Z*/, 'Redo' ], [ CTRL + 76 /*L*/, 'Link' ], [ CTRL + 66 /*B*/, 'Bold' ], [ CTRL + 73 /*I*/, 'Italic' ], [ CTRL + 85 /*U*/, 'Underline' ], [ CTRL + SHIFT + 83 /*S*/, 'Save' ], [ CTRL + ALT + 13 /*ENTER*/, 'FitWindow' ], [ SHIFT + 32 /*SPACE*/, 'Nbsp' ] ] ; FCKConfig.ContextMenu = ['Generic','Link','Anchor','Image','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','ImageButton','Button','BulletedList','NumberedList','Table','Form','DivContainer'] ; FCKConfig.BrowserContextMenuOnCtrl = false ; FCKConfig.BrowserContextMenu = false ; FCKConfig.EnableMoreFontColors = true ; FCKConfig.FontColors = '000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,808080,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF' ; FCKConfig.FontFormats = 'p;h1;h2;h3;h4;h5;h6;pre;address;div' ; FCKConfig.FontNames = 'Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana' ; FCKConfig.FontSizes = 'smaller;larger;xx-small;x-small;small;medium;large;x-large;xx-large' ; FCKConfig.StylesXmlPath = FCKConfig.EditorPath + 'fckstyles.xml' ; FCKConfig.TemplatesXmlPath = FCKConfig.EditorPath + 'fcktemplates.xml' ; FCKConfig.SpellChecker = 'ieSpell' ; // 'ieSpell' | 'SpellerPages' FCKConfig.IeSpellDownloadUrl = 'http://www.iespell.com/download.php' ; FCKConfig.SpellerPagesServerScript = 'server-scripts/spellchecker.php' ; // Available extension: .php .cfm .pl FCKConfig.FirefoxSpellChecker = false ; FCKConfig.MaxUndoLevels = 15 ; FCKConfig.DisableObjectResizing = false ; FCKConfig.DisableFFTableHandles = true ; FCKConfig.LinkDlgHideTarget = false ; FCKConfig.LinkDlgHideAdvanced = false ; FCKConfig.ImageDlgHideLink = false ; FCKConfig.ImageDlgHideAdvanced = false ; FCKConfig.FlashDlgHideAdvanced = false ; FCKConfig.ProtectedTags = '' ; // This will be applied to the body element of the editor FCKConfig.BodyId = '' ; FCKConfig.BodyClass = '' ; FCKConfig.DefaultStyleLabel = '' ; FCKConfig.DefaultFontFormatLabel = '' ; FCKConfig.DefaultFontLabel = '' ; FCKConfig.DefaultFontSizeLabel = '' ; FCKConfig.DefaultLinkTarget = '' ; // The option switches between trying to keep the html structure or do the changes so the content looks like it was in Word FCKConfig.CleanWordKeepsStructure = false ; // Only inline elements are valid. FCKConfig.RemoveFormatTags = 'b,big,code,del,dfn,em,font,i,ins,kbd,q,samp,small,span,strike,strong,sub,sup,tt,u,var' ; // Attributes that will be removed FCKConfig.RemoveAttributes = 'class,style,lang,width,height,align,hspace,valign' ; FCKConfig.CustomStyles = { 'Red Title' : { Element : 'h3', Styles : { 'color' : 'Red' } } }; // Do not add, rename or remove styles here. Only apply definition changes. FCKConfig.CoreStyles = { // Basic Inline Styles. 'Bold' : { Element : 'strong', Overrides : 'b' }, 'Italic' : { Element : 'em', Overrides : 'i' }, 'Underline' : { Element : 'u' }, 'StrikeThrough' : { Element : 'strike' }, 'Subscript' : { Element : 'sub' }, 'Superscript' : { Element : 'sup' }, // Basic Block Styles (Font Format Combo). 'p' : { Element : 'p' }, 'div' : { Element : 'div' }, 'pre' : { Element : 'pre' }, 'address' : { Element : 'address' }, 'h1' : { Element : 'h1' }, 'h2' : { Element : 'h2' }, 'h3' : { Element : 'h3' }, 'h4' : { Element : 'h4' }, 'h5' : { Element : 'h5' }, 'h6' : { Element : 'h6' }, // Other formatting features. 'FontFace' : { Element : 'span', Styles : { 'font-family' : '#("Font")' }, Overrides : [ { Element : 'font', Attributes : { 'face' : null } } ] }, 'Size' : { Element : 'span', Styles : { 'font-size' : '#("Size","fontSize")' }, Overrides : [ { Element : 'font', Attributes : { 'size' : null } } ] }, 'Color' : { Element : 'span', Styles : { 'color' : '#("Color","color")' }, Overrides : [ { Element : 'font', Attributes : { 'color' : null } } ] }, 'BackColor' : { Element : 'span', Styles : { 'background-color' : '#("Color","color")' } }, 'SelectionHighlight' : { Element : 'span', Styles : { 'background-color' : 'navy', 'color' : 'white' } } }; // The distance of an indentation step. FCKConfig.IndentLength = 40 ; FCKConfig.IndentUnit = 'px' ; // Alternatively, FCKeditor allows the use of CSS classes for block indentation. // This overrides the IndentLength/IndentUnit settings. FCKConfig.IndentClasses = [] ; // [ Left, Center, Right, Justified ] FCKConfig.JustifyClasses = [] ; // The following value defines which File Browser connector and Quick Upload // "uploader" to use. It is valid for the default implementaion and it is here // just to make this configuration file cleaner. // It is not possible to change this value using an external file or even // inline when creating the editor instance. In that cases you must set the // values of LinkBrowserURL, ImageBrowserURL and so on. // Custom implementations should just ignore it. var _FileBrowserLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py var _QuickUploadLanguage = 'php' ; // asp | aspx | cfm | lasso | perl | php | py // Don't care about the following two lines. It just calculates the correct connector // extension to use for the default File Browser (Perl uses "cgi"). var _FileBrowserExtension = _FileBrowserLanguage == 'perl' ? 'cgi' : _FileBrowserLanguage ; var _QuickUploadExtension = _QuickUploadLanguage == 'perl' ? 'cgi' : _QuickUploadLanguage ; FCKConfig.LinkBrowser = true ; FCKConfig.LinkBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.LinkBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% FCKConfig.LinkBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% FCKConfig.ImageBrowser = true ; FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Image&Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.ImageBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; // 70% ; FCKConfig.ImageBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; // 70% ; FCKConfig.FlashBrowser = true ; FCKConfig.FlashBrowserURL = FCKConfig.BasePath + 'filemanager/browser/default/browser.html?Type=Flash&Connector=' + encodeURIComponent( FCKConfig.BasePath + 'filemanager/connectors/' + _FileBrowserLanguage + '/connector.' + _FileBrowserExtension ) ; FCKConfig.FlashBrowserWindowWidth = FCKConfig.ScreenWidth * 0.7 ; //70% ; FCKConfig.FlashBrowserWindowHeight = FCKConfig.ScreenHeight * 0.7 ; //70% ; FCKConfig.LinkUpload = true ; FCKConfig.LinkUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension ; FCKConfig.LinkUploadAllowedExtensions = ".(7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip)$" ; // empty for all FCKConfig.LinkUploadDeniedExtensions = "" ; // empty for no one FCKConfig.FilesUpload = true ; FCKConfig.FilesUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload_more.' + _QuickUploadExtension ; FCKConfig.FilesUploadAllowedExtensions = ".(7z|aiff|asf|avi|bmp|csv|doc|fla|flv|gif|gz|gzip|jpeg|jpg|mid|mov|mp3|mp4|mpc|mpeg|mpg|ods|odt|pdf|png|ppt|pxd|qt|ram|rar|rm|rmi|rmvb|rtf|sdc|sitd|swf|sxc|sxw|tar|tgz|tif|tiff|txt|vsd|wav|wma|wmv|xls|xml|zip)$" ; // empty for all FCKConfig.FilesUploadDeniedExtensions = "" ; // empty for no one FCKConfig.ImageUpload = true ; FCKConfig.ImageUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension + '?Type=Image' ; FCKConfig.ImageUploadAllowedExtensions = ".(jpg|gif|jpeg|png|bmp)$" ; // empty for all FCKConfig.ImageUploadDeniedExtensions = "" ; // empty for no one FCKConfig.FlashUpload = true ; FCKConfig.FlashUploadURL = FCKConfig.BasePath + 'filemanager/connectors/' + _QuickUploadLanguage + '/upload.' + _QuickUploadExtension + '?Type=Flash' ; FCKConfig.FlashUploadAllowedExtensions = ".(swf|flv)$" ; // empty for all FCKConfig.FlashUploadDeniedExtensions = "" ; // empty for no one FCKConfig.SmileyPath = FCKConfig.BasePath + 'images/smiley/msn/' ; FCKConfig.SmileyImages = ['regular_smile.gif','sad_smile.gif','wink_smile.gif','teeth_smile.gif','confused_smile.gif','tounge_smile.gif','embaressed_smile.gif','omg_smile.gif','whatchutalkingabout_smile.gif','angry_smile.gif','angel_smile.gif','shades_smile.gif','devil_smile.gif','cry_smile.gif','lightbulb.gif','thumbs_down.gif','thumbs_up.gif','heart.gif','broken_heart.gif','kiss.gif','envelope.gif'] ; FCKConfig.SmileyColumns = 8 ; FCKConfig.SmileyWindowWidth = 320 ; FCKConfig.SmileyWindowHeight = 210 ; FCKConfig.BackgroundBlockerColor = '#ffffff' ; FCKConfig.BackgroundBlockerOpacity = 0.50 ; FCKConfig.MsWebBrowserControlCompat = false ; FCKConfig.PreventSubmitHandler = false ;
zzshop
trunk/includes/fckeditor/fckconfig.js
JavaScript
asf20
15,367
<cfcomponent output="false" displayname="FCKeditor" hint="Create an instance of the FCKeditor."> <!--- * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * ColdFusion MX integration. * Note this CFC is created for use only with Coldfusion MX and above. * For older version, check the fckeditor.cfm. * * Syntax: * * <cfscript> * fckEditor = createObject("component", "fckeditor.fckeditor"); * fckEditor.instanceName="myEditor"; * fckEditor.basePath="/fckeditor/"; * fckEditor.value="<p>This is my <strong>initial</strong> html text.</p>"; * fckEditor.width="100%"; * fckEditor.height="200"; * // ... additional parameters ... * fckEditor.create(); // create instance now. * </cfscript> * * See your macromedia coldfusion mx documentation for more info. * * *** Note: * Do not use path names with a "." (dot) in the name. This is a coldfusion * limitation with the cfc invocation. ---> <cfinclude template="fckutils.cfm"> <cffunction name="Create" access="public" output="true" returntype="void" hint="Outputs the editor HTML in the place where the function is called" > <cfoutput>#CreateHtml()#</cfoutput> </cffunction> <cffunction name="CreateHtml" access="public" output="false" returntype="string" hint="Retrieves the editor HTML" > <cfparam name="this.instanceName" type="string" /> <cfparam name="this.width" type="string" default="100%" /> <cfparam name="this.height" type="string" default="200" /> <cfparam name="this.toolbarSet" type="string" default="Default" /> <cfparam name="this.value" type="string" default="" /> <cfparam name="this.basePath" type="string" default="/fckeditor/" /> <cfparam name="this.checkBrowser" type="boolean" default="true" /> <cfparam name="this.config" type="struct" default="#structNew()#" /> <cfscript> // display the html editor or a plain textarea? if( isCompatible() ) return getHtmlEditor(); else return getTextArea(); </cfscript> </cffunction> <cffunction name="isCompatible" access="private" output="false" returnType="boolean" hint="Check browser compatibility via HTTP_USER_AGENT, if checkBrowser is true" > <cfscript> var sAgent = lCase( cgi.HTTP_USER_AGENT ); var stResult = ""; var sBrowserVersion = ""; // do not check if argument "checkBrowser" is false if( not this.checkBrowser ) return true; return FCKeditor_IsCompatibleBrowser(); </cfscript> </cffunction> <cffunction name="getTextArea" access="private" output="false" returnType="string" hint="Create a textarea field for non-compatible browsers." > <cfset var result = "" /> <cfset var sWidthCSS = "" /> <cfset var sHeightCSS = "" /> <cfscript> if( Find( "%", this.width ) gt 0) sWidthCSS = this.width; else sWidthCSS = this.width & "px"; if( Find( "%", this.width ) gt 0) sHeightCSS = this.height; else sHeightCSS = this.height & "px"; result = "<textarea name=""#this.instanceName#"" rows=""4"" cols=""40"" style=""width: #sWidthCSS#; height: #sHeightCSS#"">#HTMLEditFormat(this.value)#</textarea>" & chr(13) & chr(10); </cfscript> <cfreturn result /> </cffunction> <cffunction name="getHtmlEditor" access="private" output="false" returnType="string" hint="Create the html editor instance for compatible browsers." > <cfset var sURL = "" /> <cfset var result = "" /> <cfscript> // try to fix the basePath, if ending slash is missing if( len( this.basePath) and right( this.basePath, 1 ) is not "/" ) this.basePath = this.basePath & "/"; // construct the url sURL = this.basePath & "editor/fckeditor.html?InstanceName=" & this.instanceName; // append toolbarset name to the url if( len( this.toolbarSet ) ) sURL = sURL & "&amp;Toolbar=" & this.toolbarSet; </cfscript> <cfscript> result = result & "<input type=""hidden"" id=""#this.instanceName#"" name=""#this.instanceName#"" value=""#HTMLEditFormat(this.value)#"" style=""display:none"" />" & chr(13) & chr(10); result = result & "<input type=""hidden"" id=""#this.instanceName#___Config"" value=""#GetConfigFieldString()#"" style=""display:none"" />" & chr(13) & chr(10); result = result & "<iframe id=""#this.instanceName#___Frame"" src=""#sURL#"" width=""#this.width#"" height=""#this.height#"" frameborder=""0"" scrolling=""no""></iframe>" & chr(13) & chr(10); </cfscript> <cfreturn result /> </cffunction> <cffunction name="GetConfigFieldString" access="private" output="false" returnType="string" hint="Create configuration string: Key1=Value1&Key2=Value2&... (Key/Value:HTML encoded)" > <cfset var sParams = "" /> <cfset var key = "" /> <cfset var fieldValue = "" /> <cfset var fieldLabel = "" /> <cfset var lConfigKeys = "" /> <cfset var iPos = "" /> <cfscript> /** * CFML doesn't store casesensitive names for structure keys, but the configuration names must be casesensitive for js. * So we need to find out the correct case for the configuration keys. * We "fix" this by comparing the caseless configuration keys to a list of all available configuration options in the correct case. * changed 20041206 hk@lwd.de (improvements are welcome!) */ lConfigKeys = lConfigKeys & "CustomConfigurationsPath,EditorAreaCSS,ToolbarComboPreviewCSS,DocType"; lConfigKeys = lConfigKeys & ",BaseHref,FullPage,Debug,AllowQueryStringDebug,SkinPath"; lConfigKeys = lConfigKeys & ",PreloadImages,PluginsPath,AutoDetectLanguage,DefaultLanguage,ContentLangDirection"; lConfigKeys = lConfigKeys & ",ProcessHTMLEntities,IncludeLatinEntities,IncludeGreekEntities,ProcessNumericEntities,AdditionalNumericEntities"; lConfigKeys = lConfigKeys & ",FillEmptyBlocks,FormatSource,FormatOutput,FormatIndentator"; lConfigKeys = lConfigKeys & ",StartupFocus,ForcePasteAsPlainText,AutoDetectPasteFromWord,ForceSimpleAmpersand"; lConfigKeys = lConfigKeys & ",TabSpaces,ShowBorders,SourcePopup,ToolbarStartExpanded,ToolbarCanCollapse"; lConfigKeys = lConfigKeys & ",IgnoreEmptyParagraphValue,FloatingPanelsZIndex,TemplateReplaceAll,TemplateReplaceCheckbox"; lConfigKeys = lConfigKeys & ",ToolbarLocation,ToolbarSets,EnterMode,ShiftEnterMode,Keystrokes"; lConfigKeys = lConfigKeys & ",ContextMenu,BrowserContextMenuOnCtrl,FontColors,FontNames,FontSizes"; lConfigKeys = lConfigKeys & ",FontFormats,StylesXmlPath,TemplatesXmlPath,SpellChecker,IeSpellDownloadUrl"; lConfigKeys = lConfigKeys & ",SpellerPagesServerScript,FirefoxSpellChecker,MaxUndoLevels,DisableObjectResizing,DisableFFTableHandles"; lConfigKeys = lConfigKeys & ",LinkDlgHideTarget,LinkDlgHideAdvanced,ImageDlgHideLink,ImageDlgHideAdvanced,FlashDlgHideAdvanced"; lConfigKeys = lConfigKeys & ",ProtectedTags,BodyId,BodyClass,DefaultLinkTarget,CleanWordKeepsStructure"; lConfigKeys = lConfigKeys & ",LinkBrowser,LinkBrowserURL,LinkBrowserWindowWidth,LinkBrowserWindowHeight,ImageBrowser"; lConfigKeys = lConfigKeys & ",ImageBrowserURL,ImageBrowserWindowWidth,ImageBrowserWindowHeight,FlashBrowser,FlashBrowserURL"; lConfigKeys = lConfigKeys & ",FlashBrowserWindowWidth,FlashBrowserWindowHeight,LinkUpload,LinkUploadURL,LinkUploadWindowWidth"; lConfigKeys = lConfigKeys & ",LinkUploadWindowHeight,LinkUploadAllowedExtensions,LinkUploadDeniedExtensions,ImageUpload,ImageUploadURL"; lConfigKeys = lConfigKeys & ",ImageUploadAllowedExtensions,ImageUploadDeniedExtensions,FlashUpload,FlashUploadURL,FlashUploadAllowedExtensions"; lConfigKeys = lConfigKeys & ",FlashUploadDeniedExtensions,SmileyPath,SmileyImages,SmileyColumns,SmileyWindowWidth,SmileyWindowHeight"; for( key in this.config ) { iPos = listFindNoCase( lConfigKeys, key ); if( iPos GT 0 ) { if( len( sParams ) ) sParams = sParams & "&amp;"; fieldValue = this.config[key]; fieldName = listGetAt( lConfigKeys, iPos ); // set all boolean possibilities in CFML to true/false values if( isBoolean( fieldValue) and fieldValue ) fieldValue = "true"; else if( isBoolean( fieldValue) ) fieldValue = "false"; sParams = sParams & HTMLEditFormat( fieldName ) & '=' & HTMLEditFormat( fieldValue ); } } return sParams; </cfscript> </cffunction> </cfcomponent>
zzshop
trunk/includes/fckeditor/fckeditor.cfc
ColdFusion CFC
asf20
8,830
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the integration file for PHP (All versions). * * It loads the correct integration file based on the PHP version (avoiding * strict error messages with PHP 5). */ if ( !function_exists('version_compare') || version_compare( phpversion(), '5', '<' ) ) include_once( 'fckeditor_php4.php' ) ; else include_once( 'fckeditor_php5.php' ) ;
zzshop
trunk/includes/fckeditor/fckeditor.php
PHP
asf20
1,000
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the integration file for PHP 4. * * It defines the FCKeditor class that can be used to create editor * instances in PHP pages on server side. */ /** * Check if browser is compatible with FCKeditor. * Return true if is compatible. * * @return boolean */ function FCKeditor_IsCompatibleBrowser() { if ( isset( $_SERVER ) ) { $sAgent = $_SERVER['HTTP_USER_AGENT'] ; } else { global $HTTP_SERVER_VARS ; if ( isset( $HTTP_SERVER_VARS ) ) { $sAgent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ; } else { global $HTTP_USER_AGENT ; $sAgent = $HTTP_USER_AGENT ; } } if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false ) { $iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ; return ($iVersion >= 5.5) ; } else if ( strpos($sAgent, 'Gecko/') !== false ) { $iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ; return ($iVersion >= 20030210) ; } else if ( strpos($sAgent, 'Opera/') !== false ) { $fVersion = (float)substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4) ; return ($fVersion >= 9.5) ; } else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) ) { $iVersion = $matches[1] ; return ( $matches[1] >= 522 ) ; } else return false ; } class FCKeditor { /** * Name of the FCKeditor instance. * * @access protected * @var string */ var $InstanceName ; /** * Path to FCKeditor relative to the document root. * * @var string */ var $BasePath ; /** * Width of the FCKeditor. * Examples: 100%, 600 * * @var mixed */ var $Width ; /** * Height of the FCKeditor. * Examples: 400, 50% * * @var mixed */ var $Height ; /** * Name of the toolbar to load. * * @var string */ var $ToolbarSet ; /** * Initial value. * * @var string */ var $Value ; /** * This is where additional configuration can be passed. * Example: * $oFCKeditor->Config['EnterMode'] = 'br'; * * @var array */ var $Config ; /** * Main Constructor. * Refer to the _samples/php directory for examples. * * @param string $instanceName */ function FCKeditor( $instanceName ) { $this->InstanceName = $instanceName ; $this->BasePath = '/fckeditor/' ; $this->Width = '100%' ; $this->Height = '200' ; $this->ToolbarSet = 'Default' ; $this->Value = '' ; $this->Config = array() ; } /** * Display FCKeditor. * */ function Create() { echo $this->CreateHtml() ; } /** * Return the HTML code required to run FCKeditor. * * @return string */ function CreateHtml() { $HtmlValue = htmlspecialchars( $this->Value ) ; $Html = '' ; if ( !isset( $_GET ) ) { global $HTTP_GET_VARS ; $_GET = $HTTP_GET_VARS ; } if ( $this->IsCompatible() ) { if ( isset( $_GET['fcksource'] ) && $_GET['fcksource'] == "true" ) $File = 'fckeditor.original.html' ; else $File = 'fckeditor.html' ; $Link = "{$this->BasePath}editor/{$File}?InstanceName={$this->InstanceName}" ; if ( $this->ToolbarSet != '' ) $Link .= "&amp;Toolbar={$this->ToolbarSet}" ; // Render the linked hidden field. $Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}\" name=\"{$this->InstanceName}\" value=\"{$HtmlValue}\" style=\"display:none\" />" ; // Render the configurations hidden field. $Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}___Config\" value=\"" . $this->GetConfigFieldString() . "\" style=\"display:none\" />" ; // Render the editor IFRAME. $Html .= "<iframe id=\"{$this->InstanceName}___Frame\" src=\"{$Link}\" width=\"{$this->Width}\" height=\"{$this->Height}\" frameborder=\"0\" scrolling=\"no\"></iframe>" ; } else { if ( strpos( $this->Width, '%' ) === false ) $WidthCSS = $this->Width . 'px' ; else $WidthCSS = $this->Width ; if ( strpos( $this->Height, '%' ) === false ) $HeightCSS = $this->Height . 'px' ; else $HeightCSS = $this->Height ; $Html .= "<textarea name=\"{$this->InstanceName}\" rows=\"4\" cols=\"40\" style=\"width: {$WidthCSS}; height: {$HeightCSS}\">{$HtmlValue}</textarea>" ; } return $Html ; } /** * Returns true if browser is compatible with FCKeditor. * * @return boolean */ function IsCompatible() { return FCKeditor_IsCompatibleBrowser() ; } /** * Get settings from Config array as a single string. * * @access protected * @return string */ function GetConfigFieldString() { $sParams = '' ; $bFirst = true ; foreach ( $this->Config as $sKey => $sValue ) { if ( $bFirst == false ) $sParams .= '&amp;' ; else $bFirst = false ; if ( $sValue === true ) $sParams .= $this->EncodeConfig( $sKey ) . '=true' ; else if ( $sValue === false ) $sParams .= $this->EncodeConfig( $sKey ) . '=false' ; else $sParams .= $this->EncodeConfig( $sKey ) . '=' . $this->EncodeConfig( $sValue ) ; } return $sParams ; } /** * Encode characters that may break the configuration string * generated by GetConfigFieldString(). * * @access protected * @param string $valueToEncode * @return string */ function EncodeConfig( $valueToEncode ) { $chars = array( '&' => '%26', '=' => '%3D', '"' => '%22' ) ; return strtr( $valueToEncode, $chars ) ; } }
zzshop
trunk/includes/fckeditor/fckeditor_php4.php
PHP
asf20
7,220
<?php /* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the integration file for PHP 5. * * It defines the FCKeditor class that can be used to create editor * instances in PHP pages on server side. */ /** * Check if browser is compatible with FCKeditor. * Return true if is compatible. * * @return boolean */ function FCKeditor_IsCompatibleBrowser() { if ( isset( $_SERVER ) ) { $sAgent = $_SERVER['HTTP_USER_AGENT'] ; } else { global $HTTP_SERVER_VARS ; if ( isset( $HTTP_SERVER_VARS ) ) { $sAgent = $HTTP_SERVER_VARS['HTTP_USER_AGENT'] ; } else { global $HTTP_USER_AGENT ; $sAgent = $HTTP_USER_AGENT ; } } if ( strpos($sAgent, 'MSIE') !== false && strpos($sAgent, 'mac') === false && strpos($sAgent, 'Opera') === false ) { $iVersion = (float)substr($sAgent, strpos($sAgent, 'MSIE') + 5, 3) ; return ($iVersion >= 5.5) ; } else if ( strpos($sAgent, 'Gecko/') !== false ) { $iVersion = (int)substr($sAgent, strpos($sAgent, 'Gecko/') + 6, 8) ; return ($iVersion >= 20030210) ; } else if ( strpos($sAgent, 'Opera/') !== false ) { $fVersion = (float)substr($sAgent, strpos($sAgent, 'Opera/') + 6, 4) ; return ($fVersion >= 9.5) ; } else if ( preg_match( "|AppleWebKit/(\d+)|i", $sAgent, $matches ) ) { $iVersion = $matches[1] ; return ( $matches[1] >= 522 ) ; } else return false ; } class FCKeditor { /** * Name of the FCKeditor instance. * * @access protected * @var string */ public $InstanceName ; /** * Path to FCKeditor relative to the document root. * * @var string */ public $BasePath ; /** * Width of the FCKeditor. * Examples: 100%, 600 * * @var mixed */ public $Width ; /** * Height of the FCKeditor. * Examples: 400, 50% * * @var mixed */ public $Height ; /** * Name of the toolbar to load. * * @var string */ public $ToolbarSet ; /** * Initial value. * * @var string */ public $Value ; /** * This is where additional configuration can be passed. * Example: * $oFCKeditor->Config['EnterMode'] = 'br'; * * @var array */ public $Config ; /** * Main Constructor. * Refer to the _samples/php directory for examples. * * @param string $instanceName */ public function __construct( $instanceName ) { $this->InstanceName = $instanceName ; $this->BasePath = '/fckeditor/' ; $this->Width = '100%' ; $this->Height = '200' ; $this->ToolbarSet = 'Default' ; $this->Value = '' ; $this->Config = array() ; } /** * Display FCKeditor. * */ public function Create() { echo $this->CreateHtml() ; } /** * Return the HTML code required to run FCKeditor. * * @return string */ public function CreateHtml() { $HtmlValue = htmlspecialchars( $this->Value ) ; $Html = '' ; if ( $this->IsCompatible() ) { if ( isset( $_GET['fcksource'] ) && $_GET['fcksource'] == "true" ) $File = 'fckeditor.original.html' ; else $File = 'fckeditor.html' ; $Link = "{$this->BasePath}editor/{$File}?InstanceName={$this->InstanceName}" ; if ( $this->ToolbarSet != '' ) $Link .= "&amp;Toolbar={$this->ToolbarSet}" ; // Render the linked hidden field. $Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}\" name=\"{$this->InstanceName}\" value=\"{$HtmlValue}\" style=\"display:none\" />" ; // Render the configurations hidden field. $Html .= "<input type=\"hidden\" id=\"{$this->InstanceName}___Config\" value=\"" . $this->GetConfigFieldString() . "\" style=\"display:none\" />" ; // Render the editor IFRAME. $Html .= "<iframe id=\"{$this->InstanceName}___Frame\" src=\"{$Link}\" width=\"{$this->Width}\" height=\"{$this->Height}\" frameborder=\"0\" scrolling=\"no\"></iframe>" ; } else { if ( strpos( $this->Width, '%' ) === false ) $WidthCSS = $this->Width . 'px' ; else $WidthCSS = $this->Width ; if ( strpos( $this->Height, '%' ) === false ) $HeightCSS = $this->Height . 'px' ; else $HeightCSS = $this->Height ; $Html .= "<textarea name=\"{$this->InstanceName}\" rows=\"4\" cols=\"40\" style=\"width: {$WidthCSS}; height: {$HeightCSS}\">{$HtmlValue}</textarea>" ; } return $Html ; } /** * Returns true if browser is compatible with FCKeditor. * * @return boolean */ public function IsCompatible() { return FCKeditor_IsCompatibleBrowser() ; } /** * Get settings from Config array as a single string. * * @access protected * @return string */ public function GetConfigFieldString() { $sParams = '' ; $bFirst = true ; foreach ( $this->Config as $sKey => $sValue ) { if ( $bFirst == false ) $sParams .= '&amp;' ; else $bFirst = false ; if ( $sValue === true ) $sParams .= $this->EncodeConfig( $sKey ) . '=true' ; else if ( $sValue === false ) $sParams .= $this->EncodeConfig( $sKey ) . '=false' ; else $sParams .= $this->EncodeConfig( $sKey ) . '=' . $this->EncodeConfig( $sValue ) ; } return $sParams ; } /** * Encode characters that may break the configuration string * generated by GetConfigFieldString(). * * @access protected * @param string $valueToEncode * @return string */ public function EncodeConfig( $valueToEncode ) { $chars = array( '&' => '%26', '=' => '%3D', '"' => '%22' ) ; return strtr( $valueToEncode, $chars ) ; } }
zzshop
trunk/includes/fckeditor/fckeditor_php5.php
PHP
asf20
7,164
/* * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2008 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or later (the "GPL") * http://www.gnu.org/licenses/gpl.html * * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") * http://www.gnu.org/licenses/lgpl.html * * - Mozilla Public License Version 1.1 or later (the "MPL") * http://www.mozilla.org/MPL/MPL-1.1.html * * == END LICENSE == * * This is the integration file for JavaScript. * * It defines the FCKeditor class that can be used to create editor * instances in a HTML page in the client side. For server side * operations, use the specific integration system. */ // FCKeditor Class var FCKeditor = function( instanceName, width, height, toolbarSet, value ) { // Properties this.InstanceName = instanceName ; this.Width = width || '100%' ; this.Height = height || '200' ; this.ToolbarSet = toolbarSet || 'Default' ; this.Value = value || '' ; this.BasePath = FCKeditor.BasePath ; this.CheckBrowser = true ; this.DisplayErrors = true ; this.Config = new Object() ; // Events this.OnError = null ; // function( source, errorNumber, errorDescription ) } /** * This is the default BasePath used by all editor instances. */ FCKeditor.BasePath = '/fckeditor/' ; /** * The minimum height used when replacing textareas. */ FCKeditor.MinHeight = 200 ; /** * The minimum width used when replacing textareas. */ FCKeditor.MinWidth = 750 ; FCKeditor.prototype.Version = '2.6.3' ; FCKeditor.prototype.VersionBuild = '19836' ; FCKeditor.prototype.Create = function() { document.write( this.CreateHtml() ) ; } FCKeditor.prototype.CreateHtml = function() { // Check for errors if ( !this.InstanceName || this.InstanceName.length == 0 ) { this._ThrowError( 701, 'You must specify an instance name.' ) ; return '' ; } var sHtml = '' ; if ( !this.CheckBrowser || this._IsCompatibleBrowser() ) { sHtml += '<input type="hidden" id="' + this.InstanceName + '" name="' + this.InstanceName + '" value="' + this._HTMLEncode( this.Value ) + '" style="display:none" />' ; sHtml += this._GetConfigHtml() ; sHtml += this._GetIFrameHtml() ; } else { var sWidth = this.Width.toString().indexOf('%') > 0 ? this.Width : this.Width + 'px' ; var sHeight = this.Height.toString().indexOf('%') > 0 ? this.Height : this.Height + 'px' ; sHtml += '<textarea name="' + this.InstanceName + '" rows="4" cols="40" style="width:' + sWidth + ';height:' + sHeight ; if ( this.TabIndex ) sHtml += '" tabindex="' + this.TabIndex ; sHtml += '">' + this._HTMLEncode( this.Value ) + '<\/textarea>' ; } return sHtml ; } FCKeditor.prototype.ReplaceTextarea = function() { if ( !this.CheckBrowser || this._IsCompatibleBrowser() ) { // We must check the elements firstly using the Id and then the name. var oTextarea = document.getElementById( this.InstanceName ) ; var colElementsByName = document.getElementsByName( this.InstanceName ) ; var i = 0; while ( oTextarea || i == 0 ) { if ( oTextarea && oTextarea.tagName.toLowerCase() == 'textarea' ) break ; oTextarea = colElementsByName[i++] ; } if ( !oTextarea ) { alert( 'Error: The TEXTAREA with id or name set to "' + this.InstanceName + '" was not found' ) ; return ; } oTextarea.style.display = 'none' ; if ( oTextarea.tabIndex ) this.TabIndex = oTextarea.tabIndex ; this._InsertHtmlBefore( this._GetConfigHtml(), oTextarea ) ; this._InsertHtmlBefore( this._GetIFrameHtml(), oTextarea ) ; } } FCKeditor.prototype._InsertHtmlBefore = function( html, element ) { if ( element.insertAdjacentHTML ) // IE element.insertAdjacentHTML( 'beforeBegin', html ) ; else // Gecko { var oRange = document.createRange() ; oRange.setStartBefore( element ) ; var oFragment = oRange.createContextualFragment( html ); element.parentNode.insertBefore( oFragment, element ) ; } } FCKeditor.prototype._GetConfigHtml = function() { var sConfig = '' ; for ( var o in this.Config ) { if ( sConfig.length > 0 ) sConfig += '&amp;' ; sConfig += encodeURIComponent( o ) + '=' + encodeURIComponent( this.Config[o] ) ; } return '<input type="hidden" id="' + this.InstanceName + '___Config" value="' + sConfig + '" style="display:none" />' ; } FCKeditor.prototype._GetIFrameHtml = function() { var sFile = 'fckeditor.html' ; try { if ( (/fcksource=true/i).test( window.top.location.search ) ) sFile = 'fckeditor.original.html' ; } catch (e) { /* Ignore it. Much probably we are inside a FRAME where the "top" is in another domain (security error). */ } var sLink = this.BasePath + 'editor/' + sFile + '?InstanceName=' + encodeURIComponent( this.InstanceName ) ; if (this.ToolbarSet) sLink += '&amp;Toolbar=' + this.ToolbarSet ; html = '<iframe id="' + this.InstanceName + '___Frame" src="' + sLink + '" width="' + this.Width + '" height="' + this.Height ; if ( this.TabIndex ) html += '" tabindex="' + this.TabIndex ; html += '" frameborder="0" scrolling="no"></iframe>' ; return html ; } FCKeditor.prototype._IsCompatibleBrowser = function() { return FCKeditor_IsCompatibleBrowser() ; } FCKeditor.prototype._ThrowError = function( errorNumber, errorDescription ) { this.ErrorNumber = errorNumber ; this.ErrorDescription = errorDescription ; if ( this.DisplayErrors ) { document.write( '<div style="COLOR: #ff0000">' ) ; document.write( '[ FCKeditor Error ' + this.ErrorNumber + ': ' + this.ErrorDescription + ' ]' ) ; document.write( '</div>' ) ; } if ( typeof( this.OnError ) == 'function' ) this.OnError( this, errorNumber, errorDescription ) ; } FCKeditor.prototype._HTMLEncode = function( text ) { if ( typeof( text ) != "string" ) text = text.toString() ; text = text.replace( /&/g, "&amp;").replace( /"/g, "&quot;").replace( /</g, "&lt;").replace( />/g, "&gt;") ; return text ; } ;(function() { var textareaToEditor = function( textarea ) { var editor = new FCKeditor( textarea.name ) ; editor.Width = Math.max( textarea.offsetWidth, FCKeditor.MinWidth ) ; editor.Height = Math.max( textarea.offsetHeight, FCKeditor.MinHeight ) ; return editor ; } /** * Replace all <textarea> elements available in the document with FCKeditor * instances. * * // Replace all <textarea> elements in the page. * FCKeditor.ReplaceAllTextareas() ; * * // Replace all <textarea class="myClassName"> elements in the page. * FCKeditor.ReplaceAllTextareas( 'myClassName' ) ; * * // Selectively replace <textarea> elements, based on custom assertions. * FCKeditor.ReplaceAllTextareas( function( textarea, editor ) * { * // Custom code to evaluate the replace, returning false if it * // must not be done. * // It also passes the "editor" parameter, so the developer can * // customize the instance. * } ) ; */ FCKeditor.ReplaceAllTextareas = function() { var textareas = document.getElementsByTagName( 'textarea' ) ; for ( var i = 0 ; i < textareas.length ; i++ ) { var editor = null ; var textarea = textareas[i] ; var name = textarea.name ; // The "name" attribute must exist. if ( !name || name.length == 0 ) continue ; if ( typeof arguments[0] == 'string' ) { // The textarea class name could be passed as the function // parameter. var classRegex = new RegExp( '(?:^| )' + arguments[0] + '(?:$| )' ) ; if ( !classRegex.test( textarea.className ) ) continue ; } else if ( typeof arguments[0] == 'function' ) { // An assertion function could be passed as the function parameter. // It must explicitly return "false" to ignore a specific <textarea>. editor = textareaToEditor( textarea ) ; if ( arguments[0]( textarea, editor ) === false ) continue ; } if ( !editor ) editor = textareaToEditor( textarea ) ; editor.ReplaceTextarea() ; } } })() ; function FCKeditor_IsCompatibleBrowser() { var sAgent = navigator.userAgent.toLowerCase() ; // Internet Explorer 5.5+ if ( /*@cc_on!@*/false && sAgent.indexOf("mac") == -1 ) { var sBrowserVersion = navigator.appVersion.match(/MSIE (.\..)/)[1] ; return ( sBrowserVersion >= 5.5 ) ; } // Gecko (Opera 9 tries to behave like Gecko at this point). if ( navigator.product == "Gecko" && navigator.productSub >= 20030210 && !( typeof(opera) == 'object' && opera.postError ) ) return true ; // Opera 9.50+ if ( window.opera && window.opera.version && parseFloat( window.opera.version() ) >= 9.5 ) return true ; // Adobe AIR // Checked before Safari because AIR have the WebKit rich text editor // features from Safari 3.0.4, but the version reported is 420. if ( sAgent.indexOf( ' adobeair/' ) != -1 ) return ( sAgent.match( / adobeair\/(\d+)/ )[1] >= 1 ) ; // Build must be at least v1 // Safari 3+ if ( sAgent.indexOf( ' applewebkit/' ) != -1 ) return ( sAgent.match( / applewebkit\/(\d+)/ )[1] >= 522 ) ; // Build must be at least 522 (v3) return false ; }
zzshop
trunk/includes/fckeditor/fckeditor.js
JavaScript
asf20
9,523
<?php /** * ECSHOP 用户级错误处理类 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: cls_error.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } class ecs_error { var $_message = array(); var $_template = ''; var $error_no = 0; /** * 构造函数 * * @access public * @param string $tpl * @return void */ function __construct($tpl) { $this->ecs_error($tpl); } /** * 构造函数 * * @access public * @param string $tpl * @return void */ function ecs_error($tpl) { $this->_template = $tpl; } /** * 添加一条错误信息 * * @access public * @param string $msg * @param integer $errno * @return void */ function add($msg, $errno=1) { if (is_array($msg)) { $this->_message = array_merge($this->_message, $msg); } else { $this->_message[] = $msg; } $this->error_no = $errno; } /** * 清空错误信息 * * @access public * @return void */ function clean() { $this->_message = array(); $this->error_no = 0; } /** * 返回所有的错误信息的数组 * * @access public * @return array */ function get_all() { return $this->_message; } /** * 返回最后一条错误信息 * * @access public * @return void */ function last_message() { return array_slice($this->_message, -1); } /** * 显示错误信息 * * @access public * @param string $link * @param string $href * @return void */ function show($link = '', $href = '') { if ($this->error_no > 0) { $message = array(); $link = (empty($link)) ? $GLOBALS['_LANG']['back_up_page'] : $link; $href = (empty($href)) ? 'javascript:history.back();' : $href; $message['url_info'][$link] = $href; $message['back_url'] = $href; foreach ($this->_message AS $msg) { $message['content'] = '<div>' . htmlspecialchars($msg) . '</div>'; } if (isset($GLOBALS['smarty'])) { assign_template(); $GLOBALS['smarty']->assign('auto_redirect', true); $GLOBALS['smarty']->assign('message', $message); $GLOBALS['smarty']->display($this->_template); } else { die($message['content']); } exit; } } } ?>
zzshop
trunk/includes/cls_error.php
PHP
asf20
3,482
<?php /** * ECSHOP 前台公用函数库 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: lib_main.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } /** * 更新用户SESSION,COOKIE及登录时间、登录次数。 * * @access public * @return void */ function update_user_info() { if (!$_SESSION['user_id']) { return false; } /* 查询会员信息 */ $time = date('Y-m-d'); $sql = 'SELECT u.user_money, u.pay_points, u.user_rank, u.rank_points, '. ' IFNULL(b.type_money, 0) AS user_bonus, u.last_login, u.last_ip'. ' FROM ' .$GLOBALS['ecs']->table('users'). ' AS u ' . ' LEFT JOIN ' .$GLOBALS['ecs']->table('user_bonus'). ' AS ub'. ' ON ub.user_id = u.user_id AND ub.used_time = 0 ' . ' LEFT JOIN ' .$GLOBALS['ecs']->table('bonus_type'). ' AS b'. " ON b.type_id = ub.bonus_type_id AND b.use_start_date <= '$time' AND b.use_end_date >= '$time' ". " WHERE u.user_id = '$_SESSION[user_id]'"; if ($row = $GLOBALS['db']->getRow($sql)) { /* 更新SESSION */ $_SESSION['last_time'] = $row['last_login']; $_SESSION['last_ip'] = $row['last_ip']; $_SESSION['login_fail'] = 0; /* 取得用户等级和折扣 */ if ($row['user_rank'] == 0) { // 非特殊等级,根据等级积分计算用户等级(注意:不包括特殊等级) $sql = 'SELECT rank_id, discount FROM ' . $GLOBALS['ecs']->table('user_rank') . " WHERE special_rank = '0' AND min_points <= " . intval($row['rank_points']) . ' AND max_points > ' . intval($row['rank_points']); if ($row = $GLOBALS['db']->getRow($sql)) { $_SESSION['user_rank'] = $row['rank_id']; $_SESSION['discount'] = $row['discount'] / 100.00; } else { $_SESSION['user_rank'] = 0; $_SESSION['discount'] = 1; } } else { // 特殊等级 $sql = 'SELECT rank_id, discount FROM ' . $GLOBALS['ecs']->table('user_rank') . " WHERE rank_id = '$row[user_rank]'"; if ($row = $GLOBALS['db']->getRow($sql)) { $_SESSION['user_rank'] = $row['rank_id']; $_SESSION['discount'] = $row['discount'] / 100.00; } else { $_SESSION['user_rank'] = 0; $_SESSION['discount'] = 1; } } } /* 更新登录时间,登录次数及登录ip */ $sql = "UPDATE " .$GLOBALS['ecs']->table('users'). " SET". " visit_count = visit_count + 1, ". " last_ip = '" .real_ip(). "',". " last_login = '" .gmtime(). "'". " WHERE user_id = '" . $_SESSION['user_id'] . "'"; $GLOBALS['db']->query($sql); } /** * 获取用户信息数组 * * @access public * @param * * @return array $user 用户信息数组 */ function get_user_info($id=0) { if ($id == 0) { $id = $_SESSION['user_id']; } $time = date('Y-m-d'); $sql = 'SELECT u.user_id, u.email, u.user_name, u.user_money, u.pay_points'. ' FROM ' .$GLOBALS['ecs']->table('users'). ' AS u ' . " WHERE u.user_id = '$id'"; $user = $GLOBALS['db']->getRow($sql); $bonus = get_user_bonus($id); $user['username'] = $user['user_name']; $user['user_points'] = $user['pay_points'] . $GLOBALS['_CFG']['integral_name']; $user['user_money'] = price_format($user['user_money'], false); $user['user_bonus'] = price_format($bonus['bonus_value'], false); return $user; } /** * 取得当前位置和页面标题 * * @access public * @param integer $cat 分类编号(只有商品及分类、文章及分类用到) * @param string $str 商品名、文章标题或其他附加的内容(无链接) * @return array */ function assign_ur_here($cat = 0, $str = '') { /* 判断是否重写,取得文件名 */ $cur_url = basename(PHP_SELF); if (intval($GLOBALS['_CFG']['rewrite'])) { $filename = strpos($cur_url,'-') ? substr($cur_url, 0, strpos($cur_url,'-')) : substr($cur_url, 0, -4); } else { $filename = substr($cur_url, 0, -4); } /* 初始化“页面标题”和“当前位置” */ $page_title = $GLOBALS['_CFG']['shop_title'] . ' - ' . 'Powered by ECShop'; $ur_here = '<a href=".">' . $GLOBALS['_LANG']['home'] . '</a>'; /* 根据文件名分别处理中间的部分 */ if ($filename != 'index') { /* 处理有分类的 */ if (in_array($filename, array('category', 'goods', 'article_cat', 'article', 'brand'))) { /* 商品分类或商品 */ if ('category' == $filename || 'goods' == $filename || 'brand' == $filename) { if ($cat > 0) { $cat_arr = get_parent_cats($cat); $key = 'cid'; $type = 'category'; } else { $cat_arr = array(); } } /* 文章分类或文章 */ elseif ('article_cat' == $filename || 'article' == $filename) { if ($cat > 0) { $cat_arr = get_article_parent_cats($cat); $key = 'acid'; $type = 'article_cat'; } else { $cat_arr = array(); } } /* 循环分类 */ if (!empty($cat_arr)) { krsort($cat_arr); foreach ($cat_arr AS $val) { $page_title = htmlspecialchars($val['cat_name']) . '_' . $page_title; $args = array($key => $val['cat_id']); $ur_here .= ' <code>&gt;</code> <a href="' . build_uri($type, $args, $val['cat_name']) . '">' . htmlspecialchars($val['cat_name']) . '</a>'; } } } /* 处理无分类的 */ else { /* 团购 */ if ('group_buy' == $filename) { $page_title = $GLOBALS['_LANG']['group_buy_goods'] . '_' . $page_title; $args = array('gbid' => '0'); $ur_here .= ' <code>&gt;</code> <a href="group_buy.php">' . $GLOBALS['_LANG']['group_buy_goods'] . '</a>'; } /* 拍卖 */ elseif ('auction' == $filename) { $page_title = $GLOBALS['_LANG']['auction'] . '_' . $page_title; $args = array('auid' => '0'); $ur_here .= ' <code>&gt;</code> <a href="auction.php">' . $GLOBALS['_LANG']['auction'] . '</a>'; } /* 夺宝 */ elseif ('snatch' == $filename) { $page_title = $GLOBALS['_LANG']['snatch'] . '_' . $page_title; $args = array('id' => '0'); $ur_here .= ' <code> &gt; </code><a href="snatch.php">' . $GLOBALS['_LANG']['snatch_list'] . '</a>'; } /* 批发 */ elseif ('wholesale' == $filename) { $page_title = $GLOBALS['_LANG']['wholesale'] . '_' . $page_title; $args = array('wsid' => '0'); $ur_here .= ' <code>&gt;</code> <a href="wholesale.php">' . $GLOBALS['_LANG']['wholesale'] . '</a>'; } /* 积分兑换 */ elseif ('exchange' == $filename) { $page_title = $GLOBALS['_LANG']['exchange'] . '_' . $page_title; $args = array('wsid' => '0'); $ur_here .= ' <code>&gt;</code> <a href="exchange.php">' . $GLOBALS['_LANG']['exchange'] . '</a>'; } /* 其他的在这里补充 */ } } /* 处理最后一部分 */ if (!empty($str)) { $page_title = $str . '_' . $page_title; $ur_here .= ' <code>&gt;</code> ' . $str; } /* 返回值 */ return array('title' => $page_title, 'ur_here' => $ur_here); } /** * 获得指定分类的所有上级分类 * * @access public * @param integer $cat 分类编号 * @return array */ function get_parent_cats($cat) { if ($cat == 0) { return array(); } $arr = $GLOBALS['db']->GetAll('SELECT cat_id, cat_name, parent_id FROM ' . $GLOBALS['ecs']->table('category')); if (empty($arr)) { return array(); } $index = 0; $cats = array(); while (1) { foreach ($arr AS $row) { if ($cat == $row['cat_id']) { $cat = $row['parent_id']; $cats[$index]['cat_id'] = $row['cat_id']; $cats[$index]['cat_name'] = $row['cat_name']; $index++; break; } } if ($index == 0 || $cat == 0) { break; } } return $cats; } /** * 根据提供的数组编译成页面标题 * * @access public * @param string $type 类型 * @param array $arr 分类数组 * @return string */ function build_pagetitle($arr, $type = 'category') { $str = ''; foreach ($arr AS $val) { $str .= htmlspecialchars($val['cat_name']) . '_'; } return $str; } /** * 根据提供的数组编译成当前位置 * * @access public * @param string $type 类型 * @param array $arr 分类数组 * @return void */ function build_urhere($arr, $type = 'category') { krsort($arr); $str = ''; foreach ($arr AS $val) { switch ($type) { case 'category': case 'brand': $args = array('cid' => $val['cat_id']); break; case 'article_cat': $args = array('acid' => $val['cat_id']); break; } $str .= ' <code>&gt;</code> <a href="' . build_uri($type, $args). '">' . htmlspecialchars($val['cat_name']) . '</a>'; } return $str; } /** * 获得指定页面的动态内容 * * @access public * @param string $tmp 模板名称 * @return void */ function assign_dynamic($tmp) { $sql = 'SELECT id, number, type FROM ' . $GLOBALS['ecs']->table('template') . " WHERE filename = '$tmp' AND type > 0 AND remarks ='' AND theme='" . $GLOBALS['_CFG']['template'] . "'"; $res = $GLOBALS['db']->getAll($sql); foreach ($res AS $row) { switch ($row['type']) { case 1: /* 分类下的商品 */ $GLOBALS['smarty']->assign('goods_cat_' . $row['id'], assign_cat_goods($row['id'], $row['number'])); break; case 2: /* 品牌的商品 */ $brand_goods = assign_brand_goods($row['id'], $row['number']); $GLOBALS['smarty']->assign('brand_goods_' . $row['id'], $brand_goods['goods']); $GLOBALS['smarty']->assign('goods_brand_' . $row['id'], $brand_goods['brand']); break; case 3: /* 文章列表 */ $cat_articles = assign_articles($row['id'], $row['number']); $GLOBALS['smarty']->assign('articles_cat_' . $row['id'], $cat_articles['cat']); $GLOBALS['smarty']->assign('articles_' . $row['id'], $cat_articles['arr']); break; } } } /** * 分配文章列表给smarty * * @access public * @param integer $id 文章分类的编号 * @param integer $num 文章数量 * @return array */ function assign_articles($id, $num) { $sql = 'SELECT cat_name FROM ' . $GLOBALS['ecs']->table('article_cat') . " WHERE cat_id = '" . $id ."'"; $cat['id'] = $id; $cat['name'] = $GLOBALS['db']->getOne($sql); $cat['url'] = build_uri('article_cat', array('acid' => $id), $cat['name']); $articles['cat'] = $cat; $articles['arr'] = get_cat_articles($id, 1, $num); return $articles; } /** * 分配帮助信息 * * @access public * @return array */ function get_shop_help() { $sql = 'SELECT c.cat_id, c.cat_name, c.sort_order, a.article_id, a.title, a.file_url, a.open_type ' . 'FROM ' .$GLOBALS['ecs']->table('article'). ' AS a ' . 'LEFT JOIN ' .$GLOBALS['ecs']->table('article_cat'). ' AS c ' . 'ON a.cat_id = c.cat_id WHERE c.cat_type = 5 AND a.is_open = 1 ' . 'ORDER BY c.sort_order ASC, a.article_id'; $res = $GLOBALS['db']->getAll($sql); $arr = array(); foreach ($res AS $key => $row) { $arr[$row['cat_id']]['cat_id'] = build_uri('article_cat', array('acid'=> $row['cat_id']), $row['cat_name']); $arr[$row['cat_id']]['cat_name'] = $row['cat_name']; $arr[$row['cat_id']]['article'][$key]['article_id'] = $row['article_id']; $arr[$row['cat_id']]['article'][$key]['title'] = $row['title']; $arr[$row['cat_id']]['article'][$key]['short_title'] = $GLOBALS['_CFG']['article_title_length'] > 0 ? sub_str($row['title'], $GLOBALS['_CFG']['article_title_length']) : $row['title']; $arr[$row['cat_id']]['article'][$key]['url'] = $row['open_type'] != 1 ? build_uri('article', array('aid' => $row['article_id']), $row['title']) : trim($row['file_url']); } return $arr; } /** * 创建分页信息 * * @access public * @param string $app 程序名称,如category * @param string $cat 分类ID * @param string $record_count 记录总数 * @param string $size 每页记录数 * @param string $sort 排序类型 * @param string $order 排序顺序 * @param string $page 当前页 * @param string $keywords 查询关键字 * @param string $brand 品牌 * @param string $price_min 最小价格 * @param string $price_max 最高价格 * @return void */ function assign_pager($app, $cat, $record_count, $size, $sort, $order, $page = 1, $keywords = '', $brand = 0, $price_min = 0, $price_max = 0, $display_type = 'list', $filter_attr='', $url_format='', $sch_array='') { $sch = array('keywords' => $keywords, 'sort' => $sort, 'order' => $order, 'cat' => $cat, 'brand' => $brand, 'price_min' => $price_min, 'price_max' => $price_max, 'filter_attr'=>$filter_attr, 'display' => $display_type ); $page = intval($page); if ($page < 1) { $page = 1; } $page_count = $record_count > 0 ? intval(ceil($record_count / $size)) : 1; $pager['page'] = $page; $pager['size'] = $size; $pager['sort'] = $sort; $pager['order'] = $order; $pager['record_count'] = $record_count; $pager['page_count'] = $page_count; $pager['display'] = $display_type; switch ($app) { case 'category': $uri_args = array('cid' => $cat, 'bid' => $brand, 'price_min'=>$price_min, 'price_max'=>$price_max, 'filter_attr'=>$filter_attr, 'sort' => $sort, 'order' => $order, 'display' => $display_type); break; case 'article_cat': $uri_args = array('acid' => $cat, 'sort' => $sort, 'order' => $order); break; case 'brand': $uri_args = array('cid' => $cat, 'bid' => $brand, 'sort' => $sort, 'order' => $order, 'display' => $display_type); break; case 'search': $uri_args = array('cid' => $cat, 'bid' => $brand, 'sort' => $sort, 'order' => $order); break; case 'exchange': $uri_args = array('cid' => $cat, 'integral_min'=>$price_min, 'integral_max'=>$price_max, 'sort' => $sort, 'order' => $order, 'display' => $display_type); break; } /* 分页样式 */ $pager['styleid'] = isset($GLOBALS['_CFG']['page_style'])? intval($GLOBALS['_CFG']['page_style']) : 0; $page_prev = ($page > 1) ? $page - 1 : 1; $page_next = ($page < $page_count) ? $page + 1 : $page_count; if ($pager['styleid'] == 0) { if (!empty($url_format)) { $pager['page_first'] = $url_format . 1; $pager['page_prev'] = $url_format . $page_prev; $pager['page_next'] = $url_format . $page_next; $pager['page_last'] = $url_format . $page_count; } else { $pager['page_first'] = build_uri($app, $uri_args, '', 1, $keywords); $pager['page_prev'] = build_uri($app, $uri_args, '', $page_prev, $keywords); $pager['page_next'] = build_uri($app, $uri_args, '', $page_next, $keywords); $pager['page_last'] = build_uri($app, $uri_args, '', $page_count, $keywords); } $pager['array'] = array(); for ($i = 1; $i <= $page_count; $i++) { $pager['array'][$i] = $i; } } else { $_pagenum = 10; // 显示的页码 $_offset = 2; // 当前页偏移值 $_from = $_to = 0; // 开始页, 结束页 if($_pagenum > $page_count) { $_from = 1; $_to = $page_count; } else { $_from = $page - $_offset; $_to = $_from + $_pagenum - 1; if($_from < 1) { $_to = $page + 1 - $_from; $_from = 1; if($_to - $_from < $_pagenum) { $_to = $_pagenum; } } elseif($_to > $page_count) { $_from = $page_count - $_pagenum + 1; $_to = $page_count; } } if (!empty($url_format)) { $pager['page_first'] = ($page - $_offset > 1 && $_pagenum < $page_count) ? $url_format . 1 : ''; $pager['page_prev'] = ($page > 1) ? $url_format . $page_prev : ''; $pager['page_next'] = ($page < $page_count) ? $url_format . $page_next : ''; $pager['page_last'] = ($_to < $page_count) ? $url_format . $page_count : ''; $pager['page_kbd'] = ($_pagenum < $page_count) ? true : false; $pager['page_number'] = array(); for ($i=$_from;$i<=$_to;++$i) { $pager['page_number'][$i] = $url_format . $i; } } else { $pager['page_first'] = ($page - $_offset > 1 && $_pagenum < $page_count) ? build_uri($app, $uri_args, '', 1, $keywords) : ''; $pager['page_prev'] = ($page > 1) ? build_uri($app, $uri_args, '', $page_prev, $keywords) : ''; $pager['page_next'] = ($page < $page_count) ? build_uri($app, $uri_args, '', $page_next, $keywords) : ''; $pager['page_last'] = ($_to < $page_count) ? build_uri($app, $uri_args, '', $page_count, $keywords) : ''; $pager['page_kbd'] = ($_pagenum < $page_count) ? true : false; $pager['page_number'] = array(); for ($i=$_from;$i<=$_to;++$i) { $pager['page_number'][$i] = build_uri($app, $uri_args, '', $i, $keywords); } } } if (!empty($sch_array)) { $pager['search'] = $sch_array; } else { $pager['search']['category'] = $cat; foreach ($sch AS $key => $row) { $pager['search'][$key] = $row; } } $GLOBALS['smarty']->assign('pager', $pager); } /** * 生成给pager.lbi赋值的数组 * * @access public * @param string $url 分页的链接地址(必须是带有参数的地址,若不是可以伪造一个无用参数) * @param array $param 链接参数 key为参数名,value为参数值 * @param int $record 记录总数量 * @param int $page 当前页数 * @param int $size 每页大小 * * @return array $pager */ function get_pager($url, $param, $record_count, $page = 1, $size = 10) { $size = intval($size); if ($size < 1) { $size = 10; } $page = intval($page); if ($page < 1) { $page = 1; } $record_count = intval($record_count); $page_count = $record_count > 0 ? intval(ceil($record_count / $size)) : 1; if ($page > $page_count) { $page = $page_count; } /* 分页样式 */ $pager['styleid'] = isset($GLOBALS['_CFG']['page_style'])? intval($GLOBALS['_CFG']['page_style']) : 0; $page_prev = ($page > 1) ? $page - 1 : 1; $page_next = ($page < $page_count) ? $page + 1 : $page_count; /* 将参数合成url字串 */ $param_url = '?'; foreach ($param AS $key => $value) { $param_url .= $key . '=' . $value . '&'; } $pager['url'] = $url; $pager['start'] = ($page -1) * $size; $pager['page'] = $page; $pager['size'] = $size; $pager['record_count'] = $record_count; $pager['page_count'] = $page_count; if ($pager['styleid'] == 0) { $pager['page_first'] = $url . $param_url . 'page=1'; $pager['page_prev'] = $url . $param_url . 'page=' . $page_prev; $pager['page_next'] = $url . $param_url . 'page=' . $page_next; $pager['page_last'] = $url . $param_url . 'page=' . $page_count; $pager['array'] = array(); for ($i = 1; $i <= $page_count; $i++) { $pager['array'][$i] = $i; } } else { $_pagenum = 10; // 显示的页码 $_offset = 2; // 当前页偏移值 $_from = $_to = 0; // 开始页, 结束页 if($_pagenum > $page_count) { $_from = 1; $_to = $page_count; } else { $_from = $page - $_offset; $_to = $_from + $_pagenum - 1; if($_from < 1) { $_to = $page + 1 - $_from; $_from = 1; if($_to - $_from < $_pagenum) { $_to = $_pagenum; } } elseif($_to > $page_count) { $_from = $page_count - $_pagenum + 1; $_to = $page_count; } } $url_format = $url . $param_url . 'page='; $pager['page_first'] = ($page - $_offset > 1 && $_pagenum < $page_count) ? $url_format . 1 : ''; $pager['page_prev'] = ($page > 1) ? $url_format . $page_prev : ''; $pager['page_next'] = ($page < $page_count) ? $url_format . $page_next : ''; $pager['page_last'] = ($_to < $page_count) ? $url_format . $page_count : ''; $pager['page_kbd'] = ($_pagenum < $page_count) ? true : false; $pager['page_number'] = array(); for ($i=$_from;$i<=$_to;++$i) { $pager['page_number'][$i] = $url_format . $i; } } $pager['search'] = $param; return $pager; } /** * 调用调查内容 * * @access public * @param integer $id 调查的编号 * @return array */ function get_vote($id = '') { /* 随机取得一个调查的主题 */ if (empty($id)) { $time = gmtime(); $sql = 'SELECT vote_id, vote_name, can_multi, vote_count, RAND() AS rnd' . ' FROM ' . $GLOBALS['ecs']->table('vote') . " WHERE start_time <= '$time' AND end_time >= '$time' ". ' ORDER BY rnd LIMIT 1'; } else { $sql = 'SELECT vote_id, vote_name, can_multi, vote_count' . ' FROM ' . $GLOBALS['ecs']->table('vote'). " WHERE vote_id = '$id'"; } $vote_arr = $GLOBALS['db']->getRow($sql); if ($vote_arr !== false && !empty($vote_arr)) { /* 通过调查的ID,查询调查选项 */ $sql_option = 'SELECT v.*, o.option_id, o.vote_id, o.option_name, o.option_count ' . 'FROM ' . $GLOBALS['ecs']->table('vote') . ' AS v, ' . $GLOBALS['ecs']->table('vote_option') . ' AS o ' . "WHERE o.vote_id = v.vote_id AND o.vote_id = '$vote_arr[vote_id]' ORDER BY o.option_order ASC, o.option_id DESC"; $res = $GLOBALS['db']->getAll($sql_option); /* 总票数 */ $sql = 'SELECT SUM(option_count) AS all_option FROM ' . $GLOBALS['ecs']->table('vote_option') . " WHERE vote_id = '" . $vote_arr['vote_id'] . "' GROUP BY vote_id"; $option_num = $GLOBALS['db']->getOne($sql); $arr = array(); $count = 100; foreach ($res AS $idx => $row) { if ($option_num > 0 && $idx == count($res) - 1) { $percent = $count; } else { $percent = ($row['vote_count'] > 0 && $option_num > 0) ? round(($row['option_count'] / $option_num) * 100) : 0; $count -= $percent; } $arr[$row['vote_id']]['options'][$row['option_id']]['percent'] = $percent; $arr[$row['vote_id']]['vote_id'] = $row['vote_id']; $arr[$row['vote_id']]['vote_name'] = $row['vote_name']; $arr[$row['vote_id']]['can_multi'] = $row['can_multi']; $arr[$row['vote_id']]['vote_count'] = $row['vote_count']; $arr[$row['vote_id']]['options'][$row['option_id']]['option_id'] = $row['option_id']; $arr[$row['vote_id']]['options'][$row['option_id']]['option_name'] = $row['option_name']; $arr[$row['vote_id']]['options'][$row['option_id']]['option_count'] = $row['option_count']; } $vote_arr['vote_id'] = (!empty($vote_arr['vote_id'])) ? $vote_arr['vote_id'] : ''; $vote = array('id' => $vote_arr['vote_id'], 'content' => $arr); return $vote; } } /** * 获得浏览器名称和版本 * * @access public * @return string */ function get_user_browser() { if (empty($_SERVER['HTTP_USER_AGENT'])) { return ''; } $agent = $_SERVER['HTTP_USER_AGENT']; $browser = ''; $browser_ver = ''; if (preg_match('/MSIE\s([^\s|;]+)/i', $agent, $regs)) { $browser = 'Internet Explorer'; $browser_ver = $regs[1]; } elseif (preg_match('/FireFox\/([^\s]+)/i', $agent, $regs)) { $browser = 'FireFox'; $browser_ver = $regs[1]; } elseif (preg_match('/Maxthon/i', $agent, $regs)) { $browser = '(Internet Explorer ' .$browser_ver. ') Maxthon'; $browser_ver = ''; } elseif (preg_match('/Opera[\s|\/]([^\s]+)/i', $agent, $regs)) { $browser = 'Opera'; $browser_ver = $regs[1]; } elseif (preg_match('/OmniWeb\/(v*)([^\s|;]+)/i', $agent, $regs)) { $browser = 'OmniWeb'; $browser_ver = $regs[2]; } elseif (preg_match('/Netscape([\d]*)\/([^\s]+)/i', $agent, $regs)) { $browser = 'Netscape'; $browser_ver = $regs[2]; } elseif (preg_match('/safari\/([^\s]+)/i', $agent, $regs)) { $browser = 'Safari'; $browser_ver = $regs[1]; } elseif (preg_match('/NetCaptor\s([^\s|;]+)/i', $agent, $regs)) { $browser = '(Internet Explorer ' .$browser_ver. ') NetCaptor'; $browser_ver = $regs[1]; } elseif (preg_match('/Lynx\/([^\s]+)/i', $agent, $regs)) { $browser = 'Lynx'; $browser_ver = $regs[1]; } if (!empty($browser)) { return addslashes($browser . ' ' . $browser_ver); } else { return 'Unknow browser'; } } /** * 判断是否为搜索引擎蜘蛛 * * @access public * @return string */ function is_spider($record = true) { static $spider = NULL; if ($spider !== NULL) { return $spider; } if (empty($_SERVER['HTTP_USER_AGENT'])) { $spider = ''; return ''; } $searchengine_bot = array( 'googlebot', 'mediapartners-google', 'baiduspider+', 'msnbot', 'yodaobot', 'yahoo! slurp;', 'yahoo! slurp china;', 'iaskspider', 'sogou web spider', 'sogou push spider' ); $searchengine_name = array( 'GOOGLE', 'GOOGLE ADSENSE', 'BAIDU', 'MSN', 'YODAO', 'YAHOO', 'Yahoo China', 'IASK', 'SOGOU', 'SOGOU' ); $spider = strtolower($_SERVER['HTTP_USER_AGENT']); foreach ($searchengine_bot AS $key => $value) { if (strpos($spider, $value) !== false) { $spider = $searchengine_name[$key]; if ($record === true) { $GLOBALS['db']->autoReplace($GLOBALS['ecs']->table('searchengine'), array('date' => local_date('Y-m-d'), 'searchengine' => $spider, 'count' => 1), array('count' => 1)); } return $spider; } } $spider = ''; return ''; } /** * 获得客户端的操作系统 * * @access private * @return void */ function get_os() { if (empty($_SERVER['HTTP_USER_AGENT'])) { return 'Unknown'; } $agent = strtolower($_SERVER['HTTP_USER_AGENT']); $os = ''; if (strpos($agent, 'win') !== false) { if (strpos($agent, 'nt 5.1') !== false) { $os = 'Windows XP'; } elseif (strpos($agent, 'nt 5.2') !== false) { $os = 'Windows 2003'; } elseif (strpos($agent, 'nt 5.0') !== false) { $os = 'Windows 2000'; } elseif (strpos($agent, 'nt 6.0') !== false) { $os = 'Windows Vista'; } elseif (strpos($agent, 'nt') !== false) { $os = 'Windows NT'; } elseif (strpos($agent, 'win 9x') !== false && strpos($agent, '4.90') !== false) { $os = 'Windows ME'; } elseif (strpos($agent, '98') !== false) { $os = 'Windows 98'; } elseif (strpos($agent, '95') !== false) { $os = 'Windows 95'; } elseif (strpos($agent, '32') !== false) { $os = 'Windows 32'; } elseif (strpos($agent, 'ce') !== false) { $os = 'Windows CE'; } } elseif (strpos($agent, 'linux') !== false) { $os = 'Linux'; } elseif (strpos($agent, 'unix') !== false) { $os = 'Unix'; } elseif (strpos($agent, 'sun') !== false && strpos($agent, 'os') !== false) { $os = 'SunOS'; } elseif (strpos($agent, 'ibm') !== false && strpos($agent, 'os') !== false) { $os = 'IBM OS/2'; } elseif (strpos($agent, 'mac') !== false && strpos($agent, 'pc') !== false) { $os = 'Macintosh'; } elseif (strpos($agent, 'powerpc') !== false) { $os = 'PowerPC'; } elseif (strpos($agent, 'aix') !== false) { $os = 'AIX'; } elseif (strpos($agent, 'hpux') !== false) { $os = 'HPUX'; } elseif (strpos($agent, 'netbsd') !== false) { $os = 'NetBSD'; } elseif (strpos($agent, 'bsd') !== false) { $os = 'BSD'; } elseif (strpos($agent, 'osf1') !== false) { $os = 'OSF1'; } elseif (strpos($agent, 'irix') !== false) { $os = 'IRIX'; } elseif (strpos($agent, 'freebsd') !== false) { $os = 'FreeBSD'; } elseif (strpos($agent, 'teleport') !== false) { $os = 'teleport'; } elseif (strpos($agent, 'flashget') !== false) { $os = 'flashget'; } elseif (strpos($agent, 'webzip') !== false) { $os = 'webzip'; } elseif (strpos($agent, 'offline') !== false) { $os = 'offline'; } else { $os = 'Unknown'; } return $os; } /** * 统计访问信息 * * @access public * @return void */ function visit_stats() { if (isset($GLOBALS['_CFG']['visit_stats']) && $GLOBALS['_CFG']['visit_stats'] == 'off') { return; } $time = gmtime(); /* 检查客户端是否存在访问统计的cookie */ $visit_times = (!empty($_COOKIE['ECS']['visit_times'])) ? intval($_COOKIE['ECS']['visit_times']) + 1 : 1; setcookie('ECS[visit_times]', $visit_times, $time + 86400 * 365, '/'); $browser = get_user_browser(); $os = get_os(); $ip = real_ip(); $area = ecs_geoip($ip); /* 语言 */ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { $pos = strpos($_SERVER['HTTP_ACCEPT_LANGUAGE'], ';'); $lang = addslashes(($pos !== false) ? substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, $pos) : $_SERVER['HTTP_ACCEPT_LANGUAGE']); } else { $lang = ''; } /* 来源 */ if (!empty($_SERVER['HTTP_REFERER']) && strlen($_SERVER['HTTP_REFERER']) > 9) { $pos = strpos($_SERVER['HTTP_REFERER'], '/', 9); if ($pos !== false) { $domain = substr($_SERVER['HTTP_REFERER'], 0, $pos); $path = substr($_SERVER['HTTP_REFERER'], $pos); /* 来源关键字 */ if (!empty($domain) && !empty($path)) { save_searchengine_keyword($domain, $path); } } else { $domain = $path = ''; } } else { $domain = $path = ''; } $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('stats') . ' ( ' . 'ip_address, visit_times, browser, system, language, area, ' . 'referer_domain, referer_path, access_url, access_time' . ') VALUES (' . "'$ip', '$visit_times', '$browser', '$os', '$lang', '$area', ". "'" . addslashes($domain) ."', '" . addslashes($path) ."', '" . addslashes(PHP_SELF) ."', '" . $time . "')"; $GLOBALS['db']->query($sql); } /** * 保存搜索引擎关键字 * * @access public * @return void */ function save_searchengine_keyword($domain, $path) { if (strpos($domain, 'google.com.tw') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) { $searchengine = 'GOOGLE TAIWAN'; $keywords = urldecode($regs[1]); // google taiwan } if (strpos($domain, 'google.cn') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) { $searchengine = 'GOOGLE CHINA'; $keywords = urldecode($regs[1]); // google china } if (strpos($domain, 'google.com') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) { $searchengine = 'GOOGLE'; $keywords = urldecode($regs[1]); // google } elseif (strpos($domain, 'baidu.') !== false && preg_match('/wd=([^&]*)/i', $path, $regs)) { $searchengine = 'BAIDU'; $keywords = urldecode($regs[1]); // baidu } elseif (strpos($domain, 'baidu.') !== false && preg_match('/word=([^&]*)/i', $path, $regs)) { $searchengine = 'BAIDU'; $keywords = urldecode($regs[1]); // baidu } elseif (strpos($domain, '114.vnet.cn') !== false && preg_match('/kw=([^&]*)/i', $path, $regs)) { $searchengine = 'CT114'; $keywords = urldecode($regs[1]); // ct114 } elseif (strpos($domain, 'iask.com') !== false && preg_match('/k=([^&]*)/i', $path, $regs)) { $searchengine = 'IASK'; $keywords = urldecode($regs[1]); // iask } elseif (strpos($domain, 'soso.com') !== false && preg_match('/w=([^&]*)/i', $path, $regs)) { $searchengine = 'SOSO'; $keywords = urldecode($regs[1]); // soso } elseif (strpos($domain, 'sogou.com') !== false && preg_match('/query=([^&]*)/i', $path, $regs)) { $searchengine = 'SOGOU'; $keywords = urldecode($regs[1]); // sogou } elseif (strpos($domain, 'so.163.com') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) { $searchengine = 'NETEASE'; $keywords = urldecode($regs[1]); // netease } elseif (strpos($domain, 'yodao.com') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) { $searchengine = 'YODAO'; $keywords = urldecode($regs[1]); // yodao } elseif (strpos($domain, 'zhongsou.com') !== false && preg_match('/word=([^&]*)/i', $path, $regs)) { $searchengine = 'ZHONGSOU'; $keywords = urldecode($regs[1]); // zhongsou } elseif (strpos($domain, 'search.tom.com') !== false && preg_match('/w=([^&]*)/i', $path, $regs)) { $searchengine = 'TOM'; $keywords = urldecode($regs[1]); // tom } elseif (strpos($domain, 'live.com') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) { $searchengine = 'MSLIVE'; $keywords = urldecode($regs[1]); // MSLIVE } elseif (strpos($domain, 'tw.search.yahoo.com') !== false && preg_match('/p=([^&]*)/i', $path, $regs)) { $searchengine = 'YAHOO TAIWAN'; $keywords = urldecode($regs[1]); // yahoo taiwan } elseif (strpos($domain, 'cn.yahoo.') !== false && preg_match('/p=([^&]*)/i', $path, $regs)) { $searchengine = 'YAHOO CHINA'; $keywords = urldecode($regs[1]); // yahoo china } elseif (strpos($domain, 'yahoo.') !== false && preg_match('/p=([^&]*)/i', $path, $regs)) { $searchengine = 'YAHOO'; $keywords = urldecode($regs[1]); // yahoo } elseif (strpos($domain, 'msn.com.tw') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) { $searchengine = 'MSN TAIWAN'; $keywords = urldecode($regs[1]); // msn taiwan } elseif (strpos($domain, 'msn.com.cn') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) { $searchengine = 'MSN CHINA'; $keywords = urldecode($regs[1]); // msn china } elseif (strpos($domain, 'msn.com') !== false && preg_match('/q=([^&]*)/i', $path, $regs)) { $searchengine = 'MSN'; $keywords = urldecode($regs[1]); // msn } if (!empty($keywords)) { $gb_search = array('YAHOO CHINA', 'TOM', 'ZHONGSOU', 'NETEASE', 'SOGOU', 'SOSO', 'IASK', 'CT114', 'BAIDU'); if (EC_CHARSET == 'utf-8' && in_array($searchengine, $gb_search)) { $keywords = ecs_iconv('GBK', 'UTF8', $keywords); } if (EC_CHARSET == 'gbk' && !in_array($searchengine, $gb_search)) { $keywords = ecs_iconv('UTF8', 'GBK', $keywords); } $GLOBALS['db']->autoReplace($GLOBALS['ecs']->table('keywords'), array('date' => local_date('Y-m-d'), 'searchengine' => $searchengine, 'keyword' => addslashes($keywords), 'count' => 1), array('count' => 1)); } } /** * 获得指定用户、商品的所有标记 * * @access public * @param integer $goods_id * @param integer $user_id * @return array */ function get_tags($goods_id = 0, $user_id = 0) { $where = ''; if ($goods_id > 0) { $where .= " goods_id = '$goods_id'"; } if ($user_id > 0) { if ($goods_id > 0) { $where .= " AND"; } $where .= " user_id = '$user_id'"; } if ($where > '') { $where = ' WHERE' . $where; } $sql = 'SELECT tag_id, user_id, tag_words, COUNT(tag_id) AS tag_count' . ' FROM ' . $GLOBALS['ecs']->table('tag') . "$where GROUP BY tag_words"; $arr = $GLOBALS['db']->getAll($sql); return $arr; } /** * 获取指定主题某个模板的主题的动态模块 * * @access public * @param string $theme 模板主题 * @param string $tmp 模板名称 * * @return array() */ function get_dyna_libs($theme, $tmp) { $ext = end(explode('.', $tmp)); $tmp = basename($tmp,".$ext"); $sql = 'SELECT region, library, sort_order, id, number, type' . ' FROM ' . $GLOBALS['ecs']->table('template') . " WHERE theme = '$theme' AND filename = '" . $tmp . "' AND type > 0 AND remarks=''". ' ORDER BY region, library, sort_order'; $res = $GLOBALS['db']->getAll($sql); $dyna_libs = array(); foreach ($res AS $row) { $dyna_libs[$row['region']][$row['library']][] = array( 'id' => $row['id'], 'number' => $row['number'], 'type' => $row['type'] ); } return $dyna_libs; } /** * 替换动态模块 * * @access public * @param string $matches 匹配内容 * * @return string 结果 */ function dyna_libs_replace($matches) { $key = '/' . $matches[1]; if ($row = array_shift($GLOBALS['libs'][$key])) { $str = ''; switch($row['type']) { case 1: // 分类的商品 $str = '{assign var="cat_goods" value=$cat_goods_' .$row['id']. '}{assign var="goods_cat" value=$goods_cat_' .$row['id']. '}'; break; case 2: // 品牌的商品 $str = '{assign var="brand_goods" value=$brand_goods_' .$row['id']. '}{assign var="goods_brand" value=$goods_brand_' .$row['id']. '}'; break; case 3: // 文章列表 $str = '{assign var="articles" value=$articles_' .$row['id']. '}{assign var="articles_cat" value=$articles_cat_' .$row['id']. '}'; break; case 4: //广告位 $str = '{assign var="ads_id" value=' . $row['id'] . '}{assign var="ads_num" value=' . $row['number'] . '}'; break; } return $str . $matches[0]; } else { return $matches[0]; } } /** * 处理上传文件,并返回上传图片名(上传失败时返回图片名为空) * * @access public * @param array $upload $_FILES 数组 * @param array $type 图片所属类别,即data目录下的文件夹名 * * @return string 上传图片名 */ function upload_file($upload, $type) { if (!empty($upload['tmp_name'])) { $ftype = check_file_type($upload['tmp_name'], $upload['name'], '|png|jpg|jpeg|gif|doc|xls|txt|zip|ppt|pdf|rar|'); if (!empty($ftype)) { $name = date('Ymd'); for ($i = 0; $i < 6; $i++) { $name .= chr(mt_rand(97, 122)); } $name = $_SESSION['user_id'] . '_' . $name . '.' . $ftype; $target = ROOT_PATH . DATA_DIR . '/' . $type . '/' . $name; if (!move_upload_file($upload['tmp_name'], $target)) { $GLOBALS['err']->add($GLOBALS['_LANG']['upload_file_error'], 1); return false; } else { return $name; } } else { $GLOBALS['err']->add($GLOBALS['_LANG']['upload_file_type'], 1); return false; } } else { $GLOBALS['err']->add($GLOBALS['_LANG']['upload_file_error']); return false; } } /** * 显示一个提示信息 * * @access public * @param string $content * @param string $link * @param string $href * @param string $type 信息类型:warning, error, info * @param string $auto_redirect 是否自动跳转 * @return void */ function show_message($content, $links = '', $hrefs = '', $type = 'info', $auto_redirect = true) { assign_template(); $msg['content'] = $content; if (is_array($links) && is_array($hrefs)) { if (!empty($links) && count($links) == count($hrefs)) { foreach($links as $key =>$val) { $msg['url_info'][$val] = $hrefs[$key]; } $msg['back_url'] = $hrefs['0']; } } else { $link = empty($links) ? $GLOBALS['_LANG']['back_up_page'] : $links; $href = empty($hrefs) ? 'javascript:history.back()' : $hrefs; $msg['url_info'][$link] = $href; $msg['back_url'] = $href; } $msg['type'] = $type; $position = assign_ur_here(0, $GLOBALS['_LANG']['sys_msg']); $GLOBALS['smarty']->assign('page_title', $position['title']); // 页面标题 $GLOBALS['smarty']->assign('ur_here', $position['ur_here']); // 当前位置 if (is_null($GLOBALS['smarty']->get_template_vars('helps'))) { $GLOBALS['smarty']->assign('helps', get_shop_help()); // 网店帮助 } $GLOBALS['smarty']->assign('auto_redirect', $auto_redirect); $GLOBALS['smarty']->assign('message', $msg); $GLOBALS['smarty']->display('message.dwt'); exit; } /** * 将一个形如+10, 10, -10, 10%的字串转换为相应数字,并返回操作符号 * * @access public * @param string str 要格式化的数据 * @param char operate 操作符号,只能返回‘+’或‘*’; * @return float value 浮点数 */ function parse_rate_value($str, &$operate) { $operate = '+'; $is_rate = false; $str = trim($str); if (empty($str)) { return 0; } if ($str[strlen($str) - 1] == '%') { $value = floatval($str); if ($value > 0) { $operate = '*'; return $value / 100; } else { return 0; } } else { return floatval($str); } } /** * 重新计算购物车中的商品价格:目的是当用户登录时享受会员价格,当用户退出登录时不享受会员价格 * 如果商品有促销,价格不变 * * @access public * @return void */ function recalculate_price() { /* 取得有可能改变价格的商品:除配件和赠品之外的商品 */ $sql = 'SELECT c.rec_id, c.goods_id, c.goods_attr_id, g.promote_price, g.promote_start_date, c.goods_number,'. "g.promote_end_date, IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS member_price ". 'FROM ' . $GLOBALS['ecs']->table('cart') . ' AS c '. 'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = c.goods_id '. "LEFT JOIN " . $GLOBALS['ecs']->table('member_price') . " AS mp ". "ON mp.goods_id = g.goods_id AND mp.user_rank = '" . $_SESSION['user_rank'] . "' ". "WHERE session_id = '" .SESS_ID. "' AND c.parent_id = 0 AND c.is_gift = 0 AND c.goods_id > 0 " . "AND c.rec_type = '" . CART_GENERAL_GOODS . "' AND c.extension_code <> 'package_buy'"; $res = $GLOBALS['db']->getAll($sql); foreach ($res AS $row) { $attr_id = empty($row['goods_attr_id']) ? array() : explode(',', $row['goods_attr_id']); $goods_price = get_final_price($row['goods_id'], $row['goods_number'], true, $attr_id); $goods_sql = "UPDATE " .$GLOBALS['ecs']->table('cart'). " SET goods_price = '$goods_price' ". "WHERE goods_id = '" . $row['goods_id'] . "' AND session_id = '" . SESS_ID . "' AND rec_id = '" . $row['rec_id'] . "'"; $GLOBALS['db']->query($goods_sql); } /* 删除赠品,重新选择 */ $GLOBALS['db']->query('DELETE FROM ' . $GLOBALS['ecs']->table('cart') . " WHERE session_id = '" . SESS_ID . "' AND is_gift > 0"); } /** * 查询评论内容 * * @access public * @params integer $id * @params integer $type * @params integer $page * @return array */ function assign_comment($id, $type, $page = 1) { /* 取得评论列表 */ $count = $GLOBALS['db']->getOne('SELECT COUNT(*) FROM ' .$GLOBALS['ecs']->table('comment'). " WHERE id_value = '$id' AND comment_type = '$type' AND status = 1 AND parent_id = 0"); $size = !empty($GLOBALS['_CFG']['comments_number']) ? $GLOBALS['_CFG']['comments_number'] : 5; $page_count = ($count > 0) ? intval(ceil($count / $size)) : 1; $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('comment') . " WHERE id_value = '$id' AND comment_type = '$type' AND status = 1 AND parent_id = 0". ' ORDER BY comment_id DESC'; $res = $GLOBALS['db']->selectLimit($sql, $size, ($page-1) * $size); $arr = array(); $ids = ''; while ($row = $GLOBALS['db']->fetchRow($res)) { $ids .= $ids ? ",$row[comment_id]" : $row['comment_id']; $arr[$row['comment_id']]['id'] = $row['comment_id']; $arr[$row['comment_id']]['email'] = $row['email']; $arr[$row['comment_id']]['username'] = $row['user_name']; $arr[$row['comment_id']]['content'] = str_replace('\r\n', '<br />', htmlspecialchars($row['content'])); $arr[$row['comment_id']]['content'] = nl2br(str_replace('\n', '<br />', $arr[$row['comment_id']]['content'])); $arr[$row['comment_id']]['rank'] = $row['comment_rank']; $arr[$row['comment_id']]['add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']); } /* 取得已有回复的评论 */ if ($ids) { $sql = 'SELECT * FROM ' . $GLOBALS['ecs']->table('comment') . " WHERE parent_id IN( $ids )"; $res = $GLOBALS['db']->query($sql); while ($row = $GLOBALS['db']->fetch_array($res)) { $arr[$row['parent_id']]['re_content'] = nl2br(str_replace('\n', '<br />', htmlspecialchars($row['content']))); $arr[$row['parent_id']]['re_add_time'] = local_date($GLOBALS['_CFG']['time_format'], $row['add_time']); $arr[$row['parent_id']]['re_email'] = $row['email']; $arr[$row['parent_id']]['re_username'] = $row['user_name']; } } /* 分页样式 */ //$pager['styleid'] = isset($GLOBALS['_CFG']['page_style'])? intval($GLOBALS['_CFG']['page_style']) : 0; $pager['page'] = $page; $pager['size'] = $size; $pager['record_count'] = $count; $pager['page_count'] = $page_count; $pager['page_first'] = "javascript:gotoPage(1,$id,$type)"; $pager['page_prev'] = $page > 1 ? "javascript:gotoPage(" .($page-1). ",$id,$type)" : 'javascript:;'; $pager['page_next'] = $page < $page_count ? 'javascript:gotoPage(' .($page + 1) . ",$id,$type)" : 'javascript:;'; $pager['page_last'] = $page < $page_count ? 'javascript:gotoPage(' .$page_count. ",$id,$type)" : 'javascript:;'; $cmt = array('comments' => $arr, 'pager' => $pager); return $cmt; } function assign_template($ctype = '', $catlist = array()) { global $smarty; $smarty->assign('image_width', $GLOBALS['_CFG']['image_width']); $smarty->assign('image_height', $GLOBALS['_CFG']['image_height']); $smarty->assign('points_name', $GLOBALS['_CFG']['integral_name']); $smarty->assign('qq', explode(',', $GLOBALS['_CFG']['qq'])); $smarty->assign('ww', explode(',', $GLOBALS['_CFG']['ww'])); $smarty->assign('ym', explode(',', $GLOBALS['_CFG']['ym'])); $smarty->assign('msn', explode(',', $GLOBALS['_CFG']['msn'])); $smarty->assign('skype', explode(',', $GLOBALS['_CFG']['skype'])); $smarty->assign('stats_code', $GLOBALS['_CFG']['stats_code']); $smarty->assign('copyright', sprintf($GLOBALS['_LANG']['copyright'], date('Y'), $GLOBALS['_CFG']['shop_name'])); $smarty->assign('shop_name', $GLOBALS['_CFG']['shop_name']); $smarty->assign('service_email', $GLOBALS['_CFG']['service_email']); $smarty->assign('service_phone', $GLOBALS['_CFG']['service_phone']); $smarty->assign('shop_address', $GLOBALS['_CFG']['shop_address']); $smarty->assign('licensed', license_info()); $smarty->assign('ecs_version', VERSION); $smarty->assign('icp_number', $GLOBALS['_CFG']['icp_number']); $smarty->assign('username', !empty($_SESSION['user_name']) ? $_SESSION['user_name'] : ''); $smarty->assign('category_list', cat_list(0, 0, true, 2, false)); $smarty->assign('catalog_list', cat_list(0, 0, false, 1, false)); $smarty->assign('navigator_list', get_navigator($ctype, $catlist)); //自定义导航栏 if (!empty($GLOBALS['_CFG']['search_keywords'])) { $searchkeywords = explode(',', trim($GLOBALS['_CFG']['search_keywords'])); } else { $searchkeywords = array(); } $smarty->assign('searchkeywords', $searchkeywords); } /** * 将一个本地时间戳转成GMT时间戳 * * @access public * @param int $time * * @return int $gmt_time; */ function time2gmt($time) { return strtotime(gmdate('Y-m-d H:i:s', $time)); } /** * 查询会员的红包金额 * * @access public * @param integer $user_id * @return void */ function get_user_bonus($user_id = 0) { if ($user_id == 0) { $user_id = $_SESSION['user_id']; } $sql = "SELECT SUM(bt.type_money) AS bonus_value, COUNT(*) AS bonus_count ". "FROM " .$GLOBALS['ecs']->table('user_bonus'). " AS ub, ". $GLOBALS['ecs']->table('bonus_type') . " AS bt ". "WHERE ub.user_id = '$user_id' AND ub.bonus_type_id = bt.type_id AND ub.order_id = 0"; $row = $GLOBALS['db']->getRow($sql); return $row; } /** * 保存推荐uid * * @access public * @param void * * @return void * @author xuanyan **/ function set_affiliate() { $config = unserialize($GLOBALS['_CFG']['affiliate']); if (!empty($_GET['u']) && $config['on'] == 1) { if(!empty($config['config']['expire'])) { if($config['config']['expire_unit'] == 'hour') { $c = 1; } elseif($config['config']['expire_unit'] == 'day') { $c = 24; } elseif($config['config']['expire_unit'] == 'week') { $c = 24 * 7; } else { $c = 1; } setcookie('ecshop_affiliate_uid', intval($_GET['u']), gmtime() + 3600 * $config['config']['expire'] * $c); } else { setcookie('ecshop_affiliate_uid', intval($_GET['u']), gmtime() + 3600 * 24); // 过期时间为 1 天 } } } /** * 获取推荐uid * * @access public * @param void * * @return int * @author xuanyan **/ function get_affiliate() { if (!empty($_COOKIE['ecshop_affiliate_uid'])) { $uid = intval($_COOKIE['ecshop_affiliate_uid']); if ($GLOBALS['db']->getOne('SELECT user_id FROM ' . $GLOBALS['ecs']->table('users') . "WHERE user_id = '$uid'")) { return $uid; } else { setcookie('ecshop_affiliate_uid', '', 1); } } return 0; } /** * 获得指定分类同级的所有分类以及该分类下的子分类 * * @access public * @param integer $cat_id 分类编号 * @return array */ function article_categories_tree($cat_id = 0) { if ($cat_id > 0) { $sql = 'SELECT parent_id FROM ' . $GLOBALS['ecs']->table('article_cat') . " WHERE cat_id = '$cat_id'"; $parent_id = $GLOBALS['db']->getOne($sql); } else { $parent_id = 0; } /* 判断当前分类中全是是否是底级分类, 如果是取出底级分类上级分类, 如果不是取当前分类及其下的子分类 */ $sql = 'SELECT count(*) FROM ' . $GLOBALS['ecs']->table('article_cat') . " WHERE parent_id = '$parent_id'"; if ($GLOBALS['db']->getOne($sql)) { /* 获取当前分类及其子分类 */ $sql = 'SELECT a.cat_id, a.cat_name, a.sort_order AS parent_order, a.cat_id, ' . 'b.cat_id AS child_id, b.cat_name AS child_name, b.sort_order AS child_order ' . 'FROM ' . $GLOBALS['ecs']->table('article_cat') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS b ON b.parent_id = a.cat_id ' . "WHERE a.parent_id = '$parent_id' AND a.cat_type=1 ORDER BY parent_order ASC, a.cat_id ASC, child_order ASC"; } else { /* 获取当前分类及其父分类 */ $sql = 'SELECT a.cat_id, a.cat_name, b.cat_id AS child_id, b.cat_name AS child_name, b.sort_order ' . 'FROM ' . $GLOBALS['ecs']->table('article_cat') . ' AS a ' . 'LEFT JOIN ' . $GLOBALS['ecs']->table('article_cat') . ' AS b ON b.parent_id = a.cat_id ' . "WHERE b.parent_id = '$parent_id' AND b.cat_type = 1 ORDER BY sort_order ASC"; } $res = $GLOBALS['db']->getAll($sql); $cat_arr = array(); foreach ($res AS $row) { $cat_arr[$row['cat_id']]['id'] = $row['cat_id']; $cat_arr[$row['cat_id']]['name'] = $row['cat_name']; $cat_arr[$row['cat_id']]['url'] = build_uri('article_cat', array('acid' => $row['cat_id']), $row['cat_name']); if ($row['child_id'] != NULL) { $cat_arr[$row['cat_id']]['children'][$row['child_id']]['id'] = $row['child_id']; $cat_arr[$row['cat_id']]['children'][$row['child_id']]['name'] = $row['child_name']; $cat_arr[$row['cat_id']]['children'][$row['child_id']]['url'] = build_uri('article_cat', array('acid' => $row['child_id']), $row['child_name']); } } return $cat_arr; } /** * 获得指定文章分类的所有上级分类 * * @access public * @param integer $cat 分类编号 * @return array */ function get_article_parent_cats($cat) { if ($cat == 0) { return array(); } $arr = $GLOBALS['db']->GetAll('SELECT cat_id, cat_name, parent_id FROM ' . $GLOBALS['ecs']->table('article_cat')); if (empty($arr)) { return array(); } $index = 0; $cats = array(); while (1) { foreach ($arr AS $row) { if ($cat == $row['cat_id']) { $cat = $row['parent_id']; $cats[$index]['cat_id'] = $row['cat_id']; $cats[$index]['cat_name'] = $row['cat_name']; $index++; break; } } if ($index == 0 || $cat == 0) { break; } } return $cats; } /** * 取得某模板某库设置的数量 * @param string $template 模板名,如index * @param string $library 库名,如recommend_best * @param int $def_num 默认数量:如果没有设置模板,显示的数量 * @return int 数量 */ function get_library_number($library, $template = null) { global $page_libs; if (empty($template)) { $template = basename(PHP_SELF); $template = substr($template, 0, strrpos($template, '.')); } $template = addslashes($template); static $lib_list = array(); /* 如果没有该模板的信息,取得该模板的信息 */ if (!isset($lib_list[$template])) { $lib_list[$template] = array(); $sql = "SELECT library, number FROM " . $GLOBALS['ecs']->table('template') . " WHERE theme = '" . $GLOBALS['_CFG']['template'] . "'" . " AND filename = '$template' AND remarks='' "; $res = $GLOBALS['db']->query($sql); while ($row = $GLOBALS['db']->fetchRow($res)) { $lib = basename(strtolower(substr($row['library'], 0, strpos($row['library'], '.')))); $lib_list[$template][$lib] = $row['number']; } } $num = 0; if (isset($lib_list[$template][$library])) { $num = intval($lib_list[$template][$library]); } else { /* 模板设置文件查找默认值 */ include_once(ROOT_PATH . ADMIN_PATH . '/includes/lib_template.php'); static $static_page_libs = null; if ($static_page_libs == null) { $static_page_libs = $page_libs; } $lib = '/library/' . $library . '.lbi'; $num = isset($static_page_libs[$template][$lib]) ? $static_page_libs[$template][$lib] : 3; } return $num; } /** * 取得自定义导航栏列表 * @param string $type 位置,如top、bottom、middle * @return array 列表 */ function get_navigator($ctype = '', $catlist = array()) { $sql = 'SELECT * FROM '. $GLOBALS['ecs']->table('nav') . ' WHERE ifshow = \'1\' ORDER BY type, vieworder'; $res = $GLOBALS['db']->query($sql); $cur_url = substr(strrchr($_SERVER['REQUEST_URI'],'/'),1); if (intval($GLOBALS['_CFG']['rewrite'])) { if(strpos($cur_url, '-')) { preg_match('/([a-z]*)-([0-9]*)/',$cur_url,$matches); $cur_url = $matches[1].'.php?id='.$matches[2]; } } else { $cur_url = substr(strrchr($_SERVER['REQUEST_URI'],'/'),1); } $noindex = false; $active = 0; $navlist = array( 'top' => array(), 'middle' => array(), 'bottom' => array() ); while ($row = $GLOBALS['db']->fetchRow($res)) { $navlist[$row['type']][] = array( 'name' => $row['name'], 'opennew' => $row['opennew'], 'url' => $row['url'], 'ctype' => $row['ctype'], 'cid' => $row['cid'], ); } /*遍历自定义是否存在currentPage*/ foreach($navlist['middle'] as $k=>$v) { $condition = empty($ctype) ? (strpos($cur_url, $v['url']) === 0) : (strpos($cur_url, $v['url']) === 0 && strlen($cur_url) == strlen($v['url'])); if ($condition) { $navlist['middle'][$k]['active'] = 1; $noindex = true; $active += 1; } } if(!empty($ctype) && $active < 1) { foreach($catlist as $key => $val) { foreach($navlist['middle'] as $k=>$v) { if(!empty($v['ctype']) && $v['ctype'] == $ctype && $v['cid'] == $val && $active < 1) { $navlist['middle'][$k]['active'] = 1; $noindex = true; $active += 1; } } } } if ($noindex == false) { $navlist['config']['index'] = 1; } return $navlist; } /** * 授权信息内容 * * @return str */ function license_info() { if($GLOBALS['_CFG']['licensed'] > 0) { /* 获取HOST */ if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) { $host = $_SERVER['HTTP_X_FORWARDED_HOST']; } elseif (isset($_SERVER['HTTP_HOST'])) { $host = $_SERVER['HTTP_HOST']; } //$license = '<a href="http://license.comsenz.com/?pid=4&host='. $host .'">Licensed</a>'; $host = 'http://' . $host . '/'; $license = '<a href="http://service.shopex.cn/auth.php?product=ecshop&url=' . urlencode($host) . '">Licensed</a>'; return $license; } else { return ''; } } ?>
zzshop
trunk/includes/lib_main.php
PHP
asf20
66,297
<?php /** * ECSHOP 常量 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: inc_constant.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } /* 图片处理相关常数 */ define('ERR_INVALID_IMAGE', 1); define('ERR_NO_GD', 2); define('ERR_IMAGE_NOT_EXISTS', 3); define('ERR_DIRECTORY_READONLY', 4); define('ERR_UPLOAD_FAILURE', 5); define('ERR_INVALID_PARAM', 6); define('ERR_INVALID_IMAGE_TYPE', 7); /* 插件相关常数 */ define('ERR_COPYFILE_FAILED', 1); define('ERR_CREATETABLE_FAILED', 2); define('ERR_DELETEFILE_FAILED', 3); /* 商品属性类型常数 */ define('ATTR_TEXT', 0); define('ATTR_OPTIONAL', 1); define('ATTR_TEXTAREA', 2); define('ATTR_URL', 3); /* 会员整合相关常数 */ define('ERR_USERNAME_EXISTS', 1); // 用户名已经存在 define('ERR_EMAIL_EXISTS', 2); // Email已经存在 define('ERR_INVALID_USERID', 3); // 无效的user_id define('ERR_INVALID_USERNAME', 4); // 无效的用户名 define('ERR_INVALID_PASSWORD', 5); // 密码错误 define('ERR_INVALID_EMAIL', 6); // email错误 define('ERR_USERNAME_NOT_ALLOW', 7); // 用户名不允许注册 define('ERR_EMAIL_NOT_ALLOW', 8); // EMAIL不允许注册 /* 加入购物车失败的错误代码 */ define('ERR_NOT_EXISTS', 1); // 商品不存在 define('ERR_OUT_OF_STOCK', 2); // 商品缺货 define('ERR_NOT_ON_SALE', 3); // 商品已下架 define('ERR_CANNT_ALONE_SALE', 4); // 商品不能单独销售 define('ERR_NO_BASIC_GOODS', 5); // 没有基本件 define('ERR_NEED_SELECT_ATTR', 6); // 需要用户选择属性 /* 购物车商品类型 */ define('CART_GENERAL_GOODS', 0); // 普通商品 define('CART_GROUP_BUY_GOODS', 1); // 团购商品 define('CART_AUCTION_GOODS', 2); // 拍卖商品 define('CART_SNATCH_GOODS', 3); // 夺宝奇兵 define('CART_EXCHANGE_GOODS', 4); // 积分商城 /* 订单状态 */ define('OS_UNCONFIRMED', 0); // 未确认 define('OS_CONFIRMED', 1); // 已确认 define('OS_CANCELED', 2); // 已取消 define('OS_INVALID', 3); // 无效 define('OS_RETURNED', 4); // 退货 define('OS_SPLITED', 5); // 已分单 define('OS_SPLITING_PART', 6); // 部分分单 /* 支付类型 */ define('PAY_ORDER', 0); // 订单支付 define('PAY_SURPLUS', 1); // 会员预付款 /* 配送状态 */ define('SS_UNSHIPPED', 0); // 未发货 define('SS_SHIPPED', 1); // 已发货 define('SS_RECEIVED', 2); // 已收货 define('SS_PREPARING', 3); // 备货中 define('SS_SHIPPED_PART', 4); // 已发货(部分商品) define('SS_SHIPPED_ING', 5); // 发货中(处理分单) /* 支付状态 */ define('PS_UNPAYED', 0); // 未付款 define('PS_PAYING', 1); // 付款中 define('PS_PAYED', 2); // 已付款 /* 综合状态 */ define('CS_AWAIT_PAY', 100); // 待付款:货到付款且已发货且未付款,非货到付款且未付款 define('CS_AWAIT_SHIP', 101); // 待发货:货到付款且未发货,非货到付款且已付款且未发货 define('CS_FINISHED', 102); // 已完成:已确认、已付款、已发货 /* 缺货处理 */ define('OOS_WAIT', 0); // 等待货物备齐后再发 define('OOS_CANCEL', 1); // 取消订单 define('OOS_CONSULT', 2); // 与店主协商 /* 帐户明细类型 */ define('SURPLUS_SAVE', 0); // 为帐户冲值 define('SURPLUS_RETURN', 1); // 从帐户提款 /* 评论状态 */ define('COMMENT_UNCHECKED', 0); // 未审核 define('COMMENT_CHECKED', 1); // 已审核或已回复(允许显示) define('COMMENT_REPLYED', 2); // 该评论的内容属于回复 /* 红包发放的方式 */ define('SEND_BY_USER', 0); // 按用户发放 define('SEND_BY_GOODS', 1); // 按商品发放 define('SEND_BY_ORDER', 2); // 按订单发放 define('SEND_BY_PRINT', 3); // 线下发放 /* 广告的类型 */ define('IMG_AD', 0); // 图片广告 define('FALSH_AD', 1); // flash广告 define('CODE_AD', 2); // 代码广告 define('TEXT_AD', 3); // 文字广告 /* 是否需要用户选择属性 */ define('ATTR_NOT_NEED_SELECT', 0); // 不需要选择 define('ATTR_NEED_SELECT', 1); // 需要选择 /* 用户中心留言类型 */ define('M_MESSAGE', 0); // 留言 define('M_COMPLAINT', 1); // 投诉 define('M_ENQUIRY', 2); // 询问 define('M_CUSTOME', 3); // 售后 define('M_BUY', 4); // 求购 define('M_BUSINESS', 5); // 商家 define('M_COMMENT', 6); // 评论 /* 团购活动状态 */ define('GBS_PRE_START', 0); // 未开始 define('GBS_UNDER_WAY', 1); // 进行中 define('GBS_FINISHED', 2); // 已结束 define('GBS_SUCCEED', 3); // 团购成功(可以发货了) define('GBS_FAIL', 4); // 团购失败 /* 红包是否发送邮件 */ define('BONUS_NOT_MAIL', 0); define('BONUS_MAIL_SUCCEED', 1); define('BONUS_MAIL_FAIL', 2); /* 商品活动类型 */ define('GAT_SNATCH', 0); define('GAT_GROUP_BUY', 1); define('GAT_AUCTION', 2); define('GAT_POINT_BUY', 3); define('GAT_PACKAGE', 4); // 超值礼包 /* 帐号变动类型 */ define('ACT_SAVING', 0); // 帐户冲值 define('ACT_DRAWING', 1); // 帐户提款 define('ACT_ADJUSTING', 2); // 调节帐户 define('ACT_OTHER', 99); // 其他类型 /* 密码加密方法 */ define('PWD_MD5', 1); //md5加密方式 define('PWD_PRE_SALT', 2); //前置验证串的加密方式 define('PWD_SUF_SALT', 3); //后置验证串的加密方式 /* 文章分类类型 */ define('COMMON_CAT', 1); //普通分类 define('SYSTEM_CAT', 2); //系统默认分类 define('INFO_CAT', 3); //网店信息分类 define('UPHELP_CAT', 4); //网店帮助分类分类 define('HELP_CAT', 5); //网店帮助分类 /* 活动状态 */ define('PRE_START', 0); // 未开始 define('UNDER_WAY', 1); // 进行中 define('FINISHED', 2); // 已结束 define('SETTLED', 3); // 已处理 /* 验证码 */ define('CAPTCHA_REGISTER', 1); //注册时使用验证码 define('CAPTCHA_LOGIN', 2); //登录时使用验证码 define('CAPTCHA_COMMENT', 4); //评论时使用验证码 define('CAPTCHA_ADMIN', 8); //后台登录时使用验证码 define('CAPTCHA_LOGIN_FAIL', 16); //登录失败后显示验证码 define('CAPTCHA_MESSAGE', 32); //留言时使用验证码 /* 优惠活动的优惠范围 */ define('FAR_ALL', 0); // 全部商品 define('FAR_CATEGORY', 1); // 按分类选择 define('FAR_BRAND', 2); // 按品牌选择 define('FAR_GOODS', 3); // 按商品选择 /* 优惠活动的优惠方式 */ define('FAT_GOODS', 0); // 送赠品或优惠购买 define('FAT_PRICE', 1); // 现金减免 define('FAT_DISCOUNT', 2); // 价格打折优惠 /* 评论条件 */ define('COMMENT_LOGIN', 1); //只有登录用户可以评论 define('COMMENT_CUSTOM', 2); //只有有过一次以上购买行为的用户可以评论 define('COMMENT_BOUGHT', 3); //只有购买够该商品的人可以评论 /* 减库存时机 */ define('SDT_SHIP', 0); // 发货时 define('SDT_PLACE', 1); // 下订单时 /* 加密方式 */ define('ENCRYPT_ZC', 1); //zc加密方式 define('ENCRYPT_UC', 2); //uc加密方式 /* 商品类别 */ define('G_REAL', 1); //实体商品 define('G_CARD', 0); //虚拟卡 /* 积分兑换 */ define('TO_P', 0); //兑换到商城消费积分 define('FROM_P', 1); //用商城消费积分兑换 define('TO_R', 2); //兑换到商城等级积分 define('FROM_R', 3); //用商城等级积分兑换 /* 支付宝商家账户 */ define('ALIPAY_AUTH', 'gh0bis45h89m5mwcoe85us4qrwispes0'); define('ALIPAY_ID', '2088002052150939'); /* 添加feed事件到UC的TYPE*/ define('BUY_GOODS', 1); //购买商品 define('COMMENT_GOODS', 2); //添加商品评论 /* 邮件发送用户 */ define('SEND_LIST', 0); define('SEND_USER', 1); define('SEND_RANK', 2); /* license接口 */ define('LICENSE_VERSION', '1.0'); /* 配送方式 */ define('SHIP_LIST', 'cac|city_express|ems|flat|fpd|post_express|post_mail|presswork|sf_express|sto_express|yto|zto'); ?>
zzshop
trunk/includes/inc_constant.php
PHP
asf20
10,149
<?php /** * ECSHOP 定期删除 * =========================================================== * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ========================================================== * $Author: sxc_shop $ * $Id: ipdel.php 17135 2010-04-27 04:58:23Z sxc_shop $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $cron_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/cron/ipdel.php'; if (file_exists($cron_lang)) { global $_LANG; include_once($cron_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'ipdel_desc'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.ecshop.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'ipdel_day', 'type' => 'select', 'value' => '30'), ); return; } empty($cron['ipdel_day']) && $cron['ipdel_day'] = 7; $deltime = gmtime() - $cron['ipdel_day'] * 3600 * 24; $sql = "DELETE FROM " . $ecs->table('stats') . "WHERE access_time < '$deltime'"; $db->query($sql); ?>
zzshop
trunk/includes/modules/cron/ipdel.php
PHP
asf20
1,767
<?php /** * ECSHOP 程序说明 * =========================================================== * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ========================================================== * $Author: sxc_shop $ * $Id: auto_manage.php 17135 2010-04-27 04:58:23Z sxc_shop $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $cron_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/cron/auto_manage.php'; if (file_exists($cron_lang)) { global $_LANG; include_once($cron_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'auto_manage_desc'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.ecshop.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'auto_manage_count', 'type' => 'select', 'value' => '5'), ); return; } $time = gmtime(); $limit = !empty($cron['auto_manage_count']) ? $cron['auto_manage_count'] : 5; $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('auto_manage') . " WHERE starttime > '0' AND starttime <= '$time' OR endtime > '0' AND endtime <= '$time' LIMIT $limit"; $autodb = $db->getAll($sql); foreach ($autodb as $key => $val) { $del = $up = false; if ($val['type'] == 'goods') { $goods = true; $where = " WHERE goods_id = '$val[item_id]'"; } else { $goods = false; $where = " WHERE article_id = '$val[item_id]'"; } //上下架判断 if(!empty($val['starttime']) && !empty($val['endtime'])) { //上下架时间均设置 if($val['starttime'] <= $time && $time < $val['endtime']) { //上架时间 <= 当前时间 < 下架时间 $up = true; $del = false; } elseif($val['starttime'] >= $time && $time > $val['endtime']) { //下架时间 <= 当前时间 < 上架时间 $up = false; $del = false; } elseif($val['starttime'] == $time && $time == $val['endtime']) { //下架时间 == 当前时间 == 上架时间 $sql = "DELETE FROM " . $GLOBALS['ecs']->table('auto_manage') . "WHERE item_id = '$val[item_id]' AND type = '$val[type]'"; $db->query($sql); continue; } elseif($val['starttime'] > $val['endtime']) { // 下架时间 < 上架时间 < 当前时间 $up = true; $del = true; } elseif($val['starttime'] < $val['endtime']) { // 上架时间 < 下架时间 < 当前时间 $up = false; $del = true; } else { // 上架时间 = 下架时间 < 当前时间 $sql = "DELETE FROM " . $GLOBALS['ecs']->table('auto_manage') . "WHERE item_id = '$val[item_id]' AND type = '$val[type]'"; $db->query($sql); continue; } } elseif(!empty($val['starttime'])) { //只设置了上架时间 $up = true; $del = true; } else { //只设置了下架时间 $up = false; $del = true; } if ($goods) { if ($up) { $sql = "UPDATE " . $GLOBALS['ecs']->table('goods') . " SET is_on_sale = 1 $where"; } else { $sql = "UPDATE " . $GLOBALS['ecs']->table('goods') . " SET is_on_sale = 0 $where"; } } else { if ($up) { $sql = "UPDATE " . $GLOBALS['ecs']->table('article') . " SET is_open = 1 $where"; } else { $sql = "UPDATE " . $GLOBALS['ecs']->table('article') . " SET is_open = 0 $where"; } } $db->query($sql); if ($del) { $sql = "DELETE FROM " . $GLOBALS['ecs']->table('auto_manage') . "WHERE item_id = '$val[item_id]' AND type = '$val[type]'"; $db->query($sql); } else { if($up) { $sql = "UPDATE " . $GLOBALS['ecs']->table('auto_manage') . " SET starttime = 0 WHERE item_id = '$val[item_id]' AND type = '$val[type]'"; } else { $sql = "UPDATE " . $GLOBALS['ecs']->table('auto_manage') . " SET endtime = 0 WHERE item_id = '$val[item_id]' AND type = '$val[type]'"; } $db->query($sql); } } ?>
zzshop
trunk/includes/modules/cron/auto_manage.php
PHP
asf20
5,173
<?php /** * shopex4.8转换程序插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: shopex48.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'shopex48_desc'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP R&D TEAM'; return; } /* 类 */ class shopex48 { /* 数据库连接 ADOConnection 对象 */ var $sdb; /* 表前缀 */ var $sprefix; /* 原系统根目录 */ var $sroot; /* 新系统根目录 */ var $troot; /* 新系统网站根目录 */ var $tdocroot; /* 原系统字符集 */ var $scharset; /* 新系统字符集 */ var $tcharset; /* 构造函数 */ function shopex48(&$sdb, $sprefix, $sroot, $scharset = 'UTF8') { $this->sdb = $sdb; $this->sprefix = $sprefix; $this->sroot = $sroot; $this->troot = str_replace('/includes/modules/convert', '', str_replace('\\', '/', dirname(__FILE__))); $this->tdocroot = str_replace('/' . ADMIN_PATH, '', dirname(PHP_SELF)); $this->scharset = $scharset; if (EC_CHARSET == 'utf-8') { $tcharset = 'UTF8'; } elseif (EC_CHARSET == 'gbk') { $tcharset = 'GB2312'; } $this->tcharset = $tcharset; } /** * 需要转换的表(用于检查数据库是否完整) * @return array */ function required_tables() { return array( $this->sprefix.'goods', ); } /** * 必需的目录 * @return array */ function required_dirs() { return array( '/images/goods/', '/images/brand/', '/images/link/', ); } /** * 下一步操作:空表示结束 * @param string $step 当前操作:空表示开始 * @return string */ function next_step($step) { /* 所有操作 */ $steps = array( '' => 'step_file', 'step_file' => 'step_cat', 'step_cat' => 'step_brand', 'step_brand' => 'step_goods', 'step_goods' => 'step_users', 'step_users' => 'step_article', 'step_article' => 'step_order', 'step_order' => 'step_config', 'step_config' => '', ); return $steps[$step]; } /** * 执行某个步骤 * @param string $step */ function process($step) { $func = str_replace('step', 'process', $step); return $this->$func(); } /** * 复制文件 * @return 成功返回true,失败返回错误信息 */ function process_file() { /* 复制品牌图片 */ $from = $this->sroot . '/images/brand/'; $to = $this->troot . '/data/brandlogo/'; copy_dirs($from, $to); /* 复制商品图片 */ $to = $this->troot . '/images/goods/'; $from = $this->sroot . '/images/goods/'; copy_dirs($from, $to); /* 复制友情链接图片 */ $from = $this->sroot . '/images/link/'; $to = $this->troot . '/data/afficheimg/'; copy_dirs($from, $to); return TRUE; } /** * 商品分类 * @return 成功返回true,失败返回错误信息 */ function process_cat() { global $db, $ecs; /* 清空分类、商品类型、属性 */ truncate_table('category'); truncate_table('goods_type'); //truncate_table('attribute'); /* 查询分类并循环处理 */ $sql = "SELECT * FROM ".$this->sprefix."goods_cat"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $cat = array(); $cat['cat_id'] = $row['cat_id']; $cat['cat_name'] = $row['cat_name']; $cat['parent_id'] = $row['parent_id']; $cat['sort_order'] = $row['p_order']; /* 插入分类 */ if (!$db->autoExecute($ecs->table('category'), $cat, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 查询商品类型并循环处理 */ $sql = "SELECT * FROM ".$this->sprefix."goods_type"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $type = array(); $type['cat_id'] = $row['prop_cat_id']; $type['cat_name'] = $row['name']; $type['enabled'] = '1'; if (!$db->autoExecute($ecs->table('goods_type'), $type, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 查询属性值并循环处理 */ /* 返回成功 */ return true; } /** * 品牌 * @return 成功返回true,失败返回错误信息 */ function process_brand() { global $db, $ecs; /* 清空品牌 */ truncate_table('brand'); /* 查询品牌并插入 */ $sql = "SELECT * FROM ".$this->sprefix."brand"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $brand_logo = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['brand_logo'])); $logoarr = explode('|',$brand_logo); if(strpos($logoarr[0],'http') === 0){ $brand_url = $logoarr[0]; }else{ $logourl = explode('/',$logoarr[0],3); $brand_url = $logourl[2]; } $brand = array( 'brand_name' => $row['brand_name'], 'brand_desc' => '', 'site_url' => ecs_iconv($this->scharset, $this->tcharset, addslashes($row['brand_url'])), 'brand_logo' => $brand_url ); if (!$db->autoExecute($ecs->table('brand'), $brand, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回成功 */ return TRUE; } /** * 商品 * @return 成功返回true,失败返回错误信息 */ function process_goods() { global $db, $ecs; /* 清空商品、商品扩展分类、商品属性、商品相册、关联商品、组合商品、赠品 */ truncate_table('goods'); truncate_table('goods_cat'); truncate_table('goods_attr'); truncate_table('goods_gallery'); truncate_table('link_goods'); truncate_table('group_goods'); /* 查询品牌列表 name => id */ $brand_list = array(); $sql = "SELECT brand_id, brand_name FROM " . $ecs->table('brand'); $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $brand_list[$row['brand_name']] = $row['brand_id']; } /* 取得商店设置 */ /* 取得商品分类对应的商品类型 */ $cat_type_list = array(); $sql = "SELECT cat_id, supplier_cat_id FROM ".$this->sprefix."goods_cat"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $cat_type_list[$row['cat_id']] = $row['supplier_cat_id']; } /* 查询商品并处理 */ $sql = "SELECT * FROM ".$this->sprefix."goods"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $goods = array(); $goods['goods_id'] = $row['goods_id']; $goods['cat_id'] = $row['cat_id']; $goods['goods_sn'] = $row['bn']; $goods['goods_name'] = $row['name']; $goods['brand_id'] = trim($row['brand']) == '' ? '0' : $brand_list[ecs_iconv($this->scharset, $this->tcharset, addslashes($row['brand']))]; $goods['goods_number'] = $row['store']; $goods['goods_weight'] = $row['weight']; $goods['market_price'] = $row['mktprice']; $goods['shop_price'] = $row['price']; $goods['promote_price'] = $row['name']; $goods['goods_brief'] = $row['brief']; $goods['goods_desc'] = $row['intro']; //$goods['is_on_sale'] = $row['shop_iffb']; //$goods['is_alone_sale'] = $row['onsale']; $goods['add_time'] = $row['uptime']; //$goods['sort_order'] = $row['offer_ord']; //$goods['is_delete'] = '0'; //$goods['is_best'] = $row['recommand2']; //$goods['is_new'] = $row['new2']; //$goods['is_hot'] = $row['hot2']; //$goods['is_promote'] = $row['tejia2']; //$goods['goods_type'] = isset($cat_type_list[$row['cat_id']]) ? $cat_type_list[$row['cat_id']] : 0; $big_pic = $row['big_pic']; $big_pic_arr = explode('|',$big_pic); $small_pic = $row['small_pic']; $small_pic_arr = explode('|',$small_pic); $goods['goods_img'] = $small_pic_arr[0]; $goods['goods_thumb'] = $small_pic_arr[0]; $goods['original_img'] = $small_pic_arr[0]; $goods['last_update'] = gmtime(); /* 插入 */ if (!$db->autoExecute($ecs->table('goods'), $goods, 'INSERT', '', 'SILENT')) { //return $db->error(); } /* 商品相册 */ $sql2 = "SELECT * FROM ".$this->sprefix."gimages"; $result = $this->sdb->query($sql2); while ($row2 = $this->sdb->fetchRow($result)) { $goods_gallery = array(); $goods_gallery['goods_id'] = $row2['goods_id']; $big_pic = $row2['big']; $big_pic_arr = explode('|',$big_pic); $goods_gallery['img_original'] = $big_pic_arr[0]; $small_pic = $row2['small']; $small_pic_arr = explode('|',$small_pic); $goods_gallery['thumb_url'] = $small_pic_arr[0]; $goods_gallery['img_url'] = $goods_gallery['thumb_url']; //$goods['original_img'] = $big_pic; if (!$db->autoExecute($ecs->table('goods_gallery'), $goods_gallery, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } /* 返回成功 */ return TRUE; } /** * 会员等级、会员、会员价格 */ function process_users() { global $db, $ecs; /* 清空会员、会员等级、会员价格、用户红包、用户地址、帐户明细 */ truncate_table('user_rank'); truncate_table('users'); truncate_table('user_address'); truncate_table('user_bonus'); truncate_table('member_price'); truncate_table('user_account'); /* 查询并插入会员等级 */ $sql = "SELECT * FROM ".$this->sprefix."member_lv order by point desc"; $res = $this->sdb->query($sql); $max_points = 50000; while ($row = $this->sdb->fetchRow($res)) { $user_rank = array(); $user_rank['rank_id'] = $row['member']; $user_rank['rank_name'] = $row['name']; $user_rank['min_points'] = $row['point']; $user_rank['max_points'] = $max_points; $user_rank['discount'] = round($row['dis_count'] * 100); $user_rank['show_price'] = '1'; $user_rank['special_rank'] = '0'; if (!$db->autoExecute($ecs->table('user_rank'), $user_rank, 'INSERT', '', 'SILENT')) { //return $db->error(); } $max_points = $row['point'] - 1; } /* 查询并插入会员 */ $sql = "SELECT * FROM ".$this->sprefix."members"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $user = array(); $user['user_id'] = $row['member_id']; $user['email'] = $row['email']; $user['user_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['uname'])); $user['password'] = $row['password']; $user['question'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['pw_question'])); $user['answer'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['pw_answer'])); $user['sex'] = $row['sex']; if (!empty($row['birthday'])) { $birthday = strtotime($row['birthday']); if ($birthday != -1 && $birthday !== false) { $user['birthday'] = date('Y-m-d', $birthday); } } $user['user_money'] = $row['advance']; $user['pay_points'] = $row['point']; $user['rank_points'] = $row['point']; $user['reg_time'] = $row['regtime']; $user['last_login'] = $row['regtime']; $user['last_ip'] = $row['reg_ip']; $user['visit_count'] = '1'; $user['user_rank'] = '0'; if (!$db->autoExecute($ecs->table('users'), $user, 'INSERT', '', 'SILENT')) { //return $db->error(); } //uc_call('uc_user_register', array($user['user_name'], $user['password'], $user['email'])); } /* 收货人地址 */ $sql = "SELECT * FROM ".$this->sprefix."member_addrs"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $address = array(); $address['address_id'] = $row['addr_id']; $address['address_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name'])); $address['user_id'] = $row['member_id']; $address['consignee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name'])); //$address['email'] = $row['email']; $address['address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['addr'])); $address['zipcode'] = $row['zip']; $address['tel'] = $row['tel']; $address['mobile'] = $row['mobile']; $address['country'] = $row['country']; $address['province'] = $row['province']; $address['city'] = $row['city']; if (!$db->autoExecute($ecs->table('user_address'), $address, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 会员价格 */ $temp_arr = array(); $sql = "SELECT * FROM ".$this->sprefix."goods_lv_price"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { if ($row['goods_id'] > 0 && $row['level_id'] > 0 && !isset($temp_arr[$row['goods_id']][$row['level_id']])) { $temp_arr[$row['goods_id']][$row['level_id']] = true; $member_price = array(); $member_price['goods_id'] = $row['goods_id']; $member_price['user_rank'] = $row['level_id']; $member_price['user_price'] = $row['price']; if (!$db->autoExecute($ecs->table('member_price'), $member_price, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } unset($temp_arr); /* 帐户明细 */ $sql = "SELECT * FROM ".$this->sprefix."advance_logs"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $user_account = array(); $user_account['user_id'] = $row['member_id']; $user_account['admin_user'] = $row['memo']; $user_account['amount'] = $row['money']; $user_account['add_time'] = $row['mtime']; $user_account['paid_time'] = $row['mtime']; $user_account['admin_note'] = $row['message']; $user_account['payment'] = $row['paymethod']; $user_account['process_type'] = $row['money'] >= 0 ? SURPLUS_SAVE : SURPLUS_RETURN; $user_account['is_paid'] = '1'; if (!$db->autoExecute($ecs->table('user_account'), $user_account, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回 */ return TRUE; } /** * 文章 */ function process_article() { global $db, $ecs; /* 清空文章类型、文章、友情链接 */ //truncate_table('article_cat'); //truncate_table('article'); truncate_table('friend_link'); /* 文章 */ $sql = "SELECT * FROM ".$this->sprefix."articles"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $article = array(); $article['article_id'] = $row['article_id']; $article['cat_id'] = $row['node_id']; $article['title'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['title'])); $article['content'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['content'])); $article['content'] = str_replace('pictures/newsimg/', 'images/upload/Image/', $article['content']); $article['article_type']= '0'; $article['is_open'] = $row['ifpub']; $article['add_time'] = $row['uptime']; if (!$db->autoExecute($ecs->table('article'), $article, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 友情链接 */ $sql = "SELECT * FROM ".$this->sprefix."link"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $link = array(); $link['link_id'] = $row['link_id']; $link['link_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['link_name'])); $link['link_url'] = $row['href']; $link['show_order'] = '0'; $link_logo = $row['image_url']; $logoarr = explode('|',$link_logo); $logourl = explode('/',$logoarr[0],3); $link['link_logo'] = 'data/afficheimg/'.$logourl[2]; if (!$db->autoExecute($ecs->table('friend_link'), $link, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回 */ return TRUE; } /** * 订单 */ function process_order() { global $db, $ecs; /* 清空订单、订单商品 */ truncate_table('order_info'); truncate_table('order_goods'); truncate_table('order_action'); /* 订单 */ $sql = "SELECT o.* FROM ".$this->sprefix."orders AS o " ; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $order = array(); $order['order_sn'] = $row['order_id']; $order['user_id'] = $row['member_id']; $order['add_time'] = $row['createtime']; $order['consignee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['consignee'])); $order['address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['ship_addr'])); $order['zipcode'] = $row['ship_zip']; $order['tel'] = $row['ship_tel']; $order['mobile'] = $row['ship_mobile']; $order['email'] = $row['ship_email']; $order['postscript'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo'])); $order['shipping_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['ship_name'])); $order['pay_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['shipping'])); $order['inv_payee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['tax_company'])); $order['goods_amount'] = $row['total_amount']; $order['shipping_fee'] = $row['cost_freight']; $order['order_amount'] = $row['final_amount']; $order['pay_time'] = $row['paytime']; $order['shipping_time'] = $row['acttime']; /* 状态 */ if ($row['ordstate'] == '0') { $order['order_status'] = OS_UNCONFIRMED; $order['shipping_status'] = SS_UNSHIPPED; } elseif ($row['ordstate'] == '1') { $order['order_status'] = OS_CONFIRMED; $order['shipping_status'] = SS_UNSHIPPED; } elseif ($row['ordstate'] == '9') { $order['order_status'] = OS_INVALID; $order['shipping_status'] = SS_UNSHIPPED; } else // 3 发货 4 归档 { $order['order_status'] = OS_CONFIRMED; $order['shipping_status'] = SS_SHIPPED; } if ($row['pay_status'] == '1') { $order['pay_status'] = PS_PAYED; } else // 0 未付款 5 退款 { $order['pay_status'] = PS_UNPAYED; } if ($row['userrecsts'] == '1') // 用户操作了 { if ($row['recsts'] == '1') // 到货 { if ($order['shipping_status'] == SS_SHIPPED) { $order['shipping_status'] = SS_RECEIVED; } } elseif ($row['recsts'] == '2') // 取消 { $order['order_status'] = OS_CANCELED; $order['pay_status'] = PS_UNPAYED; $order['shipping_status'] = SS_UNSHIPPED; } } if (!$db->autoExecute($ecs->table('order_info'), $order, 'INSERT', '', 'SILENT')) { //return $db->error(); } /* 订单商品 */ } /* 返回 */ return TRUE; } /** * 商店设置 */ function process_config() { global $ecs, $db; /* 查询设置 */ $sql = "SELECT * FROM ".$this->sprefix."settings"; $row = $this->sdb->getRow($sql); $store = $row['store']; $store_arr = unserialize($store); $config = array(); //$config['shop_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($store_arr[0]); //$config['shop_title'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($store_arr[0])); //$config['shop_desc'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($store_arr[1])); //$config['shop_address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['store'])); $config['shop_address'] = $row['store']; //$config['service_email'] = $row['offer_email']; $config['service_phone'] = $store_arr[2]; //$config['icp_number'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_certtext'])); //$config['integral_scale'] = $row['offer_pointtype'] == '0' ? '0' : $row['offer_pointnum'] * 100; //$config['thumb_width'] = $row['offer_smallsize_w']; //$config['thumb_height'] = $row['offer_smallsize_h']; //$config['image_width'] = $row['offer_bigsize_w']; //$config['image_height'] = $row['offer_bigsize_h']; //$config['promote_number'] = $row['offer_tejianums']; //$config['best_number'] = $row['offer_tjnums']; //$config['new_number'] = $row['offer_newgoodsnums']; //$config['hot_number'] = $row['offer_hotnums']; //$config['smtp_host'] = $row['offer_smtp_server']; //$config['smtp_port'] = $row['offer_smtp_port']; //$config['smtp_user'] = $row['offer_smtp_user']; //$config['smtp_pass'] = $row['offer_smtp_password']; //$config['smtp_mail'] = $row['offer_smtp_email']; /* 更新 */ foreach ($config as $code => $value) { $sql = "UPDATE " . $ecs->table('shop_config') . " SET " . "value = '$value' " . "WHERE code = '$code' LIMIT 1"; if (!$db->query($sql, 'SILENT')) { //return $db->error(); } } /* 返回 */ return TRUE; } } ?>
zzshop
trunk/includes/modules/convert/shopex48.php
PHP
asf20
26,915
<?php /** * shopex4.6转换程序插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: shopex46.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'shopex46_desc'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP R&D TEAM'; return; } /** * 类 */ class shopex46 { /** * 数据库连接 ADOConnection 对象 */ var $sdb; /** * 表前缀 */ var $sprefix; /** * 原系统根目录 */ var $sroot; /** * 新系统根目录 */ var $troot; /** * 新系统网站根目录 */ var $tdocroot; /** * 原系统字符集 */ var $scharset; /** * 新系统字符集 */ var $tcharset; /** * 构造函数 */ function shopex46(&$sdb, $sprefix, $sroot, $scharset = 'UTF8') { $this->sdb = $sdb; $this->sprefix = $sprefix; $this->sroot = $sroot; $this->troot = str_replace('/includes/modules/convert', '', str_replace('\\', '/', dirname(__FILE__))); $this->tdocroot = str_replace('/' . ADMIN_PATH, '', dirname(PHP_SELF)); $this->scharset = $scharset; if (EC_CHARSET == 'utf-8') { $tcharset = 'UTF8'; } elseif (EC_CHARSET == 'gbk') { $tcharset = 'GB2312'; } $this->tcharset = $tcharset; } /** * 需要转换的表(用于检查数据库是否完整) * @return array */ function required_tables() { return array( $this->sprefix.'mall_offer_pcat',$this->sprefix.'mall_goods',$this->sprefix.'mall_offer_linkgoods',$this->sprefix.'mall_member_level', $this->sprefix.'mall_member',$this->sprefix.'mall_offer_p',$this->sprefix.'mall_offer_deliverarea',$this->sprefix.'mall_offer_t', $this->sprefix.'mall_offer_ncat',$this->sprefix.'mall_offer_ncon',$this->sprefix.'mall_offer_link',$this->sprefix.'mall_orders', $this->sprefix.'mall_items',$this->sprefix.'mall_offer', ); } /** * 比需的目录 * @return array */ function required_dirs() { return array( '/syssite/home/shop/1/pictures/newsimg/', '/syssite/home/shop/1/pictures/productsimg/big/', '/syssite/home/shop/1/pictures/productsimg/small/', '/syssite/home/shop/1/pictures/linkimg/', '/cert/', ); } /** * 下一步操作:空表示结束 * @param string $step 当前操作:空表示开始 * @return string */ function next_step($step) { /* 所有操作 */ $steps = array( '' => 'step_file', 'step_file' => 'step_cat', 'step_cat' => 'step_brand', 'step_brand' => 'step_goods', 'step_goods' => 'step_users', 'step_users' => 'step_article', 'step_article' => 'step_order', 'step_order' => 'step_config', 'step_config' => '', ); return $steps[$step]; } /** * 执行某个步骤 * @param string $step */ function process($step) { $func = str_replace('step', 'process', $step); return $this->$func(); } /** * 复制文件 * @return 成功返回true,失败返回错误信息 */ function process_file() { /* 复制 html 编辑器的图片 */ $from = $this->sroot . '/syssite/home/shop/1/pictures/newsimg/'; $to = $this->troot . '/images/upload/'; copy_files($from, $to); /* 复制商品图片 */ $to = $this->troot . '/images/' . date('Ym') . '/'; $from = $this->sroot . '/syssite/home/shop/1/pictures/productsimg/big/'; copy_files($from, $to, 'big_'); $from = $this->sroot . '/syssite/home/shop/1/pictures/productsimg/small/'; copy_files($from, $to, 'small_'); $from = $this->sroot . '/syssite/home/shop/1/pictures/productsimg/big/'; copy_files($from, $to, 'original_'); /* 复制友情链接图片 */ $from = $this->sroot . '/syssite/home/shop/1/pictures/linkimg/'; $to = $this->troot . '/data/afficheimg/'; /* 复制证书 */ $from = $this->sroot . '/cert/'; $to = $this->troot . '/cert/'; return TRUE; } /** * 商品分类 * @return 成功返回true,失败返回错误信息 */ function process_cat() { global $db, $ecs; /* 清空分类、商品类型、属性 */ truncate_table('category'); truncate_table('goods_type'); truncate_table('attribute'); /* 查询分类并循环处理 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer_pcat"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $cat = array(); $cat['cat_id'] = $row['catid']; $cat['cat_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['cat'])); $cat['parent_id'] = $row['pid']; $cat['sort_order'] = $row['catord']; /* 插入分类 */ if (!$db->autoExecute($ecs->table('category'), $cat, 'INSERT', '', 'SILENT')) { //return $db->error(); } /* 检查该分类是否有属性 */ $has_attr = false; for ($i = 1; $i <= 40; $i++) { if (trim($row["attr".$i]) != '') { $has_attr = TRUE; break; } } /* 如果该分类有属性,插入商品类型,类型名称取分类名称 */ if ($has_attr) { if (!$db->autoExecute($ecs->table('goods_type'), $cat, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 插入属性 */ $attr = array(); $attr['cat_id'] = $row['catid']; $attr['attr_input_type'] = ATTR_INPUT; $attr['attr_type'] = ATTR_NOT_NEED_SELECT; for ($i = 1; $i <= 40; $i++) { if (trim($row["attr".$i]) != '') { $attr['attr_name'] = ecs_iconv($this->scharset, $this->tcharset, $row["attr".$i]); $attr['sort_order'] = $i; if (!$db->autoExecute($ecs->table('attribute'), $attr, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } } /* 返回成功 */ return TRUE; } /** * 品牌 * @return 成功返回true,失败返回错误信息 */ function process_brand() { global $db, $ecs; /* 清空品牌 */ truncate_table('brand'); /* 查询品牌并插入 */ $sql = "SELECT DISTINCT brand FROM ".$this->sprefix."mall_goods WHERE TRIM(brand) <> ''"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $brand = array( 'brand_name' => ecs_iconv($this->scharset, $this->tcharset, addslashes($row['brand'])), 'brand_desc' => '', ); if (!$db->autoExecute($ecs->table('brand'), $brand, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回成功 */ return TRUE; } /** * 商品 * @return 成功返回true,失败返回错误信息 */ function process_goods() { global $db, $ecs; /* 清空商品、商品扩展分类、商品属性、商品相册、关联商品、组合商品、赠品 */ truncate_table('goods'); truncate_table('goods_cat'); truncate_table('goods_attr'); truncate_table('goods_gallery'); truncate_table('link_goods'); truncate_table('group_goods'); /* 查询品牌列表 name => id */ $brand_list = array(); $sql = "SELECT brand_id, brand_name FROM " . $ecs->table('brand'); $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $brand_list[$row['brand_name']] = $row['brand_id']; } /* 取得商店设置 */ $sql = "SELECT offer_pointtype, offer_pointnum FROM ".$this->sprefix."mall_offer WHERE offerid = '1'"; $config = $this->sdb->getRow($sql); /* 查询商品并处理 */ $sql = "SELECT * FROM ".$this->sprefix."mall_goods"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $goods = array(); $goods['goods_id'] = $row['gid']; $goods['cat_id'] = $row['catid']; $goods['goods_sn'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['bn'])); $goods['goods_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['goods'])); $goods['brand_id'] = trim($row['brand']) == '' ? '0' : $brand_list[ecs_iconv($this->scharset, $this->tcharset, addslashes($row['brand']))]; $goods['goods_number'] = $row['storage']; $goods['goods_weight'] = $row['weight']; $goods['market_price'] = $row['priceintro']; $goods['shop_price'] = $row['ifdiscreteness'] == '1' ? $row['basicprice'] : $row['price']; if ($row['tejia2'] == '1') { $goods['promote_price'] = $goods['shop_price']; $goods['promote_start_date'] = gmtime(); $goods['promote_end_date'] = local_strtotime('+1 weeks'); } $goods['warn_number'] = $row['ifalarm'] == '1' ? $row['alarmnum'] : '0'; $goods['goods_brief'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['intro'])); $goods['goods_desc'] = str_replace('pictures/newsimg/', $this->tdocroot . '/images/upload/', ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo']))); $goods['is_real'] = '1'; $goods['is_on_sale'] = $row['shop_iffb']; $goods['is_alone_sale'] = '1'; $goods['add_time'] = $row['uptime']; $goods['sort_order'] = $row['offer_ord']; $goods['is_delete'] = '0'; $goods['is_best'] = $row['recommand2']; $goods['is_new'] = $row['new2']; $goods['is_hot'] = $row['hot2']; $goods['is_promote'] = $row['tejia2']; $goods['goods_type'] = $row['catid']; $goods['last_update'] = gmtime(); /* 图片:如果没有本地文件,取远程图片 */ $file = $this->troot . '/images/' . date('Ym') . '/small_' . $row['gid']; if (file_exists($file. '.jpg')) { $goods['goods_thumb'] = 'images/' . date('Ym') . '/small_' . $row['gid'] . '.jpg'; } elseif (file_exists($file. '.jpeg')) { $goods['goods_thumb'] = 'images/' . date('Ym') . '/small_' . $row['gid'] . '.jpeg'; } elseif (file_exists($file. '.gif')) { $goods['goods_thumb'] = 'images/' . date('Ym') . '/small_' . $row['gid'] . '.gif'; } elseif (file_exists($file. '.png')) { $goods['goods_thumb'] = 'images/' . date('Ym') . '/small_' . $row['gid'] . '.png'; } else { $goods['goods_thumb'] = $row['smallimgremote']; } $file = $this->troot . '/images/' . date('Ym') . '/big_' . $row['gid']; if (file_exists($file. '.jpg')) { $goods['goods_img'] = 'images/' . date('Ym') . '/big_' . $row['gid'] . '.jpg'; $goods['original_img'] = 'images/' . date('Ym') . '/original_' . $row['gid'] . '.jpg'; } elseif (file_exists($file. '.jpeg')) { $goods['goods_img'] = 'images/' . date('Ym') . '/big_' . $row['gid'] . '.jpeg'; $goods['original_img'] = 'images/' . date('Ym') . '/original_' . $row['gid'] . '.jpeg'; } elseif (file_exists($file. '.gif')) { $goods['goods_img'] = 'images/' . date('Ym') . '/big_' . $row['gid'] . '.gif'; $goods['original_img'] = 'images/' . date('Ym') . '/original_' . $row['gid'] . '.gif'; } elseif (file_exists($file. '.png')) { $goods['goods_img'] = 'images/' . date('Ym') . '/big_' . $row['gid'] . '.png'; $goods['orinigal_img'] = 'images/' . date('Ym') . '/original_' . $row['gid'] . '.png'; } else { $goods['goods_img'] = $row['bigimgremote']; } /* 积分:根据商店设置 */ if ($config['offer_pointtype'] == '0') { /* 不使用积分 */ $goods['integral'] = '0'; } elseif ($config['offer_pointtype'] == '1') { /* 按比例 */ $goods['integral'] = round($goods['shop_price'] * $config['offer_pointnum']); } else { /* 自定义 */ $goods['integral'] = $row['point']; } /* 插入 */ if (!$db->autoExecute($ecs->table('goods'), $goods, 'INSERT', '', 'SILENT')) { //return $db->error(); } /* 扩展分类 */ if ($row['linkclass'] != '') { $goods_cat = array(); $goods_cat['goods_id'] = $row['gid']; $cat_id_list = explode(',', trim($row['linkclass'], ',')); foreach ($cat_id_list as $cat_id) { $goods_cat['cat_id'] = $cat_id; if (!$db->autoExecute($ecs->table('goods_cat'), $goods_cat, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } /* 取得该分类的所有属性 */ $attr_list = array(); $sql = "SELECT * FROM " . $ecs->table('attribute') . " WHERE cat_id = '$row[catid]'"; $res1 = $db->query($sql); while ($attr = $db->fetchRow($res1)) { $attr_list[$attr['sort_order']] = $attr['attr_id']; } /* 商品属性 */ if ($attr_list) { $goods_attr = array(); $goods_attr['goods_id'] = $row['gid']; for ($i = 1; $i <= 40; $i++) { if (trim($row['attr' . $i]) != '') { $goods_attr['attr_id'] = $attr_list[$i]; $goods_attr['attr_value'] = trim(ecs_iconv($this->scharset, $this->tcharset, $row['attr' . $i])); if (!$db->autoExecute($ecs->table('goods_attr'), $goods_attr, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } } /* 商品相册 */ if ($row['multi_image']) { $goods_gallery = array(); $goods_gallery['goods_id'] = $row['gid']; $img_list = explode('&&&', $row['multi_image']); foreach ($img_list as $img) { if (substr($img, 0, 7) == 'http://') { $goods_gallery['img_url'] = $img; } else { make_dir('images/' . date('Ym') . '/'); $goods_gallery['img_url'] = 'images/' . date('Ym') . '/big_' . $img; $goods_gallery['img_original'] = 'images/' . date('Ym') . '/original_' . $img; } if (!$db->autoExecute($ecs->table('goods_gallery'), $goods_gallery, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } } /* 关联商品 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer_linkgoods"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $link_goods = array(); $link_goods['goods_id'] = $row['pgid']; $link_goods['link_goods_id'] = $row['sgid']; $link_goods['is_double'] = $row['type']; if (!$db->autoExecute($ecs->table('link_goods'), $link_goods, 'INSERT', '', 'SILENT')) { //return $db->error(); } if ($row['type'] == '1') { $link_goods = array(); $link_goods['goods_id'] = $row['sgid']; $link_goods['link_goods_id'] = $row['pgid']; $link_goods['is_double'] = $row['type']; if (!$db->autoExecute($ecs->table('link_goods'), $link_goods, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } /* 组合商品 */ /* 返回成功 */ return TRUE; } /** * 会员等级、会员、会员价格 */ function process_users() { global $db, $ecs; /* 清空会员、会员等级、会员价格、用户红包、用户地址 */ truncate_table('user_rank'); truncate_table('users'); truncate_table('user_address'); truncate_table('user_bonus'); truncate_table('member_price'); truncate_table('user_account'); /* 查询并插入会员等级 */ $sql = "SELECT * FROM ".$this->sprefix."mall_member_level order by point desc"; $res = $this->sdb->query($sql); $max_points = 50000; while ($row = $this->sdb->fetchRow($res)) { $user_rank = array(); $user_rank['rank_id'] = $row['levelid']; $user_rank['rank_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name'])); $user_rank['min_points'] = $row['point']; $user_rank['max_points'] = $max_points; $user_rank['discount'] = round($row['discount'] * 100); $user_rank['show_price'] = '1'; $user_rank['special_rank'] = '0'; if (!$db->autoExecute($ecs->table('user_rank'), $user_rank, 'INSERT', '', 'SILENT')) { //return $db->error(); } $max_points = $row['point'] - 1; } /* 查询并插入会员 */ $sql = "SELECT * FROM ".$this->sprefix."mall_member"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $user = array(); $user['user_id'] = $row['userid']; $user['email'] = $row['email']; $user['user_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['user'])); $user['password'] = $row['password']; $user['question'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['pw_question'])); $user['answer'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['pw_answer'])); $user['sex'] = $row['sex']; if (!empty($row['birthday'])) { $birthday = strtotime($row['birthday']); if ($birthday != -1 && $birthday !== false) { $user['birthday'] = date('Y-m-d', $birthday); } } $user['user_money'] = $row['advance']; $user['pay_points'] = $row['point']; $user['rank_points'] = $row['point']; $user['reg_time'] = $row['regtime']; $user['last_login'] = $row['regtime']; $user['last_ip'] = $row['ip']; $user['visit_count'] = '1'; $user['user_rank'] = '0'; if (!$db->autoExecute($ecs->table('users'), $user, 'INSERT', '', 'SILENT')) { //return $db->error(); } uc_call('uc_user_register', array($user['user_name'], $user['password'], $user['email'])); } /* 收货人地址 */ $sql = "SELECT * FROM ".$this->sprefix."mall_member_receiver"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $address = array(); $address['address_id'] = $row['receiveid']; $address['address_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name'])); $address['user_id'] = $row['memberid']; $address['consignee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name'])); $address['email'] = $row['email']; $address['address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['address'])); $address['zipcode'] = $row['zipcode']; $address['tel'] = $row['telphone']; $address['mobile'] = $row['mobile']; if (!$db->autoExecute($ecs->table('user_address'), $address, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 会员价格 */ $temp_arr = array(); $sql = "SELECT * FROM ".$this->sprefix."mall_member_price"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { if ($row['gid'] > 0 && $row['levelid'] > 0 && !isset($temp_arr[$row['gid']][$row['levelid']])) { $temp_arr[$row['gid']][$row['levelid']] = true; $member_price = array(); $member_price['goods_id'] = $row['gid']; $member_price['user_rank'] = $row['levelid']; $member_price['user_price'] = $row['price']; if (!$db->autoExecute($ecs->table('member_price'), $member_price, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } unset($temp_arr); /* 帐户明细 */ $sql = "SELECT * FROM ".$this->sprefix."mall_member_advance"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $user_account = array(); $user_account['user_id'] = $row['memberid']; $user_account['admin_user'] = $row['doman']; $user_account['amount'] = $row['money']; $user_account['add_time'] = $row['date']; $user_account['paid_time'] = $row['date']; $user_account['admin_note'] = $row['description']; $user_account['process_type'] = $row['money'] >= 0 ? SURPLUS_SAVE : SURPLUS_RETURN; $user_account['is_paid'] = '1'; if (!$db->autoExecute($ecs->table('user_account'), $user_account, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回 */ return TRUE; } /** * 文章 */ function process_article() { global $db, $ecs; /* 清空文章类型、文章、友情链接 */ truncate_table('article_cat'); truncate_table('article'); truncate_table('friend_link'); /* 文章类型 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer_ncat"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $cat = array(); $cat['cat_id'] = $row['catid']; $cat['cat_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['cat'])); $cat['cat_type'] = '1'; $cat['sort_order'] = $row['pid']; $cat['is_open'] = '1'; if (!$db->autoExecute($ecs->table('article_cat'), $cat, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 文章 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer_ncon"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $article = array(); $article['article_id'] = $row['newsid']; $article['cat_id'] = $row['catid']; $article['title'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['title'])); $article['content'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['con'])); $article['article_type']= '0'; $article['is_open'] = $row['ifpub']; $article['add_time'] = $row['uptime']; if (!$db->autoExecute($ecs->table('article'), $article, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 友情链接 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer_link"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $link = array(); $link['link_id'] = $row['linkid']; $link['link_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['linktitle'])); $link['link_url'] = $row['linkurl']; $link['show_order'] = '0'; if ($row['linktype'] == 'img') { $link['link_logo'] = $row['imgurl']; } if (!$db->autoExecute($ecs->table('friend_link'), $link, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回 */ return TRUE; } /** * 订单 */ function process_order() { global $db, $ecs; /* 清空订单、订单商品 */ truncate_table('order_info'); truncate_table('order_goods'); truncate_table('order_action'); /* 订单 */ $sql = "SELECT o.*, t.tmethod, p.payment FROM ".$this->sprefix."mall_orders AS o " . "LEFT JOIN ".$this->sprefix."mall_offer_t AS t ON o.ttype = t.id " . "LEFT JOIN ".$this->sprefix."mall_offer_p AS p ON o.ptype = p.id"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $order = array(); $order['order_sn'] = $row['orderid']; $order['user_id'] = $row['userid']; $order['add_time'] = $row['ordertime']; $order['consignee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name'])); $order['address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['addr'])); $order['zipcode'] = $row['zip']; $order['tel'] = $row['tel']; $order['mobile'] = $row['mobile']; $order['email'] = $row['email']; $order['postscript'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo'])); $order['shipping_name'] = is_null($row['tmethod']) ? ' ' : ecs_iconv($this->scharset, $this->tcharset, addslashes($row['tmethod'])); $order['pay_name'] = is_null($row['payment']) ? ' ' : ecs_iconv($this->scharset, $this->tcharset, addslashes($row['payment'])); $order['inv_payee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['invoiceform'])); $order['goods_amount'] = $row['item_amount']; $order['shipping_fee'] = $row['freight']; $order['order_amount'] = $row['total_amount']; $order['pay_time'] = $row['paytime']; $order['shipping_time'] = $row['sendtime']; /* 状态 */ if ($row['ordstate'] == '0') { $order['order_status'] = OS_UNCONFIRMED; $order['shipping_status'] = SS_UNSHIPPED; } elseif ($row['ordstate'] == '1') { $order['order_status'] = OS_CONFIRMED; $order['shipping_status'] = SS_UNSHIPPED; } elseif ($row['ordstate'] == '9') { $order['order_status'] = OS_INVALID; $order['shipping_status'] = SS_UNSHIPPED; } else // 3 发货 4 归档 { $order['order_status'] = OS_CONFIRMED; $order['shipping_status'] = SS_SHIPPED; } if ($row['ifsk'] == '1') { $order['pay_status'] = PS_PAYED; } else // 0 未付款 5 退款 { $order['pay_status'] = PS_UNPAYED; } if ($row['userrecsts'] == '1') // 用户操作了 { if ($row['recsts'] == '1') // 到货 { if ($order['shipping_status'] == SS_SHIPPED) { $order['shipping_status'] = SS_RECEIVED; } } elseif ($row['recsts'] == '2') // 取消 { $order['order_status'] = OS_CANCELED; $order['pay_status'] = PS_UNPAYED; $order['shipping_status'] = SS_UNSHIPPED; } } /* 如果已付款,修改已付款金额为订单总金额,修改订单总金额为0 */ if ($order['pay_status'] > PS_UNPAYED) { $order['money_paid'] = $order['order_amount']; $order['order_amount'] = 0; } if (!$db->autoExecute($ecs->table('order_info'), $order, 'INSERT', '', 'SILENT')) { //return $db->error(); } /* 订单商品 */ $order_id = $db->insert_id(); $sql = "SELECT i.*, g.priceintro FROM ".$this->sprefix."mall_items AS i " . "LEFT JOIN ".$this->sprefix."mall_goods AS g ON i.gid = g.gid " . "WHERE orderid = '$row[orderid]'"; $res1 = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res1)) { $goods = array(); $goods['order_id'] = $order_id; $goods['goods_id'] = $row['gid']; $goods['goods_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['goods'])); $goods['goods_sn'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['bn'])); $goods['goods_number'] = $row['nums']; $goods['goods_price'] = $row['price']; $goods['market_price'] = is_null($row['priceintro']) ? $row['goods_price'] : $row['priceintro']; $goods['is_real'] = 1; $goods['parent_id'] = 0; $goods['is_gift'] = 0; if (!$db->autoExecute($ecs->table('order_goods'), $goods, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } /* 返回 */ return TRUE; } /** * 商店设置 */ function process_config() { global $ecs, $db; /* 查询设置 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer " . "WHERE offerid = '1'"; $row = $this->sdb->getRow($sql); $config = array(); $config['shop_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_name'])); $config['shop_title'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_shoptitle'])); $config['shop_desc'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_metadesc'])); $config['shop_address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_addr'])); $config['service_email'] = $row['offer_email']; $config['service_phone'] = $row['offer_tel']; $config['icp_number'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_certtext'])); //$config['integral_scale'] = $row['offer_pointtype'] == '0' ? '0' : $row['offer_pointnum'] * 100; $config['thumb_width'] = $row['offer_smallsize_w']; $config['thumb_height'] = $row['offer_smallsize_h']; $config['image_width'] = $row['offer_bigsize_w']; $config['image_height'] = $row['offer_bigsize_h']; $config['promote_number'] = $row['offer_tejianums']; $config['best_number'] = $row['offer_tjnums']; $config['new_number'] = $row['offer_newgoodsnums']; $config['hot_number'] = $row['offer_hotnums']; $config['smtp_host'] = $row['offer_smtp_server']; $config['smtp_port'] = $row['offer_smtp_port']; $config['smtp_user'] = $row['offer_smtp_user']; $config['smtp_pass'] = $row['offer_smtp_password']; $config['smtp_mail'] = $row['offer_smtp_email']; /* 更新 */ foreach ($config as $code => $value) { $sql = "UPDATE " . $ecs->table('shop_config') . " SET " . "value = '$value' " . "WHERE code = '$code' LIMIT 1"; if (!$db->query($sql, 'SILENT')) { //return $db->error(); } } /* 返回 */ return TRUE; } } ?>
zzshop
trunk/includes/modules/convert/shopex46.php
PHP
asf20
36,373
<?php /** * shopex4.7转换程序插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: shopex47.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'shopex47_desc'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP R&D TEAM'; return; } /* 类 */ class shopex47 { /* 数据库连接 ADOConnection 对象 */ var $sdb; /* 表前缀 */ var $sprefix; /* 原系统根目录 */ var $sroot; /* 新系统根目录 */ var $troot; /* 新系统网站根目录 */ var $tdocroot; /* 原系统字符集 */ var $scharset; /* 新系统字符集 */ var $tcharset; /* 构造函数 */ function shopex47(&$sdb, $sprefix, $sroot, $scharset = 'UTF8') { $this->sdb = $sdb; $this->sprefix = $sprefix; $this->sroot = $sroot; $this->troot = str_replace('/includes/modules/convert', '', str_replace('\\', '/', dirname(__FILE__))); $this->tdocroot = str_replace('/' . ADMIN_PATH, '', dirname(PHP_SELF)); $this->scharset = $scharset; if (EC_CHARSET == 'utf-8') { $tcharset = 'UTF8'; } elseif (EC_CHARSET == 'gbk') { $tcharset = 'GB2312'; } $this->tcharset = $tcharset; } /** * 需要转换的表(用于检查数据库是否完整) * @return array */ function required_tables() { return array( $this->sprefix.'mall_offer_pcat',$this->sprefix.'mall_brand',$this->sprefix.'mall_goods',$this->sprefix.'mall_offer_linkgoods', $this->sprefix.'mall_member_level',$this->sprefix.'mall_member',$this->sprefix.'mall_offer_p',$this->sprefix.'mall_offer_deliverarea',$this->sprefix.'mall_offer_t',$this->sprefix.'mall_offer_ncat',$this->sprefix.'mall_offer_ncon',$this->sprefix.'mall_offer_link', $this->sprefix.'mall_orders',$this->sprefix.'mall_items',$this->sprefix.'mall_offer', ); } /** * 必需的目录 * @return array */ function required_dirs() { return array( '/syssite/home/shop/1/pictures/brandimg/', '/syssite/home/shop/1/pictures/newsimg/', '/syssite/home/shop/1/pictures/productsimg/big/', '/syssite/home/shop/1/pictures/productsimg/small/', '/syssite/home/shop/1/pictures/linkimg/', '/cert/', ); } /** * 下一步操作:空表示结束 * @param string $step 当前操作:空表示开始 * @return string */ function next_step($step) { /* 所有操作 */ $steps = array( '' => 'step_file', 'step_file' => 'step_cat', 'step_cat' => 'step_brand', 'step_brand' => 'step_goods', 'step_goods' => 'step_users', 'step_users' => 'step_article', 'step_article' => 'step_order', 'step_order' => 'step_config', 'step_config' => '', ); return $steps[$step]; } /** * 执行某个步骤 * @param string $step */ function process($step) { $func = str_replace('step', 'process', $step); return $this->$func(); } /** * 复制文件 * @return 成功返回true,失败返回错误信息 */ function process_file() { /* 复制品牌图片 */ $from = $this->sroot . '/syssite/home/shop/1/pictures/brandimg/'; $to = $this->troot . '/data/brandlogo/'; copy_files($from, $to); /* 复制 html 编辑器的图片 */ $from = $this->sroot . '/syssite/home/shop/1/pictures/newsimg/'; $to = $this->troot . '/images/upload/Image/'; copy_files($from, $to); /* 复制商品图片 */ $to = $this->troot . '/images/' . date('Ym') . '/'; $from = $this->sroot . '/syssite/home/shop/1/pictures/productsimg/big/'; copy_files($from, $to, 'big_'); $from = $this->sroot . '/syssite/home/shop/1/pictures/productsimg/small/'; copy_files($from, $to, 'small_'); $from = $this->sroot . '/syssite/home/shop/1/pictures/productsimg/big/'; copy_files($from, $to, 'original_'); /* 复制友情链接图片 */ $from = $this->sroot . '/syssite/home/shop/1/pictures/linkimg/'; $to = $this->troot . '/data/afficheimg/'; copy_files($from, $to); /* 复制证书 */ $from = $this->sroot . '/cert/'; $to = $this->troot . '/cert/'; copy_files($from, $to); return TRUE; } /** * 商品分类 * @return 成功返回true,失败返回错误信息 */ function process_cat() { global $db, $ecs; /* 清空分类、商品类型、属性 */ truncate_table('category'); truncate_table('goods_type'); truncate_table('attribute'); /* 查询分类并循环处理 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer_pcat"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $cat = array(); $cat['cat_id'] = $row['catid']; $cat['cat_name'] = $row['cat']; $cat['parent_id'] = $row['pid']; $cat['sort_order'] = $row['catord']; /* 插入分类 */ if (!$db->autoExecute($ecs->table('category'), $cat, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 查询商品类型并循环处理 */ $sql = "SELECT * FROM ".$this->sprefix."mall_prop_category"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $type = array(); $type['cat_id'] = $row['prop_cat_id']; $type['cat_name'] = $row['cat_name']; $type['enabled'] = '1'; if (!$db->autoExecute($ecs->table('goods_type'), $type, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 查询属性值并循环处理 */ $sql = "SELECT * FROM ".$this->sprefix."mall_prop WHERE prop_type = 'propvalue'"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $attr = array(); $attr['attr_id'] = $row['prop_id']; $attr['attr_name'] = $row['prop_name']; $attr['cat_id'] = $row['prop_cat_id']; $attr['sort_order'] = $row['ordnum']; $attr['attr_input_type'] = '1'; $attr['attr_type'] = '1'; $sql = "SELECT DISTINCT prop_value FROM ".$this->sprefix."mall_prop_value WHERE prop_id = '$row[prop_id]'"; $attr['attr_values']= join("\n", $this->sdb->getCol($sql)); if (!$db->autoExecute($ecs->table('attribute'), $attr, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回成功 */ return TRUE; } /** * 品牌 * @return 成功返回true,失败返回错误信息 */ function process_brand() { global $db, $ecs; /* 清空品牌 */ truncate_table('brand'); /* 查询品牌并插入 */ $sql = "SELECT * FROM ".$this->sprefix."mall_brand"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $brand = array( 'brand_name' => $row['brand_name'], 'brand_desc' => '', 'site_url' => ecs_iconv($this->scharset, $this->tcharset, addslashes($row['brand_site_url'])), 'brand_logo' => ecs_iconv($this->scharset, $this->tcharset, addslashes($row['brand_logo'])) ); if (!$db->autoExecute($ecs->table('brand'), $brand, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回成功 */ return TRUE; } /** * 商品 * @return 成功返回true,失败返回错误信息 */ function process_goods() { global $db, $ecs; /* 清空商品、商品扩展分类、商品属性、商品相册、关联商品、组合商品、赠品 */ truncate_table('goods'); truncate_table('goods_cat'); truncate_table('goods_attr'); truncate_table('goods_gallery'); truncate_table('link_goods'); truncate_table('group_goods'); /* 查询品牌列表 name => id */ $brand_list = array(); $sql = "SELECT brand_id, brand_name FROM " . $ecs->table('brand'); $res = $db->query($sql); while ($row = $db->fetchRow($res)) { $brand_list[$row['brand_name']] = $row['brand_id']; } /* 取得商店设置 */ $sql = "SELECT offer_pointtype, offer_pointnum FROM ".$this->sprefix."mall_offer WHERE offerid = '1'"; $config = $this->sdb->getRow($sql); /* 取得商品分类对应的商品类型 */ $cat_type_list = array(); $sql = "SELECT catid, prop_cat_id FROM ".$this->sprefix."mall_offer_pcat"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $cat_type_list[$row['catid']] = $row['prop_cat_id']; } /* 查询商品并处理 */ $sql = "SELECT * FROM ".$this->sprefix."mall_goods"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $goods = array(); if ($row['ifobject'] == '0') { /* 虚拟商品 */ $goods['is_real'] = '0'; } elseif ($row['ifobject'] == '1') { /* 实体商品 */ $goods['is_real'] = '1'; } elseif ($row['ifobject'] == '2') { /* 数字文件,暂时无法转换 */ continue; } elseif ($row['ifobject'] == '3') { /* 捆绑销售,暂时无法转换 */ continue; } else { /* 未知,无法转换 */ continue; } $goods['goods_id'] = $row['gid']; $goods['cat_id'] = $row['catid']; $goods['goods_sn'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['bn'])); $goods['goods_name'] = $row['goods']; $goods['brand_id'] = trim($row['brand']) == '' ? '0' : $brand_list[ecs_iconv($this->scharset, $this->tcharset, addslashes($row['brand']))]; $goods['goods_number'] = $row['storage']; $goods['goods_weight'] = $row['weight']; $goods['market_price'] = $row['priceintro']; $goods['shop_price'] = $row['ifdiscreteness'] == '1' ? $row['basicprice'] : $row['price']; if ($row['tejia2'] == '1') { $goods['promote_price'] = $goods['shop_price']; $goods['promote_start_date'] = gmtime(); $goods['promote_end_date'] = gmstr2time('+1 weeks'); } $goods['warn_number'] = $row['ifalarm'] == '1' ? $row['alarmnum'] : '0'; $goods['goods_brief'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['intro'])); $goods['goods_desc'] = str_replace('pictures/newsimg/', $this->tdocroot . '/images/upload/Image/', ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo']))); $goods['is_on_sale'] = $row['shop_iffb']; $goods['is_alone_sale'] = $row['onsale']; $goods['add_time'] = $row['uptime']; $goods['sort_order'] = $row['offer_ord']; $goods['is_delete'] = '0'; $goods['is_best'] = $row['recommand2']; $goods['is_new'] = $row['new2']; $goods['is_hot'] = $row['hot2']; $goods['is_promote'] = $row['tejia2']; $goods['goods_type'] = isset($cat_type_list[$row['catid']]) ? $cat_type_list[$row['catid']] : 0; $goods['last_update'] = gmtime(); /* 图片:如果没有本地文件,取远程图片 */ $file = $this->troot . '/images/' . date('Ym') . '/small_' . $row['gid']; if (file_exists($file. '.jpg')) { $goods['goods_thumb'] = 'images/' . date('Ym') . '/small_' . $row['gid'] . '.jpg'; } elseif (file_exists($file. '.jpeg')) { $goods['goods_thumb'] = 'images/' . date('Ym') . '/small_' . $row['gid'] . '.jpeg'; } elseif (file_exists($file. '.gif')) { $goods['goods_thumb'] = 'images/' . date('Ym') . '/small_' . $row['gid'] . '.gif'; } elseif (file_exists($file. '.png')) { $goods['goods_thumb'] = 'images/' . date('Ym') . '/small_' . $row['gid'] . '.png'; } else { $goods['goods_thumb'] = $row['smallimgremote']; } $file = $this->troot . '/images/' . date('Ym') . '/big_' . $row['gid']; if (file_exists($file. '.jpg')) { $goods['goods_img'] = 'images/' . date('Ym') . '/big_' . $row['gid'] . '.jpg'; $goods['original_img'] = 'images/' . date('Ym') . '/original_' . $row['gid'] . '.jpg'; } elseif (file_exists($file. '.jpeg')) { $goods['goods_img'] = 'images/' . date('Ym') . '/big_' . $row['gid'] . '.jpeg'; $goods['original_img'] = 'images/' . date('Ym') . '/original_' . $row['gid'] . '.jpeg'; } elseif (file_exists($file. '.gif')) { $goods['goods_img'] = 'images/' . date('Ym') . '/big_' . $row['gid'] . '.gif'; $goods['original_img'] = 'images/' . date('Ym') . '/original_' . $row['gid'] . '.gif'; } elseif (file_exists($file. '.png')) { $goods['goods_img'] = 'images/' . date('Ym') . '/big_' . $row['gid'] . '.png'; $goods['orinigal_img'] = 'images/' . date('Ym') . '/original_' . $row['gid'] . '.png'; } else { $goods['goods_img'] = $row['bigimgremote']; } /* 积分:根据商店设置 */ if ($config['offer_pointtype'] == '0') { /* 不使用积分 */ $goods['integral'] = '0'; } elseif ($config['offer_pointtype'] == '1') { /* 按比例 */ $goods['integral'] = round($goods['shop_price'] * $config['offer_pointnum']); } else { /* 自定义 */ $goods['integral'] = $row['point']; } /* 插入 */ if (!$db->autoExecute($ecs->table('goods'), $goods, 'INSERT', '', 'SILENT')) { //return $db->error(); } /* 扩展分类 */ if ($row['linkclass'] != '') { $goods_cat = array(); $goods_cat['goods_id'] = $row['gid']; $cat_id_list = explode(',', trim($row['linkclass'], ',')); foreach ($cat_id_list as $cat_id) { $goods_cat['cat_id'] = $cat_id; if (!$db->autoExecute($ecs->table('goods_cat'), $goods_cat, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } /* 取得该分类的所有属性 */ $sql = "SELECT DISTINCT pv.prop_id, pv.prop_value " . "FROM ".$this->sprefix."mall_goods_prop_grp_value AS gp, " . $this->sprefix."mall_prop_value AS pv " . "WHERE gp.prop_value_id = pv.prop_value_id " . "AND gp.gid = '$row[gid]'"; $res1 = $this->sdb->query($sql); while ($attr = $this->sdb->fetchRow($res1)) { $goods_attr = array(); $goods_attr['goods_id'] = $row['gid']; $goods_attr['attr_id'] = $attr['prop_id']; $goods_attr['attr_value'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($attr['prop_value'])); $goods_attr['attr_price'] = '0'; if (!$db->autoExecute($ecs->table('goods_attr'), $goods_attr, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 商品相册 */ if ($row['multi_image']) { $goods_gallery = array(); $goods_gallery['goods_id'] = $row['gid']; $img_list = explode('&&&', $row['multi_image']); foreach ($img_list as $img) { if (substr($img, 0, 7) == 'http://') { $goods_gallery['img_url'] = $img; } else { make_dir('images/' . date('Ym') . '/'); $goods_gallery['img_url'] = 'images/' . date('Ym') . '/big_' . $img; $goods_gallery['img_original'] = 'images/' . date('Ym') . '/original_' . $img; } if (!$db->autoExecute($ecs->table('goods_gallery'), $goods_gallery, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } } /* 关联商品 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer_linkgoods"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $link_goods = array(); $link_goods['goods_id'] = $row['pgid']; $link_goods['link_goods_id'] = $row['sgid']; $link_goods['is_double'] = $row['type']; if (!$db->autoExecute($ecs->table('link_goods'), $link_goods, 'INSERT', '', 'SILENT')) { //return $db->error(); } if ($row['type'] == '1') { $link_goods = array(); $link_goods['goods_id'] = $row['sgid']; $link_goods['link_goods_id'] = $row['pgid']; $link_goods['is_double'] = $row['type']; if (!$db->autoExecute($ecs->table('link_goods'), $link_goods, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } /* 组合商品 */ $sql = "SELECT DISTINCT gid, prop_goods_id, price FROM ".$this->sprefix."mall_pcat_prop_has_goods"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $group_goods = array(); $group_goods['parent_id'] = $row['gid']; $group_goods['goods_id'] = $row['prop_goods_id']; $group_goods['goods_price'] = $row['price']; if (!$db->autoExecute($ecs->table('group_goods'), $group_goods, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回成功 */ return TRUE; } /** * 会员等级、会员、会员价格 */ function process_users() { global $db, $ecs; /* 清空会员、会员等级、会员价格、用户红包、用户地址、帐户明细 */ truncate_table('user_rank'); truncate_table('users'); truncate_table('user_address'); truncate_table('user_bonus'); truncate_table('member_price'); truncate_table('user_account'); /* 查询并插入会员等级 */ $sql = "SELECT * FROM ".$this->sprefix."mall_member_level order by point desc"; $res = $this->sdb->query($sql); $max_points = 50000; while ($row = $this->sdb->fetchRow($res)) { $user_rank = array(); $user_rank['rank_id'] = $row['levelid']; $user_rank['rank_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name'])); $user_rank['min_points'] = $row['point']; $user_rank['max_points'] = $max_points; $user_rank['discount'] = round($row['discount'] * 100); $user_rank['show_price'] = '1'; $user_rank['special_rank'] = '0'; if (!$db->autoExecute($ecs->table('user_rank'), $user_rank, 'INSERT', '', 'SILENT')) { //return $db->error(); } $max_points = $row['point'] - 1; } /* 查询并插入会员 */ $sql = "SELECT * FROM ".$this->sprefix."mall_member"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $user = array(); $user['user_id'] = $row['userid']; $user['email'] = $row['email']; $user['user_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['user'])); $user['password'] = $row['password']; $user['question'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['pw_question'])); $user['answer'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['pw_answer'])); $user['sex'] = $row['sex']; if (!empty($row['birthday'])) { $birthday = strtotime($row['birthday']); if ($birthday != -1 && $birthday !== false) { $user['birthday'] = date('Y-m-d', $birthday); } } $user['user_money'] = $row['advance']; $user['pay_points'] = $row['point']; $user['rank_points'] = $row['point']; $user['reg_time'] = $row['regtime']; $user['last_login'] = $row['regtime']; $user['last_ip'] = $row['ip']; $user['visit_count'] = '1'; $user['user_rank'] = '0'; if (!$db->autoExecute($ecs->table('users'), $user, 'INSERT', '', 'SILENT')) { //return $db->error(); } // uc_call('uc_user_register', array($user['user_name'], $user['password'], $user['email'])); } /* 收货人地址 */ $sql = "SELECT * FROM ".$this->sprefix."mall_member_receiver"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $address = array(); $address['address_id'] = $row['receiveid']; $address['address_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name'])); $address['user_id'] = $row['memberid']; $address['consignee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name'])); $address['email'] = $row['email']; $address['address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['address'])); $address['zipcode'] = $row['zipcode']; $address['tel'] = $row['telphone']; $address['mobile'] = $row['mobile']; if (!$db->autoExecute($ecs->table('user_address'), $address, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 会员价格 */ $temp_arr = array(); $sql = "SELECT * FROM ".$this->sprefix."mall_member_price"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { if ($row['gid'] > 0 && $row['levelid'] > 0 && !isset($temp_arr[$row['gid']][$row['levelid']])) { $temp_arr[$row['gid']][$row['levelid']] = true; $member_price = array(); $member_price['goods_id'] = $row['gid']; $member_price['user_rank'] = $row['levelid']; $member_price['user_price'] = $row['price']; if (!$db->autoExecute($ecs->table('member_price'), $member_price, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } unset($temp_arr); /* 帐户明细 */ $sql = "SELECT * FROM ".$this->sprefix."mall_member_advance"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $user_account = array(); $user_account['user_id'] = $row['memberid']; $user_account['admin_user'] = $row['doman']; $user_account['amount'] = $row['money']; $user_account['add_time'] = $row['date']; $user_account['paid_time'] = $row['date']; $user_account['admin_note'] = $row['description']; $user_account['process_type'] = $row['money'] >= 0 ? SURPLUS_SAVE : SURPLUS_RETURN; $user_account['is_paid'] = '1'; if (!$db->autoExecute($ecs->table('user_account'), $user_account, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回 */ return TRUE; } /** * 文章 */ function process_article() { global $db, $ecs; /* 清空文章类型、文章、友情链接 */ truncate_table('article_cat'); truncate_table('article'); truncate_table('friend_link'); /* 文章类型 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer_ncat"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $cat = array(); $cat['cat_id'] = $row['catid']; $cat['cat_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['cat'])); $cat['cat_type'] = '1'; $cat['sort_order'] = $row['pid']; $cat['is_open'] = '1'; if (!$db->autoExecute($ecs->table('article_cat'), $cat, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 文章 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer_ncon"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $article = array(); $article['article_id'] = $row['newsid']; $article['cat_id'] = $row['catid']; $article['title'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['title'])); $article['content'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['con'])); $article['content'] = str_replace('pictures/newsimg/', 'images/upload/Image/', $article['content']); $article['article_type']= '0'; $article['is_open'] = $row['ifpub']; $article['add_time'] = $row['uptime']; if (!$db->autoExecute($ecs->table('article'), $article, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 友情链接 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer_link"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $link = array(); $link['link_id'] = $row['linkid']; $link['link_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['linktitle'])); $link['link_url'] = $row['linkurl']; $link['show_order'] = '0'; if ($row['linktype'] == 'image') { $link['link_logo'] = 'data/afficheimg/'.$row['imgurl']; } if (!$db->autoExecute($ecs->table('friend_link'), $link, 'INSERT', '', 'SILENT')) { //return $db->error(); } } /* 返回 */ return TRUE; } /** * 订单 */ function process_order() { global $db, $ecs; /* 清空订单、订单商品 */ truncate_table('order_info'); truncate_table('order_goods'); truncate_table('order_action'); /* 订单 */ $sql = "SELECT o.*, t.tmethod, p.payment FROM ".$this->sprefix."mall_orders AS o " . "LEFT JOIN ".$this->sprefix."mall_offer_t AS t ON o.ttype = t.id " . "LEFT JOIN ".$this->sprefix."mall_offer_p AS p ON o.ptype = p.id"; $res = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res)) { $order = array(); $order['order_sn'] = $row['orderid']; $order['user_id'] = $row['userid']; $order['add_time'] = $row['ordertime']; $order['consignee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['name'])); $order['address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['addr'])); $order['zipcode'] = $row['zip']; $order['tel'] = $row['tel']; $order['mobile'] = $row['mobile']; $order['email'] = $row['email']; $order['postscript'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['memo'])); $order['shipping_name'] = is_null($row['tmethod']) ? ' ' : ecs_iconv($this->scharset, $this->tcharset, addslashes($row['tmethod'])); $order['pay_name'] = is_null($row['payment']) ? ' ' : ecs_iconv($this->scharset, $this->tcharset, addslashes($row['payment'])); $order['inv_payee'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['invoiceform'])); $order['goods_amount'] = $row['item_amount']; $order['shipping_fee'] = $row['freight']; $order['order_amount'] = $row['total_amount']; $order['pay_time'] = $row['paytime']; $order['shipping_time'] = $row['sendtime']; /* 状态 */ if ($row['ordstate'] == '0') { $order['order_status'] = OS_UNCONFIRMED; $order['shipping_status'] = SS_UNSHIPPED; } elseif ($row['ordstate'] == '1') { $order['order_status'] = OS_CONFIRMED; $order['shipping_status'] = SS_UNSHIPPED; } elseif ($row['ordstate'] == '9') { $order['order_status'] = OS_INVALID; $order['shipping_status'] = SS_UNSHIPPED; } else // 3 发货 4 归档 { $order['order_status'] = OS_CONFIRMED; $order['shipping_status'] = SS_SHIPPED; } if ($row['ifsk'] == '1') { $order['pay_status'] = PS_PAYED; } else // 0 未付款 5 退款 { $order['pay_status'] = PS_UNPAYED; } if ($row['userrecsts'] == '1') // 用户操作了 { if ($row['recsts'] == '1') // 到货 { if ($order['shipping_status'] == SS_SHIPPED) { $order['shipping_status'] = SS_RECEIVED; } } elseif ($row['recsts'] == '2') // 取消 { $order['order_status'] = OS_CANCELED; $order['pay_status'] = PS_UNPAYED; $order['shipping_status'] = SS_UNSHIPPED; } } /* 如果已付款,修改已付款金额为订单总金额,修改订单总金额为0 */ if ($order['pay_status'] > PS_UNPAYED) { $order['money_paid'] = $order['order_amount']; $order['order_amount'] = 0; } if (!$db->autoExecute($ecs->table('order_info'), $order, 'INSERT', '', 'SILENT')) { //return $db->error(); } /* 订单商品 */ $order_id = $db->insert_id(); $sql = "SELECT i.*, g.priceintro FROM ".$this->sprefix."mall_items AS i " . "LEFT JOIN ".$this->sprefix."mall_goods AS g ON i.gid = g.gid " . "WHERE orderid = '$row[orderid]'"; $res1 = $this->sdb->query($sql); while ($row = $this->sdb->fetchRow($res1)) { $goods = array(); $goods['order_id'] = $order_id; $goods['goods_id'] = $row['gid']; $goods['goods_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['goods'])); $goods['goods_sn'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['bn'])); $goods['goods_number'] = $row['nums']; $goods['goods_price'] = $row['price']; $goods['market_price'] = is_null($row['priceintro']) ? $row['goods_price'] : $row['priceintro']; $goods['is_real'] = 1; $goods['parent_id'] = 0; $goods['is_gift'] = 0; if (!$db->autoExecute($ecs->table('order_goods'), $goods, 'INSERT', '', 'SILENT')) { //return $db->error(); } } } /* 返回 */ return TRUE; } /** * 商店设置 */ function process_config() { global $ecs, $db; /* 查询设置 */ $sql = "SELECT * FROM ".$this->sprefix."mall_offer " . "WHERE offerid = '1'"; $row = $this->sdb->getRow($sql); $config = array(); $config['shop_name'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_name'])); $config['shop_title'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_shoptitle'])); $config['shop_desc'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_metadesc'])); $config['shop_address'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_addr'])); $config['service_email'] = $row['offer_email']; $config['service_phone'] = $row['offer_tel']; $config['icp_number'] = ecs_iconv($this->scharset, $this->tcharset, addslashes($row['offer_certtext'])); //$config['integral_scale'] = $row['offer_pointtype'] == '0' ? '0' : $row['offer_pointnum'] * 100; $config['thumb_width'] = $row['offer_smallsize_w']; $config['thumb_height'] = $row['offer_smallsize_h']; $config['image_width'] = $row['offer_bigsize_w']; $config['image_height'] = $row['offer_bigsize_h']; $config['promote_number'] = $row['offer_tejianums']; $config['best_number'] = $row['offer_tjnums']; $config['new_number'] = $row['offer_newgoodsnums']; $config['hot_number'] = $row['offer_hotnums']; $config['smtp_host'] = $row['offer_smtp_server']; $config['smtp_port'] = $row['offer_smtp_port']; $config['smtp_user'] = $row['offer_smtp_user']; $config['smtp_pass'] = $row['offer_smtp_password']; $config['smtp_mail'] = $row['offer_smtp_email']; /* 更新 */ foreach ($config as $code => $value) { $sql = "UPDATE " . $ecs->table('shop_config') . " SET " . "value = '$value' " . "WHERE code = '$code' LIMIT 1"; if (!$db->query($sql, 'SILENT')) { //return $db->error(); } } /* 返回 */ return TRUE; } } ?>
zzshop
trunk/includes/modules/convert/shopex47.php
PHP
asf20
38,557
<?php /** * ECSHOP ips支付系统插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * @author: xuan yan <xuanyan1983@gmail.com> * @version: v1.0 * --------------------------------------------- */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/ips.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'ips_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.ips.com.cn'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'ips_account', 'type' => 'text', 'value' => ''), array('name' => 'ips_key', 'type' => 'text', 'value' => ''), array('name' => 'ips_currency', 'type' => 'select', 'value' => '01'), array('name' => 'ips_lang', 'type' => 'select', 'value' => 'GB') ); return; } class ips { /** * 构造函数 * * @access public * @param * * @return void */ function ips() { } function __construct() { $this->ips(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $billstr = date('His', time()); $datestr = date('Ymd', time()); $mer_code = $payment['ips_account']; $billno = str_pad($order['log_id'], 10, '0', STR_PAD_LEFT) . $billstr; $amount = sprintf("%0.02f", $order['order_amount']); $strcert = $payment['ips_key']; $strcontent = $billno . $amount . $datestr . 'RMB' . $strcert; // 签名验证串 // $signmd5 = MD5($strcontent); $def_url = '<br /><form style="text-align:center;" action="https://pay.ips.com.cn/ipayment.aspx" method="post" target="_blank">'; $def_url .= "<input type='hidden' name='Mer_code' value='" . $mer_code . "'>\n"; $def_url .= "<input type='hidden' name='Billno' value='" . $billno . "'>\n"; $def_url .= "<input type='hidden' name='Gateway_type' value='" . $payment['ips_currency'] . "'>\n"; $def_url .= "<input type='hidden' name='Currency_Type' value='RMB'>\n"; $def_url .= "<input type='hidden' name='Lang' value='" . $payment['ips_lang'] . "'>\n"; $def_url .= "<input type='hidden' name='Amount' value='" . $amount . "'>\n"; $def_url .= "<input type='hidden' name='Date' value='" . $datestr . "'>\n"; $def_url .= "<input type='hidden' name='DispAmount' value='" . $amount . "'>\n"; $def_url .= "<input type='hidden' name='OrderEncodeType' value='2'>\n"; $def_url .= "<input type='hidden' name='RetEncodeType' value='12'>\n"; $def_url .= "<input type='hidden' name='Merchanturl' value='" . return_url(basename(__FILE__, '.php')) . "'>\n"; $def_url .= "<input type='hidden' name='SignMD5' value='" . $signmd5 . "'>\n"; $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form><br />"; return $def_url; } function respond() { $payment = get_payment($_GET['code']); $billno = $_GET['billno']; $amount = $_GET['amount']; $mydate = $_GET['date']; $succ = $_GET['succ']; $msg = $_GET['msg']; $ipsbillno = $_GET['ipsbillno']; $retEncodeType = $_GET['retencodetype']; $currency_type = $_GET['Currency_type']; $signature = $_GET['signature']; $order_sn = intval(substr($billno, 0, 10)); if ($succ == 'Y') { $content = $billno . $amount . $mydate . $succ . $ipsbillno . $currency_type; $cert = $payment['ips_key']; $signature_1ocal = md5($content . $cert); if ($signature_1ocal == $signature) { if (!check_money($order_sn, $amount)) { return false; } order_paid($order_sn); return true; } else { return false; } } else { return false; } } } ?>
zzshop
trunk/includes/modules/payment/ips.php
PHP
asf20
5,552
<?php /** * ECSHOP 云网支付插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: cncard.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/cncard.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'cncard_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.cncard.net/'; /* 版本号 */ $modules[$i]['version'] = 'V1.1'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'c_mid', 'type' => 'text', 'value' => ''), array('name' => 'c_pass', 'type' => 'text', 'value' => ''), array('name' => 'c_memo1', 'type' => 'text', 'value' => 'ecshop'), array('name' => 'c_moneytype', 'type' => 'select', 'value' => '0'), array('name' => 'c_language', 'type' => 'select', 'value' => '0'), array('name' => 'c_paygate', 'type' => 'select', 'value' => '') ); return; } class cncard { /** * 构造函数 * * @access public * @param * * @return void */ function cncard() { } function __construct() { $this->cncard(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $c_mid = trim($payment['c_mid']); //商户编号,在申请商户成功后即可获得,可以在申请商户成功的邮件中获取该编号 $c_order = $order['order_sn']; //商户网站依照订单号规则生成的订单号,不能重复 $c_name = ""; //商户订单中的收货人姓名 $c_address = ""; //商户订单中的收货人地址 $c_tel = ""; //商户订单中的收货人电话 $c_post = ""; //商户订单中的收货人邮编 $c_email = ""; //商户订单中的收货人Email $c_orderamount = $order['order_amount']; //商户订单总金额 if (!empty($order['add_time'])) { $c_ymd = local_date('Ymd', $order['add_time']); } else { $c_ymd = local_date('Ymd', gmtime()); } //$c_ymd = substr($order['order_sn'], 0, 8); //商户订单的产生日期,格式为"yyyymmdd",如20050102 $c_moneytype= $payment['c_moneytype']; //支付币种,0为人民币 $c_retflag = "1"; //商户订单支付成功后是否需要返回商户指定的文件,0:不用返回 1:需要返回 $c_paygate = empty($payment['c_paygate']) ? '' : trim($payment['c_paygate']); //如果在商户网站选择银行则设置该值,具体值可参见《云网支付@网技术接口手册》附录一;如果来云网支付@网选择银行此项为空值。 $c_returl = return_url(basename(__FILE__, '.php')); //如果c_retflag为1时,该地址代表商户接收云网支付结果通知的页面,请提交完整文件名(对应范例文件:GetPayNotify.php) $c_memo1 = abs(crc32(trim($payment['c_memo1']))); //商户需要在支付结果通知中转发的商户参数一 if (empty($order['order_id'])) { $c_memo2 = "voucher"; //商户需要在支付结果通知中转发的商户参数二 } else { $c_memo2 = ''; } $c_pass = trim($payment['c_pass']); //支付密钥,请登录商户管理后台,在帐户信息-基本信息-安全信息中的支付密钥项 $notifytype = "0"; //0普通通知方式/1服务器通知方式,空值为普通通知方式 $c_language = trim($payment['c_language']); //对启用了国际卡支付时,可使用该值定义消费者在银行支付时的页面语种,值为:0银行页面显示为中文/1银行页面显示为英文 $srcStr = $c_mid . $c_order . $c_orderamount . $c_ymd . $c_moneytype . $c_retflag . $c_returl . $c_paygate . $c_memo1 . $c_memo2 . $notifytype . $c_language . $c_pass; //说明:如果您想指定支付方式(c_paygate)的值时,需要先让用户选择支付方式,然后再根据用户选择的结果在这里进行MD5加密,也就是说,此时,本页面应该拆分为两个页面,分为两个步骤完成。 //--对订单信息进行MD5加密 //商户对订单信息进行MD5签名后的字符串 $c_signstr = md5($srcStr); $def_url = '<form name="payForm1" action="https://www.cncard.net/purchase/getorder.asp" method="POST" target="_blank">'. "<input type=\"hidden\" name=\"c_mid\" value=\"$c_mid\" />". "<input type=\"hidden\" name=\"c_order\" value=\"$c_order\" />". "<input type=\"hidden\" name=\"c_name\" value=\"$c_name\" />". "<input type=\"hidden\" name=\"c_address\" value=\"$c_address\" />". "<input type=\"hidden\" name=\"c_tel\" value=\"$c_tel\" />". "<input type=\"hidden\" name=\"c_post\" value=\"$c_post\" />". "<input type=\"hidden\" name=\"c_email\" value=\"$c_email\" />". "<input type=\"hidden\" name=\"c_orderamount\" value=\"$c_orderamount\" />". "<input type=\"hidden\" name=\"c_ymd\" value=\"$c_ymd\" />". "<input type=\"hidden\" name=\"c_moneytype\" value=\"$c_moneytype\" />". "<input type=\"hidden\" name=\"c_retflag\" value=\"$c_retflag\" />". "<input type=\"hidden\" name=\"c_paygate\" value=\"$c_paygate\" />". "<input type=\"hidden\" name=\"c_returl\" value=\"$c_returl\" />". "<input type=\"hidden\" name=\"c_memo1\" value=\"$c_memo1\" />". "<input type=\"hidden\" name=\"c_memo2\" value=\"$c_memo2\" />". "<input type=\"hidden\" name=\"c_language\" value=\"$c_language\" />". "<input type=\"hidden\" name=\"notifytype\" value=\"$notifytype\" />". "<input type=\"hidden\" name=\"c_signstr\" value=\"$c_signstr\" />". "<input type=\"submit\" name=\"submit\" value=\"".$GLOBALS['_LANG']['cncard_button']."\" />". "</form>"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment($_GET['code']); //--获取云网支付网关向商户发送的支付通知信息(以下简称为通知信息) $c_mid = $_REQUEST['c_mid']; //商户编号,在申请商户成功后即可获得,可以在申请商户成功的邮件中获取该编号 $c_order = $_REQUEST['c_order']; //商户提供的订单号 $c_orderamount = $_REQUEST['c_orderamount']; //商户提供的订单总金额,以元为单位,小数点后保留两位,如:13.05 $c_ymd = $_REQUEST['c_ymd']; //商户传输过来的订单产生日期,格式为"yyyymmdd",如20050102 $c_transnum = $_REQUEST['c_transnum']; //云网支付网关提供的该笔订单的交易流水号,供日后查询、核对使用; $c_succmark = $_REQUEST['c_succmark']; //交易成功标志,Y-成功 N-失败 $c_moneytype = $_REQUEST['c_moneytype']; //支付币种,0为人民币 $c_cause = $_REQUEST['c_cause']; //如果订单支付失败,则该值代表失败原因 $c_memo1 = $_REQUEST['c_memo1']; //商户提供的需要在支付结果通知中转发的商户参数一 $c_memo2 = $_REQUEST['c_memo2']; //商户提供的需要在支付结果通知中转发的商户参数二 $c_signstr = $_REQUEST['c_signstr']; //云网支付网关对已上信息进行MD5加密后的字符串 //--校验信息完整性--- if($c_mid=="" || $c_order=="" || $c_orderamount=="" || $c_ymd=="" || $c_moneytype=="" || $c_transnum=="" || $c_succmark=="" || $c_signstr=="") { //echo "支付信息有误!"; return false; } //--将获得的通知信息拼成字符串,作为准备进行MD5加密的源串,需要注意的是,在拼串时,先后顺序不能改变 //商户的支付密钥,登录商户管理后台(https://www.cncard.net/admin/),在管理首页可找到该值 $c_pass = trim($payment['c_pass']); $srcStr = $c_mid . $c_order . $c_orderamount . $c_ymd . $c_transnum . $c_succmark . $c_moneytype . $c_memo1 . $c_memo2 . $c_pass; //--对支付通知信息进行MD5加密 $r_signstr = md5($srcStr); //--校验商户网站对通知信息的MD5加密的结果和云网支付网关提供的MD5加密结果是否一致 if($r_signstr!=$c_signstr) { //echo "签名验证失败"; return false; } //验证通过后,将订单sn转换为ID 来操作ec订单表 if ($c_memo2 == 'voucher') { $c_order = get_order_id_by_sn($c_order, "true"); } else { $c_order = get_order_id_by_sn($c_order); } /* 检查支付的金额是否相符 */ if (!check_money($c_order, $c_orderamount)) { //echo "订单金额不对"; return false; } //--校验商户编号 $MerchantID= trim($payment['c_mid']); //商户自己的编号 if($MerchantID!=$c_mid){ //echo "提交的商户编号有误"; return false; } if ($c_memo1 != abs(crc32($payment['c_memo1']))) { //echo "个性签名不一致"; //return false; } // $r_orderamount = $row["订单金额"]; //商户从自己订单系统获取该值 // if($r_orderamount!=$c_orderamount){ // echo "支付金额有误"; // exit; // } //--校验商户订单系统中记录的订单生成日期和云网支付网关通知信息中的订单生成日期是否一致 // $r_ymd = $row["订单生成日期"]; //商户从自己订单系统获取该值 // if($r_ymd!=$c_ymd){ // echo "订单时间有误"; // exit; // } //--校验返回的支付结果的格式是否正确 if($c_succmark!="Y" && $c_succmark!="N") { //echo "参数提交有误"; return false; } //--根据返回的支付结果,商户进行自己的发货等操作 if($c_succmark="Y") { //根据商户自己商务规则,进行发货等系列操作 /* 改变订单状态 */ order_paid($c_order); return true; } else { //echo $c_cause; return false; } } } ?>
zzshop
trunk/includes/modules/payment/cncard.php
PHP
asf20
12,560
<?php /** * ECSHOP 支付宝插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: alipay.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/alipay.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'alipay_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.alipay.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.2'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'alipay_account', 'type' => 'text', 'value' => ''), array('name' => 'alipay_key', 'type' => 'text', 'value' => ''), array('name' => 'alipay_partner', 'type' => 'text', 'value' => ''), // array('name' => 'alipay_real_method', 'type' => 'select', 'value' => '0'), // array('name' => 'alipay_virtual_method', 'type' => 'select', 'value' => '0'), // array('name' => 'is_instant', 'type' => 'select', 'value' => '0') array('name' => 'alipay_pay_method', 'type' => 'select', 'value' => '') ); return; } /** * 类 */ class alipay { /** * 构造函数 * * @access public * @param * * @return void */ function alipay() { } function __construct() { $this->alipay(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { if (!defined('EC_CHARSET')) { $charset = 'utf-8'; } else { $charset = EC_CHARSET; } // if (empty($payment['is_instant'])) // { // /* 未开通即时到帐 */ // $service = 'trade_create_by_buyer'; // } // else // { // if (!empty($order['order_id'])) // { // /* 检查订单是否全部为虚拟商品 */ // $sql = "SELECT COUNT(*) FROM " .$GLOBALS['ecs']->table('order_goods'). // " WHERE is_real=1 AND order_id='$order[order_id]'"; // // if ($GLOBALS['db']->getOne($sql) > 0) // { // /* 订单中存在实体商品 */ // $service = (!empty($payment['alipay_real_method']) && $payment['alipay_real_method'] == 1) ? // 'create_direct_pay_by_user' : 'trade_create_by_buyer'; // } // else // { // /* 订单中全部为虚拟商品 */ // $service = (!empty($payment['alipay_virtual_method']) && $payment['alipay_virtual_method'] == 1) ? // 'create_direct_pay_by_user' : 'create_digital_goods_trade_p'; // } // } // else // { // /* 非订单方式,按照虚拟商品处理 */ // $service = (!empty($payment['alipay_virtual_method']) && $payment['alipay_virtual_method'] == 1) ? // 'create_direct_pay_by_user' : 'create_digital_goods_trade_p'; // } // } $real_method = $payment['alipay_pay_method']; switch ($real_method){ case '0': $service = 'trade_create_by_buyer'; break; case '1': $service = 'create_partner_trade_by_buyer'; break; case '2': $service = 'create_direct_pay_by_user'; break; } $agent = 'C4335319945672464113'; $parameter = array( 'agent' => $agent, 'service' => $service, 'partner' => $payment['alipay_partner'], //'partner' => ALIPAY_ID, '_input_charset' => $charset, 'notify_url' => return_url(basename(__FILE__, '.php')), 'return_url' => return_url(basename(__FILE__, '.php')), /* 业务参数 */ 'subject' => $order['order_sn'], 'out_trade_no' => $order['order_sn'] . $order['log_id'], 'price' => $order['order_amount'], 'quantity' => 1, 'payment_type' => 1, /* 物流参数 */ 'logistics_type' => 'EXPRESS', 'logistics_fee' => 0, 'logistics_payment' => 'BUYER_PAY_AFTER_RECEIVE', /* 买卖双方信息 */ 'seller_email' => $payment['alipay_account'] ); ksort($parameter); reset($parameter); $param = ''; $sign = ''; foreach ($parameter AS $key => $val) { $param .= "$key=" .urlencode($val). "&"; $sign .= "$key=$val&"; } $param = substr($param, 0, -1); $sign = substr($sign, 0, -1). $payment['alipay_key']; //$sign = substr($sign, 0, -1). ALIPAY_AUTH; $button = '<div style="text-align:center"><input type="button" onclick="window.open(\'https://www.alipay.com/cooperate/gateway.do?'.$param. '&sign='.md5($sign).'&sign_type=MD5\')" value="' .$GLOBALS['_LANG']['pay_button']. '" /></div>'; return $button; } /** * 响应操作 */ function respond() { if (!empty($_POST)) { foreach($_POST as $key => $data) { $_GET[$key] = $data; } } $payment = get_payment($_GET['code']); $seller_email = rawurldecode($_GET['seller_email']); $order_sn = str_replace($_GET['subject'], '', $_GET['out_trade_no']); $order_sn = trim($order_sn); /* 检查支付的金额是否相符 */ if (!check_money($order_sn, $_GET['total_fee'])) { return false; } /* 检查数字签名是否正确 */ ksort($_GET); reset($_GET); $sign = ''; foreach ($_GET AS $key=>$val) { if ($key != 'sign' && $key != 'sign_type' && $key != 'code') { $sign .= "$key=$val&"; } } $sign = substr($sign, 0, -1) . $payment['alipay_key']; //$sign = substr($sign, 0, -1) . ALIPAY_AUTH; if (md5($sign) != $_GET['sign']) { return false; } if ($_GET['trade_status'] == 'WAIT_SELLER_SEND_GOODS') { /* 改变订单状态 */ order_paid($order_sn, 2); return true; } elseif ($_GET['trade_status'] == 'TRADE_FINISHED') { /* 改变订单状态 */ order_paid($order_sn); return true; } elseif ($_GET['trade_status'] == 'TRADE_SUCCESS') { /* 改变订单状态 */ order_paid($order_sn, 2); return true; } else { return false; } } } ?>
zzshop
trunk/includes/modules/payment/alipay.php
PHP
asf20
8,477
<?php /** * ECSHOP 快钱插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: kuaiqian_cmbc.php 15797 2009-07-24 10:46:09Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/payment/kuaiqian.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == true) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'kuaiqian_desc_cmbc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.99bill.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'kq_account', 'type' => 'text', 'value' => ''), array('name' => 'kq_key', 'type' => 'text', 'value' => ''), ); return; } class kuaiqian_cmbc { /** * 构造函数 * * @access public * @param * * @return void */ function kuaiqian_cmbc() { } function __construct() { $this->kuaiqian_cmbc(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $merchant_acctid = trim($payment['kq_account']); //人民币账号 不可空 $key = trim($payment['kq_key']); $input_charset = 1; //字符集 默认1=utf-8 $page_url = return_url(basename(__FILE__, '.php')); $bg_url = ''; $version = 'v2.0'; $language = 1; $sign_type = 1; //签名类型 不可空 固定值 1:md5 $payer_name = ''; $payer_contact_type = ''; $payer_contact = ''; $order_id = $order['order_sn']; //商户订单号 不可空 $order_amount = $order['order_amount'] * 100; //商户订单金额 不可空 $order_time = local_date('YmdHis', $order['add_time']); //商户订单提交时间 不可空 14位 $product_name = ''; $product_num = ''; $product_id = ''; $product_desc = ''; $ext1 = $order['log_id']; $ext2 = ''; $pay_type = '10'; //支付方式 不可空 $bank_id = 'CMBC'; $redo_flag = '0'; $pid = ''; /* 生成加密签名串 请务必按照如下顺序和规则组成加密串!*/ $signmsgval = ''; $signmsgval = $this->append_param($signmsgval, "inputCharset", $input_charset); $signmsgval = $this->append_param($signmsgval, "pageUrl", $page_url); $signmsgval = $this->append_param($signmsgval, "bgUrl", $bg_url); $signmsgval = $this->append_param($signmsgval, "version", $version); $signmsgval = $this->append_param($signmsgval, "language", $language); $signmsgval = $this->append_param($signmsgval, "signType", $sign_type); $signmsgval = $this->append_param($signmsgval, "merchantAcctId", $merchant_acctid); $signmsgval = $this->append_param($signmsgval, "payerName", $payer_name); $signmsgval = $this->append_param($signmsgval, "payerContactType", $payer_contact_type); $signmsgval = $this->append_param($signmsgval, "payerContact", $payer_contact); $signmsgval = $this->append_param($signmsgval, "orderId", $order_id); $signmsgval = $this->append_param($signmsgval, "orderAmount", $order_amount); $signmsgval = $this->append_param($signmsgval, "orderTime", $order_time); $signmsgval = $this->append_param($signmsgval, "productName", $product_name); $signmsgval = $this->append_param($signmsgval, "productNum", $product_num); $signmsgval = $this->append_param($signmsgval, "productId", $product_id); $signmsgval = $this->append_param($signmsgval, "productDesc", $product_desc); $signmsgval = $this->append_param($signmsgval, "ext1", $ext1); $signmsgval = $this->append_param($signmsgval, "ext2", $ext2); $signmsgval = $this->append_param($signmsgval, "payType", $pay_type); $signmsgval = $this->append_param($signmsgval, "bankId", $bank_id); $signmsgval = $this->append_param($signmsgval, "redoFlag", $redo_flag); $signmsgval = $this->append_param($signmsgval, "pid", $pid); $signmsgval = $this->append_param($signmsgval, "key", $key); $signmsg = strtoupper(md5($signmsgval)); //签名字符串 不可空 $def_url = '<div style="text-align:center"><form name="kqPay" style="text-align:center;" method="post" action="https://www.99bill.com/gateway/recvMerchantInfoAction.htm" target="_blank">'; $def_url .= "<input type='hidden' name='inputCharset' value='" . $input_charset . "' />"; $def_url .= "<input type='hidden' name='bgUrl' value='" . $bg_url . "' />"; $def_url .= "<input type='hidden' name='pageUrl' value='" . $page_url . "' />"; $def_url .= "<input type='hidden' name='version' value='" . $version . "' />"; $def_url .= "<input type='hidden' name='language' value='" . $language . "' />"; $def_url .= "<input type='hidden' name='signType' value='" . $sign_type . "' />"; $def_url .= "<input type='hidden' name='signMsg' value='" . $signmsg . "' />"; $def_url .= "<input type='hidden' name='merchantAcctId' value='" . $merchant_acctid . "' />"; $def_url .= "<input type='hidden' name='payerName' value='" . $payer_name . "' />"; $def_url .= "<input type='hidden' name='payerContactType' value='" . $payer_contact_type . "' />"; $def_url .= "<input type='hidden' name='payerContact' value='" . $payer_contact . "' />"; $def_url .= "<input type='hidden' name='orderId' value='" . $order_id . "' />"; $def_url .= "<input type='hidden' name='orderAmount' value='" . $order_amount . "' />"; $def_url .= "<input type='hidden' name='orderTime' value='" . $order_time . "' />"; $def_url .= "<input type='hidden' name='productName' value='" . $product_name . "' />"; $def_url .= "<input type='hidden' name='payType' value='" . $pay_type . "' />"; $def_url .= "<input type='hidden' name='productNum' value='" . $product_num . "' />"; $def_url .= "<input type='hidden' name='productId' value='" . $product_id . "' />"; $def_url .= "<input type='hidden' name='productDesc' value='" . $product_desc . "' />"; $def_url .= "<input type='hidden' name='ext1' value='" . $ext1 . "' />"; $def_url .= "<input type='hidden' name='ext2' value='" . $ext2 . "' />"; $def_url .= "<input type='hidden' name='bankId' value='" . $bank_id . "' />"; $def_url .= "<input type='hidden' name='redoFlag' value='" . $redo_flag ."' />"; $def_url .= "<input type='hidden' name='pid' value='" . $pid . "' />"; $def_url .= "<input type='submit' name='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "' />"; $def_url .= "</form></div></br>"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment($_GET['code']); $merchant_acctid = $payment['kq_account']; //人民币账号 不可空 $key = $payment['kq_key']; $get_merchant_acctid = trim($_REQUEST['merchantAcctId']); $pay_result = trim($_REQUEST['payResult']); $version = trim($_REQUEST['version']); $language = trim($_REQUEST['language']); $sign_type = trim($_REQUEST['signType']); $pay_type = trim($_REQUEST['payType']); $bank_id = trim($_REQUEST['bankId']); $order_id = trim($_REQUEST['orderId']); $order_time = trim($_REQUEST['orderTime']); $order_amount = trim($_REQUEST['orderAmount']); $deal_id = trim($_REQUEST['dealId']); $bank_deal_id = trim($_REQUEST['bankDealId']); $deal_time = trim($_REQUEST['dealTime']); $pay_amount = trim($_REQUEST['payAmount']); $fee = trim($_REQUEST['fee']); $ext1 = trim($_REQUEST['ext1']); $ext2 = trim($_REQUEST['ext2']); $err_code = trim($_REQUEST['errCode']); $sign_msg = trim($_REQUEST['signMsg']); //生成加密串。必须保持如下顺序。 $merchant_signmsgval = ''; $merchant_signmsgval = $this->append_param($merchant_signmsgval,"merchantAcctId",$merchant_acctid); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"version",$version); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"language",$language); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"signType",$sign_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payType",$pay_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankId",$bank_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderId",$order_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderTime",$order_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderAmount",$order_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealId",$deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankDealId",$bank_deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealTime",$deal_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payAmount",$pay_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"fee",$fee); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext1",$ext1); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext2",$ext2); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payResult",$pay_result); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"errCode",$err_code); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"key",$key); $merchant_signmsg = md5($merchant_signmsgval); //首先对获得的商户号进行比对 if ($get_merchant_acctid != $merchant_acctid) { //商户号错误 return false; } if (strtoupper($sign_msg) == strtoupper($merchant_signmsg)) { if ($pay_result == 10 || $pay_result == 00) { order_paid($ext1); return true; } else { //'支付结果失败'; return false; } } else { //'密钥校对错误'; return false; } } /** * 将变量值不为空的参数组成字符串 * @param string $strs 参数字符串 * @param string $key 参数键名 * @param string $val 参数键对应值 */ function append_param($strs,$key,$val) { if($strs != "") { if($key != '' && $val != '') { $strs .= '&' . $key . '=' . $val; } } else { if($val != '') { $strs = $key . '=' . $val; } } return $strs; } } ?>
zzshop
trunk/includes/modules/payment/kuaiqian_cmbc.php
PHP
asf20
13,184
<?php /** * ECSHOP 网银在线插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: chinabank.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/chinabank.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'chinabank_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 支付费用 */ $modules[$i]['pay_fee'] = '1%'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.chinabank.com.cn'; /* 版本号 */ $modules[$i]['version'] = '1.0.1'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'chinabank_account', 'type' => 'text', 'value' => ''), array('name' => 'chinabank_key', 'type' => 'text', 'value' => ''), ); return; } /** * 类 */ class chinabank { /** * 构造函数 * * @access public * @param * * @return void */ function chinabank() { } function __construct() { $this->chinabank(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $data_vid = trim($payment['chinabank_account']); $data_orderid = $order['order_sn']; $data_vamount = $order['order_amount']; $data_vmoneytype = 'CNY'; $data_vpaykey = trim($payment['chinabank_key']); $data_vreturnurl = return_url(basename(__FILE__, '.php')); if (empty($order['order_id'])) { $remark1 = "voucher"; //商户需要在支付结果通知中转发的商户参数二 } else { $remark1 = ''; } $MD5KEY =$data_vamount.$data_vmoneytype.$data_orderid.$data_vid.$data_vreturnurl.$data_vpaykey; $MD5KEY = strtoupper(md5($MD5KEY)); $def_url = '<br /><form style="text-align:center;" method=post action="https://pay3.chinabank.com.cn/PayGate" target="_blank">'; $def_url .= "<input type=HIDDEN name='v_mid' value='".$data_vid."'>"; $def_url .= "<input type=HIDDEN name='v_oid' value='".$data_orderid."'>"; $def_url .= "<input type=HIDDEN name='v_amount' value='".$data_vamount."'>"; $def_url .= "<input type=HIDDEN name='v_moneytype' value='".$data_vmoneytype."'>"; $def_url .= "<input type=HIDDEN name='v_url' value='".$data_vreturnurl."'>"; $def_url .= "<input type=HIDDEN name='v_md5info' value='".$MD5KEY."'>"; $def_url .= "<input type=HIDDEN name='remark1' value='".$remark1."'>"; $def_url .= "<input type=submit value='" .$GLOBALS['_LANG']['pay_button']. "'>"; $def_url .= "</form>"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment(basename(__FILE__, '.php')); $v_oid = trim($_POST['v_oid']); $v_pmode = trim($_POST['v_pmode']); $v_pstatus = trim($_POST['v_pstatus']); $v_pstring = trim($_POST['v_pstring']); $v_amount = trim($_POST['v_amount']); $v_moneytype = trim($_POST['v_moneytype']); $remark1 = trim($_POST['remark1' ]); $remark2 = trim($_POST['remark2' ]); $v_md5str = trim($_POST['v_md5str' ]); /** * 重新计算md5的值 */ $key = $payment['chinabank_key']; $md5string=strtoupper(md5($v_oid.$v_pstatus.$v_amount.$v_moneytype.$key)); /* 检查秘钥是否正确 */ if ($v_md5str==$md5string) { //验证通过后,将订单sn转换为ID 来操作ec订单表 if ($remark1 == 'voucher') { $v_oid = get_order_id_by_sn($v_oid, "true"); } else { $v_oid = get_order_id_by_sn($v_oid); } if ($v_pstatus == '20') { /* 改变订单状态 */ order_paid($v_oid); return true; } } else { return false; } } } ?>
zzshop
trunk/includes/modules/payment/chinabank.php
PHP
asf20
5,521
<?php /** * ECSHOP 快钱插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: kuaiqian_ccb.php 15797 2009-07-24 10:46:09Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/payment/kuaiqian.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == true) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'kuaiqian_desc_ccb'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.99bill.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'kq_account', 'type' => 'text', 'value' => ''), array('name' => 'kq_key', 'type' => 'text', 'value' => ''), ); return; } class kuaiqian_ccb { /** * 构造函数 * * @access public * @param * * @return void */ function kuaiqian_ccb() { } function __construct() { $this->kuaiqian_ccb(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $merchant_acctid = trim($payment['kq_account']); //人民币账号 不可空 $key = trim($payment['kq_key']); $input_charset = 1; //字符集 默认1=utf-8 $page_url = return_url(basename(__FILE__, '.php')); $bg_url = ''; $version = 'v2.0'; $language = 1; $sign_type = 1; //签名类型 不可空 固定值 1:md5 $payer_name = ''; $payer_contact_type = ''; $payer_contact = ''; $order_id = $order['order_sn']; //商户订单号 不可空 $order_amount = $order['order_amount'] * 100; //商户订单金额 不可空 $order_time = local_date('YmdHis', $order['add_time']); //商户订单提交时间 不可空 14位 $product_name = ''; $product_num = ''; $product_id = ''; $product_desc = ''; $ext1 = $order['log_id']; $ext2 = ''; $pay_type = '10'; //支付方式 不可空 $bank_id = 'CCB'; $redo_flag = '0'; $pid = ''; /* 生成加密签名串 请务必按照如下顺序和规则组成加密串!*/ $signmsgval = ''; $signmsgval = $this->append_param($signmsgval, "inputCharset", $input_charset); $signmsgval = $this->append_param($signmsgval, "pageUrl", $page_url); $signmsgval = $this->append_param($signmsgval, "bgUrl", $bg_url); $signmsgval = $this->append_param($signmsgval, "version", $version); $signmsgval = $this->append_param($signmsgval, "language", $language); $signmsgval = $this->append_param($signmsgval, "signType", $sign_type); $signmsgval = $this->append_param($signmsgval, "merchantAcctId", $merchant_acctid); $signmsgval = $this->append_param($signmsgval, "payerName", $payer_name); $signmsgval = $this->append_param($signmsgval, "payerContactType", $payer_contact_type); $signmsgval = $this->append_param($signmsgval, "payerContact", $payer_contact); $signmsgval = $this->append_param($signmsgval, "orderId", $order_id); $signmsgval = $this->append_param($signmsgval, "orderAmount", $order_amount); $signmsgval = $this->append_param($signmsgval, "orderTime", $order_time); $signmsgval = $this->append_param($signmsgval, "productName", $product_name); $signmsgval = $this->append_param($signmsgval, "productNum", $product_num); $signmsgval = $this->append_param($signmsgval, "productId", $product_id); $signmsgval = $this->append_param($signmsgval, "productDesc", $product_desc); $signmsgval = $this->append_param($signmsgval, "ext1", $ext1); $signmsgval = $this->append_param($signmsgval, "ext2", $ext2); $signmsgval = $this->append_param($signmsgval, "payType", $pay_type); $signmsgval = $this->append_param($signmsgval, "bankId", $bank_id); $signmsgval = $this->append_param($signmsgval, "redoFlag", $redo_flag); $signmsgval = $this->append_param($signmsgval, "pid", $pid); $signmsgval = $this->append_param($signmsgval, "key", $key); $signmsg = strtoupper(md5($signmsgval)); //签名字符串 不可空 $def_url = '<div style="text-align:center"><form name="kqPay" style="text-align:center;" method="post" action="https://www.99bill.com/gateway/recvMerchantInfoAction.htm" target="_blank">'; $def_url .= "<input type='hidden' name='inputCharset' value='" . $input_charset . "' />"; $def_url .= "<input type='hidden' name='bgUrl' value='" . $bg_url . "' />"; $def_url .= "<input type='hidden' name='pageUrl' value='" . $page_url . "' />"; $def_url .= "<input type='hidden' name='version' value='" . $version . "' />"; $def_url .= "<input type='hidden' name='language' value='" . $language . "' />"; $def_url .= "<input type='hidden' name='signType' value='" . $sign_type . "' />"; $def_url .= "<input type='hidden' name='signMsg' value='" . $signmsg . "' />"; $def_url .= "<input type='hidden' name='merchantAcctId' value='" . $merchant_acctid . "' />"; $def_url .= "<input type='hidden' name='payerName' value='" . $payer_name . "' />"; $def_url .= "<input type='hidden' name='payerContactType' value='" . $payer_contact_type . "' />"; $def_url .= "<input type='hidden' name='payerContact' value='" . $payer_contact . "' />"; $def_url .= "<input type='hidden' name='orderId' value='" . $order_id . "' />"; $def_url .= "<input type='hidden' name='orderAmount' value='" . $order_amount . "' />"; $def_url .= "<input type='hidden' name='orderTime' value='" . $order_time . "' />"; $def_url .= "<input type='hidden' name='productName' value='" . $product_name . "' />"; $def_url .= "<input type='hidden' name='payType' value='" . $pay_type . "' />"; $def_url .= "<input type='hidden' name='productNum' value='" . $product_num . "' />"; $def_url .= "<input type='hidden' name='productId' value='" . $product_id . "' />"; $def_url .= "<input type='hidden' name='productDesc' value='" . $product_desc . "' />"; $def_url .= "<input type='hidden' name='ext1' value='" . $ext1 . "' />"; $def_url .= "<input type='hidden' name='ext2' value='" . $ext2 . "' />"; $def_url .= "<input type='hidden' name='bankId' value='" . $bank_id . "' />"; $def_url .= "<input type='hidden' name='redoFlag' value='" . $redo_flag ."' />"; $def_url .= "<input type='hidden' name='pid' value='" . $pid . "' />"; $def_url .= "<input type='submit' name='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "' />"; $def_url .= "</form></div></br>"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment($_GET['code']); $merchant_acctid = $payment['kq_account']; //人民币账号 不可空 $key = $payment['kq_key']; $get_merchant_acctid = trim($_REQUEST['merchantAcctId']); $pay_result = trim($_REQUEST['payResult']); $version = trim($_REQUEST['version']); $language = trim($_REQUEST['language']); $sign_type = trim($_REQUEST['signType']); $pay_type = trim($_REQUEST['payType']); $bank_id = trim($_REQUEST['bankId']); $order_id = trim($_REQUEST['orderId']); $order_time = trim($_REQUEST['orderTime']); $order_amount = trim($_REQUEST['orderAmount']); $deal_id = trim($_REQUEST['dealId']); $bank_deal_id = trim($_REQUEST['bankDealId']); $deal_time = trim($_REQUEST['dealTime']); $pay_amount = trim($_REQUEST['payAmount']); $fee = trim($_REQUEST['fee']); $ext1 = trim($_REQUEST['ext1']); $ext2 = trim($_REQUEST['ext2']); $err_code = trim($_REQUEST['errCode']); $sign_msg = trim($_REQUEST['signMsg']); //生成加密串。必须保持如下顺序。 $merchant_signmsgval = ''; $merchant_signmsgval = $this->append_param($merchant_signmsgval,"merchantAcctId",$merchant_acctid); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"version",$version); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"language",$language); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"signType",$sign_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payType",$pay_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankId",$bank_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderId",$order_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderTime",$order_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderAmount",$order_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealId",$deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankDealId",$bank_deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealTime",$deal_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payAmount",$pay_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"fee",$fee); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext1",$ext1); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext2",$ext2); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payResult",$pay_result); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"errCode",$err_code); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"key",$key); $merchant_signmsg = md5($merchant_signmsgval); //首先对获得的商户号进行比对 if ($get_merchant_acctid != $merchant_acctid) { //商户号错误 return false; } if (strtoupper($sign_msg) == strtoupper($merchant_signmsg)) { if ($pay_result == 10 || $pay_result == 00) { order_paid($ext1); return true; } else { //'支付结果失败'; return false; } } else { //'密钥校对错误'; return false; } } /** * 将变量值不为空的参数组成字符串 * @param string $strs 参数字符串 * @param string $key 参数键名 * @param string $val 参数键对应值 */ function append_param($strs,$key,$val) { if($strs != "") { if($key != '' && $val != '') { $strs .= '&' . $key . '=' . $val; } } else { if($val != '') { $strs = $key . '=' . $val; } } return $strs; } } ?>
zzshop
trunk/includes/modules/payment/kuaiqian_ccb.php
PHP
asf20
13,178
<?php /** * ECSHOP YeePay易宝神州行支付插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: testyang $ * $Id: yeepay.php 14227 2008-03-10 06:37:24Z testyang $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/yeepayszx.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'ypszx_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.yeepay.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.1'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'yp_account', 'type' => 'text', 'value' => ''), array('name' => 'yp_key', 'type' => 'text', 'value' => ''), ); return; } /** * 类 */ class yeepayszx { /** * 构造函数 * * @access public * @param * * @return void */ function yeepayszx() { } function __construct() { $this->yeepayszx(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $data_merchant_id = $payment['yp_account']; $data_order_id = $order['order_sn']; $data_amount = $order['order_amount']; $message_type = 'Buy'; $data_cur = 'CNY'; $product_id = ''; $product_cat = ''; $product_desc = ''; $address_flag = '0'; $data_return_url = return_url(basename(__FILE__, '.php')); $data_pay_key = $payment['yp_key']; $data_pay_account = $payment['yp_account']; $mct_properties = $order['log_id']; $frp_id = 'SZX'; $need_response = ''; $def_url = $message_type . $data_merchant_id . $data_order_id . $data_amount . $data_cur . $product_id . $data_return_url . $address_flag . $mct_properties . $frp_id . $need_response; $MD5KEY = $this->hmac($def_url, $data_pay_key); $def_url = "\n<form action='https://www.yeepay.com/app-merchant-proxy/node' method='post' target='_blank'>\n"; $def_url .= "<input type='hidden' name='p0_Cmd' value='".$message_type."'>\n"; $def_url .= "<input type='hidden' name='p1_MerId' value='".$data_merchant_id."'>\n"; $def_url .= "<input type='hidden' name='p2_Order' value='".$data_order_id."'>\n"; $def_url .= "<input type='hidden' name='p3_Amt' value='".$data_amount."'>\n"; $def_url .= "<input type='hidden' name='p4_Cur' value='".$data_cur."'>\n"; $def_url .= "<input type='hidden' name='p5_Pid' value='".$product_id."'>\n"; //$def_url .= "<input type='hidden' name='p6_Pcat' value='".$product_cat."'>\n"; //$def_url .= "<input type='hidden' name='p7_Pdesc' value='".$product_desc."'>\n"; $def_url .= "<input type='hidden' name='p8_Url' value='".$data_return_url."'>\n"; $def_url .= "<input type='hidden' name='p9_SAF' value='".$address_flag."'>\n"; $def_url .= "<input type='hidden' name='pa_MP' value='".$mct_properties."'>\n"; $def_url .= "<input type='hidden' name='pd_FrpId' value='". $frp_id ."' >\n"; $def_url .= "<input type='hidden' name='pr_NeedResponse' value='". $need_response ."' >\n"; $def_url .= "<input type='hidden' name='hmac' value='".$MD5KEY."'>\n"; $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form>\n"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment('yeepay'); $merchant_id = $payment['yp_account']; // 获取商户编号 $merchant_key = $payment['yp_key']; // 获取秘钥 $message_type = trim($_REQUEST['r0_Cmd']); $succeed = trim($_REQUEST['r1_Code']); // 获取交易结果,1成功,-1失败 $trxId = trim($_REQUEST['r2_TrxId']); $amount = trim($_REQUEST['r3_Amt']); // 获取订单金额 $cur = trim($_REQUEST['r4_Cur']); // 获取订单货币单位 $product_id = trim($_REQUEST['r5_Pid']); // 获取产品ID $orderid = trim($_REQUEST['r6_Order']); // 获取订单ID $userId = trim($_REQUEST['r7_Uid']); // 获取产品ID $merchant_param = trim($_REQUEST['r8_MP']); // 获取商户私有参数 $bType = trim($_REQUEST['r9_BType']); // 获取订单ID $mac = trim($_REQUEST['hmac']); // 获取安全加密串 ///生成加密串,注意顺序 $ScrtStr = $merchant_id . $message_type . $succeed . $trxId . $amount . $cur . $product_id . $orderid . $userId . $merchant_param . $bType; $mymac = $this->hmac($ScrtStr, $merchant_key); $v_result = false; if (strtoupper($mac) == strtoupper($mymac)) { if ($succeed == '1') { ///支付成功 $v_result = true; $order_id = str_replace($orderid, '', $product_id); order_paid($merchant_param); } } return $v_result; } function hmac($data, $key) { // RFC 2104 HMAC implementation for php. // Creates an md5 HMAC. // Eliminates the need to install mhash to compute a HMAC // Hacked by Lance Rushing(NOTE: Hacked means written) $key = ecs_iconv(EC_CHARSET, 'UTF8', $key); $data = ecs_iconv(EC_CHARSET, 'UTF8', $data); $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack('H*', md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad ; $k_opad = $key ^ $opad; return md5($k_opad . pack('H*', md5($k_ipad . $data))); } } ?>
zzshop
trunk/includes/modules/payment/yeepayszx.php
PHP
asf20
7,327
<?php /** * ECSHOP 快钱插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: kuaiqian_icbc.php 15797 2009-07-24 10:46:09Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/payment/kuaiqian.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == true) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'kuaiqian_desc_icbc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.99bill.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'kq_account', 'type' => 'text', 'value' => ''), array('name' => 'kq_key', 'type' => 'text', 'value' => ''), ); return; } class kuaiqian_icbc { /** * 构造函数 * * @access public * @param * * @return void */ function kuaiqian_icbc() { } function __construct() { $this->kuaiqian_icbc(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $merchant_acctid = trim($payment['kq_account']); //人民币账号 不可空 $key = trim($payment['kq_key']); $input_charset = 1; //字符集 默认1=utf-8 $page_url = return_url(basename(__FILE__, '.php')); $bg_url = ''; $version = 'v2.0'; $language = 1; $sign_type = 1; //签名类型 不可空 固定值 1:md5 $payer_name = ''; $payer_contact_type = ''; $payer_contact = ''; $order_id = $order['order_sn']; //商户订单号 不可空 $order_amount = $order['order_amount'] * 100; //商户订单金额 不可空 $order_time = local_date('YmdHis', $order['add_time']); //商户订单提交时间 不可空 14位 $product_name = ''; $product_num = ''; $product_id = ''; $product_desc = ''; $ext1 = $order['log_id']; $ext2 = ''; $pay_type = '10'; //支付方式 不可空 $bank_id = 'ICBC'; $redo_flag = '0'; $pid = ''; /* 生成加密签名串 请务必按照如下顺序和规则组成加密串!*/ $signmsgval = ''; $signmsgval = $this->append_param($signmsgval, "inputCharset", $input_charset); $signmsgval = $this->append_param($signmsgval, "pageUrl", $page_url); $signmsgval = $this->append_param($signmsgval, "bgUrl", $bg_url); $signmsgval = $this->append_param($signmsgval, "version", $version); $signmsgval = $this->append_param($signmsgval, "language", $language); $signmsgval = $this->append_param($signmsgval, "signType", $sign_type); $signmsgval = $this->append_param($signmsgval, "merchantAcctId", $merchant_acctid); $signmsgval = $this->append_param($signmsgval, "payerName", $payer_name); $signmsgval = $this->append_param($signmsgval, "payerContactType", $payer_contact_type); $signmsgval = $this->append_param($signmsgval, "payerContact", $payer_contact); $signmsgval = $this->append_param($signmsgval, "orderId", $order_id); $signmsgval = $this->append_param($signmsgval, "orderAmount", $order_amount); $signmsgval = $this->append_param($signmsgval, "orderTime", $order_time); $signmsgval = $this->append_param($signmsgval, "productName", $product_name); $signmsgval = $this->append_param($signmsgval, "productNum", $product_num); $signmsgval = $this->append_param($signmsgval, "productId", $product_id); $signmsgval = $this->append_param($signmsgval, "productDesc", $product_desc); $signmsgval = $this->append_param($signmsgval, "ext1", $ext1); $signmsgval = $this->append_param($signmsgval, "ext2", $ext2); $signmsgval = $this->append_param($signmsgval, "payType", $pay_type); $signmsgval = $this->append_param($signmsgval, "bankId", $bank_id); $signmsgval = $this->append_param($signmsgval, "redoFlag", $redo_flag); $signmsgval = $this->append_param($signmsgval, "pid", $pid); $signmsgval = $this->append_param($signmsgval, "key", $key); $signmsg = strtoupper(md5($signmsgval)); //签名字符串 不可空 $def_url = '<div style="text-align:center"><form name="kqPay" style="text-align:center;" method="post" action="https://www.99bill.com/gateway/recvMerchantInfoAction.htm" target="_blank">'; $def_url .= "<input type='hidden' name='inputCharset' value='" . $input_charset . "' />"; $def_url .= "<input type='hidden' name='bgUrl' value='" . $bg_url . "' />"; $def_url .= "<input type='hidden' name='pageUrl' value='" . $page_url . "' />"; $def_url .= "<input type='hidden' name='version' value='" . $version . "' />"; $def_url .= "<input type='hidden' name='language' value='" . $language . "' />"; $def_url .= "<input type='hidden' name='signType' value='" . $sign_type . "' />"; $def_url .= "<input type='hidden' name='signMsg' value='" . $signmsg . "' />"; $def_url .= "<input type='hidden' name='merchantAcctId' value='" . $merchant_acctid . "' />"; $def_url .= "<input type='hidden' name='payerName' value='" . $payer_name . "' />"; $def_url .= "<input type='hidden' name='payerContactType' value='" . $payer_contact_type . "' />"; $def_url .= "<input type='hidden' name='payerContact' value='" . $payer_contact . "' />"; $def_url .= "<input type='hidden' name='orderId' value='" . $order_id . "' />"; $def_url .= "<input type='hidden' name='orderAmount' value='" . $order_amount . "' />"; $def_url .= "<input type='hidden' name='orderTime' value='" . $order_time . "' />"; $def_url .= "<input type='hidden' name='productName' value='" . $product_name . "' />"; $def_url .= "<input type='hidden' name='payType' value='" . $pay_type . "' />"; $def_url .= "<input type='hidden' name='productNum' value='" . $product_num . "' />"; $def_url .= "<input type='hidden' name='productId' value='" . $product_id . "' />"; $def_url .= "<input type='hidden' name='productDesc' value='" . $product_desc . "' />"; $def_url .= "<input type='hidden' name='ext1' value='" . $ext1 . "' />"; $def_url .= "<input type='hidden' name='ext2' value='" . $ext2 . "' />"; $def_url .= "<input type='hidden' name='bankId' value='" . $bank_id . "' />"; $def_url .= "<input type='hidden' name='redoFlag' value='" . $redo_flag ."' />"; $def_url .= "<input type='hidden' name='pid' value='" . $pid . "' />"; $def_url .= "<input type='submit' name='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "' />"; $def_url .= "</form></div></br>"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment($_GET['code']); $merchant_acctid = $payment['kq_account']; //人民币账号 不可空 $key = $payment['kq_key']; $get_merchant_acctid = trim($_REQUEST['merchantAcctId']); $pay_result = trim($_REQUEST['payResult']); $version = trim($_REQUEST['version']); $language = trim($_REQUEST['language']); $sign_type = trim($_REQUEST['signType']); $pay_type = trim($_REQUEST['payType']); $bank_id = trim($_REQUEST['bankId']); $order_id = trim($_REQUEST['orderId']); $order_time = trim($_REQUEST['orderTime']); $order_amount = trim($_REQUEST['orderAmount']); $deal_id = trim($_REQUEST['dealId']); $bank_deal_id = trim($_REQUEST['bankDealId']); $deal_time = trim($_REQUEST['dealTime']); $pay_amount = trim($_REQUEST['payAmount']); $fee = trim($_REQUEST['fee']); $ext1 = trim($_REQUEST['ext1']); $ext2 = trim($_REQUEST['ext2']); $err_code = trim($_REQUEST['errCode']); $sign_msg = trim($_REQUEST['signMsg']); //生成加密串。必须保持如下顺序。 $merchant_signmsgval = ''; $merchant_signmsgval = $this->append_param($merchant_signmsgval,"merchantAcctId",$merchant_acctid); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"version",$version); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"language",$language); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"signType",$sign_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payType",$pay_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankId",$bank_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderId",$order_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderTime",$order_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderAmount",$order_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealId",$deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankDealId",$bank_deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealTime",$deal_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payAmount",$pay_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"fee",$fee); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext1",$ext1); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext2",$ext2); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payResult",$pay_result); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"errCode",$err_code); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"key",$key); $merchant_signmsg = md5($merchant_signmsgval); //首先对获得的商户号进行比对 if ($get_merchant_acctid != $merchant_acctid) { //商户号错误 return false; } if (strtoupper($sign_msg) == strtoupper($merchant_signmsg)) { if ($pay_result == 10 || $pay_result == 00) { order_paid($ext1); return true; } else { //'支付结果失败'; return false; } } else { //'密钥校对错误'; return false; } } /** * 将变量值不为空的参数组成字符串 * @param string $strs 参数字符串 * @param string $key 参数键名 * @param string $val 参数键对应值 */ function append_param($strs,$key,$val) { if($strs != "") { if($key != '' && $val != '') { $strs .= '&' . $key . '=' . $val; } } else { if($val != '') { $strs = $key . '=' . $val; } } return $strs; } } ?>
zzshop
trunk/includes/modules/payment/kuaiqian_icbc.php
PHP
asf20
13,184
<?php /** * ECSHOP 快钱插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: kuaiqian_boc.php 15797 2009-07-24 10:46:09Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/payment/kuaiqian.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == true) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'kuaiqian_desc_boc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.99bill.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'kq_account', 'type' => 'text', 'value' => ''), array('name' => 'kq_key', 'type' => 'text', 'value' => ''), ); return; } class kuaiqian_boc { /** * 构造函数 * * @access public * @param * * @return void */ function kuaiqian_boc() { } function __construct() { $this->kuaiqian_boc(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $merchant_acctid = trim($payment['kq_account']); //人民币账号 不可空 $key = trim($payment['kq_key']); $input_charset = 1; //字符集 默认1=utf-8 $page_url = return_url(basename(__FILE__, '.php')); $bg_url = ''; $version = 'v2.0'; $language = 1; $sign_type = 1; //签名类型 不可空 固定值 1:md5 $payer_name = ''; $payer_contact_type = ''; $payer_contact = ''; $order_id = $order['order_sn']; //商户订单号 不可空 $order_amount = $order['order_amount'] * 100; //商户订单金额 不可空 $order_time = local_date('YmdHis', $order['add_time']); //商户订单提交时间 不可空 14位 $product_name = ''; $product_num = ''; $product_id = ''; $product_desc = ''; $ext1 = $order['log_id']; $ext2 = ''; $pay_type = '10'; //支付方式 不可空 $bank_id = 'BOC'; $redo_flag = '0'; $pid = ''; /* 生成加密签名串 请务必按照如下顺序和规则组成加密串!*/ $signmsgval = ''; $signmsgval = $this->append_param($signmsgval, "inputCharset", $input_charset); $signmsgval = $this->append_param($signmsgval, "pageUrl", $page_url); $signmsgval = $this->append_param($signmsgval, "bgUrl", $bg_url); $signmsgval = $this->append_param($signmsgval, "version", $version); $signmsgval = $this->append_param($signmsgval, "language", $language); $signmsgval = $this->append_param($signmsgval, "signType", $sign_type); $signmsgval = $this->append_param($signmsgval, "merchantAcctId", $merchant_acctid); $signmsgval = $this->append_param($signmsgval, "payerName", $payer_name); $signmsgval = $this->append_param($signmsgval, "payerContactType", $payer_contact_type); $signmsgval = $this->append_param($signmsgval, "payerContact", $payer_contact); $signmsgval = $this->append_param($signmsgval, "orderId", $order_id); $signmsgval = $this->append_param($signmsgval, "orderAmount", $order_amount); $signmsgval = $this->append_param($signmsgval, "orderTime", $order_time); $signmsgval = $this->append_param($signmsgval, "productName", $product_name); $signmsgval = $this->append_param($signmsgval, "productNum", $product_num); $signmsgval = $this->append_param($signmsgval, "productId", $product_id); $signmsgval = $this->append_param($signmsgval, "productDesc", $product_desc); $signmsgval = $this->append_param($signmsgval, "ext1", $ext1); $signmsgval = $this->append_param($signmsgval, "ext2", $ext2); $signmsgval = $this->append_param($signmsgval, "payType", $pay_type); $signmsgval = $this->append_param($signmsgval, "bankId", $bank_id); $signmsgval = $this->append_param($signmsgval, "redoFlag", $redo_flag); $signmsgval = $this->append_param($signmsgval, "pid", $pid); $signmsgval = $this->append_param($signmsgval, "key", $key); $signmsg = strtoupper(md5($signmsgval)); //签名字符串 不可空 $def_url = '<div style="text-align:center"><form name="kqPay" style="text-align:center;" method="post" action="https://www.99bill.com/gateway/recvMerchantInfoAction.htm" target="_blank">'; $def_url .= "<input type='hidden' name='inputCharset' value='" . $input_charset . "' />"; $def_url .= "<input type='hidden' name='bgUrl' value='" . $bg_url . "' />"; $def_url .= "<input type='hidden' name='pageUrl' value='" . $page_url . "' />"; $def_url .= "<input type='hidden' name='version' value='" . $version . "' />"; $def_url .= "<input type='hidden' name='language' value='" . $language . "' />"; $def_url .= "<input type='hidden' name='signType' value='" . $sign_type . "' />"; $def_url .= "<input type='hidden' name='signMsg' value='" . $signmsg . "' />"; $def_url .= "<input type='hidden' name='merchantAcctId' value='" . $merchant_acctid . "' />"; $def_url .= "<input type='hidden' name='payerName' value='" . $payer_name . "' />"; $def_url .= "<input type='hidden' name='payerContactType' value='" . $payer_contact_type . "' />"; $def_url .= "<input type='hidden' name='payerContact' value='" . $payer_contact . "' />"; $def_url .= "<input type='hidden' name='orderId' value='" . $order_id . "' />"; $def_url .= "<input type='hidden' name='orderAmount' value='" . $order_amount . "' />"; $def_url .= "<input type='hidden' name='orderTime' value='" . $order_time . "' />"; $def_url .= "<input type='hidden' name='productName' value='" . $product_name . "' />"; $def_url .= "<input type='hidden' name='payType' value='" . $pay_type . "' />"; $def_url .= "<input type='hidden' name='productNum' value='" . $product_num . "' />"; $def_url .= "<input type='hidden' name='productId' value='" . $product_id . "' />"; $def_url .= "<input type='hidden' name='productDesc' value='" . $product_desc . "' />"; $def_url .= "<input type='hidden' name='ext1' value='" . $ext1 . "' />"; $def_url .= "<input type='hidden' name='ext2' value='" . $ext2 . "' />"; $def_url .= "<input type='hidden' name='bankId' value='" . $bank_id . "' />"; $def_url .= "<input type='hidden' name='redoFlag' value='" . $redo_flag ."' />"; $def_url .= "<input type='hidden' name='pid' value='" . $pid . "' />"; $def_url .= "<input type='submit' name='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "' />"; $def_url .= "</form></div></br>"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment($_GET['code']); $merchant_acctid = $payment['kq_account']; //人民币账号 不可空 $key = $payment['kq_key']; $get_merchant_acctid = trim($_REQUEST['merchantAcctId']); $pay_result = trim($_REQUEST['payResult']); $version = trim($_REQUEST['version']); $language = trim($_REQUEST['language']); $sign_type = trim($_REQUEST['signType']); $pay_type = trim($_REQUEST['payType']); $bank_id = trim($_REQUEST['bankId']); $order_id = trim($_REQUEST['orderId']); $order_time = trim($_REQUEST['orderTime']); $order_amount = trim($_REQUEST['orderAmount']); $deal_id = trim($_REQUEST['dealId']); $bank_deal_id = trim($_REQUEST['bankDealId']); $deal_time = trim($_REQUEST['dealTime']); $pay_amount = trim($_REQUEST['payAmount']); $fee = trim($_REQUEST['fee']); $ext1 = trim($_REQUEST['ext1']); $ext2 = trim($_REQUEST['ext2']); $err_code = trim($_REQUEST['errCode']); $sign_msg = trim($_REQUEST['signMsg']); //生成加密串。必须保持如下顺序。 $merchant_signmsgval = ''; $merchant_signmsgval = $this->append_param($merchant_signmsgval,"merchantAcctId",$merchant_acctid); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"version",$version); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"language",$language); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"signType",$sign_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payType",$pay_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankId",$bank_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderId",$order_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderTime",$order_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderAmount",$order_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealId",$deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankDealId",$bank_deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealTime",$deal_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payAmount",$pay_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"fee",$fee); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext1",$ext1); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext2",$ext2); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payResult",$pay_result); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"errCode",$err_code); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"key",$key); $merchant_signmsg = md5($merchant_signmsgval); //首先对获得的商户号进行比对 if ($get_merchant_acctid != $merchant_acctid) { //商户号错误 return false; } if (strtoupper($sign_msg) == strtoupper($merchant_signmsg)) { if ($pay_result == 10 || $pay_result == 00) { order_paid($ext1); return true; } else { //'支付结果失败'; return false; } } else { //'密钥校对错误'; return false; } } /** * 将变量值不为空的参数组成字符串 * @param string $strs 参数字符串 * @param string $key 参数键名 * @param string $val 参数键对应值 */ function append_param($strs,$key,$val) { if($strs != "") { if($key != '' && $val != '') { $strs .= '&' . $key . '=' . $val; } } else { if($val != '') { $strs = $key . '=' . $val; } } return $strs; } } ?>
zzshop
trunk/includes/modules/payment/kuaiqian_boc.php
PHP
asf20
13,178
<?php /** * ECSHOP 货到付款插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: cod.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/cod.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'cod_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '1'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '0'; /* 支付费用,由配送决定 */ $modules[$i]['pay_fee'] = '0'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.ecshop.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array(); return; } /** * 类 */ class cod { /** * 构造函数 * * @access public * @param * * @return void */ function cod() { } function __construct() { $this->cod(); } /** * 提交函数 */ function get_code() { return ''; } /** * 处理函数 */ function response() { return; } } ?>
zzshop
trunk/includes/modules/payment/cod.php
PHP
asf20
2,208
<?php /** * ECSHOP 贝宝插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: paypal.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/paypal.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'paypal_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.paypal.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'paypal_account', 'type' => 'text', 'value' => ''), array('name' => 'paypal_currency', 'type' => 'select', 'value' => 'USD') ); return; } /** * 类 */ class paypal { /** * 构造函数 * * @access public * @param * * @return void */ function paypal() { } function __construct() { $this->paypal(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $data_order_id = $order['log_id']; $data_amount = $order['order_amount']; $data_return_url = return_url(basename(__FILE__, '.php')); $data_pay_account = $payment['paypal_account']; $currency_code = $payment['paypal_currency']; $data_notify_url = return_url(basename(__FILE__, '.php')); $cancel_return = $GLOBALS['ecs']->url(); $def_url = '<br /><form style="text-align:center;" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">' . // 不能省略 "<input type='hidden' name='cmd' value='_xclick'>" . // 不能省略 "<input type='hidden' name='business' value='$data_pay_account'>" . // 贝宝帐号 "<input type='hidden' name='item_name' value='$order[order_sn]'>" . // payment for "<input type='hidden' name='amount' value='$data_amount'>" . // 订单金额 "<input type='hidden' name='currency_code' value='$currency_code'>" . // 货币 "<input type='hidden' name='return' value='$data_return_url'>" . // 付款后页面 "<input type='hidden' name='invoice' value='$data_order_id'>" . // 订单号 "<input type='hidden' name='charset' value='utf-8'>" . // 字符集 "<input type='hidden' name='no_shipping' value='1'>" . // 不要求客户提供收货地址 "<input type='hidden' name='no_note' value=''>" . // 付款说明 "<input type='hidden' name='notify_url' value='$data_notify_url'>" . "<input type='hidden' name='rm' value='2'>" . "<input type='hidden' name='cancel_return' value='$cancel_return'>" . "<input type='submit' value='" . $GLOBALS['_LANG']['paypal_button'] . "'>" . // 按钮 "</form><br />"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment('paypal'); $merchant_id = $payment['paypal_account']; ///获取商户编号 // read the post from PayPal system and add 'cmd' $req = 'cmd=_notify-validate'; foreach ($_POST as $key => $value) { $value = urlencode(stripslashes($value)); $req .= "&$key=$value"; } // post back to PayPal system to validate $header = "POST /cgi-bin/webscr HTTP/1.0\r\n"; $header .= "Content-Type: application/x-www-form-urlencoded\r\n"; $header .= "Content-Length: " . strlen($req) ."\r\n\r\n"; $fp = fsockopen ('www.paypal.com', 80, $errno, $errstr, 30); // assign posted variables to local variables $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST['mc_currency']; $txn_id = $_POST['txn_id']; $receiver_email = $_POST['receiver_email']; $payer_email = $_POST['payer_email']; $order_sn = $_POST['invoice']; $memo = !empty($_POST['memo']) ? $_POST['memo'] : ''; $action_note = $txn_id . '(' . $GLOBALS['_LANG']['paypal_txn_id'] . ')' . $memo; if (!$fp) { fclose($fp); return false; } else { fputs($fp, $header . $req); while (!feof($fp)) { $res = fgets($fp, 1024); if (strcmp($res, 'VERIFIED') == 0) { // check the payment_status is Completed if ($payment_status != 'Completed' && $payment_status != 'Pending') { fclose($fp); return false; } // check that txn_id has not been previously processed /*$sql = "SELECT COUNT(*) FROM " . $GLOBALS['ecs']->table('order_action') . " WHERE action_note LIKE '" . mysql_like_quote($txn_id) . "%'"; if ($GLOBALS['db']->getOne($sql) > 0) { fclose($fp); return false; }*/ // check that receiver_email is your Primary PayPal email if ($receiver_email != $merchant_id) { fclose($fp); return false; } // check that payment_amount/payment_currency are correct $sql = "SELECT order_amount FROM " . $GLOBALS['ecs']->table('pay_log') . " WHERE log_id = '$order_sn'"; if ($GLOBALS['db']->getOne($sql) != $payment_amount) { fclose($fp); return false; } if ($payment['paypal_currency'] != $payment_currency) { fclose($fp); return false; } // process payment order_paid($order_sn, PS_PAYED, $action_note); fclose($fp); return true; } elseif (strcmp($res, 'INVALID') == 0) { // log for manual investigation fclose($fp); return false; } } } } } ?>
zzshop
trunk/includes/modules/payment/paypal.php
PHP
asf20
8,200
<?php /** * ECSHOP 快钱插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: kuaiqian_bcom.php 15797 2009-07-24 10:46:09Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/payment/kuaiqian.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == true) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'kuaiqian_desc_bcom'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.99bill.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'kq_account', 'type' => 'text', 'value' => ''), array('name' => 'kq_key', 'type' => 'text', 'value' => ''), ); return; } class kuaiqian_bcom { /** * 构造函数 * * @access public * @param * * @return void */ function kuaiqian_bcom() { } function __construct() { $this->kuaiqian_bcom(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $merchant_acctid = trim($payment['kq_account']); //人民币账号 不可空 $key = trim($payment['kq_key']); $input_charset = 1; //字符集 默认1=utf-8 $page_url = return_url(basename(__FILE__, '.php')); $bg_url = ''; $version = 'v2.0'; $language = 1; $sign_type = 1; //签名类型 不可空 固定值 1:md5 $payer_name = ''; $payer_contact_type = ''; $payer_contact = ''; $order_id = $order['order_sn']; //商户订单号 不可空 $order_amount = $order['order_amount'] * 100; //商户订单金额 不可空 $order_time = local_date('YmdHis', $order['add_time']); //商户订单提交时间 不可空 14位 $product_name = ''; $product_num = ''; $product_id = ''; $product_desc = ''; $ext1 = $order['log_id']; $ext2 = ''; $pay_type = '10'; //支付方式 不可空 $bank_id = 'BCOM'; $redo_flag = '0'; $pid = ''; /* 生成加密签名串 请务必按照如下顺序和规则组成加密串!*/ $signmsgval = ''; $signmsgval = $this->append_param($signmsgval, "inputCharset", $input_charset); $signmsgval = $this->append_param($signmsgval, "pageUrl", $page_url); $signmsgval = $this->append_param($signmsgval, "bgUrl", $bg_url); $signmsgval = $this->append_param($signmsgval, "version", $version); $signmsgval = $this->append_param($signmsgval, "language", $language); $signmsgval = $this->append_param($signmsgval, "signType", $sign_type); $signmsgval = $this->append_param($signmsgval, "merchantAcctId", $merchant_acctid); $signmsgval = $this->append_param($signmsgval, "payerName", $payer_name); $signmsgval = $this->append_param($signmsgval, "payerContactType", $payer_contact_type); $signmsgval = $this->append_param($signmsgval, "payerContact", $payer_contact); $signmsgval = $this->append_param($signmsgval, "orderId", $order_id); $signmsgval = $this->append_param($signmsgval, "orderAmount", $order_amount); $signmsgval = $this->append_param($signmsgval, "orderTime", $order_time); $signmsgval = $this->append_param($signmsgval, "productName", $product_name); $signmsgval = $this->append_param($signmsgval, "productNum", $product_num); $signmsgval = $this->append_param($signmsgval, "productId", $product_id); $signmsgval = $this->append_param($signmsgval, "productDesc", $product_desc); $signmsgval = $this->append_param($signmsgval, "ext1", $ext1); $signmsgval = $this->append_param($signmsgval, "ext2", $ext2); $signmsgval = $this->append_param($signmsgval, "payType", $pay_type); $signmsgval = $this->append_param($signmsgval, "bankId", $bank_id); $signmsgval = $this->append_param($signmsgval, "redoFlag", $redo_flag); $signmsgval = $this->append_param($signmsgval, "pid", $pid); $signmsgval = $this->append_param($signmsgval, "key", $key); $signmsg = strtoupper(md5($signmsgval)); //签名字符串 不可空 $def_url = '<div style="text-align:center"><form name="kqPay" style="text-align:center;" method="post" action="https://www.99bill.com/gateway/recvMerchantInfoAction.htm" target="_blank">'; $def_url .= "<input type='hidden' name='inputCharset' value='" . $input_charset . "' />"; $def_url .= "<input type='hidden' name='bgUrl' value='" . $bg_url . "' />"; $def_url .= "<input type='hidden' name='pageUrl' value='" . $page_url . "' />"; $def_url .= "<input type='hidden' name='version' value='" . $version . "' />"; $def_url .= "<input type='hidden' name='language' value='" . $language . "' />"; $def_url .= "<input type='hidden' name='signType' value='" . $sign_type . "' />"; $def_url .= "<input type='hidden' name='signMsg' value='" . $signmsg . "' />"; $def_url .= "<input type='hidden' name='merchantAcctId' value='" . $merchant_acctid . "' />"; $def_url .= "<input type='hidden' name='payerName' value='" . $payer_name . "' />"; $def_url .= "<input type='hidden' name='payerContactType' value='" . $payer_contact_type . "' />"; $def_url .= "<input type='hidden' name='payerContact' value='" . $payer_contact . "' />"; $def_url .= "<input type='hidden' name='orderId' value='" . $order_id . "' />"; $def_url .= "<input type='hidden' name='orderAmount' value='" . $order_amount . "' />"; $def_url .= "<input type='hidden' name='orderTime' value='" . $order_time . "' />"; $def_url .= "<input type='hidden' name='productName' value='" . $product_name . "' />"; $def_url .= "<input type='hidden' name='payType' value='" . $pay_type . "' />"; $def_url .= "<input type='hidden' name='productNum' value='" . $product_num . "' />"; $def_url .= "<input type='hidden' name='productId' value='" . $product_id . "' />"; $def_url .= "<input type='hidden' name='productDesc' value='" . $product_desc . "' />"; $def_url .= "<input type='hidden' name='ext1' value='" . $ext1 . "' />"; $def_url .= "<input type='hidden' name='ext2' value='" . $ext2 . "' />"; $def_url .= "<input type='hidden' name='bankId' value='" . $bank_id . "' />"; $def_url .= "<input type='hidden' name='redoFlag' value='" . $redo_flag ."' />"; $def_url .= "<input type='hidden' name='pid' value='" . $pid . "' />"; $def_url .= "<input type='submit' name='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "' />"; $def_url .= "</form></div></br>"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment($_GET['code']); $merchant_acctid = $payment['kq_account']; //人民币账号 不可空 $key = $payment['kq_key']; $get_merchant_acctid = trim($_REQUEST['merchantAcctId']); $pay_result = trim($_REQUEST['payResult']); $version = trim($_REQUEST['version']); $language = trim($_REQUEST['language']); $sign_type = trim($_REQUEST['signType']); $pay_type = trim($_REQUEST['payType']); $bank_id = trim($_REQUEST['bankId']); $order_id = trim($_REQUEST['orderId']); $order_time = trim($_REQUEST['orderTime']); $order_amount = trim($_REQUEST['orderAmount']); $deal_id = trim($_REQUEST['dealId']); $bank_deal_id = trim($_REQUEST['bankDealId']); $deal_time = trim($_REQUEST['dealTime']); $pay_amount = trim($_REQUEST['payAmount']); $fee = trim($_REQUEST['fee']); $ext1 = trim($_REQUEST['ext1']); $ext2 = trim($_REQUEST['ext2']); $err_code = trim($_REQUEST['errCode']); $sign_msg = trim($_REQUEST['signMsg']); //生成加密串。必须保持如下顺序。 $merchant_signmsgval = ''; $merchant_signmsgval = $this->append_param($merchant_signmsgval,"merchantAcctId",$merchant_acctid); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"version",$version); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"language",$language); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"signType",$sign_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payType",$pay_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankId",$bank_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderId",$order_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderTime",$order_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderAmount",$order_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealId",$deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankDealId",$bank_deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealTime",$deal_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payAmount",$pay_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"fee",$fee); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext1",$ext1); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext2",$ext2); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payResult",$pay_result); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"errCode",$err_code); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"key",$key); $merchant_signmsg = md5($merchant_signmsgval); //首先对获得的商户号进行比对 if ($get_merchant_acctid != $merchant_acctid) { //商户号错误 return false; } if (strtoupper($sign_msg) == strtoupper($merchant_signmsg)) { if ($pay_result == 10 || $pay_result == 00) { order_paid($ext1); return true; } else { //'支付结果失败'; return false; } } else { //'密钥校对错误'; return false; } } /** * 将变量值不为空的参数组成字符串 * @param string $strs 参数字符串 * @param string $key 参数键名 * @param string $val 参数键对应值 */ function append_param($strs,$key,$val) { if($strs != "") { if($key != '' && $val != '') { $strs .= '&' . $key . '=' . $val; } } else { if($val != '') { $strs = $key . '=' . $val; } } return $strs; } } ?>
zzshop
trunk/includes/modules/payment/kuaiqian_bcom.php
PHP
asf20
13,184
<?php /** * ECSHOP 快钱神州行支付插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: shenzhou.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/payment/shenzhou.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == true) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'shenzhou_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.99bill.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.1'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'shenzhou_account', 'type' => 'text', 'value' => ''), array('name' => 'shenzhou_key', 'type' => 'text', 'value' => ''), ); return; } class shenzhou { /** * 构造函数 * * @access public * @param * * @return void */ function shenzhou() { } function __construct() { $this->shenzhou(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $merchant_acctid = trim($payment['shenzhou_account']); //快钱神州行账号 不可空 $key = trim($payment['shenzhou_key']); //密钥 不可空 $input_charset = 1; //字符集 默认1=utf-8 $bg_url = ''; $page_url = $GLOBALS['ecs']->url() . 'respond.php'; $version = 'v2.0'; $language = 1; $sign_type = 1; //签名类型 不可空 固定值 1:md5 $payer_name = ''; $payer_contact_type = ''; $payer_contact = ''; $order_id = $order['order_sn']; //商户订单号 不可空 $order_amount = $order['order_amount'] * 100; //商户订单金额 不可空 $pay_type = '00'; //支付方式 不可空 $card_number = ''; $card_pwd = ''; $full_amount_flag = '0'; $order_time = local_date('YmdHis', $order['add_time']); //商户订单提交时间 不可空 14位 $product_name = ''; $product_num = ''; $product_id = ''; $product_desc = ''; $ext1 = $order['log_id']; $ext2 = 'ecshop'; /* 生成加密签名串 请务必按照如下顺序和规则组成加密串!*/ $signmsgval = ''; $signmsgval = $this->append_param($signmsgval, "inputCharset", $input_charset); $signmsgval = $this->append_param($signmsgval, "bgUrl", $bg_url); $signmsgval = $this->append_param($signmsgval, "pageUrl", $page_url); $signmsgval = $this->append_param($signmsgval, "version", $version); $signmsgval = $this->append_param($signmsgval, "language", $language); $signmsgval = $this->append_param($signmsgval, "signType", $sign_type); $signmsgval = $this->append_param($signmsgval, "merchantAcctId", $merchant_acctid); $signmsgval = $this->append_param($signmsgval, "payerName", urlencode($payer_name)); $signmsgval = $this->append_param($signmsgval, "payerContactType", $payer_contact_type); $signmsgval = $this->append_param($signmsgval, "payerContact", $payer_contact); $signmsgval = $this->append_param($signmsgval, "orderId", $order_id); $signmsgval = $this->append_param($signmsgval, "orderAmount", $order_amount); $signmsgval = $this->append_param($signmsgval, "payType", $pay_type); $signmsgval = $this->append_param($signmsgval, "cardNumber", $card_number); $signmsgval = $this->append_param($signmsgval, "cardPwd", $card_pwd); $signmsgval = $this->append_param($signmsgval, "fullAmountFlag", $full_amount_flag); $signmsgval = $this->append_param($signmsgval, "orderTime", $order_time); $signmsgval = $this->append_param($signmsgval, "productName", urlencode($product_name)); $signmsgval = $this->append_param($signmsgval, "productNum", $product_num); $signmsgval = $this->append_param($signmsgval, "productId", $product_id); $signmsgval = $this->append_param($signmsgval, "productDesc", urlencode($product_desc)); $signmsgval = $this->append_param($signmsgval, "ext1", urlencode($ext1)); $signmsgval = $this->append_param($signmsgval, "ext2", urlencode($ext2)); $signmsgval = $this->append_param($signmsgval, "key", $key); $sign_msg = strtoupper(md5($signmsgval)); //安全校验域 不可空 $def_url = '<div style="text-align:center"><form name="kqPay" style="text-align:center;" method="post"'. 'action="https://www.99bill.com/szxgateway/recvMerchantInfoAction.htm" target="_blank">'; $def_url .= "<input type= 'hidden' name='inputCharset' value='" . $input_charset . "' />"; $def_url .= "<input type='hidden' name='bgUrl' value='" . $bg_url . "' />"; $def_url .= "<input type='hidden' name='pageUrl' value='" . $page_url . "' />"; $def_url .= "<input type='hidden' name='version' value='" . $version . "' />"; $def_url .= "<input type='hidden' name='language' value='" . $language . "' />"; $def_url .= "<input type='hidden' name='signType' value='" . $sign_type . "' />"; $def_url .= "<input type='hidden' name='merchantAcctId' value='" . $merchant_acctid . "' />"; $def_url .= "<input type='hidden' name='payerName' value='" . $payer_name . "' />"; $def_url .= "<input type='hidden' name='payerContactType' value='" . $payer_contact_type . "' />"; $def_url .= "<input type='hidden' name='payerContact' value='" . $payer_contact . "' />"; $def_url .= "<input type='hidden' name='orderId' value='" . $order_id . "' />"; $def_url .= "<input type='hidden' name='orderAmount' value='" . $order_amount . "' />"; $def_url .= "<input type='hidden' name='payType' value='" . $pay_type . "' />"; $def_url .= "<input type='hidden' name='cardNumber' value='" . $card_number . "' />"; $def_url .= "<input type='hidden' name='cardPwd' value='" . $card_pwd . "' />"; $def_url .= "<input type='hidden' name='fullAmountFlag' value='" .$full_amount_flag ."' />"; $def_url .= "<input type='hidden' name='orderTime' value='" . $order_time . "' />"; $def_url .= "<input type='hidden' name='productName' value='" . urlencode($product_name) . "' />"; $def_url .= "<input type='hidden' name='productNum' value='" . $product_num . "' />"; $def_url .= "<input type='hidden' name='productId' value='" . $product_id . "' />"; $def_url .= "<input type='hidden' name='productDesc' value='" . urlencode($product_desc) . "' />"; $def_url .= "<input type='hidden' name='ext1' value='" . urlencode($ext1) . "' />"; $def_url .= "<input type='hidden' name='ext2' value='" . urlencode($ext2) . "' />"; $def_url .= "<input type='hidden' name='signMsg' value='" . $sign_msg ."' />"; $def_url .= "<input type='submit' name='submit' value='".$GLOBALS['_LANG']['pay_button']."' />"; $def_url .= "</form></div><br />"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment(basename(__FILE__, '.php')); $merchant_acctid = $payment['shenzhou_account']; //收款帐号 不可空 $key = $payment['shenzhou_key']; $get_merchant_acctid = trim($_REQUEST['merchantAcctId']); //接收的收款帐号 $pay_result = trim($_REQUEST['payResult']); $version = trim($_REQUEST['version']); $language = trim($_REQUEST['language']); $sign_type = trim($_REQUEST['signType']); $pay_type = trim($_REQUEST['payType']); //20代表神州行卡密直接支付;22代表快钱账户神州行余额支付 $card_umber = trim($_REQUEST['cardNumber']); $card_pwd = trim($_REQUEST['cardPwd']); $order_id = trim($_REQUEST['orderId']); //订单号 $order_time = trim($_REQUEST['orderTime']); $order_amount = trim($_REQUEST['orderAmount']); $deal_id = trim($_REQUEST['dealId']); //获取该交易在快钱的交易号 $ext1 = trim($_REQUEST['ext1']); $ext2 = trim($_REQUEST['ext2']); $pay_amount = trim($_REQUEST['payAmount']); //获取实际支付金额 $bill_order_time = trim($_REQUEST['billOrderTime']); $pay_result = trim($_REQUEST['payResult']); //10代表支付成功; 11代表支付失败 $sign_type = trim($_REQUEST['signType']); $sign_msg = trim($_REQUEST['signMsg']); //生成加密串。必须保持如下顺序。 $merchant_signmsgval = $this->append_param($merchant_signmsgval, "merchantAcctId", $merchant_acctid); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "version", $version); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "language", $language); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "payType", $pay_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "cardNumber", $card_number); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "cardPwd", $card_pwd); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "orderId", $order_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "orderAmount", $order_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "dealId", $deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "orderTime", $order_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "ext1", $ext1); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "ext2", $ext2); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "payAmount", $pay_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "billOrderTime", $bill_order_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "payResult", $pay_result); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "signType", $sign_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval, "key", $key); $merchant_signmsg = md5($merchant_signmsgval); //首先对获得的商户号进行比对 if ($get_merchant_acctid != $merchant_acctid) { //'商户号错误'; return false; } if (strtoupper($sign_msg) == strtoupper($merchant_signmsg)) { if ($pay_result == 10) //有成功支付的结果返回10 { order_paid($ext1); return true; } elseif ($pay_result == 11 && $pay_amount > 0) { $sql = "SELECT order_amount FROM " . $GLOBALS['ecs']->table('order_info') ."WHERE order_id = '$order_id'"; $get_order_amount = $GLOBALS['db']->getOne($sql); if ($get_order_amount == $pay_amount && $get_order_amount == $order_amount) //检查订单金额、实际支付金额和订单是否相等 { order_paid($ext1); return true; } elseif ($get_order_amount == $order_amount && $pay_amount > 0) //订单金额相等 实际支付金额 > 0的情况 { $surplus_amount = $get_order_amount - $pay_amount; //计算订单剩余金额 $sql = 'UPDATE' . $GLOBALS['ecs']->table('order_info') . "SET `money_paid` = (money_paid + '$pay_amount')," . " order_amount = (order_amount - '$pay_amount') WHERE order_id = '$order_id'"; $result = $GLOBALS['db']->query($sql); $sql = 'UPDATE' . $GLOBALS['ecs']->table('order_info') . "SET `order_status` ='" . OS_CONFIRMED . "' WHERE order_id = '$orderId'"; $result = $GLOBALS['db']->query($sql); //order_paid($orderId, PS_UNPAYED); //'订单金额小于0'; return false; } else { //'订单金额不相等'; return false; } } else { //'实际支付金额不能小于0'; return false; } } else { //'签名校对错误'; return false; } } /** * 将变量值不为空的参数组成字符串 * @param string $strs 参数字符串 * @param string $key 参数键名 * @param string $val 参数键对应值 */ function append_param($strs,$key,$val) { if($strs != "") { if($val != "") { $strs .= '&' . $key . '=' . $val; } } else { if($val != "") { $strs = $key . '=' . $val; } } return $strs; } } ?>
zzshop
trunk/includes/modules/payment/shenzhou.php
PHP
asf20
15,209
<?php /** * ECSHOP 财付通中介担保支付插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: tenpayc2c.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/tenpayc2c.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'tenpay_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.tenpay.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'tenpay_account', 'type' => 'text', 'value' => ''), array('name' => 'tenpay_key', 'type' => 'text', 'value' => ''), array('name' => 'tenpay_type', 'type' => 'select', 'value'=>'1'), ); return; } /** * 类 */ class tenpayc2c { /** * 构造函数 * * @access public * @param * * @return void */ function tenpayc2c() { } function __construct() { $this->tenpayc2c(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { /* 版本号 */ $version = '2'; /* 任务代码,定值:12 */ $cmdno = '12'; /* 编码标准 */ if (!defined('EC_CHARSET')) { $encode_type = 2; } else { if (EC_CHARSET == 'utf-8') { $encode_type = 2; } else { $encode_type = 1; } } /* 平台提供者,代理商的财付通账号 */ $chnid = $payment['tenpay_account']; /* 收款方财付通账号 */ $seller = $payment['tenpay_account']; /* 商品名称 */ if (!empty($order['order_id'])) { //$mch_name = get_goods_name_by_id($order['order_id']); $mch_name = $order['order_sn']; } else { $mch_name = $GLOBALS['_LANG']['account_voucher']; } /* 总金额 */ $mch_price = floatval($order['order_amount']) * 100; /* 物流配送说明 */ $transport_desc = ''; $transport_fee = ''; /* 交易说明 */ $mch_desc = $GLOBALS['_LANG']['shop_order_sn'] . $order['order_sn']; $need_buyerinfo = '2' ; /* 交易类型:2、虚拟交易,1、实物交易 */ $mch_type = $payment['tenpay_type']; /* 获得订单的流水号,补零到10位 */ $mch_vno = $order['order_sn']; /* 返回的路径 */ $mch_returl = return_url('tenpayc2c'); $show_url = return_url('tenpayc2c'); $attach = ''; /* 数字签名 */ $sign_text = "chnid=" . $chnid . "&cmdno=" . $cmdno . "&encode_type=" . $encode_type . "&mch_desc=" . $mch_desc . "&mch_name=" . $mch_name . "&mch_price=" . $mch_price ."&mch_returl=" . $mch_returl . "&mch_type=" . $mch_type . "&mch_vno=" . $mch_vno . "&need_buyerinfo=" . $need_buyerinfo ."&seller=" . $seller . "&show_url=" . $show_url . "&version=" . $version . "&key=" . $payment['tenpay_key']; $sign =md5($sign_text); /* 交易参数 */ $parameter = array( 'attach' => $attach, 'chnid' => $chnid, 'cmdno' => $cmdno, // 业务代码, 财付通支付支付接口填 1 'encode_type' => $encode_type, //编码标准 'mch_desc' => $mch_desc, 'mch_name' => $mch_name, 'mch_price' => $mch_price, // 订单金额 'mch_returl' => $mch_returl, // 接收财付通返回结果的URL 'mch_type' => $mch_type, //交易类型 'mch_vno' => $mch_vno, // 交易号(订单号),由商户网站产生(建议顺序累加) 'need_buyerinfo' => $need_buyerinfo, //是否需要在财付通填定物流信息 'seller' => $seller, // 商家的财付通商户号 'show_url' => $show_url, 'transport_desc' => $transport_desc, 'transport_fee' => $transport_fee, 'version' => $version, //版本号 2 'sign' => $sign, // MD5签名 'sys_id' => '542554970' //ecshop C账号 不参与签名 ); $button = '<br /><form style="text-align:center;" action="https://www.tenpay.com/cgi-bin/med/show_opentrans.cgi " target="_blank" style="margin:0px;padding:0px" >'; foreach ($parameter AS $key=>$val) { $button .= "<input type='hidden' name='$key' value='$val' />"; } $button .= '<input type="image" src="'. $GLOBALS['ecs']->url() .'images/tenpayc2c.jpg" value="' .$GLOBALS['_LANG']['pay_button']. '" /></form><br />'; return $button; } /** * 响应操作 */ function respond() { /*取返回参数*/ $cmd_no = $_GET['cmdno']; $retcode = $_GET['retcode']; $status = $_GET['status']; $seller = $_GET['seller']; $total_fee = $_GET['total_fee']; $trade_price = $_GET['trade_price']; $transport_fee = $_GET['transport_fee']; $buyer_id = $_GET['buyer_id']; $chnid = $_GET['chnid']; $cft_tid = $_GET['cft_tid']; $mch_vno = $_GET['mch_vno']; $attach = !empty($_GET['attach']) ? $_GET['attach'] : ''; $version = $_GET['version']; $sign = $_GET['sign']; $payment = get_payment('tenpayc2c'); $log_id = get_order_id_by_sn($mch_vno); //$log_id = str_replace($attach, '', $mch_vno); //取得支付的log_id /* 如果$retcode大于0则表示支付失败 */ if ($retcode > 0) { //echo '操作失败'; return false; } /* 检查支付的金额是否相符 */ if (!check_money($log_id, $total_fee / 100)) { //echo '金额不相等'; return false; } /* 检查数字签名是否正确 */ $sign_text = "buyer_id=" . $buyer_id . "&cft_tid=" . $cft_tid . "&chnid=" . $chnid . "&cmdno=" . $cmd_no . "&mch_vno=" . $mch_vno . "&retcode=" . $retcode . "&seller=" .$seller . "&status=" . $status . "&total_fee=" . $total_fee . "&trade_price=" . $trade_price . "&transport_fee=" . $transport_fee . "&version=" . $version . "&key=" . $payment['tenpay_key']; $sign_md5 = strtoupper(md5($sign_text)); if ($sign_md5 != $sign) { //echo '签名错误'; return false; } elseif ($status = 3) { /* 改变订单状态为已付款 */ order_paid($log_id, PS_PAYING); return true; } else { //为止error return false; } } } ?>
zzshop
trunk/includes/modules/payment/tenpayc2c.php
PHP
asf20
8,679
<?php /** * ECSHOP 余额支付插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: balance.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/balance.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'balance_desc'; /* 是否货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.ecshop.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array(); return; } /** * 类 */ class balance { /** * 构造函数 * * @access public * @param * * @return void */ function balance() { } function __construct() { $this->balance(); } /** * 提交函数 */ function get_code() { return ''; } /** * 处理函数 */ function response() { return; } } ?>
zzshop
trunk/includes/modules/payment/balance.php
PHP
asf20
2,146
<?php /** * ECSHOP paypal快速结帐 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: paypal_ec.php 16489 2009-08-03 10:14:03Z liuhui $ */ define('API_ENDPOINT', 'https://api-3t.paypal.com/nvp'); define('USE_PROXY',FALSE); define('PROXY_HOST', '127.0.0.1'); define('PROXY_PORT', '808'); define('PAYPAL_URL', 'https://www.paypal.com/cgi-bin/webscr&cmd=_express-checkout&token='); $API_Endpoint =API_ENDPOINT; $version=VERSION; if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/paypal_ec.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'paypal_ec_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.paypal.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'paypal_ec_username', 'type' => 'text', 'value' => ''), array('name' => 'paypal_ec_password', 'type' => 'text', 'value' => ''), array('name' => 'paypal_ec_signature', 'type' => 'text', 'value' => ''), array('name' => 'paypal_ec_currency', 'type' => 'select', 'value' => 'USD') ); return; } /** * 类 */ class paypal_ec { /** * 构造函数 * * @access public * @param * * @return void */ function paypal_ec() { } function __construct() { $this->paypal_ec(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $token = ''; $serverName = $_SERVER['SERVER_NAME']; $serverPort = $_SERVER['SERVER_PORT']; $url=dirname('http://'.$serverName.':'.$serverPort.$_SERVER['REQUEST_URI']); $paymentAmount=$order['order_amount']; $currencyCodeType=$payment['paypal_ec_currency']; $paymentType='Sale'; $data_order_id = $order['log_id']; $_SESSION['paypal_username']=$payment['paypal_ec_username']; $_SESSION['paypal_password']=$payment['paypal_ec_password']; $_SESSION['paypal_signature']=$payment['paypal_ec_signature']; $returnURL =urlencode($url.'/respond.php?code=paypal_ec&currencyCodeType='.$currencyCodeType.'&paymentType='.$paymentType.'&paymentAmount='.$paymentAmount.'&invoice='.$data_order_id); $cancelURL =urlencode("$url/SetExpressCheckout.php?paymentType=$paymentType" ); $nvpstr="&Amt=".$paymentAmount."&PAYMENTACTION=".$paymentType."&ReturnUrl=".$returnURL."&CANCELURL=".$cancelURL ."&CURRENCYCODE=".$currencyCodeType ."&ButtonSource=ECSHOP_cart_EC_C2"; $resArray=$this->hash_call("SetExpressCheckout",$nvpstr); $_SESSION['reshash']=$resArray; if(isset($resArray["ACK"])) { $ack = strtoupper($resArray["ACK"]); } if (isset($resArray["TOKEN"])) { $token = urldecode($resArray["TOKEN"]); } $payPalURL = PAYPAL_URL.$token; $button = '<div style="text-align:center"><input type="button" onclick="window.open(\''.$payPalURL. '\')" value="' .$GLOBALS['_LANG']['pay_button']. '"/></div>'; return $button; } /** * 响应操作 */ function respond() { $order_sn = $_REQUEST['invoice']; $token =urlencode( $_REQUEST['token']); $nvpstr="&TOKEN=".$token; $resArray=$this->hash_call("GetExpressCheckoutDetails",$nvpstr); $_SESSION['reshash']=$resArray; $ack = strtoupper($resArray["ACK"]); if($ack=="SUCCESS") { $_SESSION['token']=$_REQUEST['token']; $_SESSION['payer_id'] = $_REQUEST['PayerID']; $_SESSION['paymentAmount']=$_REQUEST['paymentAmount']; $_SESSION['currCodeType']=$_REQUEST['currencyCodeType']; $_SESSION['paymentType']=$_REQUEST['paymentType']; $resArray=$_SESSION['reshash']; $token =urlencode( $_SESSION['token']); $paymentAmount =urlencode ($_SESSION['paymentAmount']); $paymentType = urlencode($_SESSION['paymentType']); $currCodeType = urlencode($_SESSION['currCodeType']); $payerID = urlencode($_SESSION['payer_id']); $serverName = urlencode($_SERVER['SERVER_NAME']); $nvpstr='&TOKEN='.$token.'&PAYERID='.$payerID.'&PAYMENTACTION='.$paymentType.'&AMT='.$paymentAmount.'&CURRENCYCODE='.$currCodeType.'&IPADDRESS='.$serverName ; $resArray=$this->hash_call("DoExpressCheckoutPayment",$nvpstr); $ack = strtoupper($resArray["ACK"]); if($ack=="SUCCESS") { /* 改变订单状态 */ order_paid($order_sn, 2); return true; } else { return false; } } else { return false; } } function hash_call($methodName,$nvpStr) { global $API_Endpoint; $version='53.0'; $API_UserName=$_SESSION['paypal_username']; $API_Password=$_SESSION['paypal_password']; $API_Signature=$_SESSION['paypal_signature']; $nvp_Header; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$API_Endpoint); curl_setopt($ch, CURLOPT_VERBOSE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_POST, 1); if(USE_PROXY) { curl_setopt ($ch, CURLOPT_PROXY, PROXY_HOST.":".PROXY_PORT); } $nvpreq="METHOD=".urlencode($methodName)."&VERSION=".urlencode($version)."&PWD=".urlencode($API_Password)."&USER=".urlencode($API_UserName)."&SIGNATURE=".urlencode($API_Signature).$nvpStr; curl_setopt($ch,CURLOPT_POSTFIELDS,$nvpreq); $response = curl_exec($ch); $nvpResArray=$this->deformatNVP($response); $nvpReqArray=$this->deformatNVP($nvpreq); $_SESSION['nvpReqArray']=$nvpReqArray; if (curl_errno($ch)) { $_SESSION['curl_error_no']=curl_errno($ch) ; $_SESSION['curl_error_msg']=curl_error($ch); } else { curl_close($ch); } return $nvpResArray; } function deformatNVP($nvpstr) { $intial=0; $nvpArray = array(); while(strlen($nvpstr)) { $keypos= strpos($nvpstr,'='); $valuepos = strpos($nvpstr,'&') ? strpos($nvpstr,'&'): strlen($nvpstr); $keyval=substr($nvpstr,$intial,$keypos); $valval=substr($nvpstr,$keypos+1,$valuepos-$keypos-1); $nvpArray[urldecode($keyval)] =urldecode( $valval); $nvpstr=substr($nvpstr,$valuepos+1,strlen($nvpstr)); } return $nvpArray; } } ?>
zzshop
trunk/includes/modules/payment/paypal_ec.php
PHP
asf20
8,427
<?php /** * ECSHOP YeePay易宝银行直付插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: yeepay_ccb.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/yeepay.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'yp_ccb_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.yeepay.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.1'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'yp_account', 'type' => 'text', 'value' => ''), array('name' => 'yp_key', 'type' => 'text', 'value' => ''), ); return; } /** * 类 */ class yeepay_ccb { /** * 构造函数 * * @access public * @param * * @return void */ function yeepay_ccb() { $this->frpid = 'CCB-NET'; } function __construct() { $this->yeepay_ccb(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $data_merchant_id = $payment['yp_account']; $data_order_id = $order['order_sn']; $data_amount = $order['order_amount']; $message_type = 'Buy'; $data_cur = 'CNY'; $product_id = ''; $product_cat = ''; $product_desc = ''; $address_flag = '0'; $data_return_url = return_url(basename(__FILE__, '.php')); $data_pay_key = $payment['yp_key']; $data_pay_account = $payment['yp_account']; $mct_properties = $order['log_id']; $def_url = $message_type . $data_merchant_id . $data_order_id . $data_amount . $data_cur . $product_id . $product_cat . $product_desc . $data_return_url . $address_flag . $mct_properties . $this->frpid; $MD5KEY = hmac($def_url, $data_pay_key); $def_url = "\n<form action='https://www.yeepay.com/app-merchant-proxy/node' method='post' target='_blank'>\n"; $def_url .= "<input type='hidden' name='p0_Cmd' value='".$message_type."'>\n"; $def_url .= "<input type='hidden' name='p1_MerId' value='".$data_merchant_id."'>\n"; $def_url .= "<input type='hidden' name='p2_Order' value='".$data_order_id."'>\n"; $def_url .= "<input type='hidden' name='p3_Amt' value='".$data_amount."'>\n"; $def_url .= "<input type='hidden' name='p4_Cur' value='".$data_cur."'>\n"; $def_url .= "<input type='hidden' name='p5_Pid' value='".$product_id."'>\n"; $def_url .= "<input type='hidden' name='p6_Pcat' value='".$product_cat."'>\n"; $def_url .= "<input type='hidden' name='p7_Pdesc' value='".$product_desc."'>\n"; $def_url .= "<input type='hidden' name='p8_Url' value='".$data_return_url."'>\n"; $def_url .= "<input type='hidden' name='p9_SAF' value='".$address_flag."'>\n"; $def_url .= "<input type='hidden' name='pa_MP' value='".$mct_properties."'>\n"; $def_url .= "<input type='hidden' name='pd_FrpId' value='" . $this->frpid . "'>\n"; $def_url .= "<input type='hidden' name='pd_NeedResponse' value='1'>\n"; $def_url .= "<input type='hidden' name='hmac' value='".$MD5KEY."'>\n"; $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form>\n"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment('yeepay_ccb'); $merchant_id = $payment['yp_account']; // 获取商户编号 $merchant_key = $payment['yp_key']; // 获取秘钥 $message_type = trim($_REQUEST['r0_Cmd']); $succeed = trim($_REQUEST['r1_Code']); // 获取交易结果,1成功,-1失败 $trxId = trim($_REQUEST['r2_TrxId']); $amount = trim($_REQUEST['r3_Amt']); // 获取订单金额 $cur = trim($_REQUEST['r4_Cur']); // 获取订单货币单位 $product_id = trim($_REQUEST['r5_Pid']); // 获取产品ID $orderid = trim($_REQUEST['r6_Order']); // 获取订单ID $userId = trim($_REQUEST['r7_Uid']); // 获取产品ID $merchant_param = trim($_REQUEST['r8_MP']); // 获取商户私有参数 $bType = trim($_REQUEST['r9_BType']); // 获取订单ID $mac = trim($_REQUEST['hmac']); // 获取安全加密串 ///生成加密串,注意顺序 $ScrtStr = $merchant_id . $message_type . $succeed . $trxId . $amount . $cur . $product_id . $orderid . $userId . $merchant_param . $bType; $mymac = hmac($ScrtStr, $merchant_key); $v_result = false; if (strtoupper($mac) == strtoupper($mymac)) { if ($succeed == '1') { ///支付成功 $v_result = true; $order_id = str_replace($orderid, '', $product_id); order_paid($merchant_param); } } return $v_result; } } if (!function_exists("hmac")) { function hmac($data, $key) { // RFC 2104 HMAC implementation for php. // Creates an md5 HMAC. // Eliminates the need to install mhash to compute a HMAC // Hacked by Lance Rushing(NOTE: Hacked means written) $key = ecs_iconv('GB2312', 'UTF8', $key); $data = ecs_iconv('GB2312', 'UTF8', $data); $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack('H*', md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad ; $k_opad = $key ^ $opad; return md5($k_opad . pack('H*', md5($k_ipad . $data))); } } ?>
zzshop
trunk/includes/modules/payment/yeepay_ccb.php
PHP
asf20
7,357
<?php /** * ECSHOP 银行汇款(转帐)插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: bank.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/bank.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'bank_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '0'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.ecshop.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array(); return; } /** * 类 */ class bank { /** * 构造函数 * * @access public * @param * * @return void */ function bank() { } function __construct() { $this->bank(); } /** * 提交函数 */ function get_code() { return ''; } /** * 处理函数 */ function response() { return; } } ?>
zzshop
trunk/includes/modules/payment/bank.php
PHP
asf20
2,146
<?php /** * ECSHOP YeePay易宝银行直付插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: yeepay_abchina.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/yeepay.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'yp_abc_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.yeepay.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.1'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'yp_account', 'type' => 'text', 'value' => ''), array('name' => 'yp_key', 'type' => 'text', 'value' => ''), ); return; } /** * 类 */ class yeepay_abchina { /** * 构造函数 * * @access public * @param * * @return void */ function yeepay_abchina() { $this->frpid = 'ABC-NET'; } function __construct() { $this->yeepay_abchina(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $data_merchant_id = $payment['yp_account']; $data_order_id = $order['order_sn']; $data_amount = $order['order_amount']; $message_type = 'Buy'; $data_cur = 'CNY'; $product_id = ''; $product_cat = ''; $product_desc = ''; $address_flag = '0'; $data_return_url = return_url(basename(__FILE__, '.php')); $data_pay_key = $payment['yp_key']; $data_pay_account = $payment['yp_account']; $mct_properties = $order['log_id']; $def_url = $message_type . $data_merchant_id . $data_order_id . $data_amount . $data_cur . $product_id . $product_cat . $product_desc . $data_return_url . $address_flag . $mct_properties . $this->frpid; $MD5KEY = hmac($def_url, $data_pay_key); $def_url = "\n<form action='https://www.yeepay.com/app-merchant-proxy/node' method='post' target='_blank'>\n"; $def_url .= "<input type='hidden' name='p0_Cmd' value='".$message_type."'>\n"; $def_url .= "<input type='hidden' name='p1_MerId' value='".$data_merchant_id."'>\n"; $def_url .= "<input type='hidden' name='p2_Order' value='".$data_order_id."'>\n"; $def_url .= "<input type='hidden' name='p3_Amt' value='".$data_amount."'>\n"; $def_url .= "<input type='hidden' name='p4_Cur' value='".$data_cur."'>\n"; $def_url .= "<input type='hidden' name='p5_Pid' value='".$product_id."'>\n"; $def_url .= "<input type='hidden' name='p6_Pcat' value='".$product_cat."'>\n"; $def_url .= "<input type='hidden' name='p7_Pdesc' value='".$product_desc."'>\n"; $def_url .= "<input type='hidden' name='p8_Url' value='".$data_return_url."'>\n"; $def_url .= "<input type='hidden' name='p9_SAF' value='".$address_flag."'>\n"; $def_url .= "<input type='hidden' name='pa_MP' value='".$mct_properties."'>\n"; $def_url .= "<input type='hidden' name='pd_FrpId' value='" . $this->frpid . "'>\n"; $def_url .= "<input type='hidden' name='pd_NeedResponse' value='1'>\n"; $def_url .= "<input type='hidden' name='hmac' value='".$MD5KEY."'>\n"; $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form>\n"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment('yeepay_abchina'); $merchant_id = $payment['yp_account']; // 获取商户编号 $merchant_key = $payment['yp_key']; // 获取秘钥 $message_type = trim($_REQUEST['r0_Cmd']); $succeed = trim($_REQUEST['r1_Code']); // 获取交易结果,1成功,-1失败 $trxId = trim($_REQUEST['r2_TrxId']); $amount = trim($_REQUEST['r3_Amt']); // 获取订单金额 $cur = trim($_REQUEST['r4_Cur']); // 获取订单货币单位 $product_id = trim($_REQUEST['r5_Pid']); // 获取产品ID $orderid = trim($_REQUEST['r6_Order']); // 获取订单ID $userId = trim($_REQUEST['r7_Uid']); // 获取产品ID $merchant_param = trim($_REQUEST['r8_MP']); // 获取商户私有参数 $bType = trim($_REQUEST['r9_BType']); // 获取订单ID $mac = trim($_REQUEST['hmac']); // 获取安全加密串 ///生成加密串,注意顺序 $ScrtStr = $merchant_id . $message_type . $succeed . $trxId . $amount . $cur . $product_id . $orderid . $userId . $merchant_param . $bType; $mymac = hmac($ScrtStr, $merchant_key); $v_result = false; if (strtoupper($mac) == strtoupper($mymac)) { if ($succeed == '1') { ///支付成功 $v_result = true; order_paid($merchant_param); } } return $v_result; } } if (!function_exists("hmac")) { function hmac($data, $key) { // RFC 2104 HMAC implementation for php. // Creates an md5 HMAC. // Eliminates the need to install mhash to compute a HMAC // Hacked by Lance Rushing(NOTE: Hacked means written) $key = ecs_iconv('GB2312', 'UTF8', $key); $data = ecs_iconv('GB2312', 'UTF8', $data); $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack('H*', md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad ; $k_opad = $key ^ $opad; return md5($k_opad . pack('H*', md5($k_ipad . $data))); } } ?>
zzshop
trunk/includes/modules/payment/yeepay_abchina.php
PHP
asf20
7,308
<?php /** * ECSHOP 快钱插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: kuaiqian.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/payment/kuaiqian.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == true) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'kuaiqian_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.99bill.com'; /* 版本号 */ $modules[$i]['version'] = '1.2'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'kq_account', 'type' => 'text', 'value' => ''), array('name' => 'kq_key', 'type' => 'text', 'value' => ''), ); return; } class kuaiqian { /** * 构造函数 * * @access public * @param * * @return void */ function kuaiqian() { } function __construct() { $this->kuaiqian(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $merchant_acctid = trim($payment['kq_account']); //人民币账号 不可空 $key = trim($payment['kq_key']); $input_charset = 1; //字符集 默认1=utf-8 $page_url = return_url(basename(__FILE__, '.php')); $bg_url = ''; $version = 'v2.0'; $language = 1; $sign_type = 1; //签名类型 不可空 固定值 1:md5 $payer_name = ''; $payer_contact_type = ''; $payer_contact = ''; $order_id = $order['order_sn']; //商户订单号 不可空 $order_amount = $order['order_amount'] * 100; //商户订单金额 不可空 $order_time = local_date('YmdHis', $order['add_time']); //商户订单提交时间 不可空 14位 $product_name = ''; $product_num = ''; $product_id = ''; $product_desc = ''; $ext1 = $order['log_id']; $ext2 = ''; $pay_type = '00'; //支付方式 不可空 $bank_id = ''; $redo_flag = '0'; $pid = ''; /* 生成加密签名串 请务必按照如下顺序和规则组成加密串!*/ $signmsgval = ''; $signmsgval = $this->append_param($signmsgval, "inputCharset", $input_charset); $signmsgval = $this->append_param($signmsgval, "pageUrl", $page_url); $signmsgval = $this->append_param($signmsgval, "bgUrl", $bg_url); $signmsgval = $this->append_param($signmsgval, "version", $version); $signmsgval = $this->append_param($signmsgval, "language", $language); $signmsgval = $this->append_param($signmsgval, "signType", $sign_type); $signmsgval = $this->append_param($signmsgval, "merchantAcctId", $merchant_acctid); $signmsgval = $this->append_param($signmsgval, "payerName", $payer_name); $signmsgval = $this->append_param($signmsgval, "payerContactType", $payer_contact_type); $signmsgval = $this->append_param($signmsgval, "payerContact", $payer_contact); $signmsgval = $this->append_param($signmsgval, "orderId", $order_id); $signmsgval = $this->append_param($signmsgval, "orderAmount", $order_amount); $signmsgval = $this->append_param($signmsgval, "orderTime", $order_time); $signmsgval = $this->append_param($signmsgval, "productName", $product_name); $signmsgval = $this->append_param($signmsgval, "productNum", $product_num); $signmsgval = $this->append_param($signmsgval, "productId", $product_id); $signmsgval = $this->append_param($signmsgval, "productDesc", $product_desc); $signmsgval = $this->append_param($signmsgval, "ext1", $ext1); $signmsgval = $this->append_param($signmsgval, "ext2", $ext2); $signmsgval = $this->append_param($signmsgval, "payType", $pay_type); $signmsgval = $this->append_param($signmsgval, "bankId", $bank_id); $signmsgval = $this->append_param($signmsgval, "redoFlag", $redo_flag); $signmsgval = $this->append_param($signmsgval, "pid", $pid); $signmsgval = $this->append_param($signmsgval, "key", $key); $signmsg = strtoupper(md5($signmsgval)); //签名字符串 不可空 $def_url = '<div style="text-align:center"><form name="kqPay" style="text-align:center;" method="post" action="https://www.99bill.com/gateway/recvMerchantInfoAction.htm" target="_blank">'; $def_url .= "<input type='hidden' name='inputCharset' value='" . $input_charset . "' />"; $def_url .= "<input type='hidden' name='bgUrl' value='" . $bg_url . "' />"; $def_url .= "<input type='hidden' name='pageUrl' value='" . $page_url . "' />"; $def_url .= "<input type='hidden' name='version' value='" . $version . "' />"; $def_url .= "<input type='hidden' name='language' value='" . $language . "' />"; $def_url .= "<input type='hidden' name='signType' value='" . $sign_type . "' />"; $def_url .= "<input type='hidden' name='signMsg' value='" . $signmsg . "' />"; $def_url .= "<input type='hidden' name='merchantAcctId' value='" . $merchant_acctid . "' />"; $def_url .= "<input type='hidden' name='payerName' value='" . $payer_name . "' />"; $def_url .= "<input type='hidden' name='payerContactType' value='" . $payer_contact_type . "' />"; $def_url .= "<input type='hidden' name='payerContact' value='" . $payer_contact . "' />"; $def_url .= "<input type='hidden' name='orderId' value='" . $order_id . "' />"; $def_url .= "<input type='hidden' name='orderAmount' value='" . $order_amount . "' />"; $def_url .= "<input type='hidden' name='orderTime' value='" . $order_time . "' />"; $def_url .= "<input type='hidden' name='productName' value='" . $product_name . "' />"; $def_url .= "<input type='hidden' name='payType' value='" . $pay_type . "' />"; $def_url .= "<input type='hidden' name='productNum' value='" . $product_num . "' />"; $def_url .= "<input type='hidden' name='productId' value='" . $product_id . "' />"; $def_url .= "<input type='hidden' name='productDesc' value='" . $product_desc . "' />"; $def_url .= "<input type='hidden' name='ext1' value='" . $ext1 . "' />"; $def_url .= "<input type='hidden' name='ext2' value='" . $ext2 . "' />"; $def_url .= "<input type='hidden' name='bankId' value='" . $bank_id . "' />"; $def_url .= "<input type='hidden' name='redoFlag' value='" . $redo_flag ."' />"; $def_url .= "<input type='hidden' name='pid' value='" . $pid . "' />"; $def_url .= "<input type='submit' name='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "' />"; $def_url .= "</form></div></br>"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment($_GET['code']); $merchant_acctid = $payment['kq_account']; //人民币账号 不可空 $key = $payment['kq_key']; $get_merchant_acctid = trim($_REQUEST['merchantAcctId']); $pay_result = trim($_REQUEST['payResult']); $version = trim($_REQUEST['version']); $language = trim($_REQUEST['language']); $sign_type = trim($_REQUEST['signType']); $pay_type = trim($_REQUEST['payType']); $bank_id = trim($_REQUEST['bankId']); $order_id = trim($_REQUEST['orderId']); $order_time = trim($_REQUEST['orderTime']); $order_amount = trim($_REQUEST['orderAmount']); $deal_id = trim($_REQUEST['dealId']); $bank_deal_id = trim($_REQUEST['bankDealId']); $deal_time = trim($_REQUEST['dealTime']); $pay_amount = trim($_REQUEST['payAmount']); $fee = trim($_REQUEST['fee']); $ext1 = trim($_REQUEST['ext1']); $ext2 = trim($_REQUEST['ext2']); $err_code = trim($_REQUEST['errCode']); $sign_msg = trim($_REQUEST['signMsg']); //生成加密串。必须保持如下顺序。 $merchant_signmsgval = ''; $merchant_signmsgval = $this->append_param($merchant_signmsgval,"merchantAcctId",$merchant_acctid); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"version",$version); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"language",$language); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"signType",$sign_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payType",$pay_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankId",$bank_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderId",$order_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderTime",$order_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderAmount",$order_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealId",$deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankDealId",$bank_deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealTime",$deal_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payAmount",$pay_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"fee",$fee); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext1",$ext1); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext2",$ext2); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payResult",$pay_result); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"errCode",$err_code); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"key",$key); $merchant_signmsg = md5($merchant_signmsgval); //首先对获得的商户号进行比对 if ($get_merchant_acctid != $merchant_acctid) { //商户号错误 return false; } if (strtoupper($sign_msg) == strtoupper($merchant_signmsg)) { if ($pay_result == 10 || $pay_result == 00) { order_paid($ext1); return true; } else { //'支付结果失败'; return false; } } else { //'密钥校对错误'; return false; } } /** * 将变量值不为空的参数组成字符串 * @param string $strs 参数字符串 * @param string $key 参数键名 * @param string $val 参数键对应值 */ function append_param($strs,$key,$val) { if($strs != "") { if($key != '' && $val != '') { $strs .= '&' . $key . '=' . $val; } } else { if($val != '') { $strs = $key . '=' . $val; } } return $strs; } } ?>
zzshop
trunk/includes/modules/payment/kuaiqian.php
PHP
asf20
13,153
<?php /** * ECSHOP 快钱插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: kuaiqian_sdb.php 15797 2009-07-24 10:46:09Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/payment/kuaiqian.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == true) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'kuaiqian_desc_sdb'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.99bill.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'kq_account', 'type' => 'text', 'value' => ''), array('name' => 'kq_key', 'type' => 'text', 'value' => ''), ); return; } class kuaiqian_sdb { /** * 构造函数 * * @access public * @param * * @return void */ function kuaiqian_sdb() { } function __construct() { $this->kuaiqian_sdb(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $merchant_acctid = trim($payment['kq_account']); //人民币账号 不可空 $key = trim($payment['kq_key']); $input_charset = 1; //字符集 默认1=utf-8 $page_url = return_url(basename(__FILE__, '.php')); $bg_url = ''; $version = 'v2.0'; $language = 1; $sign_type = 1; //签名类型 不可空 固定值 1:md5 $payer_name = ''; $payer_contact_type = ''; $payer_contact = ''; $order_id = $order['order_sn']; //商户订单号 不可空 $order_amount = $order['order_amount'] * 100; //商户订单金额 不可空 $order_time = local_date('YmdHis', $order['add_time']); //商户订单提交时间 不可空 14位 $product_name = ''; $product_num = ''; $product_id = ''; $product_desc = ''; $ext1 = $order['log_id']; $ext2 = ''; $pay_type = '10'; //支付方式 不可空 $bank_id = 'SDB'; $redo_flag = '0'; $pid = ''; /* 生成加密签名串 请务必按照如下顺序和规则组成加密串!*/ $signmsgval = ''; $signmsgval = $this->append_param($signmsgval, "inputCharset", $input_charset); $signmsgval = $this->append_param($signmsgval, "pageUrl", $page_url); $signmsgval = $this->append_param($signmsgval, "bgUrl", $bg_url); $signmsgval = $this->append_param($signmsgval, "version", $version); $signmsgval = $this->append_param($signmsgval, "language", $language); $signmsgval = $this->append_param($signmsgval, "signType", $sign_type); $signmsgval = $this->append_param($signmsgval, "merchantAcctId", $merchant_acctid); $signmsgval = $this->append_param($signmsgval, "payerName", $payer_name); $signmsgval = $this->append_param($signmsgval, "payerContactType", $payer_contact_type); $signmsgval = $this->append_param($signmsgval, "payerContact", $payer_contact); $signmsgval = $this->append_param($signmsgval, "orderId", $order_id); $signmsgval = $this->append_param($signmsgval, "orderAmount", $order_amount); $signmsgval = $this->append_param($signmsgval, "orderTime", $order_time); $signmsgval = $this->append_param($signmsgval, "productName", $product_name); $signmsgval = $this->append_param($signmsgval, "productNum", $product_num); $signmsgval = $this->append_param($signmsgval, "productId", $product_id); $signmsgval = $this->append_param($signmsgval, "productDesc", $product_desc); $signmsgval = $this->append_param($signmsgval, "ext1", $ext1); $signmsgval = $this->append_param($signmsgval, "ext2", $ext2); $signmsgval = $this->append_param($signmsgval, "payType", $pay_type); $signmsgval = $this->append_param($signmsgval, "bankId", $bank_id); $signmsgval = $this->append_param($signmsgval, "redoFlag", $redo_flag); $signmsgval = $this->append_param($signmsgval, "pid", $pid); $signmsgval = $this->append_param($signmsgval, "key", $key); $signmsg = strtoupper(md5($signmsgval)); //签名字符串 不可空 $def_url = '<div style="text-align:center"><form name="kqPay" style="text-align:center;" method="post" action="https://www.99bill.com/gateway/recvMerchantInfoAction.htm" target="_blank">'; $def_url .= "<input type='hidden' name='inputCharset' value='" . $input_charset . "' />"; $def_url .= "<input type='hidden' name='bgUrl' value='" . $bg_url . "' />"; $def_url .= "<input type='hidden' name='pageUrl' value='" . $page_url . "' />"; $def_url .= "<input type='hidden' name='version' value='" . $version . "' />"; $def_url .= "<input type='hidden' name='language' value='" . $language . "' />"; $def_url .= "<input type='hidden' name='signType' value='" . $sign_type . "' />"; $def_url .= "<input type='hidden' name='signMsg' value='" . $signmsg . "' />"; $def_url .= "<input type='hidden' name='merchantAcctId' value='" . $merchant_acctid . "' />"; $def_url .= "<input type='hidden' name='payerName' value='" . $payer_name . "' />"; $def_url .= "<input type='hidden' name='payerContactType' value='" . $payer_contact_type . "' />"; $def_url .= "<input type='hidden' name='payerContact' value='" . $payer_contact . "' />"; $def_url .= "<input type='hidden' name='orderId' value='" . $order_id . "' />"; $def_url .= "<input type='hidden' name='orderAmount' value='" . $order_amount . "' />"; $def_url .= "<input type='hidden' name='orderTime' value='" . $order_time . "' />"; $def_url .= "<input type='hidden' name='productName' value='" . $product_name . "' />"; $def_url .= "<input type='hidden' name='payType' value='" . $pay_type . "' />"; $def_url .= "<input type='hidden' name='productNum' value='" . $product_num . "' />"; $def_url .= "<input type='hidden' name='productId' value='" . $product_id . "' />"; $def_url .= "<input type='hidden' name='productDesc' value='" . $product_desc . "' />"; $def_url .= "<input type='hidden' name='ext1' value='" . $ext1 . "' />"; $def_url .= "<input type='hidden' name='ext2' value='" . $ext2 . "' />"; $def_url .= "<input type='hidden' name='bankId' value='" . $bank_id . "' />"; $def_url .= "<input type='hidden' name='redoFlag' value='" . $redo_flag ."' />"; $def_url .= "<input type='hidden' name='pid' value='" . $pid . "' />"; $def_url .= "<input type='submit' name='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "' />"; $def_url .= "</form></div></br>"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment($_GET['code']); $merchant_acctid = $payment['kq_account']; //人民币账号 不可空 $key = $payment['kq_key']; $get_merchant_acctid = trim($_REQUEST['merchantAcctId']); $pay_result = trim($_REQUEST['payResult']); $version = trim($_REQUEST['version']); $language = trim($_REQUEST['language']); $sign_type = trim($_REQUEST['signType']); $pay_type = trim($_REQUEST['payType']); $bank_id = trim($_REQUEST['bankId']); $order_id = trim($_REQUEST['orderId']); $order_time = trim($_REQUEST['orderTime']); $order_amount = trim($_REQUEST['orderAmount']); $deal_id = trim($_REQUEST['dealId']); $bank_deal_id = trim($_REQUEST['bankDealId']); $deal_time = trim($_REQUEST['dealTime']); $pay_amount = trim($_REQUEST['payAmount']); $fee = trim($_REQUEST['fee']); $ext1 = trim($_REQUEST['ext1']); $ext2 = trim($_REQUEST['ext2']); $err_code = trim($_REQUEST['errCode']); $sign_msg = trim($_REQUEST['signMsg']); //生成加密串。必须保持如下顺序。 $merchant_signmsgval = ''; $merchant_signmsgval = $this->append_param($merchant_signmsgval,"merchantAcctId",$merchant_acctid); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"version",$version); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"language",$language); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"signType",$sign_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payType",$pay_type); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankId",$bank_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderId",$order_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderTime",$order_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"orderAmount",$order_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealId",$deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"bankDealId",$bank_deal_id); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"dealTime",$deal_time); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payAmount",$pay_amount); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"fee",$fee); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext1",$ext1); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"ext2",$ext2); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"payResult",$pay_result); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"errCode",$err_code); $merchant_signmsgval = $this->append_param($merchant_signmsgval,"key",$key); $merchant_signmsg = md5($merchant_signmsgval); //首先对获得的商户号进行比对 if ($get_merchant_acctid != $merchant_acctid) { //商户号错误 return false; } if (strtoupper($sign_msg) == strtoupper($merchant_signmsg)) { if ($pay_result == 10 || $pay_result == 00) { order_paid($ext1); return true; } else { //'支付结果失败'; return false; } } else { //'密钥校对错误'; return false; } } /** * 将变量值不为空的参数组成字符串 * @param string $strs 参数字符串 * @param string $key 参数键名 * @param string $val 参数键对应值 */ function append_param($strs,$key,$val) { if($strs != "") { if($key != '' && $val != '') { $strs .= '&' . $key . '=' . $val; } } else { if($val != '') { $strs = $key . '=' . $val; } } return $strs; } } ?>
zzshop
trunk/includes/modules/payment/kuaiqian_sdb.php
PHP
asf20
13,178
<?php /** * ECSHOP 邮局汇款插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: post.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/post.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'post_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '0'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.ecshop.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array(); return; } /** * 类 */ class post { /** * 构造函数 * * @access public * @param * * @return void */ function post() { } function __construct() { $this->post(); } /** * 提交函数 */ function get_code() { return ''; } /** * 处理函数 */ function response() { return; } } ?>
zzshop
trunk/includes/modules/payment/post.php
PHP
asf20
2,134
<?php /** * ECSHOP ips支付系统插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * @author: liupeng <laupeng@163.com> * @version: v1.0 * --------------------------------------------- */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/express.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'express_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://express.ips.com.cn/'; /* 版本号 */ $modules[$i]['version'] = '1.0.0'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'ips_account', 'type' => 'text', 'value' => ''), array('name' => 'ips_key', 'type' => 'text', 'value' => '') ); return; } class express { /** * 构造函数 * * @access public * @param * * @return void */ function express() { } function __construct() { $this->express(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $mer_code = $payment['ips_account']; $billno = $order['log_id']; $amount = sprintf("%0.02f", $order['order_amount']); $strcert = $payment['ips_key']; $remark = ''; $signmd5 = MD5($mer_code . $billno . $amount . $remark . $strcert); $def_url = '<br /><form style="text-align:center;" action="http://express.ips.com.cn/pay/payment.asp" method="post" target="_blank" onsubmit="if(document.getElementById(\'paybank\').value==\'\'){alert(\''.$GLOBALS['_LANG']['please_select_bank'].'\');return false;}">'; $def_url .= "<input type='hidden' name='Merchant' value='" . $mer_code . "'>\n"; //商户帐号 $def_url .= "<input type='hidden' name='Billno' value='" . $billno . "'>\n"; $def_url .= "<input type='hidden' name='Amount' value='" . $amount . "'>\n"; $def_url .= "<input type='hidden' name='Remark' value=''>\n"; $def_url .= "<input type='hidden' name='BackUrl' value='" . return_url(basename(__FILE__, '.php')) . "'>\n"; $def_url .= "<input type='hidden' name='Sign' value='" .$signmd5 . "'>\n"; $def_url .= $GLOBALS['_LANG']['please_select_bank'] . ':'; $def_url .= "<select name='paybank' id='paybank'>"; $def_url .= "<option value=''>". $GLOBALS['_LANG']['please_select_bank'] ."</option>"; $def_url .= "<option value='00018'>" . $GLOBALS['_LANG']['icbc'] . "</option>"; $def_url .= "<option value='00021'>" . $GLOBALS['_LANG']['cmb'] . "</option>"; $def_url .= "<option value='00003'>" . $GLOBALS['_LANG']['ccb'] . "</option>"; $def_url .= "<option value='00017'>" . $GLOBALS['_LANG']['agricultural_bank'] . "</option>"; $def_url .= "<option value='00013'>" . $GLOBALS['_LANG']['cmbc'] . "</option>"; $def_url .= "<option value='00030'>" . $GLOBALS['_LANG']['cebbank'] . "</option>"; $def_url .= "<option value='00016'>" . $GLOBALS['_LANG']['cib'] . "</option>"; $def_url .= "<option value='00111'>" . $GLOBALS['_LANG']['boc'] . "</option>"; $def_url .= "<option value='00211'>" . $GLOBALS['_LANG']['bankcomm'] . "</option>"; $def_url .= "<option value='00311'>" . $GLOBALS['_LANG']['bankcommsh'] . "</option>"; $def_url .= "<option value='00411'>" . $GLOBALS['_LANG']['gdb'] . "</option>"; $def_url .= "<option value='00023'>" . $GLOBALS['_LANG']['sdb'] . "</option>"; $def_url .= "<option value='00032'>" . $GLOBALS['_LANG']['spdb'] . "</option>"; $def_url .= "<option value='00511'>" . $GLOBALS['_LANG']['cnbb'] . "</option>"; $def_url .= "<option value='00611'>" . $GLOBALS['_LANG']['gzcb'] . "</option>"; $def_url .= "<option value='00711'>" . $GLOBALS['_LANG']['chinapost'] . "</option>"; $def_url .= "<option value='00811'>" . $GLOBALS['_LANG']['hxb'] . "</option>"; $def_url .= "</select><br><input type='submit' value='".$GLOBALS['_LANG']['pay_button']."'></form><br />"; return $def_url; } function respond() { $payment = get_payment('express'); $merchant = $payment['ips_account']; // 商户号 $amount = $_REQUEST['Amount']; //金额 $billno = $_REQUEST['BillNo']; //订单号 $success = $_REQUEST['Success']; //是否成功Y/N $remark = $_REQUEST['Remark']; //附加信息 $sign = $_REQUEST['Sign']; $strcert = $payment['ips_key']; $signmd5 = md5($merchant . $billno . $amount . $remark . $success . $payment['ips_key']); if ($sign != $signmd5) { echo $billno; return false; } if ($success != 'Y') { return false; } else { if (!check_money($billno, $amount)) { return false; } } $fp = @fopen("http://express.ips.com.cn/merchant/confirm.asp?Merchant=".$merchant ."&BillNo=".$billno."&Amount=".$amount."&Success=".$success."&Remark=".$remark. "&sign=".$sign, 'rb'); if (!empty($fp)) { fclose($fp); } order_paid($bid, PS_PAYED); return true; } } ?>
zzshop
trunk/includes/modules/payment/express.php
PHP
asf20
6,603
<?php /** * ECSHOP 首信易支付插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: cappay.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/cappay.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /** * 模块信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'cappay_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.beijing.com.cn'; /* 版本号 */ $modules[$i]['version'] = 'V4.3'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'cappay_account', 'type' => 'text', 'value' => ''), array('name' => 'cappay_key', 'type' => 'text', 'value' => ''), array('name' => 'cappay_currency', 'type' => 'select', 'value' => 'USD') ); return; } class cappay { /** * 构造函数 * * @access public * @param * * @return void */ function cappay() { } function __construct() { $this->cappay(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $v_rcvname = trim($payment['cappay_account']); $m_orderid = $order['log_id']; $v_amount = $order['order_amount']; $v_moneytype = trim($payment['cappay_currency']);; $v_url = return_url(basename(__FILE__, '.php')); $m_ocomment = '欢迎使用首信易支付'; $v_ymd = date('Ymd',time()); /*易支付平台*/ $MD5Key = $payment['cappay_key']; //<--支付密钥--> 注:此处密钥必须与商家后台里的密钥一致 $v_oid = "$v_ymd-$v_rcvname-$m_orderid"; $sourcedata = $v_moneytype.$v_ymd.$v_amount.$v_rcvname.$v_oid.$v_rcvname.$v_url; $result = $this->hmac_md5($MD5Key,$sourcedata); $def_url = '<form method=post action="http://pay.beijing.com.cn/prs/user_payment.checkit" target="_blank">'; $def_url .= "<input type= 'hidden' name = 'v_mid' value= '".$v_rcvname."'>"; //商户编号 $def_url .= "<input type= 'hidden' name = 'v_oid' value= '".$v_oid."'>"; //订单编号 $def_url .= "<input type= 'hidden' name = 'v_rcvname' value= '".$v_rcvname."'>"; //收货人姓名 $def_url .= "<input type= 'hidden' name = 'v_rcvaddr' value= '".$v_rcvname."'>"; //收货人地址 $def_url .= "<input type= 'hidden' name = 'v_rcvtel' value= '".$v_rcvname."'>"; //收货人电话 $def_url .= "<input type= 'hidden' name = 'v_rcvpost' value= '".$v_rcvname."'>"; //收货人邮编 $def_url .= "<input type= 'hidden' name = 'v_amount' value= '".$v_amount."'>"; //订单总金额 $def_url .= "<input type= 'hidden' name = 'v_ymd' value= '".$v_ymd."'>"; //订单产生日期 $def_url .= "<input type= 'hidden' name = 'v_orderstatus' value ='0'>"; //配货状态 $def_url .= "<input type= 'hidden' name = 'v_ordername' value ='".$v_rcvname."'>"; //订货人姓名 $def_url .= "<input type= 'hidden' name = 'v_moneytype' value ='".$v_moneytype."'>"; //币种,0为人民币,1为美元 $def_url .= "<input type= 'hidden' name='v_url' value='".$v_url."'>"; //支付动作完成后返回到该url,支付结果以GET方式发送 $def_url .= "<input type='hidden' name='v_md5info' value=$result>"; //订单数字指纹 $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['cappay_button'] . "'>"; $def_url .= '</form>'; /*易支付会员通道 $def_url = "<form method=post action='http://pay.beijing.com.cn/customer/gb/pay_member.jsp' target='_blank'>"; $def_url .= "<input type='hidden' name='v_mid' value='".$v_rcvname."'>"; //商户编号 $def_url .= "<input type='hidden' name='v_oid' value='".$v_oid."'>"; //订单编号 $def_url .= "<input type='hidden' name='v_rcvname' value='".$v_rcvname."'>"; //收货人姓名 $def_url .= "<input type='hidden' name='v_rcvaddr' value='".$v_rcvname."'>"; //收货人地址 $def_url .= "<input type='hidden' name='v_rcvtel' value='".$v_rcvname."'>"; //收货人电话 $def_url .= "<input type='hidden' name='v_rcvpost' value='".$v_rcvname."'>"; //收货人邮编 $def_url .= "<input type='hidden' name='v_amount' value='".$v_amount."'>"; //订单总金额 $def_url .= "<input type='hidden' name='v_ymd' value='".$v_ymd."'>"; //订单产生日期 $def_url .= "<input type='hidden' name='v_orderstatus' value='0'>"; //配货状态 $def_url .= "<input type='hidden' name='v_ordername' value='".$v_rcvname."'>"; //订货人姓名 $def_url .= "<input type='hidden' name='v_moneytype' value='".$v_moneytype."'>"; //币种,0为人民币,1为美元 $def_url .= "<input type='hidden' name='v_url' value='".$v_url."'>"; //支付动作完成后返回到该url,支付结果以GET方式发送 $def_url .= "<input type='hidden' name='v_md5info' value=$result[0]>"; //订单数字指纹 $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['cappay_member_button'] . "'>"; $def_url .= '</form>'; //易支付手机通道 $def_url = "<form method=post action='http://pay.beijing.com.cn/customer/gb/pay_mobile.jsp' target='_blank'>"; $def_url .= "<input type='hidden' name='v_mid' value='".$v_rcvname."'>"; //商户编号 $def_url .= "<input type='hidden' name='v_oid' value='".$v_oid."'>"; //订单编号 $def_url .= "<input type='hidden' name='v_rcvname' value='".$v_rcvname."'>"; //收货人姓名 $def_url .= "<input type='hidden' name='v_rcvaddr' value='".$v_rcvname."'>"; //收货人地址 $def_url .= "<input type='hidden' name='v_rcvtel' value='".$v_rcvname."'>"; //收货人电话 $def_url .= "<input type='hidden' name='v_rcvpost' value='".$v_rcvname."'>"; //收货人邮编 $def_url .= "<input type='hidden' name='v_amount' value='".$v_amount."'>"; //订单总金额 $def_url .= "<input type='hidden' name='v_ymd' value='".$v_ymd."'>"; //订单产生日期 $def_url .= "<input type='hidden' name='v_orderstatus' value='0'>"; //配货状态 $def_url .= "<input type='hidden' name='v_ordername' value='".$v_rcvname."'>"; //订货人姓名 $def_url .= "<input type='hidden' name='v_moneytype' value='".$v_moneytype."'>"; //币种,0为人民币,1为美元 $def_url .= "<input type='hidden' name='v_url' value='".$v_url."'>"; //支付动作完成后返回到该url,支付结果以GET方式发送 $def_url .= "<input type='hidden' name='v_md5info' value=$result[0]>"; //订单数字指纹 $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['cappay_mobile_button'] . "'>"; $def_url .= '</form>'; //易支付英文通道 $def_url = "<form method=post action='http://pay.beijing.com.cn/prs/e_user_payment.checkit' target='_blank'>"; $def_url .= "<input type='hidden' name='v_mid' value='".$v_rcvname."'>"; //商户编号 $def_url .= "<input type='hidden' name='v_oid' value='".$v_oid."'>"; //订单编号 $def_url .= "<input type='hidden' name='v_rcvname' value='".$v_rcvname."'>"; //收货人姓名 $def_url .= "<input type='hidden' name='v_rcvaddr' value='".$v_rcvname."'>"; //收货人地址 $def_url .= "<input type='hidden' name='v_rcvtel' value='".$v_rcvname."'>"; //收货人电话 $def_url .= "<input type='hidden' name='v_rcvpost' value='".$v_rcvname."'>"; //收货人邮编 $def_url .= "<input type='hidden' name='v_amount' value='".$v_amount."'>"; //订单总金额 $def_url .= "<input type='hidden' name='v_ymd' value='".$v_ymd."'>"; //订单产生日期 $def_url .= "<input type='hidden' name='v_orderstatus' value='0'>"; //配货状态 $def_url .= "<input type='hidden' name='v_ordername' value='".$v_rcvname."'>"; //订货人姓名 $def_url .= "<input type='hidden' name='v_moneytype' value='".$v_moneytype."'>"; //币种,0为人民币,1为美元 $def_url .= "<input type='hidden' name='v_url' value='".$v_url."'>"; //支付动作完成后返回到该url,支付结果以GET方式发送 $def_url .= "<input type='hidden' name='v_md5info' value=$result[0]>"; //订单数字指纹 $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['cappay_en_button'] . "'>"; $def_url .= '</form>';*/ return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment(basename(__FILE__, '.php')); $v_tempdate = explode('-', $_REQUEST['v_oid']); //接受返回数据验证开始 //v_md5info验证 $md5info_paramet = $_REQUEST['v_oid'].$_REQUEST['v_pstatus'].$_REQUEST['v_pstring'].$_REQUEST['v_pmode']; $md5info_tem = $this->hmac_md5($payment['cappay_key'],$md5info_paramet); //v_md5money验证 $md5money_paramet = $_REQUEST['v_amount'].$_REQUEST['v_moneytype']; $md5money_tem = $this->hmac_md5($payment['cappay_key'],$md5money_paramet); if ($md5info_tem == $_REQUEST['v_md5info'] && $md5money_tem == $_REQUEST['v_md5money']) { //改变订单状态 order_paid($v_tempdate[2]); return true; } else { return false; } } function hmac_md5($key, $data) { if (extension_loaded('mhash')) { return bin2hex(mhash(MHASH_MD5, $data, $key)); } // RFC 2104 HMAC implementation for php. Hacked by Lance Rushing $b = 64; if (strlen($key) > $b) { $key = pack('H*', md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad; $k_opad = $key ^ $opad; return md5($k_opad . pack('H*', md5($k_ipad . $data))); } } ?>
zzshop
trunk/includes/modules/payment/cappay.php
PHP
asf20
12,133
<?php /** * ECSHOP YeePay易宝银行直付插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: yeepay_icbc.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/yeepay.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'yp_icbc_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.yeepay.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.1'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'yp_account', 'type' => 'text', 'value' => ''), array('name' => 'yp_key', 'type' => 'text', 'value' => ''), ); return; } /** * 类 */ class yeepay_icbc { /** * 构造函数 * * @access public * @param * * @return void */ function yeepay_icbc() { $this->frpid = 'ICBC-NET'; } function __construct() { $this->yeepay_icbc(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $data_merchant_id = $payment['yp_account']; $data_order_id = $order['order_sn']; $data_amount = $order['order_amount']; $message_type = 'Buy'; $data_cur = 'CNY'; $product_id = ''; $product_cat = ''; $product_desc = ''; $address_flag = '0'; $data_return_url = return_url(basename(__FILE__, '.php')); $data_pay_key = $payment['yp_key']; $data_pay_account = $payment['yp_account']; $mct_properties = $order['log_id']; $def_url = $message_type . $data_merchant_id . $data_order_id . $data_amount . $data_cur . $product_id . $product_cat . $product_desc . $data_return_url . $address_flag . $mct_properties . $this->frpid; $MD5KEY = hmac($def_url, $data_pay_key); $def_url = "\n<form action='https://www.yeepay.com/app-merchant-proxy/node' method='post' target='_blank'>\n"; $def_url .= "<input type='hidden' name='p0_Cmd' value='".$message_type."'>\n"; $def_url .= "<input type='hidden' name='p1_MerId' value='".$data_merchant_id."'>\n"; $def_url .= "<input type='hidden' name='p2_Order' value='".$data_order_id."'>\n"; $def_url .= "<input type='hidden' name='p3_Amt' value='".$data_amount."'>\n"; $def_url .= "<input type='hidden' name='p4_Cur' value='".$data_cur."'>\n"; $def_url .= "<input type='hidden' name='p5_Pid' value='".$product_id."'>\n"; $def_url .= "<input type='hidden' name='p6_Pcat' value='".$product_cat."'>\n"; $def_url .= "<input type='hidden' name='p7_Pdesc' value='".$product_desc."'>\n"; $def_url .= "<input type='hidden' name='p8_Url' value='".$data_return_url."'>\n"; $def_url .= "<input type='hidden' name='p9_SAF' value='".$address_flag."'>\n"; $def_url .= "<input type='hidden' name='pa_MP' value='".$mct_properties."'>\n"; $def_url .= "<input type='hidden' name='pd_FrpId' value='" . $this->frpid . "'>\n"; $def_url .= "<input type='hidden' name='pd_NeedResponse' value='1'>\n"; $def_url .= "<input type='hidden' name='hmac' value='".$MD5KEY."'>\n"; $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form>\n"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment('yeepay_icbc'); $merchant_id = $payment['yp_account']; // 获取商户编号 $merchant_key = $payment['yp_key']; // 获取秘钥 $message_type = trim($_REQUEST['r0_Cmd']); $succeed = trim($_REQUEST['r1_Code']); // 获取交易结果,1成功,-1失败 $trxId = trim($_REQUEST['r2_TrxId']); $amount = trim($_REQUEST['r3_Amt']); // 获取订单金额 $cur = trim($_REQUEST['r4_Cur']); // 获取订单货币单位 $product_id = trim($_REQUEST['r5_Pid']); // 获取产品ID $orderid = trim($_REQUEST['r6_Order']); // 获取订单ID $userId = trim($_REQUEST['r7_Uid']); // 获取产品ID $merchant_param = trim($_REQUEST['r8_MP']); // 获取商户私有参数 $bType = trim($_REQUEST['r9_BType']); // 获取订单ID $mac = trim($_REQUEST['hmac']); // 获取安全加密串 ///生成加密串,注意顺序 $ScrtStr = $merchant_id . $message_type . $succeed . $trxId . $amount . $cur . $product_id . $orderid . $userId . $merchant_param . $bType; $mymac = hmac($ScrtStr, $merchant_key); $v_result = false; if (strtoupper($mac) == strtoupper($mymac)) { if ($succeed == '1') { ///支付成功 $v_result = true; $order_id = str_replace($orderid, '', $product_id); order_paid($merchant_param); } } return $v_result; } } if (!function_exists("hmac")) { function hmac($data, $key) { // RFC 2104 HMAC implementation for php. // Creates an md5 HMAC. // Eliminates the need to install mhash to compute a HMAC // Hacked by Lance Rushing(NOTE: Hacked means written) $key = ecs_iconv('GB2312', 'UTF8', $key); $data = ecs_iconv('GB2312', 'UTF8', $data); $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack('H*', md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad ; $k_opad = $key ^ $opad; return md5($k_opad . pack('H*', md5($k_ipad . $data))); } } ?>
zzshop
trunk/includes/modules/payment/yeepay_icbc.php
PHP
asf20
7,364
<?php /** * ECSHOP YeePay易宝插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: yeepay.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/yeepay.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'yp_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.yeepay.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.1'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'yp_account', 'type' => 'text', 'value' => ''), array('name' => 'yp_key', 'type' => 'text', 'value' => ''), ); return; } /** * 类 */ class yeepay { /** * 构造函数 * * @access public * @param * * @return void */ function yeepay() { } function __construct() { $this->yeepay(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $data_merchant_id = $payment['yp_account']; $data_order_id = $order['order_sn']; $data_amount = $order['order_amount']; $message_type = 'Buy'; $data_cur = 'CNY'; $product_id = ''; $product_cat = ''; $product_desc = ''; $address_flag = '0'; $data_return_url = return_url(basename(__FILE__, '.php')); $data_pay_key = $payment['yp_key']; $data_pay_account = $payment['yp_account']; $mct_properties = $order['log_id']; $def_url = $message_type . $data_merchant_id . $data_order_id . $data_amount . $data_cur . $product_id . $product_cat . $product_desc . $data_return_url . $address_flag . $mct_properties; $MD5KEY = hmac($def_url, $data_pay_key); $def_url = "\n<form action='https://www.yeepay.com/app-merchant-proxy/node' method='post' target='_blank'>\n"; $def_url .= "<input type='hidden' name='p0_Cmd' value='".$message_type."'>\n"; $def_url .= "<input type='hidden' name='p1_MerId' value='".$data_merchant_id."'>\n"; $def_url .= "<input type='hidden' name='p2_Order' value='".$data_order_id."'>\n"; $def_url .= "<input type='hidden' name='p3_Amt' value='".$data_amount."'>\n"; $def_url .= "<input type='hidden' name='p4_Cur' value='".$data_cur."'>\n"; $def_url .= "<input type='hidden' name='p5_Pid' value='".$product_id."'>\n"; $def_url .= "<input type='hidden' name='p6_Pcat' value='".$product_cat."'>\n"; $def_url .= "<input type='hidden' name='p7_Pdesc' value='".$product_desc."'>\n"; $def_url .= "<input type='hidden' name='p8_Url' value='".$data_return_url."'>\n"; $def_url .= "<input type='hidden' name='p9_SAF' value='".$address_flag."'>\n"; $def_url .= "<input type='hidden' name='pa_MP' value='".$mct_properties."'>\n"; $def_url .= "<input type='hidden' name='hmac' value='".$MD5KEY."'>\n"; $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form>\n"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment('yeepay'); $merchant_id = $payment['yp_account']; // 获取商户编号 $merchant_key = $payment['yp_key']; // 获取秘钥 $message_type = trim($_REQUEST['r0_Cmd']); $succeed = trim($_REQUEST['r1_Code']); // 获取交易结果,1成功,-1失败 $trxId = trim($_REQUEST['r2_TrxId']); $amount = trim($_REQUEST['r3_Amt']); // 获取订单金额 $cur = trim($_REQUEST['r4_Cur']); // 获取订单货币单位 $product_id = trim($_REQUEST['r5_Pid']); // 获取产品ID $orderid = trim($_REQUEST['r6_Order']); // 获取订单ID $userId = trim($_REQUEST['r7_Uid']); // 获取产品ID $merchant_param = trim($_REQUEST['r8_MP']); // 获取商户私有参数 $bType = trim($_REQUEST['r9_BType']); // 获取订单ID $mac = trim($_REQUEST['hmac']); // 获取安全加密串 ///生成加密串,注意顺序 $ScrtStr = $merchant_id . $message_type . $succeed . $trxId . $amount . $cur . $product_id . $orderid . $userId . $merchant_param . $bType; $mymac = hmac($ScrtStr, $merchant_key); $v_result = false; if (strtoupper($mac) == strtoupper($mymac)) { if ($succeed == '1') { ///支付成功 $v_result = true; order_paid($merchant_param); } } return $v_result; } } if (!function_exists("hmac")) { function hmac($data, $key) { // RFC 2104 HMAC implementation for php. // Creates an md5 HMAC. // Eliminates the need to install mhash to compute a HMAC // Hacked by Lance Rushing(NOTE: Hacked means written) $key = ecs_iconv('GB2312', 'UTF8', $key); $data = ecs_iconv('GB2312', 'UTF8', $data); $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack('H*', md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad ; $k_opad = $key ^ $opad; return md5($k_opad . pack('H*', md5($k_ipad . $data))); } } ?>
zzshop
trunk/includes/modules/payment/yeepay.php
PHP
asf20
7,028
<?php /** * ECSHOP YeePay易宝银行直付插件 * ============================================================================ * 版权所有 2005-2010 上海商派网络科技有限公司,并保留所有权利。 * 网站地址: http://www.ecshop.com; * ---------------------------------------------------------------------------- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和 * 使用;不允许对程序代码以任何形式任何目的的再发布。 * ============================================================================ * $Author: liuhui $ * $Id: yeepay_cmbchina.php 17063 2010-03-25 06:35:46Z liuhui $ */ if (!defined('IN_ECS')) { die('Hacking attempt'); } $payment_lang = ROOT_PATH . 'languages/' .$GLOBALS['_CFG']['lang']. '/payment/yeepay.php'; if (file_exists($payment_lang)) { global $_LANG; include_once($payment_lang); } /* 模块的基本信息 */ if (isset($set_modules) && $set_modules == TRUE) { $i = isset($modules) ? count($modules) : 0; /* 代码 */ $modules[$i]['code'] = basename(__FILE__, '.php'); /* 描述对应的语言项 */ $modules[$i]['desc'] = 'yp_cmbchina_desc'; /* 是否支持货到付款 */ $modules[$i]['is_cod'] = '0'; /* 是否支持在线支付 */ $modules[$i]['is_online'] = '1'; /* 作者 */ $modules[$i]['author'] = 'ECSHOP TEAM'; /* 网址 */ $modules[$i]['website'] = 'http://www.yeepay.com'; /* 版本号 */ $modules[$i]['version'] = '1.0.1'; /* 配置信息 */ $modules[$i]['config'] = array( array('name' => 'yp_account', 'type' => 'text', 'value' => ''), array('name' => 'yp_key', 'type' => 'text', 'value' => ''), ); return; } /** * 类 */ class yeepay_cmbchina { /** * 构造函数 * * @access public * @param * * @return void */ function yeepay_cmbchina() { $this->frpid = 'CMBCHINA-NET'; } function __construct() { $this->yeepay_cmbchina(); } /** * 生成支付代码 * @param array $order 订单信息 * @param array $payment 支付方式信息 */ function get_code($order, $payment) { $data_merchant_id = $payment['yp_account']; $data_order_id = $order['order_sn']; $data_amount = $order['order_amount']; $message_type = 'Buy'; $data_cur = 'CNY'; $product_id = ''; $product_cat = ''; $product_desc = ''; $address_flag = '0'; $data_return_url = return_url(basename(__FILE__, '.php')); $data_pay_key = $payment['yp_key']; $data_pay_account = $payment['yp_account']; $mct_properties = $order['log_id']; $def_url = $message_type . $data_merchant_id . $data_order_id . $data_amount . $data_cur . $product_id . $product_cat . $product_desc . $data_return_url . $address_flag . $mct_properties . $this->frpid; $MD5KEY = hmac($def_url, $data_pay_key); $def_url = "\n<form action='https://www.yeepay.com/app-merchant-proxy/node' method='post' target='_blank'>\n"; $def_url .= "<input type='hidden' name='p0_Cmd' value='".$message_type."'>\n"; $def_url .= "<input type='hidden' name='p1_MerId' value='".$data_merchant_id."'>\n"; $def_url .= "<input type='hidden' name='p2_Order' value='".$data_order_id."'>\n"; $def_url .= "<input type='hidden' name='p3_Amt' value='".$data_amount."'>\n"; $def_url .= "<input type='hidden' name='p4_Cur' value='".$data_cur."'>\n"; $def_url .= "<input type='hidden' name='p5_Pid' value='".$product_id."'>\n"; $def_url .= "<input type='hidden' name='p6_Pcat' value='".$product_cat."'>\n"; $def_url .= "<input type='hidden' name='p7_Pdesc' value='".$product_desc."'>\n"; $def_url .= "<input type='hidden' name='p8_Url' value='".$data_return_url."'>\n"; $def_url .= "<input type='hidden' name='p9_SAF' value='".$address_flag."'>\n"; $def_url .= "<input type='hidden' name='pa_MP' value='".$mct_properties."'>\n"; $def_url .= "<input type='hidden' name='pd_FrpId' value='" . $this->frpid . "'>\n"; $def_url .= "<input type='hidden' name='pd_NeedResponse' value='1'>\n"; $def_url .= "<input type='hidden' name='hmac' value='".$MD5KEY."'>\n"; $def_url .= "<input type='submit' value='" . $GLOBALS['_LANG']['pay_button'] . "'>"; $def_url .= "</form>\n"; return $def_url; } /** * 响应操作 */ function respond() { $payment = get_payment('yeepay_cmbchina'); $merchant_id = $payment['yp_account']; // 获取商户编号 $merchant_key = $payment['yp_key']; // 获取秘钥 $message_type = trim($_REQUEST['r0_Cmd']); $succeed = trim($_REQUEST['r1_Code']); // 获取交易结果,1成功,-1失败 $trxId = trim($_REQUEST['r2_TrxId']); $amount = trim($_REQUEST['r3_Amt']); // 获取订单金额 $cur = trim($_REQUEST['r4_Cur']); // 获取订单货币单位 $product_id = trim($_REQUEST['r5_Pid']); // 获取产品ID $orderid = trim($_REQUEST['r6_Order']); // 获取订单ID $userId = trim($_REQUEST['r7_Uid']); // 获取产品ID $merchant_param = trim($_REQUEST['r8_MP']); // 获取商户私有参数 $bType = trim($_REQUEST['r9_BType']); // 获取订单ID $mac = trim($_REQUEST['hmac']); // 获取安全加密串 ///生成加密串,注意顺序 $ScrtStr = $merchant_id . $message_type . $succeed . $trxId . $amount . $cur . $product_id . $orderid . $userId . $merchant_param . $bType; $mymac = hmac($ScrtStr, $merchant_key); $v_result = false; if (strtoupper($mac) == strtoupper($mymac)) { if ($succeed == '1') { ///支付成功 $v_result = true; $order_id = str_replace($orderid, '', $product_id); order_paid($merchant_param); } } return $v_result; } } if (!function_exists("hmac")) { function hmac($data, $key) { // RFC 2104 HMAC implementation for php. // Creates an md5 HMAC. // Eliminates the need to install mhash to compute a HMAC // Hacked by Lance Rushing(NOTE: Hacked means written) $key = ecs_iconv('GB2312', 'UTF8', $key); $data = ecs_iconv('GB2312', 'UTF8', $data); $b = 64; // byte length for md5 if (strlen($key) > $b) { $key = pack('H*', md5($key)); } $key = str_pad($key, $b, chr(0x00)); $ipad = str_pad('', $b, chr(0x36)); $opad = str_pad('', $b, chr(0x5c)); $k_ipad = $key ^ $ipad ; $k_opad = $key ^ $opad; return md5($k_opad . pack('H*', md5($k_ipad . $data))); } } ?>
zzshop
trunk/includes/modules/payment/yeepay_cmbchina.php
PHP
asf20
7,392