function link_errors($link) { $error = false; // Errors if (!check_link_key() || intval($_POST['randkey']) != $link->randkey) { add_submit_error(_("clave incorrecta")); $error = true; } if ($link->status != 'discard') { add_submit_error(_("la historia ya está en cola") . ": {$link->status}"); $error = true; } if (strlen($link->title) < 8 || strlen($link->content) < 30) { add_submit_error(_("título o texto incompletos")); $error = true; } if (get_uppercase_ratio($link->title) > 0.4 || get_uppercase_ratio($link->content) > 0.25) { add_submit_error(_("demasiadas mayúsculas en el título o texto")); $error = true; } if (mb_strlen(html_entity_decode($link->title, ENT_COMPAT, 'UTF-8'), 'UTF-8') > 120 || mb_strlen(html_entity_decode($link->content, ENT_COMPAT, 'UTF-8'), 'UTF-8') > 550) { add_submit_error(_("título o texto demasiado largos")); $error = true; } if (strlen($link->tags) < 3) { add_submit_error(_("no has puesto etiquetas")); $error = true; } if (preg_match('/.*http:\\//', $link->title)) { add_submit_error(_("por favor, no pongas URLs en el título, no ofrece información")); $error = true; } if (!$link->category > 0) { add_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; }
function link_errors($link) { global $globals, $current_user, $site_key; $error = false; // Errors if (!check_link_key() || intval($_POST['randkey']) != $link->randkey) { add_submit_error(_("clave incorrecta")); $error = true; } if ($link->sub_id > 0 && !SitesMgr::can_send($link->sub_id)) { add_submit_error(_("envío deshabilitados en") . " {$link->sub_name}"); $error = true; } if ($link->status != 'discard') { add_submit_error(_("la historia ya está en cola") . ": {$link->status}"); $error = true; } // TODO: simplify this, return just $errors as array() // as in editlink $res = $link->check_field_errors(); if (!empty($res)) { $error = true; foreach ($res as $e) { add_submit_error($e); } } return $error; }