function link_errors($linkres) { $error = false; // Errors if (intval($_POST['randkey']) != $linkres->randkey) { //echo '<br style="clear: both;" />'; print_form_submit_error(_("Clave incorrecta")); $error = true; } if ($linkres->status != 'discard') { //echo '<br style="clear: both;" />'; print_form_submit_error(_("La historia ya está en cola") . ": {$linkres->status}"); $error = true; } if (strlen($linkres->title) < 10 || strlen($linkres->content) < 30) { print_form_submit_error(_("Título o texto incompletos")); $error = true; } if (get_uppercase_ratio($linkres->title) > 0.25 || get_uppercase_ratio($linkres->content) > 0.25) { print_form_submit_error(_("Demasiadas mayúsculas en el título o texto")); $error = true; } if (mb_strlen(html_entity_decode($linkres->title, ENT_COMPAT, 'UTF-8'), 'UTF-8') > 120 || mb_strlen(html_entity_decode($linkres->content, ENT_COMPAT, 'UTF-8'), 'UTF-8') > 550) { print_form_submit_error(_("Título o texto demasiado largos")); $error = true; } if (strlen($linkres->tags) < 3) { print_form_submit_error(_("No has puesto etiquetas")); $error = true; } if (preg_match('/.*http:\\//', $linkres->title)) { //echo '<br style="clear: both;" />'; print_form_submit_error(_("Por favor, no pongas URLs en el título, no ofrece información")); $error = true; } if (!$linkres->category > 0) { //echo '<br style="clear: both;" />'; print_form_submit_error(_("Categoría no seleccionada")); $error = true; } return $error; }
function link_errors($linkres) { $error = false; // Errors $start_date = strtodate($linkres->start_date); $end_date = strtodate($linkres->end_date); if ($start_date>$end_date) { print_form_submit_error(_("A segunda data non pode ser anterior á primeira")); $error = true; } if(! check_link_key() || intval($_POST['randkey']) != $linkres->randkey) { print_form_submit_error(_("clave incorrecta")); $error = true; } if($linkres->status != 'discard') { //echo '<br style="clear: both;" />'; print_form_submit_error(_("la historia ya está en cola").": $linkres->status"); $error = true; } if(strlen($linkres->title) < 10 || strlen($linkres->content) < 30 ) { print_form_submit_error(_("título o texto incompletos")); $error = true; } if(get_uppercase_ratio($linkres->title) > 0.25 || get_uppercase_ratio($linkres->content) > 0.25 ) { print_form_submit_error(_("demasiadas mayúsculas en el título o texto")); $error = true; } if(mb_strlen(html_entity_decode($linkres->title, ENT_COMPAT, 'UTF-8'), 'UTF-8') > 120 || mb_strlen(html_entity_decode($linkres->content, ENT_COMPAT, 'UTF-8'), 'UTF-8') > 550 ) { print_form_submit_error(_("título o texto demasiado largos")); $error = true; } if(strlen($linkres->tags) < 3 ) { print_form_submit_error(_("no has puesto etiquetas")); $error = true; } if(preg_match('/.*http:\//', $linkres->title)) { //echo '<br style="clear: both;" />'; print_form_submit_error(_("por favor, no pongas URLs en el título, no ofrece información")); $error = true; } if(!$linkres->category > 0) { //echo '<br style="clear: both;" />'; print_form_submit_error(_("categoría no seleccionada")); $error = true; } return $error; }