コード例 #1
0
ファイル: submit.php プロジェクト: brainsqueezer/fffff
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;
}
コード例 #2
0
ファイル: link.php プロジェクト: brainsqueezer/fffff
 function check_field_errors()
 {
     global $globals;
     $errors = array();
     if (!$this->sub_id > 0) {
         $errors[] = _("sub no seleccionado");
         $site_id = SitesMgr::my_id();
     } else {
         $site_id = $this->sub_id;
     }
     $properties = SitesMgr::get_extended_properties($site_id);
     if (empty($this->url) && empty($properties['no_link'])) {
         $errors[] = _("falta url enlace");
     }
     // Filter content and title
     // It also deletes punctuaction marks at the end
     $this->title = clean_text(preg_replace('/(\\w) *[.,] *$/', "\$1", $this->title), 50, true, 120);
     if ($properties['allow_paragraphs']) {
         $replace_nl = false;
     } else {
         $replace_nl = true;
     }
     $this->content = clean_text_with_tags($this->content, 0, $replace_nl, $properties['intro_max_len']);
     if (mb_strlen($this->title) < 8) {
         $errors[] = _("título incompleto");
     }
     if (get_uppercase_ratio($this->title) > 0.5) {
         $errors[] = "demasiadas mayúsculas en el título";
     }
     /* The length is already constrained in clean_text()
     		if(mb_strlen(html_entity_decode($this->title, ENT_COMPAT, 'UTF-8'), 'UTF-8') > 120) {
     			$errors[] = ("título demasiado largo");
     		}
     */
     if ($properties['intro_max_len'] > 0 && $properties['intro_min_len'] > 0 && mb_strlen($this->content) < $properties['intro_min_len']) {
         $errors[] = _("texto incompleto");
     }
     if (get_uppercase_ratio($this->content) > 0.3) {
         $errors[] = "demasiadas mayúsculas en el texto";
     }
     /* Already constrained in clean_text_with_tags()
     		if( $properties['intro_max_len'] > 0 && mb_strlen(html_entity_decode($this->content, ENT_COMPAT, 'UTF-8'), 'UTF-8') > $properties['intro_max_len'] ) {
     			$errors[] = ("texto demasiado largo");
     		}
     */
     if (strlen($this->tags) < 3) {
         $errors[] = "no has puesto etiquetas";
     }
     if (preg_match('/.*http:\\//', $this->title)) {
         $errors[] = "no pongas URLs en el título, no ofrece información";
     }
     return $errors;
 }
コード例 #3
0
ファイル: submit.php プロジェクト: rasomu/chuza
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;
}
コード例 #4
0
ファイル: submit.php プロジェクト: brainsqueezer/fffff
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;
}