Index: trunk/tools/wikiportrait/pages/licenses_nl.php |
— | — | @@ -28,4 +28,4 @@ |
29 | 29 | <h4><a href="http://nl.wikisource.org/wiki/Nederlandstalige_tekst_van_de_GNU-licentie_voor_vrije_documentatie">GNU-licentie voor vrije documentatie (GFDL)</a></h4> |
30 | 30 | <img src="images/icon_gnu.png" alt="GNU head" /> |
31 | 31 | <p>De GNU-licentie voor vrije documentatie, afgekort met GFDL, is de standaardlicentie op Wikipedia. Kortweg houdt de GFDL in dat de afbeelding gekopieerd, verspreid en bewerkt mag worden, mits correcte vermelding van de auteur plaatsvindt. De GFDL is een zogenaamde copyleft-licentie: alles wat mensen veranderen aan de afbeelding moet ook weer onder de GFDL worden vrijgeven. Een nadeel (of voordeel, het is maar net hoe je het bekijkt) van de GFDL is dat de complete licentietekst bij elke afbeelding moet worden meegeleverd. Dat is geen probleem op het internet, waar een link volstaat, maar op druk betekent dit dat je naast de afbeelding een stuk of vijf pagina's tekst moet meeleveren. </p> |
32 | | -</div> <!-- license GFDL --> |
\ No newline at end of file |
| 32 | +</div> <!-- license GFDL --> |
Index: trunk/tools/wikiportrait/pages/uploadform_nl.php |
— | — | @@ -15,10 +15,10 @@ |
16 | 16 | <li>Uw foto moet minimaal een resolutie hebben van 640x480 pixels</li> |
17 | 17 | </ul> |
18 | 18 | <p> |
19 | | - <strong>Let op:</strong> Inzendingen zonder vermelding van de fotograaf en van de rechthebbende, of inzendingen die |
| 19 | + <strong>Let op:</strong> Inzendingen zonder vermelding van de fotograaf en van de rechthebbende, of inzendingen die |
20 | 20 | van zoekmachines als Google e.d. zijn afgehaald worden <strong>niet</strong> in behandeling genomen! |
21 | 21 | </p> |
22 | | - |
| 22 | + |
23 | 23 | <button id="toggleUpload">Upload mijn foto</button> |
24 | 24 | </div> |
25 | 25 | |
— | — | @@ -29,11 +29,11 @@ |
30 | 30 | <input type="file" name="file" id="file" size="40" /> |
31 | 31 | </div> |
32 | 32 | |
33 | | - <div class="item"> |
| 33 | + <div class="item"> |
34 | 34 | <label for="title">Wie staat er op de foto</label> |
35 | 35 | <input type="text" name="title" id="title" size="40" value="" /> |
36 | 36 | </div> |
37 | | - |
| 37 | + |
38 | 38 | <div class="item"> |
39 | 39 | <label for="source">Rechthebbende en/of auteur van de foto</label> |
40 | 40 | <input type="text" name="source" id="source" size="40" value="" /> |
— | — | @@ -43,30 +43,30 @@ |
44 | 44 | <label for="name">Uw naam</label> |
45 | 45 | <input type="text" name="name" id="name" size="40" value="" /> |
46 | 46 | </div> |
47 | | - |
| 47 | + |
48 | 48 | <div class="item"> |
49 | | - <label for="email">E-mail</label> |
| 49 | + <label for="email">E-mail</label> |
50 | 50 | <input type="text" name="email" id="email" size="40" value="" /><br /> |
51 | 51 | <p><em>Dit moet een officieel adres zijn van u of uw agentschap, geen Hotmail, Gmail, Yahoo, e.d. adressen aub</em></p> |
52 | 52 | </div> |
53 | | - |
| 53 | + |
54 | 54 | <div class="item"> |
55 | 55 | <label for="data">Datum van foto (optioneel)</label> |
56 | 56 | <input type="text" name="date" id="date" size="40" value="" /> |
57 | 57 | </div> |
58 | | - |
59 | | - <div class="item"> |
| 58 | + |
| 59 | + <div class="item"> |
60 | 60 | <label for="description">Beschrijving van de foto (optioneel)</label> |
61 | 61 | <textarea name="description" id="description" rows="6" cols="80"></textarea> |
62 | 62 | </div> |
63 | | - |
64 | | - <div class="item"> |
| 63 | + |
| 64 | + <div class="item"> |
65 | 65 | <label for="license">Licentie</label> |
66 | 66 | <select name="license" id="license"> |
67 | 67 | <option value="ccby-gfdl" style="font-weight:bold;">Multi-licentie Creative Commons Naamsvermelding / GFDL (aanbevolen)</option> <!-- Multi-license CC-BY / GFDL --> |
68 | | - <!-- |
69 | | - <option value="ccbysa-gfdl">Multi-licentie Creative Commons Naamsvermelding-GelijkDelen / GFDL</option> |
70 | | - <option value="gfdl">GNU Licentie voor Vrije Documentatie (GFDL)</option> |
| 68 | + <!-- |
| 69 | + <option value="ccbysa-gfdl">Multi-licentie Creative Commons Naamsvermelding-GelijkDelen / GFDL</option> |
| 70 | + <option value="gfdl">GNU Licentie voor Vrije Documentatie (GFDL)</option> |
71 | 71 | <option value="ccby">Creative Commons Naamsvermelding</option> |
72 | 72 | <option value="ccbysa">Creative Commons Naamsvermelding-Gelijkdelen</option> |
73 | 73 | <option value="pd">Publiek Domein</option> |
— | — | @@ -75,30 +75,30 @@ |
76 | 76 | </select> |
77 | 77 | <em><a href="javascript:popUp(GE_WIZARD + '?question=licenses')">Wat is een licentie?</a></em> |
78 | 78 | </div> |
79 | | - |
| 79 | + |
80 | 80 | <div class="item"> |
81 | | - <label for="uploadDisclaimer">Voorwaarden</label> |
| 81 | + <label for="uploadDisclaimer">Voorwaarden</label> |
82 | 82 | <textarea name="uploadDisclaimer" id="uploadDescription" rows="6" cols="80">Door het uploaden van dit materiaal en het klikken op de knop 'Upload foto' verklaart u dat u de rechthebbende eigenaar bent van het materiaal. Door dit materiaal te uploaden geeft u toestemming voor het gebruik van het materiaal onder de condities van de door u geselecteerde licentie(s), deze condities variëren per licentie maar houden in ieder geval in dat het materiaal verspreid, bewerkt en commercieel gebruikt mag worden door eenieder. Voor de specifieke extra condities per licentie verwijzen u naar de bijbehorende licentieteksten. U kunt op het vrijgeven van deze rechten na het akkoord gaan met deze voorwaarden niet meer terugkomen. De Wikimedia Foundation en haar chapters (waaronder de Vereniging Wikimedia Nederland) zijn op geen enkele wijze aansprakelijk voor misbruik van het materiaal of aanspraak op het materiaal door derden. De eventuele geportretteerden hebben geen bezwaar tegen publicatie onder genoemde licenties. Ook mijn eventuele opdrachtgever geeft toestemming.</textarea> |
83 | 83 | </div> |
84 | | - |
| 84 | + |
85 | 85 | <div class="item"> |
86 | 86 | <label for="disclaimerAgree">Ik ga akkoord met de bovengenoemde voorwaarden. <br />Mijn toestemming wordt automatisch gemaild naar info-nl at wikimedia dot org.</label> |
87 | 87 | <input type="checkbox" name="disclaimerAgree" id="disclaimerAgree" /> |
88 | 88 | </div> |
89 | | - |
| 89 | + |
90 | 90 | <br style="clear:both;" /> |
91 | | - |
92 | | - <button type="submit" id="btnUpload" name="btnUpload">Upload mijn foto</button> |
93 | | - |
| 91 | + |
| 92 | + <button type="submit" id="btnUpload" name="btnUpload">Upload mijn foto</button> |
| 93 | + |
94 | 94 | <div id="loading" class="imgbox jshide"> |
95 | 95 | <script type="text/javascript"> |
96 | 96 | document.write('<img src="' + GE_URL + 'images/loading.gif" alt="Loading..." />'); |
97 | 97 | document.write('<p>' + messages.WAIT_FOR_UPLOAD + '</p>'); |
98 | 98 | </script> |
99 | | - </div> |
100 | | - |
| 99 | + </div> |
| 100 | + |
101 | 101 | </form> <!-- we upload using javascript, so disable this --> |
102 | | - |
| 102 | + |
103 | 103 | </div> <!-- #upload --> |
104 | 104 | |
105 | | -<br style="clear:both;" /> |
\ No newline at end of file |
| 105 | +<br style="clear:both;" /> |
Index: trunk/tools/wikiportrait/pages/welcome_nl.php |
— | — | @@ -1,33 +1,33 @@ |
2 | 2 | <table style="margin-top: 20px;"> |
3 | 3 | <tr> |
4 | | - <td valign="top" style="padding-right:20px;"> |
| 4 | + <td valign="top" style="padding-right:20px;"> |
5 | 5 | <p> |
6 | | - Staat er op <a href="http://nl.wikipedia.org">Wikipedia</a> een artikel zonder portretfoto? |
| 6 | + Staat er op <a href="http://nl.wikipedia.org">Wikipedia</a> een artikel zonder portretfoto? |
7 | 7 | En heeft u een foto die bij een artikel zou passen? |
8 | 8 | Stel dan uw foto hier ter beschikking en de vrijwilligers van Wikipedia doen de rest. |
9 | 9 | </p> |
10 | | - |
| 10 | + |
11 | 11 | <p> |
12 | | - <script type="text/javascript"> |
13 | | - document.write('<img class="thumb" src="' + GE_URL + '/images/commons_logo.png" alt="Wikimedia Commons" />'); |
14 | | - </script> |
15 | | - Als u veel foto's heeft, of bijvoorbeeld foto's met andere onderwerpen dan beroemdheden |
16 | | - overweegt u dan uw foto's onder te brengen bij <a href="http://commons.wikimedia.org/wiki/Commons:Welkom"> |
17 | | - Wikimedia Commons</a>, de centrale mediadatabank van Wikipedia. |
18 | | - </p> |
19 | | - |
20 | | - <br class="clear" /> |
21 | | - |
22 | | - <p> |
23 | | - Klik hieronder om te beginnen. Binnenkort staat ook úw foto op Wikipedia.<sup>*</sup> |
24 | | - </p> |
| 12 | + <script type="text/javascript"> |
| 13 | + document.write('<img class="thumb" src="' + GE_URL + '/images/commons_logo.png" alt="Wikimedia Commons" />'); |
| 14 | + </script> |
| 15 | + Als u veel foto's heeft, of bijvoorbeeld foto's met andere onderwerpen dan beroemdheden |
| 16 | + overweegt u dan uw foto's onder te brengen bij <a href="http://commons.wikimedia.org/wiki/Commons:Welkom"> |
| 17 | + Wikimedia Commons</a>, de centrale mediadatabank van Wikipedia. |
| 18 | + </p> |
| 19 | + |
| 20 | + <br class="clear" /> |
| 21 | + |
| 22 | + <p> |
| 23 | + Klik hieronder om te beginnen. Binnenkort staat ook úw foto op Wikipedia.<sup>*</sup> |
| 24 | + </p> |
25 | 25 | </td> |
26 | 26 | <td> |
27 | 27 | <script type="text/javascript"> |
28 | 28 | document.write('<a href="' + GE_WIZARD + '?question=first">'); |
29 | 29 | document.write('<img src="' + GE_URL + '/images/home_advertisement.jpg" alt="Advertentie" />'); |
30 | 30 | document.write('</a>'); |
31 | | - </script> |
| 31 | + </script> |
32 | 32 | </td> |
33 | 33 | </tr> |
34 | 34 | </table> |
Index: trunk/tools/wikiportrait/pages/press_nl.php |
— | — | @@ -14,13 +14,13 @@ |
15 | 15 | ["wikiportret_advertentie_150dpi_zwartwit.jpg", "Advertentie op 150 dpi zwart/wit (JPG)"], |
16 | 16 | ["wikiportret_advertentie_cmyk.pdf","Advertentie als CMYK PDF (voor drukwerk)"] |
17 | 17 | ]; |
18 | | - |
| 18 | + |
19 | 19 | for (var i in images) { |
20 | 20 | document.write('<li><a href="' + GE_URL + '/pers/media/' + images[i][0] + '">' + images[i][1] + '</a></li>'); |
21 | 21 | } |
22 | 22 | </script> |
23 | | - </ul> |
24 | | - |
| 23 | + </ul> |
| 24 | + |
25 | 25 | <p> |
26 | 26 | Voor vragen: neem contact op met Hay Kranen (06 - 14 95 13 08), secretaris van <a href="http://www.wmnl.nl">Wikimedia Nederland</a> |
27 | | - </p> |
\ No newline at end of file |
| 27 | + </p> |
Index: trunk/tools/wikiportrait/pers.php |
— | — | @@ -2,7 +2,7 @@ |
3 | 3 | include '_header.php'; |
4 | 4 | ?> |
5 | 5 | <div id="questions"> |
6 | | - <?php show_page('press'); ?> |
| 6 | + <?php show_page( 'press' ); ?> |
7 | 7 | </div> <!-- /questions --> |
8 | 8 | <?php |
9 | 9 | include '_footer.php'; |
Index: trunk/tools/wikiportrait/javascript/lib_formvalidation.js |
— | — | @@ -1,105 +1,105 @@ |
2 | 2 | // This library is used for form validaton |
3 | | -function FormValidation(form) { |
| 3 | +function FormValidation( form ) { |
4 | 4 | // public variables |
5 | | - var result = {} |
6 | | - result.validated = false; |
7 | | - result.error = ''; |
8 | | - |
9 | | - function hasRequiredValues(requiredValues) { |
10 | | - var emptyValues = []; |
11 | | - |
12 | | - for (var i in requiredValues) { |
| 5 | + var result = { } |
| 6 | + result.validated = false; |
| 7 | + result.error = ''; |
| 8 | + |
| 9 | + function hasRequiredValues( requiredValues ) { |
| 10 | + var emptyValues = []; |
| 11 | + |
| 12 | + for ( var i in requiredValues ) { |
13 | 13 | var requiredValue = requiredValues[i]; |
14 | | - if (form[requiredValue].value == "") { |
| 14 | + if ( form[requiredValue].value == "" ) { |
15 | 15 | // form empty, add to the list |
16 | | - emptyValues.push(requiredValue); |
| 16 | + emptyValues.push( requiredValue ); |
17 | 17 | } else { |
18 | 18 | // remove any classes if available |
19 | | - $("#" + requiredValue).removeClass("warning"); |
| 19 | + $( "#" + requiredValue ).removeClass( "warning" ); |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | | - if (emptyValues.length > 0) { // there are empty values |
| 23 | + if ( emptyValues.length > 0 ) { // there are empty values |
24 | 24 | // first generate the error string |
25 | | - for (var i in emptyValues) { |
| 25 | + for ( var i in emptyValues ) { |
26 | 26 | // Get the correct name for this field from the <label> assigned to it |
27 | | - result.error += $("label[for=" + emptyValues[i] + "]").text() + ", "; |
28 | | - |
| 27 | + result.error += $( "label[for=" + emptyValues[i] + "]" ).text() + ", "; |
| 28 | + |
29 | 29 | // also light up the specific fields |
30 | | - $("#" + emptyValues[i]).addClass("warning"); |
31 | | - } |
| 30 | + $( "#" + emptyValues[i] ).addClass( "warning" ); |
| 31 | + } |
32 | 32 | // we cut off the last 2 characters from the string to prevent the ', ' at the end of the string |
33 | | - result.error = messages.EMPTY_VALUE + result.error.substr(0, (result.error.length - 2)); |
| 33 | + result.error = messages.EMPTY_VALUE + result.error.substr( 0, ( result.error.length - 2 ) ); |
34 | 34 | return false; |
35 | 35 | } else { |
36 | 36 | // no empty values, so this form has all the required values |
37 | 37 | return true; |
38 | 38 | } |
39 | 39 | } |
40 | | - |
| 40 | + |
41 | 41 | function hasValidEmail() { |
42 | 42 | var emailRegEx =/^[\w][\w\.\-]*@(?:[a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,4}$/ |
43 | 43 | |
44 | 44 | if (form.email.value.search(emailRegEx) == -1) { |
45 | 45 | // email not valid, change the error message |
46 | 46 | result.error = messages.INVALID_EMAIL; |
47 | | - $("#email").addClass("warning"); |
| 47 | + $( "#email" ).addClass( "warning" ); |
48 | 48 | return false; |
49 | 49 | } else { |
50 | | - $("#email").removeClass("warning"); |
| 50 | + $( "#email" ).removeClass( "warning" ); |
51 | 51 | return true; |
52 | 52 | } |
53 | 53 | } |
54 | | - |
55 | | - function hasGoodEmailProvider(providers) { |
| 54 | + |
| 55 | + function hasGoodEmailProvider( providers ) { |
56 | 56 | // searches the email string for any occurences of unwanted e-mail providers (e.g. hotmail, yahoo, gmail) |
57 | | - for (var i in providers) { |
| 57 | + for ( var i in providers ) { |
58 | 58 | var provider = providers[i]; |
59 | | - if (form.email.value.toLowerCase().indexOf(provider) != -1) { |
| 59 | + if ( form.email.value.toLowerCase().indexOf( provider ) != -1 ) { |
60 | 60 | // bad email provider |
61 | 61 | result.error = messages.INVALID_EMAIL_PROVIDER + provider; |
62 | | - $("#email").addClass("warning"); |
| 62 | + $( "#email" ).addClass( "warning" ); |
63 | 63 | return false; |
64 | 64 | } |
65 | 65 | } |
66 | | - $("#email").removeClass("warning"); |
| 66 | + $( "#email" ).removeClass( "warning" ); |
67 | 67 | return true; |
68 | 68 | } |
69 | | - |
| 69 | + |
70 | 70 | function hasCheckedDisclaimer() { |
71 | | - if (form. disclaimerAgree.checked) { |
72 | | - $("#disclaimerAgreeBox").removeClass("warning"); |
| 71 | + if ( form. disclaimerAgree.checked ) { |
| 72 | + $( "#disclaimerAgreeBox" ).removeClass( "warning" ); |
73 | 73 | return true; |
74 | 74 | } else { |
75 | 75 | result.error = messages.DISCLAIMER_NOT_AGREED; |
76 | | - $("#disclaimerAgreeBox").addClass("warning"); |
| 76 | + $( "#disclaimerAgreeBox" ).addClass( "warning" ); |
77 | 77 | return false; |
78 | 78 | } |
79 | 79 | } |
80 | | - |
81 | | - function hasValidFiletype(filetypes) { |
82 | | - for (var i in filetypes) { |
| 80 | + |
| 81 | + function hasValidFiletype( filetypes ) { |
| 82 | + for ( var i in filetypes ) { |
83 | 83 | var filetype = filetypes[i]; |
84 | | - if (form.file.value.toLowerCase().indexOf(filetype) != -1) { |
85 | | - $("#file").removeClass("warning"); |
| 84 | + if ( form.file.value.toLowerCase().indexOf( filetype ) != -1 ) { |
| 85 | + $( "#file" ).removeClass( "warning" ); |
86 | 86 | return true; |
87 | | - } |
| 87 | + } |
88 | 88 | } |
89 | | - |
| 89 | + |
90 | 90 | // no valid filetypes found |
91 | 91 | result.error = messages.INVALID_FILETYPE; |
92 | | - $("#file").addClass("warning"); |
| 92 | + $( "#file" ).addClass( "warning" ); |
93 | 93 | return false; |
94 | | - } |
95 | | - |
| 94 | + } |
| 95 | + |
96 | 96 | // The whole routine |
97 | | - if (hasRequiredValues(["file", "title", "source", "name", "email"]) == false) return result; |
98 | | - if (hasValidEmail() == false) return result; |
99 | | - if (hasGoodEmailProvider(['hotmail.com', 'gmail.com', 'yahoo.com', 'live.com', 'live.nl', 'yahoo.ca', 'msn.com']) == false) return result; |
100 | | - if (hasCheckedDisclaimer() == false) return result; |
101 | | - if (hasValidFiletype(['.png', '.jpg', '.jpeg', '.gif']) == false) return result; |
102 | | - |
| 97 | + if ( hasRequiredValues( ["file", "title", "source", "name", "email"] ) == false ) return result; |
| 98 | + if ( hasValidEmail() == false ) return result; |
| 99 | + if ( hasGoodEmailProvider( ['hotmail.com', 'gmail.com', 'yahoo.com', 'live.com', 'live.nl', 'yahoo.ca', 'msn.com'] ) == false ) return result; |
| 100 | + if ( hasCheckedDisclaimer() == false ) return result; |
| 101 | + if ( hasValidFiletype( ['.png', '.jpg', '.jpeg', '.gif'] ) == false ) return result; |
| 102 | + |
103 | 103 | // all checks passed, upload the photograph |
104 | 104 | result.validated = true; |
105 | | - return result; |
106 | | -} |
\ No newline at end of file |
| 105 | + return result; |
| 106 | +} |
Index: trunk/tools/wikiportrait/javascript/lib_js.js |
— | — | @@ -1,59 +1,59 @@ |
2 | 2 | // This is the main library used for the website |
3 | 3 | |
4 | | -$(document).ready(function() { |
5 | | - $(".jshide").hide(); |
6 | | - |
7 | | - $('#goback').click(function() { |
8 | | - history.go(-1); |
9 | | - }); |
| 4 | +$( document ).ready( function() { |
| 5 | + $( ".jshide" ).hide(); |
10 | 6 | |
11 | | - $("#btnUpload").click(function() { |
12 | | - var validate = FormValidation(document.upload); |
13 | | - |
14 | | - // We validate the form first to see if there is any invalid content |
15 | | - if (validate.validated) { |
16 | | - // Form is validated correctly |
| 7 | + $( '#goback' ).click( function() { |
| 8 | + history.go( -1 ); |
| 9 | + } ); |
| 10 | + |
| 11 | + $( "#btnUpload" ).click( function() { |
| 12 | + var validate = FormValidation( document.upload ); |
| 13 | + |
| 14 | + // We validate the form first to see if there is any invalid content |
| 15 | + if ( validate.validated ) { |
| 16 | + // Form is validated correctly |
17 | 17 | // hide the submit button and upload stuff |
18 | | - $(this).fadeOut(); |
19 | | - $('#loading').fadeIn(); |
20 | | - document.upload.submit(); // and submit the form |
| 18 | + $( this ).fadeOut(); |
| 19 | + $( '#loading' ).fadeIn(); |
| 20 | + document.upload.submit(); // and submit the form |
21 | 21 | } else { |
22 | 22 | // An error occured, display error message of some kind, if the box already exists put the error in there |
23 | | - if (document.getElementById('uploadwarning')) { |
| 23 | + if ( document.getElementById( 'uploadwarning' ) ) { |
24 | 24 | // box already exists, change just the warning |
25 | | - $("#uploadwarning > p").html(validate.error); |
| 25 | + $( "#uploadwarning > p" ).html( validate.error ); |
26 | 26 | } else { |
27 | 27 | // Make a new box |
28 | 28 | var errorBox = '<div class="warning" id="uploadwarning"><p>' + validate.error + '</p></div>'; |
29 | | - $("#upload").prepend(errorBox); |
| 29 | + $( "#upload" ).prepend( errorBox ); |
30 | 30 | } |
31 | 31 | |
32 | 32 | // Do some cool effect |
33 | | - $("#uploadwarning").fadeIn(); |
34 | | - |
| 33 | + $( "#uploadwarning" ).fadeIn(); |
| 34 | + |
35 | 35 | // Scroll the screen to that place |
36 | | - var warningPosition = $("#uploadwarning").offset() |
37 | | - window.scrollTo(0, warningPosition.top - 50); |
38 | | - |
| 36 | + var warningPosition = $( "#uploadwarning" ).offset() |
| 37 | + window.scrollTo( 0, warningPosition.top - 50 ); |
| 38 | + |
39 | 39 | return false; // do not execute the normal execution of the button (upload the form) |
40 | 40 | } |
41 | | - }); |
42 | | - |
43 | | - $('#toggleexp').click( function() { |
| 41 | + } ); |
| 42 | + |
| 43 | + $( '#toggleexp' ).click( function() { |
44 | 44 | // Slide the explanation down with extra text |
45 | | - $('#explanation').slideToggle("medium"); |
| 45 | + $( '#explanation' ).slideToggle( "medium" ); |
46 | 46 | this.blur(); |
47 | | - }); |
48 | | - |
49 | | - $('#toggleUpload').click(function() { |
| 47 | + } ); |
| 48 | + |
| 49 | + $( '#toggleUpload' ).click( function() { |
50 | 50 | // The upload form is only displayed after clicking the 'I've read the rules' button |
51 | | - $('#uploadbox').slideDown("medium"); |
52 | | - $(this).fadeOut(); |
53 | | - }); |
54 | | -}); |
| 51 | + $( '#uploadbox' ).slideDown( "medium" ); |
| 52 | + $( this ).fadeOut(); |
| 53 | + } ); |
| 54 | +} ); |
55 | 55 | |
56 | | -function popUp(URL) { |
| 56 | +function popUp( URL ) { |
57 | 57 | day = new Date(); |
58 | 58 | id = day.getTime(); |
59 | | - eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=640,height=480,left = 320,top = 272');"); |
60 | | -} |
\ No newline at end of file |
| 59 | + eval( "page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=640,height=480,left=320,top=272');" ); |
| 60 | +} |
Index: trunk/tools/wikiportrait/wizard.php |
— | — | @@ -1,9 +1,8 @@ |
2 | 2 | <?php |
3 | 3 | include '_header.php'; |
4 | 4 | ?> |
5 | | - <div id="questions"> |
6 | | - <?php show_wizard(); ?> |
7 | | - </div> |
| 5 | + <div id="questions"> |
| 6 | + <?php show_wizard(); ?> |
| 7 | + </div> |
8 | 8 | <?php |
9 | 9 | include '_footer.php'; |
10 | | -?> |
\ No newline at end of file |
Index: trunk/tools/wikiportrait/style.css |
— | — | @@ -6,29 +6,39 @@ |
7 | 7 | padding: 0; |
8 | 8 | } |
9 | 9 | |
10 | | -a:hover { color: red; } |
11 | | -img { border: 0; } |
12 | | -ul li { font-size: 1.2em; } |
13 | | -.jsonly { display: none; } |
| 10 | +a:hover { |
| 11 | + color: red; |
| 12 | +} |
14 | 13 | |
| 14 | +img { |
| 15 | + border: 0; |
| 16 | +} |
15 | 17 | |
| 18 | +ul li { |
| 19 | + font-size: 1.2em; |
| 20 | +} |
| 21 | + |
| 22 | +.jsonly { |
| 23 | + display: none; |
| 24 | +} |
| 25 | + |
16 | 26 | .item, label, input, textarea, select, .item p { |
17 | | - float: left; |
| 27 | + float: left; |
18 | 28 | } |
19 | 29 | |
20 | 30 | .item { |
21 | | - clear: both; |
22 | | - margin-bottom: 25px; |
| 31 | + clear: both; |
| 32 | + margin-bottom: 25px; |
23 | 33 | } |
24 | 34 | |
25 | | -label { |
26 | | - vertical-align: middle; |
27 | | - width: 300px; |
| 35 | +label { |
| 36 | + vertical-align: middle; |
| 37 | + width: 300px; |
28 | 38 | } |
29 | 39 | |
30 | 40 | img.thumb { |
31 | | - float: left; |
32 | | - margin: 0 10px 10px 0; |
| 41 | + float: left; |
| 42 | + margin: 0 10px 10px 0; |
33 | 43 | } |
34 | 44 | |
35 | 45 | /* scale back up to a sane default */ |
— | — | @@ -39,11 +49,19 @@ |
40 | 50 | padding: 0; |
41 | 51 | } |
42 | 52 | |
43 | | -#header, #questions, #footer { margin-left: 160px; } |
| 53 | +#header, #questions, #footer { |
| 54 | + margin-left: 160px; |
| 55 | +} |
44 | 56 | |
45 | | -#header h1 { font-size: 188%; border-bottom: 1px solid #aaa; } |
46 | | -#header a { text-decoration: none; } |
| 57 | +#header h1 { |
| 58 | + font-size: 188%; |
| 59 | + border-bottom: 1px solid #aaa; |
| 60 | +} |
47 | 61 | |
| 62 | +#header a { |
| 63 | + text-decoration: none; |
| 64 | +} |
| 65 | + |
48 | 66 | #questions { |
49 | 67 | margin-right: 1em; |
50 | 68 | border: 1px solid #aaa; |
— | — | @@ -52,43 +70,46 @@ |
53 | 71 | padding-top: 0; |
54 | 72 | } |
55 | 73 | |
56 | | - #questions p { font-size: 125%; } |
| 74 | + #questions p { |
| 75 | + font-size: 125%; |
| 76 | + } |
| 77 | + |
57 | 78 | #questions p.error { |
58 | 79 | color: red; |
59 | 80 | font-weight: bold; |
60 | 81 | } |
61 | | - |
| 82 | + |
62 | 83 | #questions p.mail { |
63 | 84 | background: #ccc; |
64 | 85 | margin-left: 15px; |
65 | 86 | padding: 10px; |
66 | 87 | border: 1px solid black; |
67 | 88 | } |
68 | | - |
| 89 | + |
69 | 90 | #questions div.warning, #questions div.info { |
70 | 91 | background: #fcc; |
71 | 92 | padding: 0px 10px; |
72 | 93 | border: 1px solid black; |
73 | 94 | margin-bottom: 20px; |
74 | 95 | } |
75 | | - |
| 96 | + |
76 | 97 | #questions div.info { |
77 | 98 | background: #ddf; |
78 | 99 | } |
79 | | - |
| 100 | + |
80 | 101 | #questions div.info img { |
81 | 102 | float: left; |
82 | 103 | margin: 10px 15px 15px 0px; |
83 | | - } |
84 | | - |
85 | | - #questions div.info ul { |
| 104 | + } |
| 105 | + |
| 106 | + #questions div.info ul { |
86 | 107 | margin-left: 50px; |
87 | 108 | } |
88 | | - |
| 109 | + |
89 | 110 | #questions div.info button { |
90 | 111 | margin-bottom: 15px; |
91 | 112 | } |
92 | | - |
| 113 | + |
93 | 114 | #questions a.question, #questions div.action, #questions div.caution, #questions div.imgbox { |
94 | 115 | font-size: 155%; |
95 | 116 | border: 2px solid #ccc; |
— | — | @@ -98,63 +119,70 @@ |
99 | 120 | text-decoration: none; |
100 | 121 | padding: 10px 0 0 10px; |
101 | 122 | } |
102 | | - |
| 123 | + |
103 | 124 | #questions a.question:hover { |
104 | | - background: url('images/bg_btn_hover.png'); |
| 125 | + background: url('images/bg_btn_hover.png'); |
105 | 126 | } |
106 | | - |
| 127 | + |
107 | 128 | #questions div.action, #questions div.caution, #questions div.imgbox { |
108 | 129 | margin-bottom: 1em; |
109 | 130 | color: #333; |
110 | 131 | height: 75px; |
111 | 132 | } |
112 | | - |
113 | | - #questions div.action { background-image: url('images/bg_action.png'); } |
114 | | - #questions div.caution { background-image: url('images/bg_caution.png'); } |
115 | | - |
| 133 | + |
| 134 | + #questions div.action { |
| 135 | + background-image: url('images/bg_action.png'); |
| 136 | + } |
| 137 | + #questions div.caution { |
| 138 | + background-image: url('images/bg_caution.png'); |
| 139 | + } |
| 140 | + |
116 | 141 | #questions div.imgbox { |
117 | 142 | margin-top: 1em; |
118 | 143 | font-size: 100%; |
119 | 144 | } |
120 | | - |
| 145 | + |
121 | 146 | #questions big { |
122 | 147 | display: block; |
123 | 148 | font-size: 155%; |
124 | 149 | padding-bottom: 15px; |
125 | 150 | } |
126 | | - |
127 | | - #expwrap { |
128 | | - margin-bottom: 1em; |
129 | | - background-image: url('images/bg_explanation.png'); |
| 151 | + |
| 152 | + #expwrap { |
| 153 | + margin-bottom: 1em; |
| 154 | + background-image: url('images/bg_explanation.png'); |
130 | 155 | padding: 1em; |
131 | 156 | border: 1px solid #aaa; |
132 | 157 | } |
133 | | - |
| 158 | + |
134 | 159 | #expwrap a { |
135 | 160 | text-decoration: none; |
136 | 161 | font-size: 110%; |
137 | 162 | } |
138 | | - |
| 163 | + |
139 | 164 | #expwrap p { |
140 | 165 | font-size: 110%; |
141 | 166 | padding: 0; |
142 | 167 | margin: 0; |
143 | 168 | } |
144 | | - |
| 169 | + |
145 | 170 | div.license { |
146 | 171 | padding: 0 1em; |
147 | 172 | border: 1px solid #909090; |
148 | 173 | background: #eee; |
149 | 174 | margin-bottom: 1em; |
150 | 175 | } |
151 | | - |
152 | | - div.license img { float: left; margin-right: 0.5em; } |
153 | | - |
| 176 | + |
| 177 | + div.license img { |
| 178 | + float: left; |
| 179 | + margin-right: 0.5em; |
| 180 | + } |
| 181 | + |
154 | 182 | #footer { |
155 | 183 | background-color: white; |
156 | 184 | border-top: 1px solid #fabd23; |
157 | 185 | border-bottom: 1px solid #fabd23; |
158 | | - margin: 1em 0 1em 0; |
| 186 | + margin: 1em 0 1em 0; |
159 | 187 | text-align: center; |
160 | 188 | font-size: 90%; |
161 | | -} |
\ No newline at end of file |
| 189 | +} |
Index: trunk/tools/wikiportrait/admin/index.php |
— | — | @@ -1,95 +1,95 @@ |
2 | 2 | <?php |
3 | | - include '../inc/common.php'; |
4 | | - |
5 | | - $admin_tasks = array( |
6 | | - "good" => ___("ACTION_GOOD"), |
7 | | - "google" => ___("ACTION_GOOGLE"), |
8 | | - "bad_quality" => ___("ACTION_BAD_QUALITY"), |
9 | | - "invalid_email" => ___("ACTION_INVALID_EMAIL"), |
10 | | - "not_relevant" => ___("ACTION_NOT_RELEVANT") |
11 | | - ); |
12 | | - |
13 | | - $id = $_GET['id']; |
14 | | - $secret = $_GET['secret']; |
15 | | - $action = $_GET['action']; |
16 | | - |
17 | | - if(!$id || !$secret) { |
18 | | - // bail("No id or secret given"); |
19 | | - } |
| 3 | + include '../inc/common.php'; |
20 | 4 | |
21 | | - // Look up the id and see if it matches with the secret |
22 | | - $image = $db->select(TB_IMAGES, $id); |
23 | | - if(!$image) bail("id not found"); |
24 | | - |
25 | | - // Security precaution |
26 | | - unset($image['email']); |
| 5 | + $admin_tasks = array( |
| 6 | + "good" => ___( "ACTION_GOOD" ), |
| 7 | + "google" => ___( "ACTION_GOOGLE" ), |
| 8 | + "bad_quality" => ___( "ACTION_BAD_QUALITY" ), |
| 9 | + "invalid_email" => ___( "ACTION_INVALID_EMAIL" ), |
| 10 | + "not_relevant" => ___( "ACTION_NOT_RELEVANT" ) |
| 11 | + ); |
27 | 12 | |
28 | | -/* |
29 | | - $image_secret = md5(GE_SECRET.$image['id'].$image['timestamp']); |
| 13 | + $id = $_GET['id']; |
| 14 | + $secret = $_GET['secret']; |
| 15 | + $action = $_GET['action']; |
30 | 16 | |
31 | | - if($image_secret != $secret) bail("Secret not correct"); |
32 | | - */ |
33 | | - |
| 17 | + if ( !$id || !$secret ) { |
| 18 | + // bail("No id or secret given"); |
| 19 | + } |
| 20 | + |
| 21 | + // Look up the id and see if it matches with the secret |
| 22 | + $image = $db->select( TB_IMAGES, $id ); |
| 23 | + if ( !$image ) bail( "id not found" ); |
| 24 | + |
| 25 | + // Security precaution |
| 26 | + unset( $image['email'] ); |
| 27 | + |
| 28 | + /* |
| 29 | + $image_secret = md5(GE_SECRET.$image['id'].$image['timestamp']); |
| 30 | + |
| 31 | + if($image_secret != $secret) bail("Secret not correct"); |
| 32 | + */ |
| 33 | + |
34 | 34 | ?> |
35 | 35 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
36 | 36 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> |
37 | 37 | <head> |
38 | | - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
39 | | - <title>Wikiportret admin</title> |
40 | | - <style type="text/css"> |
41 | | - #wrapper { width: 960px; } |
42 | | - .clear { clear:both; } |
43 | | - img { float: left; } |
44 | | - .warning { color: red; text-decoration:underline; } |
45 | | - #data { |
46 | | - float:right; |
47 | | - } |
48 | | - #data li { margin-bottom: 10px; } |
49 | | - #data strong { |
50 | | - display: block; |
51 | | - } |
52 | | - </style> |
53 | | - </head> |
54 | | - <body> |
55 | | - <div id="wrapper"> |
56 | | - <?php |
57 | | - if($action) : |
58 | | - ?> |
59 | | - <textarea cols="80" rows="40"><?php echo admin_action($action); ?></textarea> |
60 | | - <?php |
61 | | - else: |
62 | | - ?> |
63 | | - <h1><?php __("RATE_THIS_IMAGE"); ?></h1> |
64 | | - |
65 | | - <?php if($image['action'] != null) echo '<h2 class="warning">'.___("IMAGE_ACTION_DONE").'</h2>'; ?> |
66 | | - |
67 | | - <a href="<?php echo GE_URL.'uploads/'.$image['filename']; ?>"> |
68 | | - <img src="<?php timthumb(GE_URL.'uploads/'.$image['filename'], 640, 480); ?>" alt="<?php echo $image['title']; ?>" /> |
69 | | - </a> |
70 | | - <ul id="data"> |
71 | | - <?php |
72 | | - foreach($image as $key=>$value) { |
73 | | - echo "<li><strong>$key</strong><span>$value</span></li>"; |
74 | | - } |
75 | | - ?> |
76 | | - </ul> |
77 | | - |
78 | | - <br class="clear" /> |
79 | | - |
80 | | - <h2><?php __("ACTION_FOR_IMAGE"); ?> |
81 | | - <ul id="tasks"> |
82 | | - <?php |
83 | | - if($image['action'] == null) { |
84 | | - foreach($admin_tasks as $task=>$text) { |
85 | | - $url = GE_URL."admin/index.php?id=$id&secret=$secret&action=$task"; |
86 | | - echo '<li><a href="'.$url.'">'.$text.'</a></li>'; |
87 | | - } |
88 | | - } |
89 | | - ?> |
90 | | - </ul> |
91 | | - <?php |
92 | | - endif; |
93 | | - ?> |
94 | | - </div> |
95 | | - </body> |
| 38 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 39 | + <title>Wikiportret admin</title> |
| 40 | + <style type="text/css"> |
| 41 | + #wrapper { width: 960px; } |
| 42 | + .clear { clear:both; } |
| 43 | + img { float: left; } |
| 44 | + .warning { color: red; text-decoration:underline; } |
| 45 | + #data { |
| 46 | + float:right; |
| 47 | + } |
| 48 | + #data li { margin-bottom: 10px; } |
| 49 | + #data strong { |
| 50 | + display: block; |
| 51 | + } |
| 52 | + </style> |
| 53 | + </head> |
| 54 | + <body> |
| 55 | + <div id="wrapper"> |
| 56 | + <?php |
| 57 | + if ( $action ) : |
| 58 | + ?> |
| 59 | + <textarea cols="80" rows="40"><?php echo admin_action( $action ); ?></textarea> |
| 60 | + <?php |
| 61 | + else : |
| 62 | + ?> |
| 63 | + <h1><?php __( "RATE_THIS_IMAGE" ); ?></h1> |
| 64 | + |
| 65 | + <?php if ( $image['action'] != null ) echo '<h2 class="warning">' . ___( "IMAGE_ACTION_DONE" ) . '</h2>'; ?> |
| 66 | + |
| 67 | + <a href="<?php echo GE_URL . 'uploads/' . $image['filename']; ?>"> |
| 68 | + <img src="<?php timthumb( GE_URL . 'uploads/' . $image['filename'], 640, 480 ); ?>" alt="<?php echo $image['title']; ?>" /> |
| 69 | + </a> |
| 70 | + <ul id="data"> |
| 71 | + <?php |
| 72 | + foreach ( $image as $key => $value ) { |
| 73 | + echo "<li><strong>$key</strong><span>$value</span></li>"; |
| 74 | + } |
| 75 | + ?> |
| 76 | + </ul> |
| 77 | + |
| 78 | + <br class="clear" /> |
| 79 | + |
| 80 | + <h2><?php __( "ACTION_FOR_IMAGE" ); ?></h2> |
| 81 | + <ul id="tasks"> |
| 82 | + <?php |
| 83 | + if ( $image['action'] == null ) { |
| 84 | + foreach ( $admin_tasks as $task => $text ) { |
| 85 | + $url = GE_URL . "admin/index.php?id=$id&secret=$secret&action=$task"; |
| 86 | + echo '<li><a href="' . $url . '">' . $text . '</a></li>'; |
| 87 | + } |
| 88 | + } |
| 89 | + ?> |
| 90 | + </ul> |
| 91 | + <?php |
| 92 | + endif; |
| 93 | + ?> |
| 94 | + </div> |
| 95 | + </body> |
96 | 96 | </html> |
Index: trunk/tools/wikiportrait/inc/lib-db.php |
— | — | @@ -1,139 +1,151 @@ |
2 | 2 | <?php |
3 | 3 | Class db { |
4 | | - private $db = false; |
5 | | - public $last_query = ''; |
6 | | - public $num_rows; |
7 | | - public $last_insert_id; |
8 | | - public $last_error; |
9 | | - private $stripslashes = false; |
10 | | - |
11 | | - function db($host, $user, $pass, $database) { |
12 | | - $this->host = $host; |
13 | | - $this->user = $user; |
14 | | - $this->pass = $pass; |
15 | | - $this->database = $database; |
16 | | - $this->debug = 1; |
17 | | - $this->connect(); |
18 | | - } |
19 | | - |
20 | | - function select_db($database = false) { |
21 | | - // only change if a new database is given |
22 | | - if ($database) $this->database = $database; |
23 | | - @mysql_select_db($this->database, $this->db) or $this->bail("The database ".$this->database." could not be found. "); |
24 | | - } |
25 | | - |
26 | | - function connect() { |
27 | | - @$this->db = mysql_connect($this->host, $this->user, $this->pass) or $this->bail("Could not connect to database!"); |
28 | | - $this->select_db(); |
29 | | - return $db; |
30 | | - } |
31 | | - |
32 | | - function query($sql) { |
33 | | - $this->last_query = $sql; |
34 | | - @$result = mysql_query($sql); |
35 | | - if($result) { |
36 | | - // TODO |
37 | | - // This is a little risky, because the insert_id() function is |
38 | | - // run every time a query is done, while it should only happen with INSERT |
39 | | - // queries |
40 | | - $this->last_insert_id = @mysql_insert_id($this->db); |
41 | | - return $result; |
42 | | - } else { |
43 | | - $this->last_error = @mysql_error(); |
44 | | - $this->bail(); |
45 | | - } |
46 | | - } |
47 | | - |
48 | | - function last_query() { |
49 | | - return $this->last_query; |
50 | | - } |
51 | | - |
52 | | - function where($where) { |
53 | | - // User can either pass the $where clausule as an array |
54 | | - // like array("id" => 5, "text" => "foo"); or as a digit |
55 | | - // in the last case, we assume its an id |
56 | | - if(is_array($where)) { |
57 | | - $sql = " WHERE "; |
58 | | - $i = 0; |
59 | | - foreach($where as $key=>$value) { |
60 | | - $sql .= "`".$this->escape($key)."` = '".$this->escape($value)."'"; |
61 | | - if($i < count($where)-1) $sql .= " AND "; |
62 | | - $i++; |
63 | | - } |
64 | | - $sql .= ";"; |
65 | | - } else if ($where != false) { |
66 | | - $sql = "WHERE `id`='".$this->escape($where)."' LIMIT 1;"; |
67 | | - } |
68 | | - return $sql; |
69 | | - } |
70 | | - |
71 | | - function select($table, $where = false) { |
72 | | - $sql = "SELECT * FROM `".$this->escape($table)."`"; |
73 | | - |
74 | | - // Add WHERE clause if needed |
75 | | - if ($where) $sql .= $this->where($where); |
76 | | - |
77 | | - $result = $this->query($sql); |
78 | | - return $this->convert_to_array($result); |
79 | | - } |
80 | | - |
81 | | - function num_rows() { |
82 | | - // returns number of returned rows from the last query |
83 | | - return $this->num_rows; |
84 | | - } |
85 | | - |
86 | | - function delete($table, $where) { |
87 | | - $sql = "DELETE FROM `$table`"; |
88 | | - $sql .= $this->where($where); |
89 | | - return $this->query($sql, false); |
90 | | - } |
91 | | - |
92 | | - function insert($table, $array) { |
93 | | - // Loop through the $values array to add keys and values |
94 | | - $i =0; |
95 | | - $max = count($array) - 1; |
96 | | - foreach($array as $key=>$value) { |
97 | | - $insert .= "`".$this->escape($key)."`"; |
98 | | - if ($i < $max) $insert .= ","; |
99 | | - $values .= "'".$this->escape($value)."'"; |
100 | | - if ($i < $max) $values .= ","; |
101 | | - $i++; |
102 | | - } |
103 | | - |
104 | | - // Finally make the sql statement and query it |
105 | | - $sql = "INSERT INTO `$table` ($insert) VALUES ($values);"; |
106 | | - return $this->query($sql, false); |
107 | | - } |
108 | | - |
109 | | - function convert_to_array($mysql_result) { |
110 | | - if(!$mysql_result) return false; |
| 4 | + private $db = false; |
| 5 | + public $last_query = ''; |
| 6 | + public $num_rows; |
| 7 | + public $last_insert_id; |
| 8 | + public $last_error; |
| 9 | + private $stripslashes = false; |
111 | 10 | |
112 | | - // If this result only has one row, simply return that (default setting) |
113 | | - if (mysql_num_rows($mysql_result) == 1) { |
114 | | - return mysql_fetch_array($mysql_result, MYSQL_ASSOC); |
115 | | - } else { |
116 | | - $array = array(); |
117 | | - while($row = mysql_fetch_array($mysql_result, MYSQL_ASSOC)) { |
118 | | - // Stupid PHP with its slashes |
119 | | - if(($this->stripslashes) && get_magic_quotes_gpc()) $row = stripslashes_deep($row); |
120 | | - $array[] = $row; |
121 | | - } |
122 | | - return $array; |
123 | | - } |
124 | | - } |
125 | | - |
126 | | - function escape($value) { |
127 | | - // Strips slashes and escapes possibile scary characters |
128 | | - if(get_magic_quotes_gpc()) { |
129 | | - $value = stripslashes($value); |
130 | | - } |
131 | | - return mysql_real_escape_string($value, $this->db); |
132 | | - } |
133 | | - |
134 | | - function bail($msg) { |
135 | | - // die with a message |
136 | | - if($this->debug > 0) $msg .= "<br>Mysql_error: ".$this->last_error."<br>Last query:".$this->last_query; |
137 | | - die($msg); |
138 | | - } |
| 11 | + function db( $host, $user, $pass, $database ) { |
| 12 | + $this->host = $host; |
| 13 | + $this->user = $user; |
| 14 | + $this->pass = $pass; |
| 15 | + $this->database = $database; |
| 16 | + $this->debug = 1; |
| 17 | + $this->connect(); |
| 18 | + } |
| 19 | + |
| 20 | + function select_db( $database = false ) { |
| 21 | + // only change if a new database is given |
| 22 | + if ( $database ) $this->database = $database; |
| 23 | + @mysql_select_db( $this->database, $this->db ) or $this->bail( "The database " . $this->database . " could not be found. " ); |
| 24 | + } |
| 25 | + |
| 26 | + function connect() { |
| 27 | + @$this->db = mysql_connect( $this->host, $this->user, $this->pass ) or $this->bail( "Could not connect to database!" ); |
| 28 | + $this->select_db(); |
| 29 | + return $db; |
| 30 | + } |
| 31 | + |
| 32 | + function query( $sql ) { |
| 33 | + $this->last_query = $sql; |
| 34 | + @$result = mysql_query( $sql ); |
| 35 | + if ( $result ) { |
| 36 | + // TODO |
| 37 | + // This is a little risky, because the insert_id() function is |
| 38 | + // run every time a query is done, while it should only happen with INSERT |
| 39 | + // queries |
| 40 | + $this->last_insert_id = @mysql_insert_id( $this->db ); |
| 41 | + return $result; |
| 42 | + } |
| 43 | + else { |
| 44 | + $this->last_error = @mysql_error(); |
| 45 | + $this->bail(); |
| 46 | + } |
| 47 | + } |
| 48 | + |
| 49 | + function last_query() { |
| 50 | + return $this->last_query; |
| 51 | + } |
| 52 | + |
| 53 | + function where( $where ) { |
| 54 | + // User can either pass the $where clausule as an array |
| 55 | + // like array("id" => 5, "text" => "foo"); or as a digit |
| 56 | + // in the last case, we assume its an id |
| 57 | + if ( is_array( $where ) ) { |
| 58 | + $sql = " WHERE "; |
| 59 | + $i = 0; |
| 60 | + foreach ( $where as $key => $value ) { |
| 61 | + $sql .= "`" . $this->escape( $key ) . "` = '" . $this->escape( $value ) . "'"; |
| 62 | + if ( $i < count( $where ) - 1 ) { |
| 63 | + $sql .= " AND "; |
| 64 | + } |
| 65 | + $i++; |
| 66 | + } |
| 67 | + $sql .= ";"; |
| 68 | + } |
| 69 | + else if ( $where != false ) { |
| 70 | + $sql = "WHERE `id`='" . $this->escape( $where ) . "' LIMIT 1;"; |
| 71 | + } |
| 72 | + return $sql; |
| 73 | + } |
| 74 | + |
| 75 | + function select( $table, $where = false ) { |
| 76 | + $sql = "SELECT * FROM `" . $this->escape( $table ) . "`"; |
| 77 | + |
| 78 | + // Add WHERE clause if needed |
| 79 | + if ( $where ) { |
| 80 | + $sql .= $this->where( $where ); |
| 81 | + } |
| 82 | + |
| 83 | + $result = $this->query( $sql ); |
| 84 | + return $this->convert_to_array( $result ); |
| 85 | + } |
| 86 | + |
| 87 | + function num_rows() { |
| 88 | + // returns number of returned rows from the last query |
| 89 | + return $this->num_rows; |
| 90 | + } |
| 91 | + |
| 92 | + function delete( $table, $where ) { |
| 93 | + $sql = "DELETE FROM `$table`"; |
| 94 | + $sql .= $this->where( $where ); |
| 95 | + return $this->query( $sql, false ); |
| 96 | + } |
| 97 | + |
| 98 | + function insert( $table, $array ) { |
| 99 | + // Loop through the $values array to add keys and values |
| 100 | + $i = 0; |
| 101 | + $max = count( $array ) - 1; |
| 102 | + foreach ( $array as $key => $value ) { |
| 103 | + $insert .= "`" . $this->escape( $key ) . "`"; |
| 104 | + if ( $i < $max ) { |
| 105 | + $insert .= ","; |
| 106 | + } |
| 107 | + $values .= "'" . $this->escape( $value ) . "'"; |
| 108 | + if ( $i < $max ) { |
| 109 | + $values .= ","; |
| 110 | + } |
| 111 | + $i++; |
| 112 | + } |
| 113 | + |
| 114 | + // Finally make the sql statement and query it |
| 115 | + $sql = "INSERT INTO `$table` ($insert) VALUES ($values);"; |
| 116 | + return $this->query( $sql, false ); |
| 117 | + } |
| 118 | + |
| 119 | + function convert_to_array( $mysql_result ) { |
| 120 | + if ( !$mysql_result ) return false; |
| 121 | + |
| 122 | + // If this result only has one row, simply return that (default setting) |
| 123 | + if ( mysql_num_rows( $mysql_result ) == 1 ) { |
| 124 | + return mysql_fetch_array( $mysql_result, MYSQL_ASSOC ); |
| 125 | + } |
| 126 | + else { |
| 127 | + $array = array(); |
| 128 | + while ( $row = mysql_fetch_array( $mysql_result, MYSQL_ASSOC ) ) { |
| 129 | + // Stupid PHP with its slashes |
| 130 | + if ( ( $this->stripslashes ) && get_magic_quotes_gpc() ) { |
| 131 | + $row = stripslashes_deep( $row ); |
| 132 | + } |
| 133 | + $array[] = $row; |
| 134 | + } |
| 135 | + return $array; |
| 136 | + } |
| 137 | + } |
| 138 | + |
| 139 | + function escape( $value ) { |
| 140 | + // Strips slashes and escapes possibile scary characters |
| 141 | + if ( get_magic_quotes_gpc() ) { |
| 142 | + $value = stripslashes( $value ); |
| 143 | + } |
| 144 | + return mysql_real_escape_string( $value, $this->db ); |
| 145 | + } |
| 146 | + |
| 147 | + function bail( $msg ) { |
| 148 | + // die with a message |
| 149 | + if ( $this->debug > 0 ) $msg .= "<br />Mysql_error: " . $this->last_error . "<br />Last query:" . $this->last_query; |
| 150 | + die( $msg ); |
| 151 | + } |
139 | 152 | } // Class db |
140 | | -?> |
\ No newline at end of file |
Index: trunk/tools/wikiportrait/inc/timthumb.php |
— | — | @@ -13,17 +13,17 @@ |
14 | 14 | |
15 | 15 | // HTML example: <img src="/scripts/timthumb.php?src=/images/whatever.jpg&w=150&h=200&zc=1" alt="" /> |
16 | 16 | |
17 | | -error_reporting(E_ALL); |
| 17 | +error_reporting( E_ALL ); |
18 | 18 | |
19 | | -if(!isset($_REQUEST["src"])) { |
20 | | - die("no image specified"); |
| 19 | +if ( !isset( $_REQUEST["src"] ) ) { |
| 20 | + die( "no image specified" ); |
21 | 21 | } |
22 | 22 | |
23 | 23 | // clean params before use |
24 | 24 | $src = clean_source( $_REQUEST[ "src" ] ); |
25 | 25 | |
26 | 26 | // set document root |
27 | | -$doc_root = get_document_root($src); |
| 27 | +$doc_root = get_document_root( $src ); |
28 | 28 | |
29 | 29 | // get path to image on file system |
30 | 30 | $src = $doc_root . '/' . $src; |
— | — | @@ -38,51 +38,51 @@ |
39 | 39 | $cache_dir = '../cache'; |
40 | 40 | |
41 | 41 | // get mime type of src |
42 | | -$mime_type = mime_type($src); |
| 42 | +$mime_type = mime_type( $src ); |
43 | 43 | |
44 | 44 | // check to see if this image is in the cache already |
45 | | -//check_cache($cache_dir, $mime_type); |
| 45 | +// check_cache($cache_dir, $mime_type); |
46 | 46 | |
47 | 47 | // make sure that the src is gif/jpg/png |
48 | | -if(!valid_src_mime_type($mime_type)) { |
49 | | - die("Invalid src mime type: $mime_type"); |
| 48 | +if ( !valid_src_mime_type( $mime_type ) ) { |
| 49 | + die( "Invalid src mime type: $mime_type" ); |
50 | 50 | } |
51 | 51 | |
52 | 52 | // check to see if GD function exist |
53 | | -if(!function_exists('imagecreatetruecolor')) { |
54 | | - die("GD Library Error: imagecreatetruecolor does not exist"); |
| 53 | +if ( !function_exists( 'imagecreatetruecolor' ) ) { |
| 54 | + die( "GD Library Error: imagecreatetruecolor does not exist" ); |
55 | 55 | } |
56 | 56 | |
57 | | -if(strlen($src) && file_exists($src)) { |
| 57 | +if ( strlen( $src ) && file_exists( $src ) ) { |
58 | 58 | |
59 | 59 | // open the existing image |
60 | | - $image = open_image($mime_type, $src); |
61 | | - if($image === false) { |
62 | | - die('Unable to open image : ' . $src); |
| 60 | + $image = open_image( $mime_type, $src ); |
| 61 | + if ( $image === false ) { |
| 62 | + die( 'Unable to open image : ' . $src ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | // Get original width and height |
66 | | - $width = imagesx($image); |
67 | | - $height = imagesy($image); |
| 66 | + $width = imagesx( $image ); |
| 67 | + $height = imagesy( $image ); |
68 | 68 | |
69 | 69 | // don't allow new width or height to be greater than the original |
70 | | - if( $new_width > $width ) { |
| 70 | + if ( $new_width > $width ) { |
71 | 71 | $new_width = $width; |
72 | 72 | } |
73 | | - if( $new_height > $height ) { |
| 73 | + if ( $new_height > $height ) { |
74 | 74 | $new_height = $height; |
75 | 75 | } |
76 | 76 | |
77 | 77 | // generate new w/h if not provided |
78 | | - if( $new_width && !$new_height ) { |
| 78 | + if ( $new_width && !$new_height ) { |
79 | 79 | |
80 | 80 | $new_height = $height * ( $new_width / $width ); |
81 | 81 | |
82 | | - } elseif($new_height && !$new_width) { |
| 82 | + } elseif ( $new_height && !$new_width ) { |
83 | 83 | |
84 | 84 | $new_width = $width * ( $new_height / $height ); |
85 | 85 | |
86 | | - } elseif(!$new_width && !$new_height) { |
| 86 | + } elseif ( !$new_width && !$new_height ) { |
87 | 87 | |
88 | 88 | $new_width = $width; |
89 | 89 | $new_height = $height; |
— | — | @@ -92,7 +92,7 @@ |
93 | 93 | // create a new true color image |
94 | 94 | $canvas = imagecreatetruecolor( $new_width, $new_height ); |
95 | 95 | |
96 | | - if( $zoom_crop ) { |
| 96 | + if ( $zoom_crop ) { |
97 | 97 | |
98 | 98 | $src_x = $src_y = 0; |
99 | 99 | $src_w = $width; |
— | — | @@ -132,10 +132,10 @@ |
133 | 133 | |
134 | 134 | } else { |
135 | 135 | |
136 | | - if(strlen($src)) { |
137 | | - die($src . ' not found.'); |
| 136 | + if ( strlen( $src ) ) { |
| 137 | + die( $src . ' not found.' ); |
138 | 138 | } else { |
139 | | - die('no source specified.'); |
| 139 | + die( 'no source specified.' ); |
140 | 140 | } |
141 | 141 | |
142 | 142 | } |
— | — | @@ -144,38 +144,38 @@ |
145 | 145 | |
146 | 146 | // check to see if we can write to the cache directory |
147 | 147 | $is_writable = 0; |
148 | | - $cache_file_name = $cache_dir . '/' . get_cache_file(); |
| 148 | + $cache_file_name = $cache_dir . '/' . get_cache_file(); |
149 | 149 | |
150 | | - if(touch($cache_file_name)) { |
| 150 | + if ( touch( $cache_file_name ) ) { |
151 | 151 | |
152 | 152 | // give 666 permissions so that the developer |
153 | 153 | // can overwrite web server user |
154 | | - chmod($cache_file_name, 0666); |
| 154 | + chmod( $cache_file_name, 0666 ); |
155 | 155 | $is_writable = 1; |
156 | 156 | |
157 | 157 | } else { |
158 | 158 | |
159 | 159 | $cache_file_name = NULL; |
160 | | - header('Content-type: ' . $mime_type); |
| 160 | + header( 'Content-type: ' . $mime_type ); |
161 | 161 | |
162 | 162 | } |
163 | 163 | |
164 | | - if(stristr($mime_type, 'gif')) { |
| 164 | + if ( stristr( $mime_type, 'gif' ) ) { |
165 | 165 | |
166 | | - imagegif($image_resized, $cache_file_name); |
| 166 | + imagegif( $image_resized, $cache_file_name ); |
167 | 167 | |
168 | | - } elseif(stristr($mime_type, 'jpeg')) { |
| 168 | + } elseif ( stristr( $mime_type, 'jpeg' ) ) { |
169 | 169 | |
170 | | - imagejpeg($image_resized, $cache_file_name, $quality); |
| 170 | + imagejpeg( $image_resized, $cache_file_name, $quality ); |
171 | 171 | |
172 | | - } elseif(stristr($mime_type, 'png')) { |
| 172 | + } elseif ( stristr( $mime_type, 'png' ) ) { |
173 | 173 | |
174 | | - $quality = floor($quality * 0.09); |
175 | | - imagepng($image_resized, $cache_file_name, $quality); |
| 174 | + $quality = floor( $quality * 0.09 ); |
| 175 | + imagepng( $image_resized, $cache_file_name, $quality ); |
176 | 176 | |
177 | 177 | } |
178 | 178 | |
179 | | - if($is_writable) { |
| 179 | + if ( $is_writable ) { |
180 | 180 | show_cache_file( $cache_dir, $mime_type ); |
181 | 181 | } |
182 | 182 | |
— | — | @@ -185,7 +185,7 @@ |
186 | 186 | |
187 | 187 | function get_request( $property, $default = 0 ) { |
188 | 188 | |
189 | | - if( isset($_REQUEST[$property]) ) { |
| 189 | + if ( isset( $_REQUEST[$property] ) ) { |
190 | 190 | return $_REQUEST[$property]; |
191 | 191 | } else { |
192 | 192 | return $default; |
— | — | @@ -193,20 +193,20 @@ |
194 | 194 | |
195 | 195 | } |
196 | 196 | |
197 | | -function open_image($mime_type, $src) { |
| 197 | +function open_image( $mime_type, $src ) { |
198 | 198 | |
199 | | - if(stristr($mime_type, 'gif')) { |
| 199 | + if ( stristr( $mime_type, 'gif' ) ) { |
200 | 200 | |
201 | | - $image = imagecreatefromgif($src); |
| 201 | + $image = imagecreatefromgif( $src ); |
202 | 202 | |
203 | | - } elseif(stristr($mime_type, 'jpeg')) { |
| 203 | + } elseif ( stristr( $mime_type, 'jpeg' ) ) { |
204 | 204 | |
205 | | - @ini_set('gd.jpeg_ignore_warning', 1); |
206 | | - $image = imagecreatefromjpeg($src); |
| 205 | + @ini_set( 'gd.jpeg_ignore_warning', 1 ); |
| 206 | + $image = imagecreatefromjpeg( $src ); |
207 | 207 | |
208 | | - } elseif( stristr($mime_type, 'png')) { |
| 208 | + } elseif ( stristr( $mime_type, 'png' ) ) { |
209 | 209 | |
210 | | - $image = imagecreatefrompng($src); |
| 210 | + $image = imagecreatefrompng( $src ); |
211 | 211 | |
212 | 212 | } |
213 | 213 | |
— | — | @@ -214,34 +214,34 @@ |
215 | 215 | |
216 | 216 | } |
217 | 217 | |
218 | | -function mime_type($file) { |
| 218 | +function mime_type( $file ) { |
219 | 219 | |
220 | | - $os = strtolower(php_uname()); |
| 220 | + $os = strtolower( php_uname() ); |
221 | 221 | $mime_type = ''; |
222 | 222 | |
223 | 223 | // use PECL fileinfo to determine mime type |
224 | | - if( function_exists('finfo_open')) { |
225 | | - $finfo = finfo_open(FILEINFO_MIME); |
226 | | - $mime_type = finfo_file($finfo, $file); |
227 | | - finfo_close($finfo); |
| 224 | + if ( function_exists( 'finfo_open' ) ) { |
| 225 | + $finfo = finfo_open( FILEINFO_MIME ); |
| 226 | + $mime_type = finfo_file( $finfo, $file ); |
| 227 | + finfo_close( $finfo ); |
228 | 228 | } |
229 | 229 | |
230 | 230 | // try to determine mime type by using unix file command |
231 | 231 | // this should not be executed on windows |
232 | | - if(!valid_src_mime_type($mime_type) && !(eregi('windows', $os))) { |
233 | | - if(preg_match("/freebsd|linux/", $os)) { |
234 | | - $mime_type = trim(@shell_exec('file -bi $file')); |
| 232 | + if ( !valid_src_mime_type( $mime_type ) && !( eregi( 'windows', $os ) ) ) { |
| 233 | + if ( preg_match( "/freebsd|linux/", $os ) ) { |
| 234 | + $mime_type = trim( @shell_exec( 'file -bi $file' ) ); |
235 | 235 | } |
236 | 236 | } |
237 | 237 | |
238 | 238 | // use file's extension to determine mime type |
239 | | - if(!valid_src_mime_type($mime_type)) { |
| 239 | + if ( !valid_src_mime_type( $mime_type ) ) { |
240 | 240 | |
241 | 241 | // set defaults |
242 | 242 | $mime_type = 'image/jpeg'; |
243 | 243 | // file details |
244 | | - $fileDetails = pathinfo($file); |
245 | | - $ext = strtolower($fileDetails["extension"]); |
| 244 | + $fileDetails = pathinfo( $file ); |
| 245 | + $ext = strtolower( $fileDetails["extension"] ); |
246 | 246 | // mime types |
247 | 247 | $types = array( |
248 | 248 | 'jpg' => 'image/jpeg', |
— | — | @@ -250,7 +250,7 @@ |
251 | 251 | 'gif' => 'image/gif' |
252 | 252 | ); |
253 | 253 | |
254 | | - if(strlen($ext) && strlen($types[$ext])) { |
| 254 | + if ( strlen( $ext ) && strlen( $types[$ext] ) ) { |
255 | 255 | $mime_type = $types[$ext]; |
256 | 256 | } |
257 | 257 | |
— | — | @@ -260,42 +260,42 @@ |
261 | 261 | |
262 | 262 | } |
263 | 263 | |
264 | | -function valid_src_mime_type($mime_type) { |
| 264 | +function valid_src_mime_type( $mime_type ) { |
265 | 265 | |
266 | | - if(preg_match("/jpg|jpeg|gif|png/i", $mime_type)) { |
| 266 | + if ( preg_match( "/jpg|jpeg|gif|png/i", $mime_type ) ) { |
267 | 267 | return true; |
268 | 268 | } |
269 | 269 | return false; |
270 | 270 | |
271 | 271 | } |
272 | 272 | |
273 | | -function check_cache($cache_dir, $mime_type) { |
| 273 | +function check_cache( $cache_dir, $mime_type ) { |
274 | 274 | |
275 | 275 | // make sure cache dir exists |
276 | | - if(!file_exists($cache_dir)) { |
| 276 | + if ( !file_exists( $cache_dir ) ) { |
277 | 277 | // give 777 permissions so that developer can overwrite |
278 | 278 | // files created by web server user |
279 | | - mkdir($cache_dir); |
280 | | - chmod($cache_dir, 0777); |
| 279 | + mkdir( $cache_dir ); |
| 280 | + chmod( $cache_dir, 0777 ); |
281 | 281 | } |
282 | 282 | |
283 | | - show_cache_file($cache_dir, $mime_type); |
| 283 | + show_cache_file( $cache_dir, $mime_type ); |
284 | 284 | |
285 | 285 | } |
286 | 286 | |
287 | | -function show_cache_file($cache_dir, $mime_type) { |
| 287 | +function show_cache_file( $cache_dir, $mime_type ) { |
288 | 288 | |
289 | 289 | $cache_file = $cache_dir . '/' . get_cache_file(); |
290 | 290 | |
291 | | - if( file_exists( $cache_file ) ) { |
| 291 | + if ( file_exists( $cache_file ) ) { |
292 | 292 | |
293 | | - if( isset( $_SERVER[ "HTTP_IF_MODIFIED_SINCE" ] ) ) { |
| 293 | + if ( isset( $_SERVER[ "HTTP_IF_MODIFIED_SINCE" ] ) ) { |
294 | 294 | |
295 | 295 | // check for updates |
296 | | - $if_modified_since = preg_replace( '/;.*$/', '', $_SERVER[ "HTTP_IF_MODIFIED_SINCE" ] ); |
| 296 | + $if_modified_since = preg_replace( '/;.*$/', '', $_SERVER[ "HTTP_IF_MODIFIED_SINCE" ] ); |
297 | 297 | $gmdate_mod = gmdate( 'D, d M Y H:i:s', filemtime( $cache_file ) ); |
298 | 298 | |
299 | | - if( strstr( $gmdate_mod, 'GMT' ) ) { |
| 299 | + if ( strstr( $gmdate_mod, 'GMT' ) ) { |
300 | 300 | $gmdate_mod .= " GMT"; |
301 | 301 | } |
302 | 302 | |
— | — | @@ -306,17 +306,17 @@ |
307 | 307 | |
308 | 308 | } |
309 | 309 | |
310 | | - $fileSize = filesize($cache_file); |
| 310 | + $fileSize = filesize( $cache_file ); |
311 | 311 | |
312 | 312 | // send headers then display image |
313 | | - header("Content-Type: " . $mime_type); |
314 | | - //header("Accept-Ranges: bytes"); |
315 | | - header("Last-Modified: " . gmdate('D, d M Y H:i:s', filemtime($cache_file)) . " GMT"); |
316 | | - header("Content-Length: " . $fileSize); |
317 | | - header("Cache-Control: max-age=9999, must-revalidate"); |
318 | | - header("Expires: " . gmdate("D, d M Y H:i:s", time() + 9999) . "GMT"); |
| 313 | + header( "Content-Type: " . $mime_type ); |
| 314 | + // header("Accept-Ranges: bytes"); |
| 315 | + header( "Last-Modified: " . gmdate( 'D, d M Y H:i:s', filemtime( $cache_file ) ) . " GMT" ); |
| 316 | + header( "Content-Length: " . $fileSize ); |
| 317 | + header( "Cache-Control: max-age=9999, must-revalidate" ); |
| 318 | + header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + 9999 ) . "GMT" ); |
319 | 319 | |
320 | | - readfile($cache_file); |
| 320 | + readfile( $cache_file ); |
321 | 321 | |
322 | 322 | die(); |
323 | 323 | |
— | — | @@ -329,10 +329,10 @@ |
330 | 330 | global $quality; |
331 | 331 | |
332 | 332 | static $cache_file; |
333 | | - if(!$cache_file) { |
| 333 | + if ( !$cache_file ) { |
334 | 334 | $frags = split( "\.", $_REQUEST['src'] ); |
335 | 335 | $ext = strtolower( $frags[ count( $frags ) - 1 ] ); |
336 | | - if(!valid_extension($ext)) { $ext = 'jpg'; } |
| 336 | + if ( !valid_extension( $ext ) ) { $ext = 'jpg'; } |
337 | 337 | $cachename = get_request( 'src', 'timthumb' ) . get_request( 'w', 100 ) . get_request( 'h', 100 ) . get_request( 'zc', 1 ) . get_request( '9', 80 ); |
338 | 338 | $cache_file = md5( $cachename ) . '.' . $ext; |
339 | 339 | } |
— | — | @@ -340,9 +340,9 @@ |
341 | 341 | |
342 | 342 | } |
343 | 343 | |
344 | | -function valid_extension ($ext) { |
| 344 | +function valid_extension ( $ext ) { |
345 | 345 | |
346 | | - if( preg_match( "/jpg|jpeg|png|gif/i", $ext ) ) return 1; |
| 346 | + if ( preg_match( "/jpg|jpeg|png|gif/i", $ext ) ) return 1; |
347 | 347 | return 0; |
348 | 348 | |
349 | 349 | } |
— | — | @@ -350,15 +350,15 @@ |
351 | 351 | function clean_source ( $src ) { |
352 | 352 | |
353 | 353 | // remove http/ https/ ftp |
354 | | - $src = preg_replace("/^((ht|f)tp(s|):\/\/)/i", "", $src); |
| 354 | + $src = preg_replace( "/^((ht|f)tp(s|):\/\/)/i", "", $src ); |
355 | 355 | // remove domain name from the source url |
356 | 356 | $host = $_SERVER["HTTP_HOST"]; |
357 | | - $src = str_replace($host, "", $src); |
358 | | - $host = str_replace("www.", "", $host); |
359 | | - $src = str_replace($host, "", $src); |
| 357 | + $src = str_replace( $host, "", $src ); |
| 358 | + $host = str_replace( "www.", "", $host ); |
| 359 | + $src = str_replace( $host, "", $src ); |
360 | 360 | |
361 | | - //$src = preg_replace( "/(?:^\/+|\.{2,}\/+?)/", "", $src ); |
362 | | - //$src = preg_replace( '/^\w+:\/\/[^\/]+/', '', $src ); |
| 361 | + // $src = preg_replace( "/(?:^\/+|\.{2,}\/+?)/", "", $src ); |
| 362 | + // $src = preg_replace( '/^\w+:\/\/[^\/]+/', '', $src ); |
363 | 363 | |
364 | 364 | // don't allow users the ability to use '../' |
365 | 365 | // in order to gain access to files below document root |
— | — | @@ -373,16 +373,16 @@ |
374 | 374 | |
375 | 375 | } |
376 | 376 | |
377 | | -function get_document_root ($src) { |
378 | | - if( @file_exists( $_SERVER['DOCUMENT_ROOT'] . '/' . $src ) ) { |
| 377 | +function get_document_root ( $src ) { |
| 378 | + if ( @file_exists( $_SERVER['DOCUMENT_ROOT'] . '/' . $src ) ) { |
379 | 379 | return $_SERVER['DOCUMENT_ROOT']; |
380 | 380 | } |
381 | 381 | // the relative paths below are useful if timthumb is moved outside of document root |
382 | 382 | // specifically if installed in wordpress themes like mimbo pro: |
383 | 383 | // /wp-content/themes/mimbopro/scripts/timthumb.php |
384 | 384 | $paths = array( '..', '../..', '../../..', '../../../..' ); |
385 | | - foreach( $paths as $path ) { |
386 | | - if( @file_exists( $path . '/' . $src ) ) { |
| 385 | + foreach ( $paths as $path ) { |
| 386 | + if ( @file_exists( $path . '/' . $src ) ) { |
387 | 387 | return $path; |
388 | 388 | } |
389 | 389 | } |
Index: trunk/tools/wikiportrait/inc/lib-admin.php |
— | — | @@ -1,33 +1,32 @@ |
2 | 2 | <?php |
3 | | - // Library for the admin page |
4 | | - function admin_action($action) { |
5 | | - global $image; |
6 | | - |
7 | | - // Start with a header |
8 | | - $mail = sprintf(___("RESPONSE_HEADER"), $image['name']); |
| 3 | +// Library for the admin page |
| 4 | +function admin_action( $action ) { |
| 5 | + global $image; |
9 | 6 | |
10 | | - // Add specific text for this action |
11 | | - switch($action) { |
12 | | - case "good": |
13 | | - $mail .= sprintf(___("RESPONSE_ACTION_CONFIRMATION"), $image['title']); |
14 | | - break; |
15 | | - case "google": |
16 | | - $mail .= ___("RESPONSE_ACTION_GOOGLE"); |
17 | | - break; |
18 | | - case "invalid_email": |
19 | | - $mail .= ___("RESPONSE_ACTION_INVALID_EMAIL"); |
20 | | - break; |
21 | | - case "bad_quality": |
22 | | - $mail .= ___("RESPONSE_ACTION_BAD_QUALITY"); |
23 | | - break; |
24 | | - case "not_relevant": |
25 | | - $mail .= ___("RESPONSE_ACTION_NOT_RELEVANT"); |
26 | | - } |
27 | | - |
28 | | - // add footer and disclaimer |
29 | | - $mail .= ___("RESPONSE_FOOTER"); |
30 | | - $mail .= ___("RESPONSE_DISCLAIMER"); |
31 | | - |
32 | | - return $mail; |
33 | | - } |
34 | | -?> |
\ No newline at end of file |
| 7 | + // Start with a header |
| 8 | + $mail = sprintf( ___( "RESPONSE_HEADER" ), $image['name'] ); |
| 9 | + |
| 10 | + // Add specific text for this action |
| 11 | + switch( $action ) { |
| 12 | + case "good": |
| 13 | + $mail .= sprintf( ___( "RESPONSE_ACTION_CONFIRMATION" ), $image['title'] ); |
| 14 | + break; |
| 15 | + case "google": |
| 16 | + $mail .= ___( "RESPONSE_ACTION_GOOGLE" ); |
| 17 | + break; |
| 18 | + case "invalid_email": |
| 19 | + $mail .= ___( "RESPONSE_ACTION_INVALID_EMAIL" ); |
| 20 | + break; |
| 21 | + case "bad_quality": |
| 22 | + $mail .= ___( "RESPONSE_ACTION_BAD_QUALITY" ); |
| 23 | + break; |
| 24 | + case "not_relevant": |
| 25 | + $mail .= ___( "RESPONSE_ACTION_NOT_RELEVANT" ); |
| 26 | + } |
| 27 | + |
| 28 | + // add footer and disclaimer |
| 29 | + $mail .= ___( "RESPONSE_FOOTER" ); |
| 30 | + $mail .= ___( "RESPONSE_DISCLAIMER" ); |
| 31 | + |
| 32 | + return $mail; |
| 33 | +} |
Index: trunk/tools/wikiportrait/inc/config-sample.php |
— | — | @@ -1,28 +1,27 @@ |
2 | 2 | <?php |
3 | | - # config |
4 | | - define ('DB_HOST', 'localhost'); // host for your database. usually 'localhost' will do ok |
5 | | - define ('DB_USER', 'root'); // username for acces to the database |
6 | | - define ('DB_PASS', ''); // password for the database |
7 | | - define ('DB_DATABASE', 'uploadwizard'); // the database you have made for the tables of this script |
8 | | - |
9 | | - define ('TB_PREFIX', ''); |
10 | | - define ('TB_MESSAGES', TB_PREFIX.'messages'); |
11 | | - define ('TB_IMAGES', TB_PREFIX.'images'); |
12 | | - |
13 | | - define ('GE_DEBUG', 0); |
14 | | - define ('GE_LANGUAGE', 'nl'); // default language |
15 | | - |
16 | | - define ('ABSPATH', '/var/www/wikiportrait/'); // Trailing slash! |
17 | | - define ('GE_URL', 'http://www.example.com/'); |
18 | | - define ('GE_HOME', GE_URL.'index.php'); |
19 | | - define ('GE_WIZARD', GE_URL.'wizard.php'); |
20 | | - define ('GE_IMAGES_PATH', ABSPATH.'uploads/'); |
21 | | - |
22 | | - $ALLOWED_EXTENSIONS = array(".png", ".jpg", ".jpeg", ".gif"); // allowed extensions for image uploads, NOTE THE DOT (.) before every extension! |
23 | | - define ('GE_MIN_RESOLUTION', 480); |
24 | | - |
25 | | - define ('GE_OTRS_MAIL', 'email@example.com'); |
26 | | - define ('GE_OTRS_FROM', 'email@example.com'); |
27 | | - |
28 | | - error_reporting(0); // set this to 'E_ALL ^ E_NOTICE' for normal error reporting, SET TO ZERO FOR PRODUCTION USE! |
29 | | -?> |
\ No newline at end of file |
| 3 | +# config |
| 4 | +define ( 'DB_HOST', 'localhost' ); // host for your database. usually 'localhost' will do ok |
| 5 | +define ( 'DB_USER', 'root' ); // username for acces to the database |
| 6 | +define ( 'DB_PASS', '' ); // password for the database |
| 7 | +define ( 'DB_DATABASE', 'uploadwizard' ); // the database you have made for the tables of this script |
| 8 | + |
| 9 | +define ( 'TB_PREFIX', '' ); |
| 10 | +define ( 'TB_MESSAGES', TB_PREFIX . 'messages' ); |
| 11 | +define ( 'TB_IMAGES', TB_PREFIX . 'images' ); |
| 12 | + |
| 13 | +define ( 'GE_DEBUG', 0 ); |
| 14 | +define ( 'GE_LANGUAGE', 'nl' ); // default language |
| 15 | + |
| 16 | +define ( 'ABSPATH', '/var/www/wikiportrait/' ); // Trailing slash! |
| 17 | +define ( 'GE_URL', 'http://www.example.com/' ); |
| 18 | +define ( 'GE_HOME', GE_URL . 'index.php' ); |
| 19 | +define ( 'GE_WIZARD', GE_URL . 'wizard.php' ); |
| 20 | +define ( 'GE_IMAGES_PATH', ABSPATH . 'uploads/' ); |
| 21 | + |
| 22 | +$ALLOWED_EXTENSIONS = array( ".png", ".jpg", ".jpeg", ".gif" ); // allowed extensions for image uploads, NOTE THE DOT (.) before every extension! |
| 23 | +define ( 'GE_MIN_RESOLUTION', 480 ); |
| 24 | + |
| 25 | +define ( 'GE_OTRS_MAIL', 'email@example.com' ); |
| 26 | +define ( 'GE_OTRS_FROM', 'email@example.com' ); |
| 27 | + |
| 28 | +error_reporting( 0 ); // set this to 'E_ALL ^ E_NOTICE' for normal error reporting, SET TO ZERO FOR PRODUCTION USE! |
Index: trunk/tools/wikiportrait/inc/lib-utils.php |
— | — | @@ -1,12 +1,12 @@ |
2 | 2 | <?php |
3 | | -function printr($msg) { |
4 | | - echo "<pre>".print_r($msg, true)."</pre>"; |
| 3 | +function printr( $msg ) { |
| 4 | + echo "<pre>" . print_r( $msg, true ) . "</pre>"; |
5 | 5 | } |
6 | 6 | |
7 | | -function bail($msg) { |
| 7 | +function bail( $msg ) { |
8 | 8 | // Die, or if in debug mode, with a message |
9 | | - if(GE_DEBUG > 0) { |
10 | | - die($msg); |
| 9 | + if ( GE_DEBUG > 0 ) { |
| 10 | + die( $msg ); |
11 | 11 | } |
12 | 12 | else { |
13 | 13 | die(); |
— | — | @@ -14,14 +14,14 @@ |
15 | 15 | } |
16 | 16 | |
17 | 17 | // returns a constant from the $GLOBALS['constants'] array |
18 | | -function disp($const) { |
19 | | - if ($GLOBALS['constants'][$const]) { |
| 18 | +function disp( $const ) { |
| 19 | + if ( $GLOBALS['constants'][$const] ) { |
20 | 20 | // This constant is available |
21 | 21 | return $GLOBALS['constants'][$const]; |
22 | 22 | } |
23 | 23 | else { |
24 | 24 | // Not available, display when GE_DEBUG is on |
25 | | - if (GE_DEBUG >= 1) { |
| 25 | + if ( GE_DEBUG >= 1 ) { |
26 | 26 | return "Unknown constant: $const"; |
27 | 27 | } |
28 | 28 | } |
— | — | @@ -30,18 +30,18 @@ |
31 | 31 | // Functions for translating entries. __() gives an echo, ___() returns the value |
32 | 32 | // I know, we could have used gettext() for this, but the messages need to be in the |
33 | 33 | // db, not in .mo files and i'm lazy |
34 | | -function __($const) { |
35 | | - echo disp($const); |
| 34 | +function __( $const ) { |
| 35 | + echo disp( $const ); |
36 | 36 | } |
37 | 37 | |
38 | | -function ___($const) { |
39 | | - return disp($const); |
| 38 | +function ___( $const ) { |
| 39 | + return disp( $const ); |
40 | 40 | } |
41 | 41 | |
42 | 42 | // Simple wrapper for the timthumb.php script |
43 | | -function timthumb($src, $width, $height, $zoomcrop = 0, $echo = true) { |
44 | | - $url = GE_URL."inc/timthumb.php?src=$src&w=$width&h=$height&zc=$zc"; |
45 | | - if($echo) { |
| 43 | +function timthumb( $src, $width, $height, $zoomcrop = 0, $echo = true ) { |
| 44 | + $url = GE_URL . "inc/timthumb.php?src=$src&w=$width&h=$height&zc=$zc"; |
| 45 | + if ( $echo ) { |
46 | 46 | echo $url; |
47 | 47 | } |
48 | 48 | else { |
— | — | @@ -50,21 +50,21 @@ |
51 | 51 | } |
52 | 52 | |
53 | 53 | // shows a variable if GE_DEBUG > 1 |
54 | | -function debug($var) { |
55 | | - if (GE_DEBUG >= 1) { |
| 54 | +function debug( $var ) { |
| 55 | + if ( GE_DEBUG >= 1 ) { |
56 | 56 | echo $var; |
57 | 57 | } |
58 | 58 | } |
59 | 59 | |
60 | | -function sanitize_dashed($value) { |
61 | | - $value = strip_tags($value); |
62 | | - $value = strtolower($value); |
| 60 | +function sanitize_dashed( $value ) { |
| 61 | + $value = strip_tags( $value ); |
| 62 | + $value = strtolower( $value ); |
63 | 63 | // kill entities |
64 | | - $value = preg_replace('/&.+?;/', '', $value); |
65 | | - $value = preg_replace('/[^%a-z0-9 _-]/', '', $value); |
66 | | - $value = preg_replace('/\s+/', '-', $value); |
67 | | - $value = preg_replace('|-+|', '-', $value); |
68 | | - $value = trim($value, '-'); |
| 64 | + $value = preg_replace( '/&.+?;/', '', $value ); |
| 65 | + $value = preg_replace( '/[^%a-z0-9 _-]/', '', $value ); |
| 66 | + $value = preg_replace( '/\s+/', '-', $value ); |
| 67 | + $value = preg_replace( '|-+|', '-', $value ); |
| 68 | + $value = trim( $value, '-' ); |
69 | 69 | return $value; |
70 | 70 | } |
71 | 71 | |
Index: trunk/tools/wikiportrait/inc/lib.php |
— | — | @@ -1,44 +1,44 @@ |
2 | 2 | <?php |
3 | 3 | // displays the explanation that goes with an action or question if applicable |
4 | | -function explanation($constant) { |
| 4 | +function explanation( $constant ) { |
5 | 5 | $explanation = $GLOBALS['explanations'][$constant]; |
6 | | - if ($explanation) { |
| 6 | + if ( $explanation ) { |
7 | 7 | echo '<div id="expwrap">'; |
8 | | - echo '» <a href="#" id="toggleexp">'.disp('EXPLANATION').'</a>'."\n"; |
9 | | - echo '<div id="explanation" class="jshide"><p>'.$explanation.'</p></div>'."\n"; |
| 8 | + echo '» <a href="#" id="toggleexp">' . disp( 'EXPLANATION' ) . '</a>' . "\n"; |
| 9 | + echo '<div id="explanation" class="jshide"><p>' . $explanation . '</p></div>' . "\n"; |
10 | 10 | echo '</div>'; |
11 | 11 | } |
12 | 12 | } |
13 | 13 | |
14 | | -function question($question, $yes, $no, $constant) { |
| 14 | +function question( $question, $yes, $no, $constant ) { |
15 | 15 | $phpself = $_SERVER['PHP_SELF']; |
16 | 16 | echo "<p>$question</p>"; |
17 | | - explanation($constant); |
18 | | - echo '<a href="'.$phpself.'?question='.$yes.'" class="question">'.disp('YES').'</a><br />'; |
19 | | - echo '<a href="'.$phpself.'?question='.$no.'" class="question">'.disp('NO').'</a></br />'; |
| 17 | + explanation( $constant ); |
| 18 | + echo '<a href="' . $phpself . '?question=' . $yes . '" class="question">' . disp( 'YES' ) . '</a><br />'; |
| 19 | + echo '<a href="' . $phpself . '?question=' . $no . '" class="question">' . disp( 'NO' ) . '</a></br />'; |
20 | 20 | } |
21 | 21 | |
22 | | -function action($action, $constant) { |
| 22 | +function action( $action, $constant ) { |
23 | 23 | // display an action |
24 | 24 | $phpself = $_SERVER['PHP_SELF']; |
25 | | - if ($constant == DO_NOT_UPLOAD) { |
| 25 | + if ( $constant == DO_NOT_UPLOAD ) { |
26 | 26 | $class = 'caution'; |
27 | 27 | } |
28 | 28 | else { |
29 | 29 | $class = 'action'; |
30 | 30 | } |
31 | 31 | |
32 | | - echo "<p>".disp('ADVICE_WIZARD')."</p>"; |
33 | | - echo '<div class="'.$class.'">'.$action.'</div>'; |
| 32 | + echo "<p>" . disp( 'ADVICE_WIZARD' ) . "</p>"; |
| 33 | + echo '<div class="' . $class . '">' . $action . '</div>'; |
34 | 34 | |
35 | | - explanation($constant); |
| 35 | + explanation( $constant ); |
36 | 36 | |
37 | 37 | // if the action is not 'DO_NOT_UPLOAD' present a link to the upload form |
38 | | - if ($constant != DO_NOT_UPLOAD) { |
39 | | - echo '<a href="'.$phpself.'?question=uploadform&action='.$constant.'" class="question">'.disp('UPLOAD_LINK').'</a><br />'; |
| 38 | + if ( $constant != DO_NOT_UPLOAD ) { |
| 39 | + echo '<a href="' . $phpself . '?question=uploadform&action=' . $constant . '" class="question">' . disp( 'UPLOAD_LINK' ) . '</a><br />'; |
40 | 40 | } |
41 | 41 | |
42 | | - echo '<a href="'.GE_HOME.'" class="question">'.disp('START_AGAIN').'</a>'; |
| 42 | + echo '<a href="' . GE_HOME . '" class="question">' . disp( 'START_AGAIN' ) . '</a>'; |
43 | 43 | } |
44 | 44 | |
45 | 45 | function fill_globals() { |
— | — | @@ -47,13 +47,13 @@ |
48 | 48 | // get all values from the db and puts it into a new array called $constants |
49 | 49 | $GLOBALS['constants'] = array(); |
50 | 50 | $GLOBALS['explanations'] = array(); |
51 | | - $messages = $db->select(TB_MESSAGES, array("language" => $GLOBALS['settings']['language'])); |
| 51 | + $messages = $db->select( TB_MESSAGES, array( "language" => $GLOBALS['settings']['language'] ) ); |
52 | 52 | |
53 | | - foreach($messages as $message) { |
| 53 | + foreach ( $messages as $message ) { |
54 | 54 | $GLOBALS['constants'][$message['constant']] = $message['message']; |
55 | 55 | |
56 | 56 | // add to the explanations array if applicable |
57 | | - if ($message['explanation']) { |
| 57 | + if ( $message['explanation'] ) { |
58 | 58 | $GLOBALS['explanations'][$message['constant']] = $message['explanation']; |
59 | 59 | } |
60 | 60 | } |
— | — | @@ -61,20 +61,20 @@ |
62 | 62 | // transfer data to global array |
63 | 63 | $const = $GLOBALS['constants']; |
64 | 64 | $GLOBALS['questions'] = array( |
65 | | - "SUBJECT_PROTECTED" => array($const['SUBJECT_PROTECTED'], "DO_NOT_UPLOAD", "OWN_WORK"), |
66 | | - "OWN_WORK" => array($const['OWN_WORK'], "WORK_IN_EMPLOYMENT", "CREATOR_PD"), |
67 | | - "WORK_IN_EMPLOYMENT" => array($const['WORK_IN_EMPLOYMENT'], "EMPLOYER_PERMISSION", "OWN_PERMISSION"), |
68 | | - "CREATOR_PERMISSION" => array($const['CREATOR_PERMISSION'], "UPLOAD_LICENSE_EMAIL", "DO_NOT_UPLOAD"), |
69 | | - "CREATOR_PD" => array($const['CREATOR_PD'], "UPLOAD_PD", "DO_NOT_UPLOAD"), |
70 | | - "OWN_PERMISSION" => array($const['OWN_PERMISSION'], "UPLOAD_LICENSE", "DO_NOT_UPLOAD"), |
71 | | - "EMPLOYER_PERMISSION" => array($const['EMPLOYER_PERMISSION'], "UPLOAD_LICENSE_EMAIL", "DO_NOT_UPLOAD") |
| 65 | + "SUBJECT_PROTECTED" => array( $const['SUBJECT_PROTECTED'], "DO_NOT_UPLOAD", "OWN_WORK" ), |
| 66 | + "OWN_WORK" => array( $const['OWN_WORK'], "WORK_IN_EMPLOYMENT", "CREATOR_PD" ), |
| 67 | + "WORK_IN_EMPLOYMENT" => array( $const['WORK_IN_EMPLOYMENT'], "EMPLOYER_PERMISSION", "OWN_PERMISSION" ), |
| 68 | + "CREATOR_PERMISSION" => array( $const['CREATOR_PERMISSION'], "UPLOAD_LICENSE_EMAIL", "DO_NOT_UPLOAD" ), |
| 69 | + "CREATOR_PD" => array( $const['CREATOR_PD'], "UPLOAD_PD", "DO_NOT_UPLOAD" ), |
| 70 | + "OWN_PERMISSION" => array( $const['OWN_PERMISSION'], "UPLOAD_LICENSE", "DO_NOT_UPLOAD" ), |
| 71 | + "EMPLOYER_PERMISSION" => array( $const['EMPLOYER_PERMISSION'], "UPLOAD_LICENSE_EMAIL", "DO_NOT_UPLOAD" ) |
72 | 72 | ); |
73 | 73 | |
74 | 74 | $GLOBALS['actions'] = array( |
75 | | - "DO_NOT_UPLOAD" => $const['DO_NOT_UPLOAD'], |
76 | | - "UPLOAD_PD" => $const['UPLOAD_PD'], |
77 | | - "UPLOAD_LICENSE" => $const['UPLOAD_LICENSE'], |
78 | | - "UPLOAD_LICENSE_EMAIL" => $const['UPLOAD_LICENSE_EMAIL'] |
| 75 | + "DO_NOT_UPLOAD" => $const['DO_NOT_UPLOAD'], |
| 76 | + "UPLOAD_PD" => $const['UPLOAD_PD'], |
| 77 | + "UPLOAD_LICENSE" => $const['UPLOAD_LICENSE'], |
| 78 | + "UPLOAD_LICENSE_EMAIL" => $const['UPLOAD_LICENSE_EMAIL'] |
79 | 79 | ); |
80 | 80 | } |
81 | 81 | |
— | — | @@ -86,24 +86,24 @@ |
87 | 87 | ); |
88 | 88 | |
89 | 89 | echo '<br /><form method="GET" action="" name="language">'; |
90 | | - echo disp('CHOOSE_LANGUAGE').': '; |
91 | | - echo '<select name="newLanguage">'."\n"; |
92 | | - foreach ($languages as $code=>$language) { |
| 90 | + echo disp( 'CHOOSE_LANGUAGE' ) . ': '; |
| 91 | + echo '<select name="newLanguage">' . "\n"; |
| 92 | + foreach ( $languages as $code => $language ) { |
93 | 93 | // if this is the current selected language give a selected attribute |
94 | | - if ($code == $GLOBALS['settings']['language']) { |
| 94 | + if ( $code == $GLOBALS['settings']['language'] ) { |
95 | 95 | $selected = " selected"; |
96 | 96 | } |
97 | 97 | else { |
98 | 98 | $selected = ""; |
99 | 99 | } |
100 | | - echo '<option value="'.$code.'"'.$selected.'>'.$language.'</option>'; |
| 100 | + echo '<option value="' . $code . '"' . $selected . '>' . $language . '</option>'; |
101 | 101 | } |
102 | 102 | echo '</select>'; |
103 | 103 | echo '<input type="submit" action="" value="OK" />'; |
104 | 104 | echo '</form>'; |
105 | 105 | } |
106 | 106 | |
107 | | -function return_file_upload_errorcode($code) { |
| 107 | +function return_file_upload_errorcode( $code ) { |
108 | 108 | $errors = array( |
109 | 109 | UPLOAD_ERR_OK => 'There is no error, the file uploaded with success.', |
110 | 110 | UPLOAD_ERR_INI_SIZE => 'The uploaded file exceeds the upload_max_filesize directive in php.ini.', |
— | — | @@ -117,34 +117,34 @@ |
118 | 118 | return $errors[$code]; |
119 | 119 | } |
120 | 120 | |
121 | | -function upload_file($file, $filename) { |
122 | | - $destination = GE_IMAGES_PATH.$filename; |
123 | | - $moveresult = @move_uploaded_file($_FILES[$file]['tmp_name'], $destination); |
| 121 | +function upload_file( $file, $filename ) { |
| 122 | + $destination = GE_IMAGES_PATH . $filename; |
| 123 | + $moveresult = @move_uploaded_file( $_FILES[$file]['tmp_name'], $destination ); |
124 | 124 | |
125 | 125 | $return = array(); |
126 | | - if ($moveresult) { |
| 126 | + if ( $moveresult ) { |
127 | 127 | $return['key'] = "ok"; |
128 | 128 | $return['value'] = $destination; |
129 | 129 | } |
130 | 130 | else { |
131 | 131 | $return['key'] = "error"; |
132 | | - $return['value'] = return_file_upload_errorcode($_FILES[$file]['error']); |
| 132 | + $return['value'] = return_file_upload_errorcode( $_FILES[$file]['error'] ); |
133 | 133 | } |
134 | 134 | return $return; |
135 | 135 | } |
136 | 136 | |
137 | | -function add_image($array) { |
| 137 | +function add_image( $array ) { |
138 | 138 | global $db, $settings; |
139 | 139 | |
140 | 140 | // set up return value |
141 | 141 | $return = array(); |
142 | 142 | |
143 | 143 | // We assume that $array contains all the values we need |
144 | | - $img_array = build_assoc_array($array, array("file", "title", "source", "name", "email", "license", "disclaimerAgree", "date", "description")); |
| 144 | + $img_array = build_assoc_array( $array, array( "file", "title", "source", "name", "email", "license", "disclaimerAgree", "date", "description" ) ); |
145 | 145 | |
146 | 146 | // check if all needed values are inserted |
147 | | - $check = check_array_required($img_array, array("title", "source", "name", "email", "license", "disclaimerAgree")); |
148 | | - if ($check != "ok") { |
| 147 | + $check = check_array_required( $img_array, array( "title", "source", "name", "email", "license", "disclaimerAgree" ) ); |
| 148 | + if ( $check != "ok" ) { |
149 | 149 | $return['key'] = "missing_values"; |
150 | 150 | $return['value'] = $check; |
151 | 151 | return $return; |
— | — | @@ -152,40 +152,40 @@ |
153 | 153 | |
154 | 154 | // Check if email is valid |
155 | 155 | $regex = "/^[^@]+@[^@]+(\.[^@]+)+$/"; |
156 | | - if (!preg_match($regex, $array['email'])) { |
| 156 | + if ( !preg_match( $regex, $array['email'] ) ) { |
157 | 157 | $return['key'] = "invalid_email"; |
158 | 158 | return $return; |
159 | 159 | } |
160 | 160 | |
161 | 161 | // Check if the extension is supported |
162 | | - $extension = strtolower(strrchr($_FILES["file"]["name"],".")); |
| 162 | + $extension = strtolower( strrchr( $_FILES["file"]["name"], "." ) ); |
163 | 163 | |
164 | | - if (!in_array($extension, $settings['ALLOWED_EXTENSIONS'])) { |
| 164 | + if ( !in_array( $extension, $settings['ALLOWED_EXTENSIONS'] ) ) { |
165 | 165 | $return['key'] = "unsupported_extension"; |
166 | 166 | return $return; |
167 | 167 | } |
168 | 168 | |
169 | 169 | // Check if the resolution is high enough |
170 | | - $imagesize = getimagesize($_FILES["file"]["tmp_name"]); |
171 | | - if ( ($imagesize[0] < GE_MIN_RESOLUTION) || ($imagesize[1] < GE_MIN_RESOLUTION) ) { |
| 170 | + $imagesize = getimagesize( $_FILES["file"]["tmp_name"] ); |
| 171 | + if ( ( $imagesize[0] < GE_MIN_RESOLUTION ) || ( $imagesize[1] < GE_MIN_RESOLUTION ) ) { |
172 | 172 | $return['key'] = "low_resolution"; |
173 | 173 | return $return; |
174 | 174 | } |
175 | 175 | |
176 | 176 | // Okay, upload the image |
177 | 177 | // First we make an unique name simply by using a sanitized title + the current UNIX timestamp |
178 | | - $filename = sanitize_dashed($img_array["title"])."-".time().".jpg"; |
| 178 | + $filename = sanitize_dashed( $img_array["title"] ) . "-" . time() . ".jpg"; |
179 | 179 | |
180 | | - $upload_result = upload_file("file", $filename); |
181 | | - if ($upload_result['key'] == "error") { |
| 180 | + $upload_result = upload_file( "file", $filename ); |
| 181 | + if ( $upload_result['key'] == "error" ) { |
182 | 182 | $return['key'] = "upload_false"; |
183 | 183 | $return['value'] = $upload_result['value']; |
184 | 184 | return $return; |
185 | 185 | } |
186 | | - else if ($upload_result['key'] == "ok") { |
| 186 | + else if ( $upload_result['key'] == "ok" ) { |
187 | 187 | $img_array["filename"] = $filename; |
188 | | - unset($img_array["file"]); |
189 | | - unset($img_array["disclaimerAgree"]); |
| 188 | + unset( $img_array["file"] ); |
| 189 | + unset( $img_array["disclaimerAgree"] ); |
190 | 190 | } |
191 | 191 | |
192 | 192 | // Also add a timestamp and IP to the DB entry |
— | — | @@ -193,8 +193,8 @@ |
194 | 194 | $img_array["ip"] = $_SERVER['REMOTE_ADDR']; |
195 | 195 | |
196 | 196 | // build the query and execute it |
197 | | - $result = $db->insert(TB_IMAGES, $img_array); |
198 | | - if ($result) { |
| 197 | + $result = $db->insert( TB_IMAGES, $img_array ); |
| 198 | + if ( $result ) { |
199 | 199 | $return['key'] = "db_ok"; |
200 | 200 | |
201 | 201 | // Also add the id from mysql_insert_id() |
— | — | @@ -208,66 +208,66 @@ |
209 | 209 | return $return; |
210 | 210 | } |
211 | 211 | |
212 | | -function check_array_required($array, $required) { |
| 212 | +function check_array_required( $array, $required ) { |
213 | 213 | $return = ''; |
214 | | - foreach ($required as $value) { |
215 | | - if ($array[$value] == "") { |
| 214 | + foreach ( $required as $value ) { |
| 215 | + if ( $array[$value] == "" ) { |
216 | 216 | // we translate the form names as well |
217 | 217 | $translate = array( |
218 | | - 'title' => ___('FORM_TITLE'), |
219 | | - 'source' => ___('FORM_SOURCE'), |
220 | | - 'name' => ___('FORM_NAME'), |
221 | | - 'email' => ___('FORM_EMAIL'), |
222 | | - 'disclaimerAgree' => ___('FORM_DISCLAIMER_AGREE') |
| 218 | + 'title' => ___( 'FORM_TITLE' ), |
| 219 | + 'source' => ___( 'FORM_SOURCE' ), |
| 220 | + 'name' => ___( 'FORM_NAME' ), |
| 221 | + 'email' => ___( 'FORM_EMAIL' ), |
| 222 | + 'disclaimerAgree' => ___( 'FORM_DISCLAIMER_AGREE' ) |
223 | 223 | ); |
224 | 224 | |
225 | | - foreach ($translate as $val=>$trans) { |
226 | | - if ($value == $val) $value = $trans; |
| 225 | + foreach ( $translate as $val => $trans ) { |
| 226 | + if ( $value == $val ) $value = $trans; |
227 | 227 | } |
228 | | - $return .= $value.", "; |
| 228 | + $return .= $value . ", "; |
229 | 229 | } |
230 | 230 | } |
231 | | - $return = ($return == '') ? "ok" : $return; |
| 231 | + $return = ( $return == '' ) ? "ok" : $return; |
232 | 232 | return $return; |
233 | 233 | } |
234 | 234 | |
235 | | -function build_assoc_array($inputarray, $okvalues) { |
| 235 | +function build_assoc_array( $inputarray, $okvalues ) { |
236 | 236 | $newarray = array(); |
237 | | - foreach ($inputarray as $key=>$value) { |
238 | | - if (in_array($key, $okvalues)) { |
| 237 | + foreach ( $inputarray as $key => $value ) { |
| 238 | + if ( in_array( $key, $okvalues ) ) { |
239 | 239 | $newarray[$key] = $value; |
240 | 240 | } |
241 | 241 | } |
242 | 242 | return $newarray; |
243 | 243 | } |
244 | 244 | |
245 | | -function is_language($lang) { |
| 245 | +function is_language( $lang ) { |
246 | 246 | global $settings; |
247 | | - return in_array($lang, $settings['LANGUAGES']); |
| 247 | + return in_array( $lang, $settings['LANGUAGES'] ); |
248 | 248 | } |
249 | 249 | |
250 | 250 | /* |
251 | | -* Sends an e-mail to OTRS containing the data from this upload |
252 | | -*/ |
253 | | -function send_otrs_mail($data) { |
| 251 | + * Sends an e-mail to OTRS containing the data from this upload |
| 252 | + */ |
| 253 | +function send_otrs_mail( $data ) { |
254 | 254 | global $settings; |
255 | 255 | |
256 | 256 | $id = $data['id']; |
257 | | - $secret = md5(GE_SECRET.$data['id'].$data['timestamp']); |
| 257 | + $secret = md5( GE_SECRET . $data['id'] . $data['timestamp'] ); |
258 | 258 | |
259 | 259 | $msg = "Content-Type: text/plain; charset=UTF-8\n"; |
260 | 260 | $msg .= " |
261 | 261 | Beste OTRS vrijwillger, |
262 | 262 | zojuist is er op www.wikiportret.nl een nieuwe foto geupload. |
263 | | - Deze foto heeft als titel '".$data['title']."', gemaakt door '".$data['source']."' |
264 | | - onder de licentie '".$data['license']."' met als omschrijving '".$data['description']."' |
265 | | - De uploader heeft het volgende IP-adres: '".$data['ip']."' |
| 263 | + Deze foto heeft als titel '" . $data['title'] . "', gemaakt door '" . $data['source'] . "' |
| 264 | + onder de licentie '" . $data['license'] . "' met als omschrijving '" . $data['description'] . "' |
| 265 | + De uploader heeft het volgende IP-adres: '" . $data['ip'] . "' |
266 | 266 | |
267 | 267 | Je kunt de foto bekijken op Wikiportret en de foto daar afwijzen, of een tekst genereren die |
268 | 268 | je kan copy-pasten om een e-mail te schrijven. |
269 | 269 | |
270 | 270 | Klik op deze link: |
271 | | - ".GE_URL."admin/?id=$id&secret=$secret |
| 271 | + " . GE_URL . "admin/?id=$id&secret=$secret |
272 | 272 | |
273 | 273 | Als je vragen hebt over de uploadwizard kun je terecht bij Hay (Husky) |
274 | 274 | via http://nl.wikipedia.org/wiki/Gebruiker:Husky of eventueel via hay@bykr.org. |
— | — | @@ -276,21 +276,21 @@ |
277 | 277 | "; |
278 | 278 | |
279 | 279 | // ok, mail |
280 | | - $to = GE_OTRS_MAIL; |
281 | | - $subject = "[Wikiportret] ".$data['title']." geupload op wikiportret.nl"; |
282 | | - if(GE_DEV_MODE > 0) $subject = "TEST-MODE:".$subject; |
283 | | - $headers = 'From: '.$data['email']."\r\n". |
284 | | - 'Reply-to: '.$data['email']."\r\n". |
285 | | - 'X-Mailer: PHP/'.phpversion(); |
| 280 | + $to = GE_OTRS_MAIL; |
| 281 | + $subject = "[Wikiportret] " . $data['title'] . " geupload op wikiportret.nl"; |
| 282 | + if ( GE_DEV_MODE > 0 ) $subject = "TEST-MODE:" . $subject; |
| 283 | + $headers = 'From: ' . $data['email'] . "\r\n" . |
| 284 | + 'Reply-to: ' . $data['email'] . "\r\n" . |
| 285 | + 'X-Mailer: PHP/' . phpversion(); |
286 | 286 | |
287 | | - @$mail = mail($to, $subject, $msg, $headers); |
| 287 | + @$mail = mail( $to, $subject, $msg, $headers ); |
288 | 288 | |
289 | 289 | // Also mail to some extra people |
290 | | - foreach($settings['EXTRA_MAIL_RECEIVERS'] as $address) { |
291 | | - @mail($address, $subject, $msg, $headers); |
| 290 | + foreach ( $settings['EXTRA_MAIL_RECEIVERS'] as $address ) { |
| 291 | + @mail( $address, $subject, $msg, $headers ); |
292 | 292 | } |
293 | 293 | |
294 | | - if ($mail) { |
| 294 | + if ( $mail ) { |
295 | 295 | return true; |
296 | 296 | } |
297 | 297 | else { |
— | — | @@ -298,15 +298,15 @@ |
299 | 299 | } |
300 | 300 | } |
301 | 301 | |
302 | | -function show_page($page) { |
| 302 | +function show_page( $page ) { |
303 | 303 | // echoes the contents of a static page from the /pages directory |
304 | 304 | // used for the welcome page, form page, license page, etc. |
305 | | - $file = ABSPATH.'pages/'.$page.'_'.$GLOBALS['settings']['language'].'.php'; |
306 | | - if (is_file($file)) { |
307 | | - $text = file_get_contents($file); |
| 305 | + $file = ABSPATH . 'pages/' . $page . '_' . $GLOBALS['settings']['language'] . '.php'; |
| 306 | + if ( is_file( $file ) ) { |
| 307 | + $text = file_get_contents( $file ); |
308 | 308 | } |
309 | 309 | else { |
310 | | - $text = "<p class='error'>ERROR: No page could be found for language code '".$GLOBALS['settings']['language']."'</p>"; |
| 310 | + $text = "<p class='error'>ERROR: No page could be found for language code '" . $GLOBALS['settings']['language'] . "'</p>"; |
311 | 311 | } |
312 | 312 | echo $text; |
313 | 313 | } |
— | — | @@ -315,97 +315,96 @@ |
316 | 316 | global $settings; |
317 | 317 | |
318 | 318 | $question = $GLOBALS['question']; |
319 | | - $questions = $GLOBALS['questions']; |
320 | | - $actions = $GLOBALS['actions']; |
| 319 | + $questions = $GLOBALS['questions']; |
| 320 | + $actions = $GLOBALS['actions']; |
321 | 321 | $phpself = $_SERVER['PHP_SELF']; |
322 | 322 | |
323 | | - if (empty($question)) { |
| 323 | + if ( empty( $question ) ) { |
324 | 324 | // welcome, no questions yet |
325 | 325 | show_language_chooser(); // gives a dropdown box of all available languages and changes $GLOBALS['settings']['language'] to that language |
326 | | - echo "<p>".disp('WELCOME_MESSAGE')."</p>"; |
327 | | - echo '<a href="'.$phpself.'?question=first" class="question">'.disp('CLICK_TO_BEGIN').'</a>'; |
| 326 | + echo "<p>" . disp( 'WELCOME_MESSAGE' ) . "</p>"; |
| 327 | + echo '<a href="' . $phpself . '?question=first" class="question">' . disp( 'CLICK_TO_BEGIN' ) . '</a>'; |
328 | 328 | } |
329 | | - else if ($question == "licenses") { |
330 | | - show_page('licenses'); |
331 | | - echo '<a href="'.GE_HOME.'" class="question">'.disp('START_AGAIN').'</a>'; |
| 329 | + else if ( $question == "licenses" ) { |
| 330 | + show_page( 'licenses' ); |
| 331 | + echo '<a href="' . GE_HOME . '" class="question">' . disp( 'START_AGAIN' ) . '</a>'; |
332 | 332 | } |
333 | | - else if ($question == "uploadform") { |
334 | | - if (isset($_POST['btnUpload'])) { |
335 | | - $result = add_image($_POST); |
| 333 | + else if ( $question == "uploadform" ) { |
| 334 | + if ( isset( $_POST['btnUpload'] ) ) { |
| 335 | + $result = add_image( $_POST ); |
336 | 336 | $msg_status = "alert"; // we presume there will be an error :) |
337 | | - if ($result['key'] == "db_ok") { |
| 337 | + if ( $result['key'] == "db_ok" ) { |
338 | 338 | $msg_status = "ok"; |
339 | 339 | } |
340 | | - else if ($result['key'] == "upload_false") { |
341 | | - $msg = "Ik kon het bestand niet uploaden vanwege ".$result['value']; |
| 340 | + else if ( $result['key'] == "upload_false" ) { |
| 341 | + $msg = "Ik kon het bestand niet uploaden vanwege " . $result['value']; |
342 | 342 | } |
343 | | - else if ($result['key'] == "db_error") { |
344 | | - $msg = "Er was een fout met de database: ".$result['value']; |
| 343 | + else if ( $result['key'] == "db_error" ) { |
| 344 | + $msg = "Er was een fout met de database: " . $result['value']; |
345 | 345 | } |
346 | | - else if ($result['key'] == "thumbnail_error") { |
347 | | - $msg = "Er is een fout opgetreden bij het maken van de thumbnails: ".$result['value']; |
| 346 | + else if ( $result['key'] == "thumbnail_error" ) { |
| 347 | + $msg = "Er is een fout opgetreden bij het maken van de thumbnails: " . $result['value']; |
348 | 348 | $msg .= "<br />De foto is <strong>niet</strong> toegevoegd aan de website!"; |
349 | 349 | } |
350 | | - else if ($result['key'] == "invalid_email") { |
| 350 | + else if ( $result['key'] == "invalid_email" ) { |
351 | 351 | $msg = "Het door u opgegeven e-mail adres is niet correct"; |
352 | 352 | } |
353 | | - else if ($result['key'] == "unsupported_extension") { |
| 353 | + else if ( $result['key'] == "unsupported_extension" ) { |
354 | 354 | $msg = "Het bestand wat u probeert te uploaden is geen afbeelding. De afbeeldingstypes die wij ondersteunen zijn: "; |
355 | | - foreach ($settings['ALLOWED_EXTENSIONS'] as $ext) { |
356 | | - $msg .= $ext.", "; |
| 355 | + foreach ( $settings['ALLOWED_EXTENSIONS'] as $ext ) { |
| 356 | + $msg .= $ext . ", "; |
357 | 357 | } |
358 | 358 | } |
359 | | - else if ($result['key'] == "low_resolution") { |
| 359 | + else if ( $result['key'] == "low_resolution" ) { |
360 | 360 | $msg = "De resolutie van uw afbeelding is te laag. De minimale afmetingen van uw afbeelding moet 640x480 pixels zijn."; |
361 | 361 | } |
362 | | - else if ($result['key'] == "missing_values") { |
| 362 | + else if ( $result['key'] == "missing_values" ) { |
363 | 363 | // missing values |
364 | | - $msg = "Deze waardes zijn niet ingevuld maar zijn wel noodzakelijk: ".$result['value']; |
| 364 | + $msg = "Deze waardes zijn niet ingevuld maar zijn wel noodzakelijk: " . $result['value']; |
365 | 365 | } |
366 | 366 | |
367 | 367 | // files uploaded |
368 | | - if ($msg_status == "ok") { |
| 368 | + if ( $msg_status == "ok" ) { |
369 | 369 | // Send an e-mail to OTRS |
370 | | - |
371 | | - if (send_otrs_mail($result['value'])) { |
372 | | - echo '<h2>'.disp('UPLOAD_SUCCESSFUL').'</h2>'; |
373 | | - echo '<p>'.disp('UPLOAD_SUCCESSFUL_MESSAGE').'</p>'; |
374 | | - echo '<big>'.disp('THANKS_UPLOAD').'</big>'; |
375 | | - echo '<a href="'.$phpself.'?question=uploadform" class="question">'.disp('UPLOAD_ANOTHER_IMAGE').'</a><br />'; |
376 | | - echo '<p style="margin-top:0;"><em>'.disp('UPLOAD_ANOTHER_IMAGE_WARNING').'</em></p>'; |
| 370 | + if ( send_otrs_mail( $result['value'] ) ) { |
| 371 | + echo '<h2>' . disp( 'UPLOAD_SUCCESSFUL' ) . '</h2>'; |
| 372 | + echo '<p>' . disp( 'UPLOAD_SUCCESSFUL_MESSAGE' ) . '</p>'; |
| 373 | + echo '<big>' . disp( 'THANKS_UPLOAD' ) . '</big>'; |
| 374 | + echo '<a href="' . $phpself . '?question=uploadform" class="question">' . disp( 'UPLOAD_ANOTHER_IMAGE' ) . '</a><br />'; |
| 375 | + echo '<p style="margin-top:0;"><em>' . disp( 'UPLOAD_ANOTHER_IMAGE_WARNING' ) . '</em></p>'; |
377 | 376 | } |
378 | 377 | else { |
379 | 378 | // OTRS mail failed for some reason |
380 | | - echo '<h2>'.disp('UPLOAD_FAILED').'</h2>'; |
381 | | - echo '<p>'.disp('TRY_AGAIN_LATER').'</h2>'; |
| 379 | + echo '<h2>' . disp( 'UPLOAD_FAILED' ) . '</h2>'; |
| 380 | + echo '<p>' . disp( 'TRY_AGAIN_LATER' ) . '</h2>'; |
382 | 381 | } |
383 | 382 | } |
384 | 383 | else { |
385 | | - echo '<h2>'.disp('UPLOAD_FAILED').'</h2>'; |
386 | | - echo '<p>'.$msg.'</p>'; |
387 | | - echo '<p><a href="#" id="goback">'.disp('GO_BACK_CHANGE_VALUES').'</a></p>'; |
| 384 | + echo '<h2>' . disp( 'UPLOAD_FAILED' ) . '</h2>'; |
| 385 | + echo '<p>' . $msg . '</p>'; |
| 386 | + echo '<p><a href="#" id="goback">' . disp( 'GO_BACK_CHANGE_VALUES' ) . '</a></p>'; |
388 | 387 | } |
389 | 388 | } |
390 | 389 | else { |
391 | 390 | // files not uploaded yet, only display upload form |
392 | | - show_page('uploadform'); |
| 391 | + show_page( 'uploadform' ); |
393 | 392 | } |
394 | 393 | |
395 | | - echo '<a href="'.GE_HOME.'" class="question">'.disp('START_AGAIN').'</a>'; |
| 394 | + echo '<a href="' . GE_HOME . '" class="question">' . disp( 'START_AGAIN' ) . '</a>'; |
396 | 395 | } |
397 | | - else if ($question == "first") { |
| 396 | + else if ( $question == "first" ) { |
398 | 397 | // first time question |
399 | 398 | // give 'SUBJECT_PROTECTED' in the function to avoid having to search explanations for 'first' |
400 | | - question ($questions["SUBJECT_PROTECTED"][0], $questions['SUBJECT_PROTECTED'][1], $questions['SUBJECT_PROTECTED'][2], 'SUBJECT_PROTECTED'); |
| 399 | + question ( $questions["SUBJECT_PROTECTED"][0], $questions['SUBJECT_PROTECTED'][1], $questions['SUBJECT_PROTECTED'][2], 'SUBJECT_PROTECTED' ); |
401 | 400 | } |
402 | 401 | else { |
403 | 402 | // not the first question or welcome |
404 | | - if (!array_key_exists($question, $actions)) { |
405 | | - question($questions[$question][0], $questions[$question][1], $questions[$question][2], $question); |
| 403 | + if ( !array_key_exists( $question, $actions ) ) { |
| 404 | + question( $questions[$question][0], $questions[$question][1], $questions[$question][2], $question ); |
406 | 405 | } |
407 | 406 | else { |
408 | 407 | // not a question but an action |
409 | | - action($actions[$question], $question); |
| 408 | + action( $actions[$question], $question ); |
410 | 409 | } |
411 | 410 | } |
412 | 411 | } |
Index: trunk/tools/wikiportrait/inc/common.php |
— | — | @@ -2,14 +2,17 @@ |
3 | 3 | // General variables |
4 | 4 | $wikiportrait_version = "1.1beta-3"; |
5 | 5 | |
6 | | -if(!@include 'config.php') die("Could not find config.php. Maybe you haven't made a configuration file yet?"); |
| 6 | +if ( !@include 'config.php' ) { |
| 7 | + die( "Could not find config.php. Maybe you haven't made a configuration file yet?" ); |
| 8 | +} |
| 9 | + |
7 | 10 | require 'lib.php'; // General library |
8 | 11 | require 'lib-db.php'; // Global database Class |
9 | 12 | require 'lib-utils.php'; // Utility stuff |
10 | 13 | require 'lib-admin.php'; // stuff for admin/index.php |
11 | 14 | |
12 | 15 | // connect to db |
13 | | -$db = new db(DB_HOST, DB_USER, DB_PASS, DB_DATABASE); |
| 16 | +$db = new db( DB_HOST, DB_USER, DB_PASS, DB_DATABASE ); |
14 | 17 | |
15 | 18 | // start session |
16 | 19 | session_start(); |
— | — | @@ -18,7 +21,7 @@ |
19 | 22 | $_SESSION['language'] = GE_LANGUAGE; // default |
20 | 23 | |
21 | 24 | // Maybe overwrite with a custom setting? |
22 | | -if (isset($_GET['newLanguage']) && is_language($_GET['newLanguage'])) { |
| 25 | +if ( isset( $_GET['newLanguage'] ) && is_language( $_GET['newLanguage'] ) ) { |
23 | 26 | $_SESSION['language'] = $_GET['newLanguage']; |
24 | 27 | } |
25 | 28 | |
Index: trunk/tools/wikiportrait/style_ie6.css |
— | — | @@ -1,3 +1,3 @@ |
2 | 2 | label { |
3 | | - clear: both; |
4 | | -} |
\ No newline at end of file |
| 3 | + clear: both; |
| 4 | +} |
Index: trunk/tools/wikiportrait/_header.php |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | <?php |
3 | | - include 'inc/common.php'; |
| 3 | +include 'inc/common.php'; |
4 | 4 | ?> |
5 | 5 | <!doctype html> |
6 | 6 | <html> |
— | — | @@ -13,18 +13,18 @@ |
14 | 14 | --> |
15 | 15 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
16 | 16 | <link rel="stylesheet" type="text/css" href="style.css" /> |
17 | | - <!--[if lt IE 7]> |
18 | | - <link rel="stylesheet" href="style_ie6.css" type="text/css" media="screen" /> |
19 | | - <![endif]--> |
| 17 | + <!--[if lt IE 7]> |
| 18 | + <link rel="stylesheet" href="style_ie6.css" type="text/css" media="screen" /> |
| 19 | + <![endif]--> |
20 | 20 | <style type="text/css"> |
21 | | - #wrapper { |
22 | | - /* we need to set this here because it might change per language */ |
23 | | - background: url('images/logo_<?php echo $GLOBALS['settings']['language']; ?>.png') top left no-repeat; |
24 | | - } |
25 | | - </style> |
| 21 | + #wrapper { |
| 22 | + /* we need to set this here because it might change per language */ |
| 23 | + background: url('images/logo_<?php echo $GLOBALS['settings']['language']; ?>.png') top left no-repeat; |
| 24 | + } |
| 25 | + </style> |
26 | 26 | |
27 | | - <script type="text/javascript" src="javascript/jquery.js"></script> |
28 | | - <script type="text/javascript" src="javascript/lib_formvalidation.js"></script> |
| 27 | + <script type="text/javascript" src="javascript/jquery.js"></script> |
| 28 | + <script type="text/javascript" src="javascript/lib_formvalidation.js"></script> |
29 | 29 | <script type="text/javascript" src="javascript/lib_js.js"></script> |
30 | 30 | <script type="text/javascript"> |
31 | 31 | var GE_WIZARD='<?php echo GE_WIZARD; // this is a quick hack to prevent having to write a parser for the uploadforms :) ?>'; |
— | — | @@ -32,24 +32,24 @@ |
33 | 33 | |
34 | 34 | var messages = {}; |
35 | 35 | <?php |
36 | | - $values = array("EMPTY_VALUE", "INVALID_EMAIL", "INVALID_EMAIL_PROVIDER", "DISCLAIMER_NOT_AGREED", "INVALID_FILETYPE", "WAIT_FOR_UPLOAD"); |
37 | | - foreach($values as $value) { |
38 | | - echo "messages.$value = '".addslashes(___($value))."';\n"; |
39 | | - } |
40 | | - ?> |
| 36 | + $values = array( "EMPTY_VALUE", "INVALID_EMAIL", "INVALID_EMAIL_PROVIDER", "DISCLAIMER_NOT_AGREED", "INVALID_FILETYPE", "WAIT_FOR_UPLOAD" ); |
| 37 | + foreach ( $values as $value ) { |
| 38 | + echo "messages.$value = '" . addslashes( ___( $value ) ) . "';\n"; |
| 39 | + } |
| 40 | + ?> |
41 | 41 | </script> |
42 | | - <title> |
43 | | - <?php if(GE_DEV_MODE > 0) echo "TEST MODE - "; ?> |
44 | | - <?php __('TITLE'); ?> |
45 | | - </title> |
| 42 | + <title> |
| 43 | + <?php if ( GE_DEV_MODE > 0 ) echo "TEST MODE - "; ?> |
| 44 | + <?php __( 'TITLE' ); ?> |
| 45 | + </title> |
46 | 46 | </head> |
47 | 47 | <body> |
48 | 48 | <div id="wrapper"> |
49 | 49 | <div id="header"> |
50 | 50 | <h1> |
51 | | - <a href="<?php echo GE_HOME; ?>"> |
52 | | - <?php if(GE_DEV_MODE > 0) echo "TEST MODE - "; ?> |
53 | | - <?php __('TITLE'); ?> |
54 | | - </a> |
55 | | - </h1> |
| 51 | + <a href="<?php echo GE_HOME; ?>"> |
| 52 | + <?php if ( GE_DEV_MODE > 0 ) echo "TEST MODE - "; ?> |
| 53 | + <?php __( 'TITLE' ); ?> |
| 54 | + </a> |
| 55 | + </h1> |
56 | 56 | </div> |
Index: trunk/tools/wikiportrait/index.php |
— | — | @@ -27,17 +27,16 @@ |
28 | 28 | ?> |
29 | 29 | <div id="questions"> |
30 | 30 | <?php |
31 | | - show_page('welcome'); |
| 31 | + show_page( 'welcome' ); |
32 | 32 | ?> |
33 | 33 | |
34 | 34 | <p> |
35 | | - <a href="<?php echo GE_WIZARD; ?>?question=first" class="question"><?php echo disp('CLICK_TO_BEGIN'); ?></a> |
| 35 | + <a href="<?php echo GE_WIZARD; ?>?question=first" class="question"><?php echo disp( 'CLICK_TO_BEGIN' ); ?></a> |
36 | 36 | </p> |
37 | 37 | |
38 | 38 | <?php |
39 | | - show_page('welcome_disclaimer'); |
| 39 | + show_page( 'welcome_disclaimer' ); |
40 | 40 | ?> |
41 | 41 | </div> <!-- /questions --> |
42 | 42 | <?php |
43 | 43 | include '_footer.php'; |
44 | | -?> |
\ No newline at end of file |