Ejemplo n.º 1
0
function data_qwd($qwd, $row)
{
    global $lg, $tab_check, $link, $h_thumb;
    $tab_lb = array("lb0" => $qwd, "lb18" => "", "lb373" => "", "lb1" => "", "lb2" => "", "lb170" => "", "lb571" => "", "lb31" => "", "lb186" => "", "lb195" => "", "lb217" => "", "lb276" => "", "lb179" => "", "lb3" => "", "lb973" => "", "lb727" => "", "lb347" => "", "lb1212" => "", "lb214" => "", "lb350" => "", "url_img" => "", "wp_links" => "");
    if ($row == 0) {
        $tab_lb["lb1"] = label($qwd, $lg);
        if ($tab_lb["lb1"] == $qwd) {
            $tab_lb["lb1"] = "";
        }
    } else {
        $id = $row['id'];
        if ($tab_check["c31"] == "1") {
            $tab_lb["lb31"] = txt_prop($id, 31, $lg, "normal", false, false);
        }
        $tab_lb["lb1"] = label_item($qwd, $lg);
        if ($tab_check["c2"] == "1") {
            $tab_lb["lb2"] = alias_item($qwd, $lg);
        }
        if ($tab_check["c170"] == "1") {
            $tab_lb["lb170"] = creators($id, $lg);
        }
        if ($tab_check["c571"] == "1") {
            $year1 = $row['year1'];
            $year2 = $row['year1'];
            if (!is_null($row['year1'])) {
                $tab_lb["lb571"] .= $row['year1'];
                if (!is_null($row['year2']) && $row['year1'] != $row['year2']) {
                    $tab_lb["lb571"] .= " – " . $row['year2'];
                }
                if ($row['b_date'] == 1) {
                    $tab_lb["lb571"] .= " (~)";
                }
            }
        }
        if ($tab_check["c186"] == "1") {
            $tab_lb["lb186"] = txt_prop($id, 186, $lg, "normal", false, false);
        }
        if ($tab_check["c195"] == "1") {
            $tab_lb["lb195"] = txt_prop($id, 195, $lg, "listlink", false, false);
        }
        if ($tab_check["c217"] == "1") {
            $tab_lb["lb217"] = $row['P217'];
        }
        if ($tab_check["c276"] == "1") {
            $tab_lb["lb276"] = txt_prop($id, 276, $lg, "normal", false, false);
        }
        if ($tab_check["c179"] == "1") {
            $tab_lb["lb179"] = txt_prop($id, 179, $lg, "normal", false, false);
        }
        if ($tab_check["c973"] == "1") {
            $tab_lb["lb973"] = $row['link'];
        }
        if ($tab_check["c727"] == "1") {
            $tab_lb["lb727"] = $row['P727'];
        }
        if ($tab_check["c347"] == "1") {
            $tab_lb["lb347"] = $row['P347'];
        }
        if ($tab_check["c1212"] == "1") {
            $tab_lb["lb1212"] = $row['P1212'];
        }
        if ($tab_check["c214"] == "1") {
            $tab_lb["lb214"] = $row['P214'];
        }
        if ($tab_check["c350"] == "1") {
            $tab_lb["lb350"] = $row['P350'];
        }
        if ($tab_check["c18"] == "1") {
            if (intval($row['P18']) != 0) {
                $sql = "SELECT P18, width, height from commons_img  WHERE id=" . $row['P18'];
                $rep2 = mysqli_query($link, $sql);
                $data2 = mysqli_fetch_assoc($rep2);
                $img = str_replace(" ", "_", $data2['P18']);
                $digest = md5($img);
                $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . urlencode($img);
                $w_thumb = floor(intval($data2['width']) / intval($data2['height']) * $h_thumb);
                $thumb = "http://upload.wikimedia.org/wikipedia/commons/thumb/" . $folder . "/" . $w_thumb . "px-" . urlencode($img);
                if (substr($img, -3) == "svg") {
                    $thumb .= ".png";
                }
                $tab_lb["url_img"] = "https://commons.wikimedia.org/wiki/File:" . urlencode($img);
                $tab_lb["lb18"] = "\t<a href=\"" . $tab_lb["url_img"] . "\" title=\"https://commons.wikimedia.org/wiki/File:" . urlencode($img) . "\"><img src=\"" . $thumb . "\"  alt=\"" . str_replace("\"", "\\\"", $tab_lb["lb1"]) . "\" /></a>";
            }
        }
        if ($tab_check["c373"] == "1") {
            $tab_lb["lb373"] = $row['P373'];
        }
        if ($tab_check["c3"] == "1") {
            $sql = "SELECT page,lg from label_page WHERE qwd=" . $qwd . " AND page!='' ORDER BY lg ";
            $rep2 = mysqli_query($link, $sql);
            $num_rows = mysqli_num_rows($rep2);
            if ($num_rows > 0) {
                $cpt2 = 0;
                $lg_of = "";
                while ($data2 = mysqli_fetch_assoc($rep2)) {
                    $cpt2++;
                    if ($data2['lg'] != $lg_of) {
                        if ($cpt2 != 1) {
                            $tab_lb["lb3"] .= ", ";
                            $tab_lb["wp_links"] .= ", ";
                        }
                        $tab_lb["lb3"] .= " <a href=\"https://" . $data2['lg'] . ".wikipedia.org/wiki/" . $data2['page'] . "\">[" . $data2['lg'] . "]</a>";
                        $tab_lb["wp_links"] .= "https://" . $data2['lg'] . ".wikipedia.org/wiki/" . $data2['page'];
                    }
                    $lg_of = $data2['lg'];
                }
            }
        }
    }
    return $tab_lb;
}
Ejemplo n.º 2
0
$cpt = 0;
while ($data = mysqli_fetch_assoc($rep)) {
    $content = "";
    $cpt++;
    $id_artw = $data['id'];
    $qwd_art = $data['qwd'];
    $inv = $data['P217'];
    $described_link = $data['link'];
    $titre = "";
    $titre = label_item($qwd_art, $l);
    $trunc_title = truncate($titre);
    $trunk = false;
    if ($titre != $trunc_title) {
        $trunk = true;
    }
    $alias = alias_item($qwd_art, $l);
    $creator = txt_prop($id_artw, 170, $l, "creator", false);
    $pageWP = page_item($qwd_art, $l);
    $lgWP = "";
    $pos = strpos($pageWP, "|");
    if ($pos) {
        $lgWP = substr($pageWP, 0, $pos);
        $pageWP = substr($pageWP, $pos + 1, strlen($pageWP));
    }
    $coll0 = val_0($id_artw, 195, $l);
    $location0 = val_0($id_artw, 275, $l);
    $coll_or_loc = $coll0;
    if ($coll0 == "") {
        $coll_or_loc = $location0;
    }
    $location = txt_prop($id_artw, 276, $l);