public function __construct() { parent::__construct(); $this->_m(array('view' => w(), 'star' => w(), 'attend' => w(), 'tag' => w(), 'acp' => w('edit'))); $this->auth(false); $g = getdate(); $d = explode(' ', gmdate('j n Y', _localtime())); $v_week = $d[0] + (7 - ($g['wday'] - 1)) - (!$g['wday'] ? 7 : 0); $this->day['midnight'] = _timestamp($d[1], $d[0], $d[2]); $this->day['week'] = _timestamp($d[1], $v_week, $d[2]); $this->day['midnight_one'] = $this->day['midnight'] + 86400; $this->day['midnight_two'] = $this->day['midnight'] + 86400 * 2; }
protected function _birthday_home() { global $core; $birth_start = _timestamp(); $birth_end = _timestamp(); $sql = 'SELECT bio_id, bio_nickname, bio_email, bio_birth FROM _bio WHERE bio_birth >= ? AND bio_birth <= ? AND bio_birthlast < ? ORDER BY bio_nickname'; $birthdays = _rowset(sql_filter($sql, $birthday_start, $birthday_end)); foreach ($birthdays as $row) { $core->email->init('info', 'birthday:plain'); $core->email->send($row->bio_email); } return; }
public function home() { $cols = w('Email Nickname Cumpleaños País'); $sql = 'SELECT user_email, user_username, user_birthday, country_name FROM _members m, _countries c WHERE m.user_type = ? AND m.user_country = c.country_id ORDER BY m.user_username'; $members = _rowset(sql_filter($sql, 1)); foreach ($members as $i => $rowm) { if (!$i) { _style('table'); foreach ($cols as $j => $field) { if (!$j) { _style('table.head', array('TITLE' => '#')); } _style('table.head', array('TITLE' => $field)); } } _style('table.row'); $j = 0; foreach ($rowm as $f => $row) { if (!$j) { _style('table.row.col', array('VALUE' => $i + 1)); } switch ($f) { case 'user_birthday': $row_year = substr($row, 0, 4); $row_month = substr($row, 4, 2); $row_day = substr($row, 6, 2); $row = _format_date(_timestamp($row_month, $row_day, $row_year), 'd F Y'); break; } _style('table.row.col', array('VALUE' => $row)); $j++; } } return; }
<?php if (!defined('ROOT')) { exit('No direct script access allowed'); } $arr = array(); $arr["TIMESTAMP"] = _timestamp(false); $arr["SITE"] = SITENAME; $arr["SERVER"] = $GLOBALS['LOGIKS']["_SERVER"]["HTTP_HOST"]; $arr["SERVER SOFTWARE"] = $GLOBALS['LOGIKS']["_SERVER"]["SERVER_SOFTWARE"]; //$arr["HTTPS"]=$GLOBALS['LOGIKS']["_SERVER"]["HTTPS"]; //printArray($GLOBALS['LOGIKS']["_SERVER"]); printServiceMsg($arr);
protected function _analytics_home() { global $bio; $sql = 'SELECT *, SUM(stats_members + stats_guests) AS total FROM _bio_stats WHERE bio_id = ? GROUP BY date ORDER BY date DESC'; $stats = sql_rowset(sql_filter($sql, $bio->v('bio_id')), 'stats_date'); $years_sum = w(); $years_temp = w(); $years = w(); foreach ($stats as $date => $void) { $year = substr($date, 0, 4); if (!isset($years_temp[$year])) { $years[] = $year; $years_temp[$year] = true; } if (!isset($years_sum[$year])) { $years_sum[$year] = 0; } $years_sum[$year] += $void['total']; } unset($years_temp); if (sizeof($years)) { rsort($years); } else { $years[] = date('Y'); } $total_graph = 0; foreach ($years as $year) { _style('year', array('YEAR' => $year)); if (!isset($years_sum[$year])) { $years_sum[$year] = 0; } for ($i = 1; $i < 13; $i++) { $month = ($i < 10 ? '0' : '') . $i; $monthdata = isset($stats[$year . $month]) ? $stats[$year . $month] : (object) w(); $monthdata->total = isset($monthdata->total) ? $monthdata->total : 0; $monthdata->percent = $years_sum[$year] > 0 ? $monthdata->total / $years_sum[$year] : 0; $monthdata->members = isset($monthdata->members) ? $monthdata->members : 0; $monthdata->guests = isset($monthdata->guests) ? $monthdata->guests : 0; $monthdata->unix = _timestamp($i, 1, $year, 0, 0, 0); $total_graph += $monthdata->total; _style('year.month', array('NAME' => _format_date($monthdata->unix, 'F'), 'TOTAL' => $monthdata->total, 'MEMBERS' => $monthdata->members, 'GUESTS' => $monthdata->guests, 'PERCENT' => sprintf("%.1d", $monthdata->percent * 100))); } } v_style(array('BEFORE_VIEWS' => number_format($bio->v('bio_views')), 'SHOW_VIEWS_LEGEND' => $this->data['views'] > $total_graph)); return; }
protected function bio_online() { global $bio, $core; $total = (object) array('now' => (object) w('active 0 inactive 0 robot 0 alien 0'), 'day' => (object) w('active 0 inactive 0 robot 0 alien 0')); $today = _timestamp(); $robots = $bio - bots(); foreach ($total as $period => &$object) { $this->bio_online_query($period, $object, $today, $robots); } return $total; }
protected function parse_calendar($field, &$value) { switch ($field) { case 'calendar': $e = explode('/', $value); $value = _timestamp($e[1], $e[0], $e[2]); break; } return $value; }
protected function _create_home() { global $user; $v = $tree = $this->init(); $z = $this->__(w('zmode')); if (_button()) { $v_ary = array('subject', 'content'); if ($user->v('is_founder')) { $v_ary = array_merge($v_ary, array('node' => 0, 'parent' => 0, 'level' => 0, 'module' => 0, 'alias', 'child_hide' => 0, 'child_order', 'nav' => 0, 'nav_hide' => 0, 'css_parent' => 0, 'css_var', 'quickload' => 0, 'dynamic' => 0, 'tags', 'template', 'redirect', 'description', 'allow_comments' => 0, 'approve_comments' => 0, 'form' => 0, 'form_email', 'published', 'move')); } $v = $this->__($v_ary); /* $v = $this->__(array( 'node' => 0, 'parent' => 0, 'level' => 0, 'module' => 0, 'alias', 'child_hide' => 0, 'child_order', 'nav' => 0, 'nav_hide' => 0, 'css_parent' => 0, 'css_var', 'quickload' => 0, 'dynamic' => 0, 'tags', 'template', 'redirect', 'subject', 'content', 'description', 'allow_comments' => 0, 'approve_comments' => 0, 'form' => 0, 'form_email', 'published', 'move' )); */ // $v['edited'] = time(); foreach (w('node level parent module') as $row) { $v[$row] = $tree['tree_' . $row]; } if ($z['zmode'] == 'create') { $v['parent'] = $tree['tree_id']; $v['level']++; if (!$v['node']) { $v['node'] = $v['parent']; } } // Parse vars foreach ($v as $row_k => $row_v) { switch ($row_k) { case 'subject': $row_v = $this->html($row_v, 'strong'); break; case 'content': $row_v = $this->html($row_v); break; case 'alias': $row_v = _alias($row_v, w('_'), '-'); break; case 'checksum': $row_v = _hash($v['content']); break; case 'published': $row_v = dvar($row_v, date('d m Y')); $e_date = explode(' ', $row_v); $row_v = _timestamp($e_date[1], $e_date[0], $e_date[2]); break; } $v[$row_k] = $row_v; } if ($z['zmode'] == 'modify' && $tree['tree_alias'] == 'home' && $v['alias'] != 'home') { $v['alias'] = 'home'; } if (f($v['alias'])) { $sql = 'SELECT tree_id FROM _tree WHERE tree_alias = ? AND tree_id <> ?'; if (_fieldrow(sql_filter($sql, $v['alias'], $tree['tree_id']))) { $this->_error('#ALIAS_IN_USE'); } } if ($z['zmode'] == 'modify') { if ($v['move']) { $mv_field = !is_numb($v['move']) ? 'alias' : 'id'; $sql = 'SELECT * FROM _tree WHERE tree_?? = ?'; if ($mv_tree = _fieldrow(sql_filter($sql, $mv_field, $v['move']))) { $mv_insert = array('module' => $mv_tree['module_id'], 'node' => $mv_tree['tree_node'], 'parent' => $mv_tree['tree_id'], 'level' => $mv_tree['tree_level'] + 1); $sql = 'UPDATE _tree SET ' . _build_array('UPDATE', prefix('tree', $mv_insert)) . sql_filter(' WHERE article_id = ?', $tree['tree_id']); _sql($sql); $sql = 'UPDATE _tree SET tree_childs = tree_childs - 1 WHERE tree_id = ?'; _sql(sql_filter($sql, $tree['tree_parent'])); $sql = 'UPDATE _tree SET tree_childs = tree_childs + 1 WHERE tree_id = ?'; _sql(sql_filter($sql, $mv_tree['tree_id'])); } } unset($v['move']); // Check input values against database foreach ($v as $row_k => $row_v) { if ($tree['tree_' . $row_k] == $row_v) { unset($v[$row_k]); } } if (!(count($v) - 1)) { unset($v['edited']); } } else { unset($v['move']); } // $u_tree = _rewrite($tree); if (count($v)) { if (isset($v['content']) && $v['content']) { $v['content'] = str_replace(w('< >'), w('< >'), $v['content']); } if ($z['zmode'] == 'create') { $sql = 'INSERT INTO _tree' . _build_array('INSERT', prefix('tree', $v)); } else { $sql = 'UPDATE _tree SET ' . _build_array('UPDATE', prefix('tree', $v)) . sql_filter(' WHERE tree_id = ?', $tree['tree_id']); } _sql($sql); if ($z['zmode'] == 'create') { $u_tree = f($v['alias']) ? $v['alias'] : _nextid(); $sql = 'UPDATE _tree SET tree_childs = tree_childs + 1 WHERE tree_id = ?'; _sql(sql_filter($sql, $tree['tree_id'])); } } redirect(_link($u_tree)); } // // Show fieldset /*$v_fieldset = array( 'subject', 'content', 'description', 'alias', 'child_hide' => 0, 'child_order', 'nav' => 0, 'nav_hide' => 0, 'css_parent', 'css_var', 'quickload' => 0, 'dynamic' => 0, 'tags', 'template', 'redirect', 'allow_comments' => 0, 'approve_comments' => 0, 'form' => 0, 'form_email', 'published' ); */ $v_fieldset = array('subject', 'content'); if ($user->v('is_founder')) { $v_fieldset = array_merge($v_fieldset, array('description', 'alias', 'child_hide' => 0, 'child_order', 'nav' => 0, 'nav_hide' => 0, 'css_parent', 'css_var', 'quickload' => 0, 'dynamic' => 0, 'tags', 'template', 'redirect', 'allow_comments' => 0, 'approve_comments' => 0, 'form' => 0, 'form_email', 'published')); } $is_modify = $z['zmode'] == 'modify'; foreach (_array_keys($v_fieldset, '') as $k => $row) { $name = 'tree_' . $k; $cp_lang = _lang('CP_' . $k); $value = $is_modify ? isset($v[$k]) ? $v[$k] : (isset($tree[$name]) ? $tree[$name] : '') : ''; $checked = is_numb($row) && $is_modify && $tree[$name] ? ' checked="checked"' : ''; if (f($value)) { switch ($k) { case 'published': $value = date('d m Y', $value); break; } } $type = 'text'; if (is_numb($row)) { $value = 1; $type = 'checkbox'; } $tag = 'input'; if ($k == 'content') { $tag = 'textarea'; } _style('field', array('NAME' => $k, 'ID' => $k, 'TAG' => $tag, 'TYPE' => $type, 'VALUE' => $value, 'LANG' => $cp_lang, 'CHECKED' => $checked)); if ($k == 'template') { $i = 0; $fp = @opendir('./style/custom/'); while ($row_d = @readdir($fp)) { if (_extension($row_d) != 'htm') { continue; } if (!$i) { _style('field.templated'); _style('field.templated.row', array('V' => '', 'FILE' => _lang('NONE'))); } $v_file = str_replace('.htm', '', $row_d); _style('field.templated.row', array('V' => $v_file, 'FILE' => $v_file)); $i++; } @closedir($fp); } // } $cp_format = !$is_modify ? 'CREATE' : 'MODIFY'; v_style(array('CP_PAGE' => sprintf(_lang('CP_PAGE_' . $cp_format), $tree['tree_subject']))); return; }
protected function _connected_home() { global $bio, $core; $totals = w(); $time_today = _timestamp(); $bots = get_bots(); $sql = 'SELECT b.bio_id, b.bio_alias, b.bio_name, b.bio_level, b.bio_show, s.session_ip FROM _bio b, _sessions s WHERE b.bio_level NOT IN (??) ((s.session_time >= ? AND b.bio_id = s.session_bio) OR (b.bio_lastvisit >= ? AND b.bio_lastvisit < ?) ) ORDER BY b.bio_name'; $sessions = sql_rowset(sql_filter($sql)); $i = 0; foreach ($sessions as $row) { // Guest if ($row->bio_id == 1) { if ($row->session_ip != $last_ip) { $totals['guest']++; } $last_ip = $row->session_ip; continue; } if (!$i) { _style('online', array('L_TITLE' => _lang('ONLINE'))); _style('online.list'); } // Member if ($row['bio_id'] != $last_bio_id) { $is_bot = isset($bots[$row->bio_id]); if ($row->bio_show) { if (!$is_bot) { $totals['visible']++; } } else { $totals['hidden']++; } if (!$is_bot && ($row->bio_show || $bio->v('auth_founder')) || $is_bot && $bio->v('auth_founder')) { _style('online.list.row', array('USERNAME' => $row->bio_name, 'PROFILE' => _link_bio($row->bio_alias))); } } // $last_bio_id = $row->bio_id; $i++; } if (!!$totals['visible']) { _style('online.none'); } $online_ary = array('MEMBERS_TOTAL' => array_sum($totals), 'MEMBERS_VISIBLE' => $totals['visible'], 'MEMBERS_GUESTS' => $totals['guests'], 'MEMBERS_HIDDEN' => $totals['hidden'], 'MEMBERS_BOT' => $totals['bots']); foreach ($online_ary as $lk => $vk) { if (!$vk && $lk != 'MEMBERS_TOTAL') { continue; } _style('online.legend.row', array('L_MEMBERS' => _lang($lk . ($vk != 1 ? '2' : '')), 'ONLINE_VALUE' => $vk)); } // Online $sql = 'SELECT b.bio_id, b.bio_alias, b.bio_name, b.bio_level, b.bio_show, s.session_ip FROM _bio b, _sessions s WHERE s.session_time >= ?? AND b.bio_id = s.session_bio ORDER BY b.bio_name, s.session_ip'; $this->connected(sql_filter($sql, $local_time[0] - 300), 'online', 'MEMBERS_ONLINE'); // Today online $sql = 'SELECT bio_id, bio_alias, bio_name, bio_show, bio_level FROM _bio WHERE bio_level NOT IN (??) AND bio_lastvisit >= ? AND bio_lastvisit < ? ORDER BY bio_name'; $this->connected(sql_filter($sql, _implode(',', w(USER_INACTIVE)), $time_today, $time_today + 86399), 'online', 'MEMBERS_TODAY', 'MEMBERS_VISIBLE'); return; }
protected function _up_home() { global $bio, $warning; $v = $this->__(w('send address')); if (!empty($v->send)) { $v = _array_merge($v, $this->__(array_merge(w('password firstname lastname country status'), _array_keys(w('gender birth_day birth_month birth_year'), 0)))); if (empty($v->address)) { $warning->set('empty_address'); } if (empty($v->password)) { $warning->set('empty_password'); } if (!email_format($v->address)) { $warning->set('bad_address'); } if (!($v->alias = _low($v->firstname . $v->lastname))) { $warning->set('bad_alias'); } if ($this->alias_exists($v->alias)) { $warning->set('record_alias'); } if (!($v->country = $this->country_exists($v->country))) { $warning->set('bad_country'); } if (!$v->birth_day || !$v->birth_month || !$v->birth_year) { $warning->set('bad_birth'); } $v->birth = _timestamp($v->birth_month, $v->birth_day, $v->birth_year); $v->name = trim($v->firstname) . ' ' . trim($v->lastname); $sql_insert = array('type' => 0, 'level' => 0, 'active' => 1, 'alias' => $v->alias, 'name' => $v->firstname . ' ' . $v->lastname, 'first' => $v->firstname, 'last' => $v->lastname, 'key' => HashPassword($v->password), 'address' => $v->address, 'gender' => $v->gender, 'birth' => $v->birth, 'birthlast' => 0, 'regip' => $bio->v('ip'), 'regdate' => time(), 'session_time' => time(), 'lastpage' => '', 'timezone' => -6, 'dst' => 0, 'dateformat' => 'd M Y H:i', 'lang' => 'sp', 'country' => $v->country, 'avatar' => '', 'actkey' => '', 'recovery' => 0, 'fails' => 0); $bio->id = sql_put('_bio', prefix('bio', $sql_insert)); $sql_insert = array('bio' => $bio->id, 'name' => $v->address, 'primary' => 1); sql_put('_bio_address', prefix('address', $sql_insert)); echo 'OK'; exit; } //$gi = geoip_open(XFS.XCOR . 'store/geoip.dat', GEOIP_STANDARD); $geoip_code = ''; if ($bio->v('ip') != '127.0.0.1') { // GeoIP if (!@function_exists('geoip_country_code_by_name')) { //require_once(XFS.XCOR . 'geoip.php'); } //$geoip_code = @geoip_country_code_by_name($bio->v('ip')); } for ($i = 1; $i < 32; $i++) { if ($i == 1) { _style('birth_day'); } _style('birth_day.row', array('DAY' => $i)); } for ($i = 1; $i < 13; $i++) { if ($i == 1) { _style('birth_month'); } _style('birth_month.row', array('MONTH' => $i)); } for ($i = date('Y'); $i > 1900; $i--) { if ($i == date('Y')) { _style('birth_year'); } _style('birth_year.row', array('YEAR' => $i)); } //_pre($geoip_code, true); /* $sql = 'SELECT * FROM _countries ORDER BY country_name'; $countries = sql_rowset($sql); $v->country = ($v->country) ? $v->country : ((isset($country_codes[$geoip_code])) ? $country_codes[$geoip_code] : $country_codes['gt']); foreach ($countries as $i => $row) { if (!$i) _style('countries'); _style('countries.row', array( 'V_ID' => $row->country_id, 'V_NAME' => $row->country_name, 'V_SEL' => 0) ); } * */ return; }
protected function _up_home() { $v = $this->__(w('address')); if (_button()) { $v = array_merge($v, $this->__(array_merge(w('alias nickname ref_in'), _array_keys(w('gender country birth_day birth_month birth_year aup ref'), 0)))); if (empty($v->nickname) && !empty($v->address) && !is_email($v->address)) { $v->nickname = $v->address; } if (empty($v->nickname)) { $warning->set('empty_username'); } if (bio_length($v - nickname)) { $warning->set('len_alias'); } if (!($v->alias = _low($v->nickname))) { $warning->set('bad_alias'); } if ($this->alias_exists($v->alias)) { $warning->set('record_alias'); } if (!$this->country_exists($v->country)) { $warning->set('bad_country'); } if (!$v->birth_day || !$v->birth_month || !$v->birth_year) { $this->_error('BAD_BIRTH'); } $v->birth = _timestamp($v->birth_month, $v->birth_day, $v->birth_year); $sql_insert = array('alias' => $v->alias, 'nickname' => $v->nickname, 'address' => $v->address, 'gender' => $v->gender, 'country' => $v->country, 'birth' => $v->birth); sql_put('_bio', prefix('user', $sql_insert)); } // GeoIP require_once XFS . XCOR . 'geoip.php'; $gi = geoip_open(XFS . XCOR . 'store/geoip.dat', GEOIP_STANDARD); $geoip_code = strtolower(geoip_country_code_by_addr($gi, $bio->ip)); $sql = 'SELECT * FROM _countries ORDER BY country_name'; $countries = _rowset($sql); $v2->country = $v2->country ? $v2->country : (isset($country_codes[$geoip_code]) ? $country_codes[$geoip_code] : $country_codes['gt']); foreach ($countries as $i => $row) { if (!$i) { _style('countries'); } _style('countries.row', array('V_ID' => $row->country_id, 'V_NAME' => $row->country_name, 'V_SEL' => 0)); } return; }