示例#1
0
 function _show()
 {
     $out = array();
     $this->load();
     if ($redirect_to = $this->getDuplicateId()) {
         $person2 = Persons::getInstance()->getByIdLoaded($redirect_to);
         if ($person2->loaded) {
             @ob_end_clean();
             header('Location: ' . $this->getUrl($redirect = true) . '?redirect=a_' . $this->id);
             exit;
         }
     }
     $out['picture'] = $this->getPicture();
     $langId = $this->data['author_lang'] ? $this->data['author_lang'] : 136;
     foreach (Config::$langs as $code => $id_lang) {
         if ($id_lang == $langId) {
             $langCode = $code;
         }
     }
     $out['lang_code'] = $langCode;
     $out['id'] = $this->id;
     $out['lang_title'] = Config::$langRus[$langCode];
     $out['lang_id'] = $langId;
     $out['first_name'] = $this->data['first_name'];
     $out['last_name'] = $this->data['last_name'];
     $out['middle_name'] = $this->data['middle_name'];
     $out['avg_mark'] = $this->getAvgMark();
     $date_b = timestamp_to_ymd($this->data['date_birth']);
     $date_b = (int) $date_b[0] ? digit2($date_b[2]) . '.' . digit2($date_b[1]) . '.' . $date_b[0] : '';
     $date_d = timestamp_to_ymd($this->data['date_death']);
     $date_d = (int) $date_d[0] ? digit2($date_d[2]) . '.' . digit2($date_d[1]) . '.' . $date_d[0] : '';
     $out['date_birth'] = $date_b;
     $out['date_death'] = $date_d;
     $out['wiki_url'] = $this->data['wiki_url'];
     $out['homepage'] = $this->data['homepage'];
     $out['bio']['html'] = $this->data['bio'];
     $out['bio']['short'] = $this->data['short_bio'];
     $out['lastSave'] = $this->data['authorlastSave'];
     return $out;
 }
示例#2
0
function getDateFromString(&$s)
{
    $parts = explode('-', $s);
    $rs = '0000-00-00';
    if (count($parts) < 2) {
        $parts = explode('.', $s);
        if (count($parts) > 2 && checkdate($parts[1], $parts[0], $parts[2])) {
            $rs = digit2((int) $parts[2]) . '-' . digit2((int) $parts[1]) . '-' . digit2((int) $parts[0]);
        }
    } else {
        if (count($parts) > 2) {
            if (checkdate($parts[2], $parts[1], $parts[0])) {
                $rs = (int) $parts[0] . '-' . (int) $parts[2] . '-' . (int) $parts[1];
            }
        } else {
            $rs = '0000-00-00';
        }
    }
    return $rs;
}