- Timestamp:
- 12/13/09 18:05:25 (2 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
-
common/common.php (modified) (1 diff)
-
common/round.php (modified) (3 diffs)
-
www/controllers/round.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/common/common.php
r1074 r1076 78 78 define("IA_TLF_TRIED", '2'); 79 79 define("IA_TLF_SOLVED", '3'); 80 81 // Constants for IA user-defined rounds 82 // Users can't create rounds lasting 123141231223 hours 83 define("IA_USER_DEFINED_ROUND_DURATION_LIMIT", '48'); 84 // Users can't create rounds 5412312421 days before the round starts 85 define("IA_USER_DEFINED_ROUND_DAYSBEFORE_LIMIT", '30'); 86 // Users can't create user defined rounds with too many problems 87 define("IA_USER_DEFINED_ROUND_TASK_LIMIT", '25'); 80 88 81 89 // Windows hack for checkdnsrr function. -
trunk/common/round.php
r1046 r1076 51 51 function round_validate_parameters($round_type, $parameters) { 52 52 $errors = array(); 53 if ($round_type == 'classic' or $round_type == 'user-defined') { 53 if ($round_type == 'classic' or $round_type == 'user-defined' 54 or $round_type == 'archive') { 54 55 // Check duration 55 56 $duration = getattr($parameters, 'duration'); … … 57 58 $errors['duration'] = "Durata trebuie specificata"; 58 59 } 60 61 if ($round_type == 'user-defined') { 62 if ($duration > IA_USER_DEFINED_ROUND_DURATION_LIMIT) { 63 $errors['duration'] = "Durata maxim admisa este de " . 64 IA_USER_DEFINED_ROUND_DURATION_LIMIT . " ore"; 65 } 66 } 67 59 68 if (!is_numeric($duration) || $duration < 0) { 60 69 $errors['duration'] = "Durata trebuie sa fie un numar pozitiv"; 61 70 } 62 } elseif ($round_type == 'archive') {63 // Empty...64 71 } else { 65 72 log_error("Bad round_type"); … … 119 126 if (!is_db_date(getattr($round, 'start_time', db_date_format()))) { 120 127 $errors['start_time'] = "Timpul trebuie specificat ca YYYY-MM-DD HH:MM:SS"; 128 } else { 129 if ($round['type'] == 'user-defined') { 130 $current_time = db_date_parse(date("Y-m-d H:i:s")); 131 $round_time = db_date_parse($round['start_time']); 132 133 if (($round_time - $current_time) > 134 IA_USER_DEFINED_ROUND_DAYSBEFORE_LIMIT * 60 * 60 * 24) { 135 $errors['start_time'] = "Nu poti creea o runda cu mai mult de " 136 . IA_USER_DEFINED_ROUND_DAYSBEFORE_LIMIT . " zile inainte"; 137 } 138 } 121 139 } 122 140 -
trunk/www/controllers/round.php
r1069 r1076 116 116 // Validate task list. 117 117 $new_round_tasks = $values['tasks']; 118 118 119 if (!is_array($new_round_tasks)) { 119 120 $errors['tasks'] = 'Valori invalide.'; … … 130 131 } 131 132 } 133 134 if (request_is_post() && count($values['tasks']) == 0) { 135 $errors['tasks'] = "Trebuie sa alegi cel putin o problema"; 136 } 137 138 // Additional validation for user defined tasks 139 if (!array_key_exists('tasks', $errors) 140 && $values['type'] == 'user-defined' && 141 count($values['tasks']) > IA_USER_DEFINED_ROUND_TASK_LIMIT) { 142 $errors['tasks'] = "Nu poti alege mai mult de " . 143 IA_USER_DEFINED_ROUND_TASK_LIMIT . " probleme"; 144 } 145 132 146 if (array_key_exists('tasks', $errors)) { 133 147 $values['tasks'] = array();
Note: See TracChangeset
for help on using the changeset viewer.
![[infoarena] development](/chrome/site/logo.png)