function biblio($name) { $array = biblio::get($name); if ($array) { foreach ($array as $k => $v) { s::roll($name, array('value' => $k, 'name' => $v)); } } else { return array(); } }
function load($user_id) { if (self::$user) { return true; } db::table('users'); db::where('user_id', $user_id); db::where('user_pub', 1); db::limit(1); self::$user = db::assoc(); if (db::rows() == 0) { self::logout(); } define("WEB_USER_ID", $user_id); define("WEB_USER_GROUP_ID", self::get('group_id')); define("WEB_USER_RATING", self::get('user_rating')); define("WEB_USER_LOGIN", self::get('user_login')); $user_status = self::get('user_status'); define("WEB_USER_STATUS", $user_status); if ($user_status != 'normal') { $user_status_link = ' <a href="/profile/money/" class="ico ico24 icoStatus' . $user_status . ' ico_no_hover" title="' . biblio::get('user_status', $user_status) . '"> </a>'; s::set('WEB_USER_STATUS', $user_status_link); } s::set('WEB_USER_LOGIN', self::get('user_login')); s::set('WEB_USER_RATING', self::get('user_rating')); if (self::get('user_person_type') == 'law') { s::set('WEB_USER_NAME', self::get('user_company')); } else { s::set('WEB_USER_NAME', self::get('user_name')); s::set('WEB_USER_SURNAME', self::get('user_surname')); } s::set('WEB_USER_BALANCE', self::get('user_balance')); s::set('WEB_USER_ID', $user_id); $_SESSION['USER_PERSON_TYPE'] = self::get('user_person_type'); return true; }
function date2print($template, $date = false) { if (!$date) { $date = self::get(true); $parts = self::$parts; } else { $parts = self::date2parts($date); } $month = biblio::get('month_gen', intval($parts['month'])); $month_short = biblio::get('month_sokr', intval($parts['month'])); $dayn_short = date('D', mktime(0, 0, 0, $parts['month'], $parts['day'], $parts['year'])); $dayn_full = date('l', mktime(0, 0, 0, $parts['month'], $parts['day'], $parts['year'])); // str_replace год если текущий = '' //if ($month_plague == 1) $month = $bibl['month_gen'][$regs[2]]; //else $month = $bibl['month_nom'][$regs[2]]; // if (self::$dayn_upper == 1) $bibl['dayn_sokr'][$dayn] = strtoupper($bibl['dayn_sokr'][$dayn]{0}).substr($bibl['dayn_sokr'][$dayn],1); //if (self::$month_upper == 1) $month = strtoupper($month{0}).substr($month,1); //if (self::$month_upper == 1) /* $month_short = strtoupper($month_short{0}).substr($month_short,1); Fs - month short Ds - dayn_sokr Fn - month_nom F - month_gen */ $date = str_replace('%D', $dayn_short, $template); $date = str_replace('%l', $dayn_full, $date); $date = str_replace('%d', intval($parts['day']), $date); $date = str_replace('%j', intval($parts['day']), $date); $date = str_replace('%F', $month, $date); $date = str_replace('%m', $parts['month'], $date); $date = str_replace('%M', $month_short, $date); $date = str_replace('%n', intval($parts['month']), $date); $date = str_replace('%Y', $parts['year'], $date); $date = str_replace('%y', substr($parts['year'], 2), $date); $date = str_replace('%G', intval($parts['hour']), $date); $date = str_replace('%H', intval($parts['hour']), $date); $date = str_replace('%i', $parts['minute'], $date); $date = str_replace('%s', $parts['second'], $date); return $date; }