bare strings without CSS ids in code buhao!

Reported by rejon on 2010-11-22
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Open Font Library
Critical
Bassel Safadi
aikiframework
Critical
Bassel Safadi
openclipart
Critical
Bassel Safadi

Bug Description

This is horrible. The default error messages in aiki are being output without any ID for styling with CSS or class, and more importantly bare strings have no ability to be translated. This is totally bad form.

An example of this is all over aiki/src/system/libraries/records.php

Just do a search for the variable being used to spread this heinous practice:

rejon@futurebox:~/Documents/aikiframework/aikiframework/src/system/libraries$ grep -Rn "output_result" *
records.php:136: $output_result = "";
records.php:209: $output_result .= "__warning__ Please fill $intwalker[1]<br />";
records.php:235: $output_result .= "<b>Please enter a password</b><br />";
records.php:278: $output_result .= "<b>The email address is not valid</b><br />";
records.php:295: $output_result .= "<b>This value is already in use</b><br />";
records.php:446: $output_result .= "new directory created: $path";
records.php:457: $output_result .=( "Sorry, but that file '$newfile' already exists.");
records.php:573: $output_result .= "__added_successfully__<br />";
records.php:576: $output_result .= "uploaded <b>$num_of_uploaded_files</b> files out of <b>$total_uploaded_files</b> selected files<br /><br />";
records.php:577: $output_result .= "<b>Uploaded files:</b><br />".$files_names_output;
records.php:581: $output_result .= "<br /><b>NOT uploaded files:</b><br />".$not_uploaded_output;
records.php:618: $output_result .= "Filename:<br />";
records.php:619: $output_result .= "<p dir='ltr'>".$name."</p>";
records.php:622: $output_result = "__error_inserting_into_database__<br>";
records.php:623: $output_result .= "Nothing uploaded <br />";
records.php:625: $output_result .= "<br /><b>NOT uploaded files:</b><br />".$not_uploaded_output;
records.php:688: return $output_result;
records.php:908: $output_result = "Edited record $record_id in $tablename successfully";
records.php:912: $output_result = "Inserted new record in $tablename successfully";
records.php:918: $output_result = "Faild to edit record $record_id in $tablename";
records.php:921: return $output_result;

We need a solution to this that is translatable. Ideally, all error output that is nonessential would be in aiki, then if not in aiki, it needs to use GETTEXT to generate language.

Steps to fixing this bug:

1.) figure out our best solution
2.) scour the codebase and apply the fix

The problem right now is that default error messages on ocal, scale, and other sites just pop up. An immediate solution is to style these with a class like message or error or warning depending upon severity. bassel, we need to talk this one out.

rejon (rejon) on 2010-11-22
Changed in aikiframework:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → rejon (rejon)
milestone: none → 0.7
Changed in openclipart:
milestone: none → 2.8
importance: Undecided → High
status: New → Confirmed
rejon (rejon) wrote :

OMG! This bites us in the butt again! Bassel, editing fabricatorz ourartfund.com software, and the strings are stuck in records.php that are uneditable unless edit aiki framework core! That means they can't be translated nor styled without editing the core.

rejon@slobook:~/Documents/aikiframework/aikiframework/src/system/libraries$ grep success *
bot.php: echo "Imported the mockup successfully";
forms.php: $("#form_container").html("Added successfully");
forms.php: echo "Form for db table: <b>$table</b> created successfully";
installer.php:(2, 0, \'added_successfully\', \'Added successfully\', \'\', \'\'),
installer.php:(14, 0, \'aiki_home\', \'default\', \'body\', \'div\', 0, \'\', \'0\', 0, \'homepage\', \'\', \'\', \'\', \'\', \'<h2>Welcome to Aiki Framework</h2><br/><br/>\r\n\r\n<img src="[root]assets/apps/admin/images/logo.png" />\r\n\r\n<br/><br/>\r\n\r\nYou have successfully installed your Aiki.\r\n\r\n<br/><br/>\r\n\r\nPlease use the <a href="[root]/admin">admin panel</a> to start creating your own CMS and to change this default page.\r\n\r\n<br/><br/>\r\n\r\nFor documentation please visit <a target="_blank" href="http://www.aikiframework.org">aikiframework.org</a>.\r\n\r\n<br/><br/>\r\n\r\nAiki Framework is licensed under the GNU AGPL 3.0.<br /><a href="http://www.fsf.org/licensing/licenses/agpl-3.0.html"><img border="0" src="[root]/assets/images/agpl.png" /></a>\', \'#aiki_home {\r\n\r\n border:1px solid #c3c3c3;\r\n\r\n width:450px;\r\n\r\nmargin: 200px auto;\r\n\r\ntext-align:center;\r\n\r\nbackground:GhostWhite ;\r\n\r\npadding:30px;\r\n\r\n}\r\n\r\n\r\n\r\n#aiki_home img{\r\n\r\nmargin:5px;\r\n\r\n}\r\n\r\n\r\n\r\n#aiki_home div{\r\n\r\nwidth: 260px; \r\n\r\nmargin: 0 auto;\r\n\r\n}\r\n\r\n\r\n\r\n#aiki_home table{\r\n\r\ntext-align:right;\r\n\r\nwidth: 100%;\r\n\r\n}\', \'\', 0, 0, \'\', \'Aikiframework\', 0, \'\', \'\', 0, 0, 0, \'\', 1),
installer.php: echo '<h1>Great success '.$full_name.'! Aiki Framework is installed.</h1>';
records.php: $output_result .= "__added_successfully__<br />";
records.php: case "upload_success":
records.php: $output_result = "Edited record $record_id in $tablename successfully";
records.php: $output_result = "Inserted new record in $tablename successfully";

Changed in openfontlibrary:
status: New → Confirmed
Changed in aikiframework:
importance: High → Critical
Changed in openclipart:
importance: High → Critical
Changed in aikiframework:
assignee: rejon (rejon) → Bassel Safadi (bassel)
Changed in openclipart:
assignee: nobody → Bassel Safadi (bassel)
Changed in openfontlibrary:
assignee: nobody → Bassel Safadi (bassel)
importance: Undecided → Critical
rejon (rejon) wrote :

The Added successfully is styled, but its hardcoded in records.php and also, the File Added text below, totally unstyled. Should never be in the codebase, ever!

Bassel Safadi (bassel) on 2010-11-24
Changed in aikiframework:
status: Confirmed → Fix Released
rejon (rejon) wrote :

fix the language first :)

Changed in aikiframework:
status: Fix Released → In Progress
Bassel Safadi (bassel) wrote :

They are fixed now :-)

Changed in aikiframework:
status: In Progress → Fix Released
Bassel Safadi (bassel) wrote :

after the update to latest aiki, this is fixed on ocal, on most pages it's updated but the cache is still holding some old html in some places, all will be updated in the next 24 hours when varnish clean those pages.
I also disabled aiki cache for now

Changed in openclipart:
status: Confirmed → Fix Released
rejon (rejon) on 2010-12-15
Changed in openfontlibrary:
status: Confirmed → Fix Released
milestone: none → 0.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers