r59063 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r59062‎ | r59063 | r59064 >
Date:13:27, 14 November 2009
Author:siebrand
Status:deferred
Tags:
Comment:
* added a missing </h2> in admin/index.php
* <br> -> <br />
* update formatting and indentation
Modified paths:
  • /trunk/tools/wikiportrait/_header.php (modified) (history)
  • /trunk/tools/wikiportrait/admin/index.php (modified) (history)
  • /trunk/tools/wikiportrait/inc/common.php (modified) (history)
  • /trunk/tools/wikiportrait/inc/config-sample.php (modified) (history)
  • /trunk/tools/wikiportrait/inc/lib-admin.php (modified) (history)
  • /trunk/tools/wikiportrait/inc/lib-db.php (modified) (history)
  • /trunk/tools/wikiportrait/inc/lib-utils.php (modified) (history)
  • /trunk/tools/wikiportrait/inc/lib.php (modified) (history)
  • /trunk/tools/wikiportrait/inc/timthumb.php (modified) (history)
  • /trunk/tools/wikiportrait/index.php (modified) (history)
  • /trunk/tools/wikiportrait/javascript/lib_formvalidation.js (modified) (history)
  • /trunk/tools/wikiportrait/javascript/lib_js.js (modified) (history)
  • /trunk/tools/wikiportrait/pages/licenses_nl.php (modified) (history)
  • /trunk/tools/wikiportrait/pages/press_nl.php (modified) (history)
  • /trunk/tools/wikiportrait/pages/uploadform_nl.php (modified) (history)
  • /trunk/tools/wikiportrait/pages/welcome_nl.php (modified) (history)
  • /trunk/tools/wikiportrait/pers.php (modified) (history)
  • /trunk/tools/wikiportrait/style.css (modified) (history)
  • /trunk/tools/wikiportrait/style_ie6.css (modified) (history)
  • /trunk/tools/wikiportrait/wizard.php (modified) (history)

Diff [purge]

Index: trunk/tools/wikiportrait/pages/licenses_nl.php
@@ -28,4 +28,4 @@
2929 <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>
3030 <img src="images/icon_gnu.png" alt="GNU head" />
3131 <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 @@
1616 <li>Uw foto moet minimaal een resolutie hebben van 640x480 pixels</li>
1717 </ul>
1818 <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
2020 van zoekmachines als Google e.d. zijn afgehaald worden <strong>niet</strong> in behandeling genomen!
2121 </p>
22 -
 22+
2323 <button id="toggleUpload">Upload mijn foto</button>
2424 </div>
2525
@@ -29,11 +29,11 @@
3030 <input type="file" name="file" id="file" size="40" />
3131 </div>
3232
33 - <div class="item">
 33+ <div class="item">
3434 <label for="title">Wie staat er op de foto</label>
3535 <input type="text" name="title" id="title" size="40" value="" />
3636 </div>
37 -
 37+
3838 <div class="item">
3939 <label for="source">Rechthebbende en/of auteur van de foto</label>
4040 <input type="text" name="source" id="source" size="40" value="" />
@@ -43,30 +43,30 @@
4444 <label for="name">Uw naam</label>
4545 <input type="text" name="name" id="name" size="40" value="" />
4646 </div>
47 -
 47+
4848 <div class="item">
49 - <label for="email">E-mail</label>
 49+ <label for="email">E-mail</label>
5050 <input type="text" name="email" id="email" size="40" value="" /><br />
5151 <p><em>Dit moet een officieel adres zijn van u of uw agentschap, geen Hotmail, Gmail, Yahoo, e.d. adressen aub</em></p>
5252 </div>
53 -
 53+
5454 <div class="item">
5555 <label for="data">Datum van foto (optioneel)</label>
5656 <input type="text" name="date" id="date" size="40" value="" />
5757 </div>
58 -
59 - <div class="item">
 58+
 59+ <div class="item">
6060 <label for="description">Beschrijving van de foto (optioneel)</label>
6161 <textarea name="description" id="description" rows="6" cols="80"></textarea>
6262 </div>
63 -
64 - <div class="item">
 63+
 64+ <div class="item">
6565 <label for="license">Licentie</label>
6666 <select name="license" id="license">
6767 <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>
7171 <option value="ccby">Creative Commons Naamsvermelding</option>
7272 <option value="ccbysa">Creative Commons Naamsvermelding-Gelijkdelen</option>
7373 <option value="pd">Publiek Domein</option>
@@ -75,30 +75,30 @@
7676 </select>
7777 <em><a href="javascript:popUp(GE_WIZARD + '?question=licenses')">Wat is een licentie?</a></em>
7878 </div>
79 -
 79+
8080 <div class="item">
81 - <label for="uploadDisclaimer">Voorwaarden</label>
 81+ <label for="uploadDisclaimer">Voorwaarden</label>
8282 <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>
8383 </div>
84 -
 84+
8585 <div class="item">
8686 <label for="disclaimerAgree">Ik ga akkoord met de bovengenoemde voorwaarden. <br />Mijn toestemming wordt automatisch gemaild naar info-nl at wikimedia dot org.</label>
8787 <input type="checkbox" name="disclaimerAgree" id="disclaimerAgree" />
8888 </div>
89 -
 89+
9090 <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+
9494 <div id="loading" class="imgbox jshide">
9595 <script type="text/javascript">
9696 document.write('<img src="' + GE_URL + 'images/loading.gif" alt="Loading..." />');
9797 document.write('<p>' + messages.WAIT_FOR_UPLOAD + '</p>');
9898 </script>
99 - </div>
100 -
 99+ </div>
 100+
101101 </form> <!-- we upload using javascript, so disable this -->
102 -
 102+
103103 </div> <!-- #upload -->
104104
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 @@
22 <table style="margin-top: 20px;">
33 <tr>
4 - <td valign="top" style="padding-right:20px;">
 4+ <td valign="top" style="padding-right:20px;">
55 <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?
77 En heeft u een foto die bij een artikel zou passen?
88 Stel dan uw foto hier ter beschikking en de vrijwilligers van Wikipedia doen de rest.
99 </p>
10 -
 10+
1111 <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>
2525 </td>
2626 <td>
2727 <script type="text/javascript">
2828 document.write('<a href="' + GE_WIZARD + '?question=first">');
2929 document.write('<img src="' + GE_URL + '/images/home_advertisement.jpg" alt="Advertentie" />');
3030 document.write('</a>');
31 - </script>
 31+ </script>
3232 </td>
3333 </tr>
3434 </table>
Index: trunk/tools/wikiportrait/pages/press_nl.php
@@ -14,13 +14,13 @@
1515 ["wikiportret_advertentie_150dpi_zwartwit.jpg", "Advertentie op 150 dpi zwart/wit (JPG)"],
1616 ["wikiportret_advertentie_cmyk.pdf","Advertentie als CMYK PDF (voor drukwerk)"]
1717 ];
18 -
 18+
1919 for (var i in images) {
2020 document.write('<li><a href="' + GE_URL + '/pers/media/' + images[i][0] + '">' + images[i][1] + '</a></li>');
2121 }
2222 </script>
23 - </ul>
24 -
 23+ </ul>
 24+
2525 <p>
2626 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 @@
33 include '_header.php';
44 ?>
55 <div id="questions">
6 - <?php show_page('press'); ?>
 6+ <?php show_page( 'press' ); ?>
77 </div> <!-- /questions -->
88 <?php
99 include '_footer.php';
Index: trunk/tools/wikiportrait/javascript/lib_formvalidation.js
@@ -1,105 +1,105 @@
22 // This library is used for form validaton
3 -function FormValidation(form) {
 3+function FormValidation( form ) {
44 // 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 ) {
1313 var requiredValue = requiredValues[i];
14 - if (form[requiredValue].value == "") {
 14+ if ( form[requiredValue].value == "" ) {
1515 // form empty, add to the list
16 - emptyValues.push(requiredValue);
 16+ emptyValues.push( requiredValue );
1717 } else {
1818 // remove any classes if available
19 - $("#" + requiredValue).removeClass("warning");
 19+ $( "#" + requiredValue ).removeClass( "warning" );
2020 }
2121 }
2222
23 - if (emptyValues.length > 0) { // there are empty values
 23+ if ( emptyValues.length > 0 ) { // there are empty values
2424 // first generate the error string
25 - for (var i in emptyValues) {
 25+ for ( var i in emptyValues ) {
2626 // 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+
2929 // also light up the specific fields
30 - $("#" + emptyValues[i]).addClass("warning");
31 - }
 30+ $( "#" + emptyValues[i] ).addClass( "warning" );
 31+ }
3232 // 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 ) );
3434 return false;
3535 } else {
3636 // no empty values, so this form has all the required values
3737 return true;
3838 }
3939 }
40 -
 40+
4141 function hasValidEmail() {
4242 var emailRegEx =/^[\w][\w\.\-]*@(?:[a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,4}$/
4343
4444 if (form.email.value.search(emailRegEx) == -1) {
4545 // email not valid, change the error message
4646 result.error = messages.INVALID_EMAIL;
47 - $("#email").addClass("warning");
 47+ $( "#email" ).addClass( "warning" );
4848 return false;
4949 } else {
50 - $("#email").removeClass("warning");
 50+ $( "#email" ).removeClass( "warning" );
5151 return true;
5252 }
5353 }
54 -
55 - function hasGoodEmailProvider(providers) {
 54+
 55+ function hasGoodEmailProvider( providers ) {
5656 // 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 ) {
5858 var provider = providers[i];
59 - if (form.email.value.toLowerCase().indexOf(provider) != -1) {
 59+ if ( form.email.value.toLowerCase().indexOf( provider ) != -1 ) {
6060 // bad email provider
6161 result.error = messages.INVALID_EMAIL_PROVIDER + provider;
62 - $("#email").addClass("warning");
 62+ $( "#email" ).addClass( "warning" );
6363 return false;
6464 }
6565 }
66 - $("#email").removeClass("warning");
 66+ $( "#email" ).removeClass( "warning" );
6767 return true;
6868 }
69 -
 69+
7070 function hasCheckedDisclaimer() {
71 - if (form. disclaimerAgree.checked) {
72 - $("#disclaimerAgreeBox").removeClass("warning");
 71+ if ( form. disclaimerAgree.checked ) {
 72+ $( "#disclaimerAgreeBox" ).removeClass( "warning" );
7373 return true;
7474 } else {
7575 result.error = messages.DISCLAIMER_NOT_AGREED;
76 - $("#disclaimerAgreeBox").addClass("warning");
 76+ $( "#disclaimerAgreeBox" ).addClass( "warning" );
7777 return false;
7878 }
7979 }
80 -
81 - function hasValidFiletype(filetypes) {
82 - for (var i in filetypes) {
 80+
 81+ function hasValidFiletype( filetypes ) {
 82+ for ( var i in filetypes ) {
8383 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" );
8686 return true;
87 - }
 87+ }
8888 }
89 -
 89+
9090 // no valid filetypes found
9191 result.error = messages.INVALID_FILETYPE;
92 - $("#file").addClass("warning");
 92+ $( "#file" ).addClass( "warning" );
9393 return false;
94 - }
95 -
 94+ }
 95+
9696 // 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+
103103 // all checks passed, upload the photograph
104104 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 @@
22 // This is the main library used for the website
33
4 -$(document).ready(function() {
5 - $(".jshide").hide();
6 -
7 - $('#goback').click(function() {
8 - history.go(-1);
9 - });
 4+$( document ).ready( function() {
 5+ $( ".jshide" ).hide();
106
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
1717 // 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
2121 } else {
2222 // 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' ) ) {
2424 // box already exists, change just the warning
25 - $("#uploadwarning > p").html(validate.error);
 25+ $( "#uploadwarning > p" ).html( validate.error );
2626 } else {
2727 // Make a new box
2828 var errorBox = '<div class="warning" id="uploadwarning"><p>' + validate.error + '</p></div>';
29 - $("#upload").prepend(errorBox);
 29+ $( "#upload" ).prepend( errorBox );
3030 }
3131
3232 // Do some cool effect
33 - $("#uploadwarning").fadeIn();
34 -
 33+ $( "#uploadwarning" ).fadeIn();
 34+
3535 // 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+
3939 return false; // do not execute the normal execution of the button (upload the form)
4040 }
41 - });
42 -
43 - $('#toggleexp').click( function() {
 41+ } );
 42+
 43+ $( '#toggleexp' ).click( function() {
4444 // Slide the explanation down with extra text
45 - $('#explanation').slideToggle("medium");
 45+ $( '#explanation' ).slideToggle( "medium" );
4646 this.blur();
47 - });
48 -
49 - $('#toggleUpload').click(function() {
 47+ } );
 48+
 49+ $( '#toggleUpload' ).click( function() {
5050 // 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+} );
5555
56 -function popUp(URL) {
 56+function popUp( URL ) {
5757 day = new Date();
5858 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 @@
22 <?php
33 include '_header.php';
44 ?>
5 - <div id="questions">
6 - <?php show_wizard(); ?>
7 - </div>
 5+ <div id="questions">
 6+ <?php show_wizard(); ?>
 7+ </div>
88 <?php
99 include '_footer.php';
10 -?>
\ No newline at end of file
Index: trunk/tools/wikiportrait/style.css
@@ -6,29 +6,39 @@
77 padding: 0;
88 }
99
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+}
1413
 14+img {
 15+ border: 0;
 16+}
1517
 18+ul li {
 19+ font-size: 1.2em;
 20+}
 21+
 22+.jsonly {
 23+ display: none;
 24+}
 25+
1626 .item, label, input, textarea, select, .item p {
17 - float: left;
 27+ float: left;
1828 }
1929
2030 .item {
21 - clear: both;
22 - margin-bottom: 25px;
 31+ clear: both;
 32+ margin-bottom: 25px;
2333 }
2434
25 -label {
26 - vertical-align: middle;
27 - width: 300px;
 35+label {
 36+ vertical-align: middle;
 37+ width: 300px;
2838 }
2939
3040 img.thumb {
31 - float: left;
32 - margin: 0 10px 10px 0;
 41+ float: left;
 42+ margin: 0 10px 10px 0;
3343 }
3444
3545 /* scale back up to a sane default */
@@ -39,11 +49,19 @@
4050 padding: 0;
4151 }
4252
43 -#header, #questions, #footer { margin-left: 160px; }
 53+#header, #questions, #footer {
 54+ margin-left: 160px;
 55+}
4456
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+}
4761
 62+#header a {
 63+ text-decoration: none;
 64+}
 65+
4866 #questions {
4967 margin-right: 1em;
5068 border: 1px solid #aaa;
@@ -52,43 +70,46 @@
5371 padding-top: 0;
5472 }
5573
56 - #questions p { font-size: 125%; }
 74+ #questions p {
 75+ font-size: 125%;
 76+ }
 77+
5778 #questions p.error {
5879 color: red;
5980 font-weight: bold;
6081 }
61 -
 82+
6283 #questions p.mail {
6384 background: #ccc;
6485 margin-left: 15px;
6586 padding: 10px;
6687 border: 1px solid black;
6788 }
68 -
 89+
6990 #questions div.warning, #questions div.info {
7091 background: #fcc;
7192 padding: 0px 10px;
7293 border: 1px solid black;
7394 margin-bottom: 20px;
7495 }
75 -
 96+
7697 #questions div.info {
7798 background: #ddf;
7899 }
79 -
 100+
80101 #questions div.info img {
81102 float: left;
82103 margin: 10px 15px 15px 0px;
83 - }
84 -
85 - #questions div.info ul {
 104+ }
 105+
 106+ #questions div.info ul {
86107 margin-left: 50px;
87108 }
88 -
 109+
89110 #questions div.info button {
90111 margin-bottom: 15px;
91112 }
92 -
 113+
93114 #questions a.question, #questions div.action, #questions div.caution, #questions div.imgbox {
94115 font-size: 155%;
95116 border: 2px solid #ccc;
@@ -98,63 +119,70 @@
99120 text-decoration: none;
100121 padding: 10px 0 0 10px;
101122 }
102 -
 123+
103124 #questions a.question:hover {
104 - background: url('images/bg_btn_hover.png');
 125+ background: url('images/bg_btn_hover.png');
105126 }
106 -
 127+
107128 #questions div.action, #questions div.caution, #questions div.imgbox {
108129 margin-bottom: 1em;
109130 color: #333;
110131 height: 75px;
111132 }
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+
116141 #questions div.imgbox {
117142 margin-top: 1em;
118143 font-size: 100%;
119144 }
120 -
 145+
121146 #questions big {
122147 display: block;
123148 font-size: 155%;
124149 padding-bottom: 15px;
125150 }
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');
130155 padding: 1em;
131156 border: 1px solid #aaa;
132157 }
133 -
 158+
134159 #expwrap a {
135160 text-decoration: none;
136161 font-size: 110%;
137162 }
138 -
 163+
139164 #expwrap p {
140165 font-size: 110%;
141166 padding: 0;
142167 margin: 0;
143168 }
144 -
 169+
145170 div.license {
146171 padding: 0 1em;
147172 border: 1px solid #909090;
148173 background: #eee;
149174 margin-bottom: 1em;
150175 }
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+
154182 #footer {
155183 background-color: white;
156184 border-top: 1px solid #fabd23;
157185 border-bottom: 1px solid #fabd23;
158 - margin: 1em 0 1em 0;
 186+ margin: 1em 0 1em 0;
159187 text-align: center;
160188 font-size: 90%;
161 -}
\ No newline at end of file
 189+}
Index: trunk/tools/wikiportrait/admin/index.php
@@ -1,95 +1,95 @@
22 <?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';
204
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+ );
2712
28 -/*
29 - $image_secret = md5(GE_SECRET.$image['id'].$image['timestamp']);
 13+ $id = $_GET['id'];
 14+ $secret = $_GET['secret'];
 15+ $action = $_GET['action'];
3016
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+
3434 ?>
3535 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3636 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
3737 <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>
9696 </html>
Index: trunk/tools/wikiportrait/inc/lib-db.php
@@ -1,139 +1,151 @@
22 <?php
33 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;
11110
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+ }
139152 } // Class db
140 -?>
\ No newline at end of file
Index: trunk/tools/wikiportrait/inc/timthumb.php
@@ -13,17 +13,17 @@
1414
1515 // HTML example: <img src="/scripts/timthumb.php?src=/images/whatever.jpg&w=150&h=200&zc=1" alt="" />
1616
17 -error_reporting(E_ALL);
 17+error_reporting( E_ALL );
1818
19 -if(!isset($_REQUEST["src"])) {
20 - die("no image specified");
 19+if ( !isset( $_REQUEST["src"] ) ) {
 20+ die( "no image specified" );
2121 }
2222
2323 // clean params before use
2424 $src = clean_source( $_REQUEST[ "src" ] );
2525
2626 // set document root
27 -$doc_root = get_document_root($src);
 27+$doc_root = get_document_root( $src );
2828
2929 // get path to image on file system
3030 $src = $doc_root . '/' . $src;
@@ -38,51 +38,51 @@
3939 $cache_dir = '../cache';
4040
4141 // get mime type of src
42 -$mime_type = mime_type($src);
 42+$mime_type = mime_type( $src );
4343
4444 // 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);
4646
4747 // 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" );
5050 }
5151
5252 // 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" );
5555 }
5656
57 -if(strlen($src) && file_exists($src)) {
 57+if ( strlen( $src ) && file_exists( $src ) ) {
5858
5959 // 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 );
6363 }
6464
6565 // Get original width and height
66 - $width = imagesx($image);
67 - $height = imagesy($image);
 66+ $width = imagesx( $image );
 67+ $height = imagesy( $image );
6868
6969 // don't allow new width or height to be greater than the original
70 - if( $new_width > $width ) {
 70+ if ( $new_width > $width ) {
7171 $new_width = $width;
7272 }
73 - if( $new_height > $height ) {
 73+ if ( $new_height > $height ) {
7474 $new_height = $height;
7575 }
7676
7777 // generate new w/h if not provided
78 - if( $new_width && !$new_height ) {
 78+ if ( $new_width && !$new_height ) {
7979
8080 $new_height = $height * ( $new_width / $width );
8181
82 - } elseif($new_height && !$new_width) {
 82+ } elseif ( $new_height && !$new_width ) {
8383
8484 $new_width = $width * ( $new_height / $height );
8585
86 - } elseif(!$new_width && !$new_height) {
 86+ } elseif ( !$new_width && !$new_height ) {
8787
8888 $new_width = $width;
8989 $new_height = $height;
@@ -92,7 +92,7 @@
9393 // create a new true color image
9494 $canvas = imagecreatetruecolor( $new_width, $new_height );
9595
96 - if( $zoom_crop ) {
 96+ if ( $zoom_crop ) {
9797
9898 $src_x = $src_y = 0;
9999 $src_w = $width;
@@ -132,10 +132,10 @@
133133
134134 } else {
135135
136 - if(strlen($src)) {
137 - die($src . ' not found.');
 136+ if ( strlen( $src ) ) {
 137+ die( $src . ' not found.' );
138138 } else {
139 - die('no source specified.');
 139+ die( 'no source specified.' );
140140 }
141141
142142 }
@@ -144,38 +144,38 @@
145145
146146 // check to see if we can write to the cache directory
147147 $is_writable = 0;
148 - $cache_file_name = $cache_dir . '/' . get_cache_file();
 148+ $cache_file_name = $cache_dir . '/' . get_cache_file();
149149
150 - if(touch($cache_file_name)) {
 150+ if ( touch( $cache_file_name ) ) {
151151
152152 // give 666 permissions so that the developer
153153 // can overwrite web server user
154 - chmod($cache_file_name, 0666);
 154+ chmod( $cache_file_name, 0666 );
155155 $is_writable = 1;
156156
157157 } else {
158158
159159 $cache_file_name = NULL;
160 - header('Content-type: ' . $mime_type);
 160+ header( 'Content-type: ' . $mime_type );
161161
162162 }
163163
164 - if(stristr($mime_type, 'gif')) {
 164+ if ( stristr( $mime_type, 'gif' ) ) {
165165
166 - imagegif($image_resized, $cache_file_name);
 166+ imagegif( $image_resized, $cache_file_name );
167167
168 - } elseif(stristr($mime_type, 'jpeg')) {
 168+ } elseif ( stristr( $mime_type, 'jpeg' ) ) {
169169
170 - imagejpeg($image_resized, $cache_file_name, $quality);
 170+ imagejpeg( $image_resized, $cache_file_name, $quality );
171171
172 - } elseif(stristr($mime_type, 'png')) {
 172+ } elseif ( stristr( $mime_type, 'png' ) ) {
173173
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 );
176176
177177 }
178178
179 - if($is_writable) {
 179+ if ( $is_writable ) {
180180 show_cache_file( $cache_dir, $mime_type );
181181 }
182182
@@ -185,7 +185,7 @@
186186
187187 function get_request( $property, $default = 0 ) {
188188
189 - if( isset($_REQUEST[$property]) ) {
 189+ if ( isset( $_REQUEST[$property] ) ) {
190190 return $_REQUEST[$property];
191191 } else {
192192 return $default;
@@ -193,20 +193,20 @@
194194
195195 }
196196
197 -function open_image($mime_type, $src) {
 197+function open_image( $mime_type, $src ) {
198198
199 - if(stristr($mime_type, 'gif')) {
 199+ if ( stristr( $mime_type, 'gif' ) ) {
200200
201 - $image = imagecreatefromgif($src);
 201+ $image = imagecreatefromgif( $src );
202202
203 - } elseif(stristr($mime_type, 'jpeg')) {
 203+ } elseif ( stristr( $mime_type, 'jpeg' ) ) {
204204
205 - @ini_set('gd.jpeg_ignore_warning', 1);
206 - $image = imagecreatefromjpeg($src);
 205+ @ini_set( 'gd.jpeg_ignore_warning', 1 );
 206+ $image = imagecreatefromjpeg( $src );
207207
208 - } elseif( stristr($mime_type, 'png')) {
 208+ } elseif ( stristr( $mime_type, 'png' ) ) {
209209
210 - $image = imagecreatefrompng($src);
 210+ $image = imagecreatefrompng( $src );
211211
212212 }
213213
@@ -214,34 +214,34 @@
215215
216216 }
217217
218 -function mime_type($file) {
 218+function mime_type( $file ) {
219219
220 - $os = strtolower(php_uname());
 220+ $os = strtolower( php_uname() );
221221 $mime_type = '';
222222
223223 // 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 );
228228 }
229229
230230 // try to determine mime type by using unix file command
231231 // 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' ) );
235235 }
236236 }
237237
238238 // use file's extension to determine mime type
239 - if(!valid_src_mime_type($mime_type)) {
 239+ if ( !valid_src_mime_type( $mime_type ) ) {
240240
241241 // set defaults
242242 $mime_type = 'image/jpeg';
243243 // file details
244 - $fileDetails = pathinfo($file);
245 - $ext = strtolower($fileDetails["extension"]);
 244+ $fileDetails = pathinfo( $file );
 245+ $ext = strtolower( $fileDetails["extension"] );
246246 // mime types
247247 $types = array(
248248 'jpg' => 'image/jpeg',
@@ -250,7 +250,7 @@
251251 'gif' => 'image/gif'
252252 );
253253
254 - if(strlen($ext) && strlen($types[$ext])) {
 254+ if ( strlen( $ext ) && strlen( $types[$ext] ) ) {
255255 $mime_type = $types[$ext];
256256 }
257257
@@ -260,42 +260,42 @@
261261
262262 }
263263
264 -function valid_src_mime_type($mime_type) {
 264+function valid_src_mime_type( $mime_type ) {
265265
266 - if(preg_match("/jpg|jpeg|gif|png/i", $mime_type)) {
 266+ if ( preg_match( "/jpg|jpeg|gif|png/i", $mime_type ) ) {
267267 return true;
268268 }
269269 return false;
270270
271271 }
272272
273 -function check_cache($cache_dir, $mime_type) {
 273+function check_cache( $cache_dir, $mime_type ) {
274274
275275 // make sure cache dir exists
276 - if(!file_exists($cache_dir)) {
 276+ if ( !file_exists( $cache_dir ) ) {
277277 // give 777 permissions so that developer can overwrite
278278 // files created by web server user
279 - mkdir($cache_dir);
280 - chmod($cache_dir, 0777);
 279+ mkdir( $cache_dir );
 280+ chmod( $cache_dir, 0777 );
281281 }
282282
283 - show_cache_file($cache_dir, $mime_type);
 283+ show_cache_file( $cache_dir, $mime_type );
284284
285285 }
286286
287 -function show_cache_file($cache_dir, $mime_type) {
 287+function show_cache_file( $cache_dir, $mime_type ) {
288288
289289 $cache_file = $cache_dir . '/' . get_cache_file();
290290
291 - if( file_exists( $cache_file ) ) {
 291+ if ( file_exists( $cache_file ) ) {
292292
293 - if( isset( $_SERVER[ "HTTP_IF_MODIFIED_SINCE" ] ) ) {
 293+ if ( isset( $_SERVER[ "HTTP_IF_MODIFIED_SINCE" ] ) ) {
294294
295295 // 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" ] );
297297 $gmdate_mod = gmdate( 'D, d M Y H:i:s', filemtime( $cache_file ) );
298298
299 - if( strstr( $gmdate_mod, 'GMT' ) ) {
 299+ if ( strstr( $gmdate_mod, 'GMT' ) ) {
300300 $gmdate_mod .= " GMT";
301301 }
302302
@@ -306,17 +306,17 @@
307307
308308 }
309309
310 - $fileSize = filesize($cache_file);
 310+ $fileSize = filesize( $cache_file );
311311
312312 // 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" );
319319
320 - readfile($cache_file);
 320+ readfile( $cache_file );
321321
322322 die();
323323
@@ -329,10 +329,10 @@
330330 global $quality;
331331
332332 static $cache_file;
333 - if(!$cache_file) {
 333+ if ( !$cache_file ) {
334334 $frags = split( "\.", $_REQUEST['src'] );
335335 $ext = strtolower( $frags[ count( $frags ) - 1 ] );
336 - if(!valid_extension($ext)) { $ext = 'jpg'; }
 336+ if ( !valid_extension( $ext ) ) { $ext = 'jpg'; }
337337 $cachename = get_request( 'src', 'timthumb' ) . get_request( 'w', 100 ) . get_request( 'h', 100 ) . get_request( 'zc', 1 ) . get_request( '9', 80 );
338338 $cache_file = md5( $cachename ) . '.' . $ext;
339339 }
@@ -340,9 +340,9 @@
341341
342342 }
343343
344 -function valid_extension ($ext) {
 344+function valid_extension ( $ext ) {
345345
346 - if( preg_match( "/jpg|jpeg|png|gif/i", $ext ) ) return 1;
 346+ if ( preg_match( "/jpg|jpeg|png|gif/i", $ext ) ) return 1;
347347 return 0;
348348
349349 }
@@ -350,15 +350,15 @@
351351 function clean_source ( $src ) {
352352
353353 // remove http/ https/ ftp
354 - $src = preg_replace("/^((ht|f)tp(s|):\/\/)/i", "", $src);
 354+ $src = preg_replace( "/^((ht|f)tp(s|):\/\/)/i", "", $src );
355355 // remove domain name from the source url
356356 $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 );
360360
361 - //$src = preg_replace( "/(?:^\/+|\.{2,}\/+?)/", "", $src );
362 - //$src = preg_replace( '/^\w+:\/\/[^\/]+/', '', $src );
 361+ // $src = preg_replace( "/(?:^\/+|\.{2,}\/+?)/", "", $src );
 362+ // $src = preg_replace( '/^\w+:\/\/[^\/]+/', '', $src );
363363
364364 // don't allow users the ability to use '../'
365365 // in order to gain access to files below document root
@@ -373,16 +373,16 @@
374374
375375 }
376376
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 ) ) {
379379 return $_SERVER['DOCUMENT_ROOT'];
380380 }
381381 // the relative paths below are useful if timthumb is moved outside of document root
382382 // specifically if installed in wordpress themes like mimbo pro:
383383 // /wp-content/themes/mimbopro/scripts/timthumb.php
384384 $paths = array( '..', '../..', '../../..', '../../../..' );
385 - foreach( $paths as $path ) {
386 - if( @file_exists( $path . '/' . $src ) ) {
 385+ foreach ( $paths as $path ) {
 386+ if ( @file_exists( $path . '/' . $src ) ) {
387387 return $path;
388388 }
389389 }
Index: trunk/tools/wikiportrait/inc/lib-admin.php
@@ -1,33 +1,32 @@
22 <?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;
96
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 @@
22 <?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 @@
22 <?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>";
55 }
66
7 -function bail($msg) {
 7+function bail( $msg ) {
88 // 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 );
1111 }
1212 else {
1313 die();
@@ -14,14 +14,14 @@
1515 }
1616
1717 // 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] ) {
2020 // This constant is available
2121 return $GLOBALS['constants'][$const];
2222 }
2323 else {
2424 // Not available, display when GE_DEBUG is on
25 - if (GE_DEBUG >= 1) {
 25+ if ( GE_DEBUG >= 1 ) {
2626 return "Unknown constant: $const";
2727 }
2828 }
@@ -30,18 +30,18 @@
3131 // Functions for translating entries. __() gives an echo, ___() returns the value
3232 // I know, we could have used gettext() for this, but the messages need to be in the
3333 // db, not in .mo files and i'm lazy
34 -function __($const) {
35 - echo disp($const);
 34+function __( $const ) {
 35+ echo disp( $const );
3636 }
3737
38 -function ___($const) {
39 - return disp($const);
 38+function ___( $const ) {
 39+ return disp( $const );
4040 }
4141
4242 // 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 ) {
4646 echo $url;
4747 }
4848 else {
@@ -50,21 +50,21 @@
5151 }
5252
5353 // 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 ) {
5656 echo $var;
5757 }
5858 }
5959
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 );
6363 // 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, '-' );
6969 return $value;
7070 }
7171
Index: trunk/tools/wikiportrait/inc/lib.php
@@ -1,44 +1,44 @@
22 <?php
33 // displays the explanation that goes with an action or question if applicable
4 -function explanation($constant) {
 4+function explanation( $constant ) {
55 $explanation = $GLOBALS['explanations'][$constant];
6 - if ($explanation) {
 6+ if ( $explanation ) {
77 echo '<div id="expwrap">';
8 - echo '&raquo; <a href="#" id="toggleexp">'.disp('EXPLANATION').'</a>'."\n";
9 - echo '<div id="explanation" class="jshide"><p>'.$explanation.'</p></div>'."\n";
 8+ echo '&raquo; <a href="#" id="toggleexp">' . disp( 'EXPLANATION' ) . '</a>' . "\n";
 9+ echo '<div id="explanation" class="jshide"><p>' . $explanation . '</p></div>' . "\n";
1010 echo '</div>';
1111 }
1212 }
1313
14 -function question($question, $yes, $no, $constant) {
 14+function question( $question, $yes, $no, $constant ) {
1515 $phpself = $_SERVER['PHP_SELF'];
1616 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 />';
2020 }
2121
22 -function action($action, $constant) {
 22+function action( $action, $constant ) {
2323 // display an action
2424 $phpself = $_SERVER['PHP_SELF'];
25 - if ($constant == DO_NOT_UPLOAD) {
 25+ if ( $constant == DO_NOT_UPLOAD ) {
2626 $class = 'caution';
2727 }
2828 else {
2929 $class = 'action';
3030 }
3131
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>';
3434
35 - explanation($constant);
 35+ explanation( $constant );
3636
3737 // 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 />';
4040 }
4141
42 - echo '<a href="'.GE_HOME.'" class="question">'.disp('START_AGAIN').'</a>';
 42+ echo '<a href="' . GE_HOME . '" class="question">' . disp( 'START_AGAIN' ) . '</a>';
4343 }
4444
4545 function fill_globals() {
@@ -47,13 +47,13 @@
4848 // get all values from the db and puts it into a new array called $constants
4949 $GLOBALS['constants'] = array();
5050 $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'] ) );
5252
53 - foreach($messages as $message) {
 53+ foreach ( $messages as $message ) {
5454 $GLOBALS['constants'][$message['constant']] = $message['message'];
5555
5656 // add to the explanations array if applicable
57 - if ($message['explanation']) {
 57+ if ( $message['explanation'] ) {
5858 $GLOBALS['explanations'][$message['constant']] = $message['explanation'];
5959 }
6060 }
@@ -61,20 +61,20 @@
6262 // transfer data to global array
6363 $const = $GLOBALS['constants'];
6464 $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" )
7272 );
7373
7474 $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']
7979 );
8080 }
8181
@@ -86,24 +86,24 @@
8787 );
8888
8989 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 ) {
9393 // if this is the current selected language give a selected attribute
94 - if ($code == $GLOBALS['settings']['language']) {
 94+ if ( $code == $GLOBALS['settings']['language'] ) {
9595 $selected = " selected";
9696 }
9797 else {
9898 $selected = "";
9999 }
100 - echo '<option value="'.$code.'"'.$selected.'>'.$language.'</option>';
 100+ echo '<option value="' . $code . '"' . $selected . '>' . $language . '</option>';
101101 }
102102 echo '</select>';
103103 echo '<input type="submit" action="" value="OK" />';
104104 echo '</form>';
105105 }
106106
107 -function return_file_upload_errorcode($code) {
 107+function return_file_upload_errorcode( $code ) {
108108 $errors = array(
109109 UPLOAD_ERR_OK => 'There is no error, the file uploaded with success.',
110110 UPLOAD_ERR_INI_SIZE => 'The uploaded file exceeds the upload_max_filesize directive in php.ini.',
@@ -117,34 +117,34 @@
118118 return $errors[$code];
119119 }
120120
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 );
124124
125125 $return = array();
126 - if ($moveresult) {
 126+ if ( $moveresult ) {
127127 $return['key'] = "ok";
128128 $return['value'] = $destination;
129129 }
130130 else {
131131 $return['key'] = "error";
132 - $return['value'] = return_file_upload_errorcode($_FILES[$file]['error']);
 132+ $return['value'] = return_file_upload_errorcode( $_FILES[$file]['error'] );
133133 }
134134 return $return;
135135 }
136136
137 -function add_image($array) {
 137+function add_image( $array ) {
138138 global $db, $settings;
139139
140140 // set up return value
141141 $return = array();
142142
143143 // 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" ) );
145145
146146 // 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" ) {
149149 $return['key'] = "missing_values";
150150 $return['value'] = $check;
151151 return $return;
@@ -152,40 +152,40 @@
153153
154154 // Check if email is valid
155155 $regex = "/^[^@]+@[^@]+(\.[^@]+)+$/";
156 - if (!preg_match($regex, $array['email'])) {
 156+ if ( !preg_match( $regex, $array['email'] ) ) {
157157 $return['key'] = "invalid_email";
158158 return $return;
159159 }
160160
161161 // Check if the extension is supported
162 - $extension = strtolower(strrchr($_FILES["file"]["name"],"."));
 162+ $extension = strtolower( strrchr( $_FILES["file"]["name"], "." ) );
163163
164 - if (!in_array($extension, $settings['ALLOWED_EXTENSIONS'])) {
 164+ if ( !in_array( $extension, $settings['ALLOWED_EXTENSIONS'] ) ) {
165165 $return['key'] = "unsupported_extension";
166166 return $return;
167167 }
168168
169169 // 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 ) ) {
172172 $return['key'] = "low_resolution";
173173 return $return;
174174 }
175175
176176 // Okay, upload the image
177177 // 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";
179179
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" ) {
182182 $return['key'] = "upload_false";
183183 $return['value'] = $upload_result['value'];
184184 return $return;
185185 }
186 - else if ($upload_result['key'] == "ok") {
 186+ else if ( $upload_result['key'] == "ok" ) {
187187 $img_array["filename"] = $filename;
188 - unset($img_array["file"]);
189 - unset($img_array["disclaimerAgree"]);
 188+ unset( $img_array["file"] );
 189+ unset( $img_array["disclaimerAgree"] );
190190 }
191191
192192 // Also add a timestamp and IP to the DB entry
@@ -193,8 +193,8 @@
194194 $img_array["ip"] = $_SERVER['REMOTE_ADDR'];
195195
196196 // 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 ) {
199199 $return['key'] = "db_ok";
200200
201201 // Also add the id from mysql_insert_id()
@@ -208,66 +208,66 @@
209209 return $return;
210210 }
211211
212 -function check_array_required($array, $required) {
 212+function check_array_required( $array, $required ) {
213213 $return = '';
214 - foreach ($required as $value) {
215 - if ($array[$value] == "") {
 214+ foreach ( $required as $value ) {
 215+ if ( $array[$value] == "" ) {
216216 // we translate the form names as well
217217 $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' )
223223 );
224224
225 - foreach ($translate as $val=>$trans) {
226 - if ($value == $val) $value = $trans;
 225+ foreach ( $translate as $val => $trans ) {
 226+ if ( $value == $val ) $value = $trans;
227227 }
228 - $return .= $value.", ";
 228+ $return .= $value . ", ";
229229 }
230230 }
231 - $return = ($return == '') ? "ok" : $return;
 231+ $return = ( $return == '' ) ? "ok" : $return;
232232 return $return;
233233 }
234234
235 -function build_assoc_array($inputarray, $okvalues) {
 235+function build_assoc_array( $inputarray, $okvalues ) {
236236 $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 ) ) {
239239 $newarray[$key] = $value;
240240 }
241241 }
242242 return $newarray;
243243 }
244244
245 -function is_language($lang) {
 245+function is_language( $lang ) {
246246 global $settings;
247 - return in_array($lang, $settings['LANGUAGES']);
 247+ return in_array( $lang, $settings['LANGUAGES'] );
248248 }
249249
250250 /*
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 ) {
254254 global $settings;
255255
256256 $id = $data['id'];
257 - $secret = md5(GE_SECRET.$data['id'].$data['timestamp']);
 257+ $secret = md5( GE_SECRET . $data['id'] . $data['timestamp'] );
258258
259259 $msg = "Content-Type: text/plain; charset=UTF-8\n";
260260 $msg .= "
261261 Beste OTRS vrijwillger,
262262 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'] . "'
266266
267267 Je kunt de foto bekijken op Wikiportret en de foto daar afwijzen, of een tekst genereren die
268268 je kan copy-pasten om een e-mail te schrijven.
269269
270270 Klik op deze link:
271 - ".GE_URL."admin/?id=$id&secret=$secret
 271+ " . GE_URL . "admin/?id=$id&secret=$secret
272272
273273 Als je vragen hebt over de uploadwizard kun je terecht bij Hay (Husky)
274274 via http://nl.wikipedia.org/wiki/Gebruiker:Husky of eventueel via hay@bykr.org.
@@ -276,21 +276,21 @@
277277 ";
278278
279279 // 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();
286286
287 - @$mail = mail($to, $subject, $msg, $headers);
 287+ @$mail = mail( $to, $subject, $msg, $headers );
288288
289289 // 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 );
292292 }
293293
294 - if ($mail) {
 294+ if ( $mail ) {
295295 return true;
296296 }
297297 else {
@@ -298,15 +298,15 @@
299299 }
300300 }
301301
302 -function show_page($page) {
 302+function show_page( $page ) {
303303 // echoes the contents of a static page from the /pages directory
304304 // 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 );
308308 }
309309 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>";
311311 }
312312 echo $text;
313313 }
@@ -315,97 +315,96 @@
316316 global $settings;
317317
318318 $question = $GLOBALS['question'];
319 - $questions = $GLOBALS['questions'];
320 - $actions = $GLOBALS['actions'];
 319+ $questions = $GLOBALS['questions'];
 320+ $actions = $GLOBALS['actions'];
321321 $phpself = $_SERVER['PHP_SELF'];
322322
323 - if (empty($question)) {
 323+ if ( empty( $question ) ) {
324324 // welcome, no questions yet
325325 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>';
328328 }
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>';
332332 }
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 );
336336 $msg_status = "alert"; // we presume there will be an error :)
337 - if ($result['key'] == "db_ok") {
 337+ if ( $result['key'] == "db_ok" ) {
338338 $msg_status = "ok";
339339 }
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'];
342342 }
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'];
345345 }
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'];
348348 $msg .= "<br />De foto is <strong>niet</strong> toegevoegd aan de website!";
349349 }
350 - else if ($result['key'] == "invalid_email") {
 350+ else if ( $result['key'] == "invalid_email" ) {
351351 $msg = "Het door u opgegeven e-mail adres is niet correct";
352352 }
353 - else if ($result['key'] == "unsupported_extension") {
 353+ else if ( $result['key'] == "unsupported_extension" ) {
354354 $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 . ", ";
357357 }
358358 }
359 - else if ($result['key'] == "low_resolution") {
 359+ else if ( $result['key'] == "low_resolution" ) {
360360 $msg = "De resolutie van uw afbeelding is te laag. De minimale afmetingen van uw afbeelding moet 640x480 pixels zijn.";
361361 }
362 - else if ($result['key'] == "missing_values") {
 362+ else if ( $result['key'] == "missing_values" ) {
363363 // 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'];
365365 }
366366
367367 // files uploaded
368 - if ($msg_status == "ok") {
 368+ if ( $msg_status == "ok" ) {
369369 // 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>';
377376 }
378377 else {
379378 // 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>';
382381 }
383382 }
384383 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>';
388387 }
389388 }
390389 else {
391390 // files not uploaded yet, only display upload form
392 - show_page('uploadform');
 391+ show_page( 'uploadform' );
393392 }
394393
395 - echo '<a href="'.GE_HOME.'" class="question">'.disp('START_AGAIN').'</a>';
 394+ echo '<a href="' . GE_HOME . '" class="question">' . disp( 'START_AGAIN' ) . '</a>';
396395 }
397 - else if ($question == "first") {
 396+ else if ( $question == "first" ) {
398397 // first time question
399398 // 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' );
401400 }
402401 else {
403402 // 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 );
406405 }
407406 else {
408407 // not a question but an action
409 - action($actions[$question], $question);
 408+ action( $actions[$question], $question );
410409 }
411410 }
412411 }
Index: trunk/tools/wikiportrait/inc/common.php
@@ -2,14 +2,17 @@
33 // General variables
44 $wikiportrait_version = "1.1beta-3";
55
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+
710 require 'lib.php'; // General library
811 require 'lib-db.php'; // Global database Class
912 require 'lib-utils.php'; // Utility stuff
1013 require 'lib-admin.php'; // stuff for admin/index.php
1114
1215 // 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 );
1417
1518 // start session
1619 session_start();
@@ -18,7 +21,7 @@
1922 $_SESSION['language'] = GE_LANGUAGE; // default
2023
2124 // Maybe overwrite with a custom setting?
22 -if (isset($_GET['newLanguage']) && is_language($_GET['newLanguage'])) {
 25+if ( isset( $_GET['newLanguage'] ) && is_language( $_GET['newLanguage'] ) ) {
2326 $_SESSION['language'] = $_GET['newLanguage'];
2427 }
2528
Index: trunk/tools/wikiportrait/style_ie6.css
@@ -1,3 +1,3 @@
22 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 @@
22 <?php
3 - include 'inc/common.php';
 3+include 'inc/common.php';
44 ?>
55 <!doctype html>
66 <html>
@@ -13,18 +13,18 @@
1414 -->
1515 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1616 <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]-->
2020 <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>
2626
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>
2929 <script type="text/javascript" src="javascript/lib_js.js"></script>
3030 <script type="text/javascript">
3131 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 @@
3333
3434 var messages = {};
3535 <?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+ ?>
4141 </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>
4646 </head>
4747 <body>
4848 <div id="wrapper">
4949 <div id="header">
5050 <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>
5656 </div>
Index: trunk/tools/wikiportrait/index.php
@@ -27,17 +27,16 @@
2828 ?>
2929 <div id="questions">
3030 <?php
31 - show_page('welcome');
 31+ show_page( 'welcome' );
3232 ?>
3333
3434 <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>
3636 </p>
3737
3838 <?php
39 - show_page('welcome_disclaimer');
 39+ show_page( 'welcome_disclaimer' );
4040 ?>
4141 </div> <!-- /questions -->
4242 <?php
4343 include '_footer.php';
44 -?>
\ No newline at end of file

Status & tagging log