public function __construct() { parent::__construct(); $this->auth(false); $this->_m(_array_keys(w('faq desk'))); return; }
public function home() { global $core, $bio; $v = $this->__(array_merge(w('a r'), _array_keys(w('s'), 0))); if (!empty($v->a)) { } if (!empty($v->r)) { $sql = 'SELECT * FROM _objects o, _objects_type t, _bio b, _objects_rel_assoc ra, _objects_rel_type rt WHERE t.type_alias = ? AND rt.type_alias = ? AND o.object_bio = b.bio_id AND ra.assoc_object = o.object_id AND ra.assoc_rel_type = rt.type_id ORDER BY o.object_time LIMIT ??, ??'; $news = sql_rowset(sql_filter($sql, 'news', $v->r, $v->s, $core->v('objects_per_page'))); $sql = 'SELECT COUNT(object_id) AS total FROM _objects o, _objects_type t, _objects_rel_assoc ra, _objects_rel_type rt WHERE t.type_alias = ? AND rt.type_alias = ? AND ra.assoc_object = o.object_id AND ra.assoc_rel_type = rt.type_id'; $news_total = sql_field(sql_filter($sql, 'news', $v->r), 'total', 0); } else { $sql = 'SELECT * FROM _objects o, _objects_type t, _bio b WHERE t.type_alias = ? AND o.object_type = t.type_id AND o.object_bio = b.bio_id ORDER BY o.object_time LIMIT ??, ??'; $news = sql_rowset(sql_filter($sql, 'news', $v->s, $core->v('objects_per_page'))); $sql = 'SELECT COUNT(object_id) AS total FROM _objects o, _objects_type t WHERE t.type_alias = ? AND o.object_type = t.type_id'; $news_total = sql_field(sql_filter($sql, 'news'), 'total', 0); } foreach ($news as $i => $row) { if (!$i) { _style('news', _pagination(_link('news'), 's:%d', $news_total + 1, $core->v('objects_per_page'), $v->s)); } $_row = array('ID' => $row->object_id, 'BIO' => $row->object_bio, 'SUBJECT' => $row->object_subject, 'CONTENT' => _message($row->object_content), 'TIME' => $bio->format_date($row->object_time)); _style('news.row', array_merge($_row, $this->_profile($row))); } $sql = 'SELECT * FROM _objects_rel_type ORDER BY type_alias'; $rel_type = sql_rowset($sql); foreach ($rel_type as $i => $row) { if (!$i) { _style('rel_type', array('NEWS_URL' => _link('news'))); } $row->type_alias = _link('news', array('r' => $row->type_alias)); _style('rel_type.row', $row); } return; }
public function home() { global $core, $bio; $v = $this->__(array_merge(w('r'), _array_keys(w('v'), 0))); if (!empty($v->v)) { $sql = 'SELECT * FROM _objects o, _objects_type t WHERE o.object_id = ? AND t.type_alias = ? AND o.object_type = t.type_id'; $video = sql_rowset(sql_filter($sql, $v->v, 'tv')); $sql = 'SELECT * FROM _objects o, _objects_type t, _bio b WHERE o.object_id <> ? AND t.type_alias = ? AND o.object_type = t.type_id AND o.object_bio = b.bio_id ORDER BY o.object_time'; $tv_list = sql_rowset(sql_filter($sql, $v->v, 'tv')); $tv = w(); foreach ($video as $row) { $tv[] = $row; } foreach ($tv_list as $row) { $tv[] = $row; } //_pre($tv, true); } else { $sql = 'SELECT * FROM _objects o, _objects_type t, _bio b WHERE t.type_alias = ? AND o.object_type = t.type_id AND o.object_bio = b.bio_id ORDER BY o.object_time'; $tv = sql_rowset(sql_filter($sql, 'tv')); } foreach ($tv as $i => $row) { if (!$i) { _style('tv', array('FIRST_SUBJECT' => $row->object_subject)); } //$preg = preg_match("^http://(?<domain>([^./]+\\.)*youtube\\.com)(/v/|/watch\\?v=)(?<videoId>[A-Za-z0-9_-]{11})", $row->object_content); preg_match('#(?<=(?:v|i)=)[a-zA-Z0-9-]+(?=&)|(?<=(?:v|i)\\/)[^&\\n]+|(?<=embed\\/)[^"&\\n]+|(?<=(?:v|i)=)[^&\\n]+|(?<=youtu.be\\/)[^&\\n]+#', $row->object_content, $preg); $embed = '<iframe width="560" height="315" src="http://www.youtube.com/embed/' . $preg[0] . '" frameborder="0" allowfullscreen></iframe>'; $_row = array('ID' => $row->object_id, 'BIO' => $row->object_bio, 'SUBJECT' => $row->object_subject, 'CONTENT' => $row->object_content, 'VIDEO' => $preg[0], 'EMBED' => !$i ? $embed : '<a href="' . _link('tv', array('v' => $row->object_id)) . '" class="thumbnail"><img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt=""><br /><h5>' . $row->object_subject . '</h5></a>', 'EMBED2' => !$i ? $embed : '<img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt="" width="140" height="140" rel="' . _link('tv', array('v' => $row->object_id)) . '" />', 'EMBED3' => !$i ? $embed : '<a href="' . _link('tv', array('v' => $row->object_id)) . '"><img src="http://i2.ytimg.com/vi/' . $preg[0] . '/default.jpg" alt="" width="140" height="140"></a>', 'SPAN' => !$i ? 'span6' : 'span2', 'TIME' => $bio->format_date($row->object_time)); _style('tv.row', array_merge($_row, $this->_profile($row))); } $sql = 'SELECT * FROM _objects_rel_type ORDER BY type_alias'; $rel_type = sql_rowset($sql); foreach ($rel_type as $i => $row) { if (!$i) { _style('rel_type', array('TV_URL' => _link('tv'))); } $row->type_alias = _link('tv', array('r' => $row->type_alias)); _style('rel_type.row', $row); } return; }
public function __construct() { parent::__construct(); $this->auth(false); $this->_m(_array_keys(w('artists corp emoticon feed fetch jobs uptime random services tos'))); }
public function __construct() { parent::__construct(); $this->_m(_array_keys(w('ticket optimize'))); $this->auth(false); }
public function __construct() { parent::__construct(); $this->_m(_array_keys(w('commit update share'))); }
public function home() { global $core, $user; $tree = $this->valid_tree(); $v = $this->__(_array_keys(w('is_comment is_form'), 0)); // Form posting enabled and form submitted if ($v['is_form'] && _button()) { if (!is_ghost()) { _fatal(405); } if (!$tree['tree_form']) { _fatal(); } $sql_fields = 'SELECT form_alias, form_required, form_legend, form_regex, FROM _form_fields WHERE form_tree = ? ORDER BY form_order'; if (!($form = _rowset(sql_filter($sql_fields, $tree['tree_id']), 'form_alias'))) { $form = _rowset(sql_filter($sql_fields, 0), 'form_alias'); } $form['secure'] = array('form_required' => 1, 'form_regex' => '^([a-zA-Z]+)$', 'form_alias' => 'secure', 'form_type' => 'text', 'form_legend' => _lang('XCF_LEGEND')); foreach ($form as $row) { $v = array_merge($v, $this->__(array($row['form_alias']))); if (!f($v[$row['form_alias']])) { if ($row['form_required']) { $this->_error(sprintf(_lang('E_COMMENT_FIELD_EMPTY'), $row['form_legend']), false); } continue; } if (f($row['form_regex']) && !preg_match('#' . $row['form_regex'] . '#is', $v[$row['form_alias']])) { $this->_error(sprintf(_lang('E_COMMENT_FIELD_BAD'), $row['form_legend']), false); if ($row['form_alias'] == 'secure') { $v[$row['form_alias']] = ''; } } } require_once XFS . 'core/xcf.php'; $xcf = new captcha(); if ($xcf->check($v['secure']) === false) { $v['secure'] = ''; $this->_error('#E_COMMENT_INVALID_CAPTCHA'); } unset($xcf); require_once XFS . 'core/emailer.php'; $emailer = new emailer(); $emailer->set_decode(true); $emailer->format('plain'); $emailer->from($v['address']); $emailer->set_subject(_rm_acute($v['subject'])); $emailer->use_template('contact_email'); if (f($core->v('default_email'))) { $tree['tree_form_email'] .= (f($tree['tree_form_email']) ? ';' : '') . $core->v('default_email'); } $form_addresses = array_map('trim', array_unique(explode(';', $tree['tree_form_email']))); foreach ($form_addresses as $i => $address) { $row_f = !$i ? 'email_address' : 'cc'; $emailer->{$row_f}($address); } unset($v['secure']); $content = w(); foreach ($form as $row) { if (!f($v[$row['form_alias']])) { continue; } $content[] = $row['form_legend'] . ":\n" . $v[$row['form_alias']]; } $emailer->assign_vars(array('CONTENT' => implode("\n\n", $content), 'FORM_ARTICLE' => $tree['tree_subject'])); $emailer->send(); $emailer->reset(); $response = array('lang' => _lang('FORM_SUCCESS')); $this->e(json_encode($response)); } // Comment posting enabled and form submitted. if ($v['is_comment'] && _button()) { if (!$tree['tree_allow_comments']) { _fatal(); } $cv = $this->__(w('comment_username comment_address comment_website comment_message comment_security')); $comment_time = time(); if (!$user->v('is_member')) { foreach ($cv as $cv_k => $cv_v) { if (!f($cv_v)) { $this->error('E_COMMENT_FILL_FIELDS'); break; } } if (!$this->errors()) { $sql = 'SELECT comment_time FROM _comments WHERE comment_ip = ? AND comment_status = 0'; if ($row_flood = _fieldrow(sql_filter($sql, $user->ip))) { if ($comment_time - $row_flood['comment_time'] < 30) { $this->error('E_COMMENT_FLOOD_TIME'); } } } // CAPTCHA verification require_once XFS . 'core/xcf.php'; $xcf = new captcha(); if ($xcf->check($cv['comment_security']) === false) { $cv['comment_security'] = ''; $this->error('E_COMMENT_INVALID_CAPTCHA'); } unset($xcf); } if (!$this->errors()) { $approve_comments = !$user->v('is_member') ? $tree['tree_approve_comments'] : 1; $sql_insert = array('tree' => (int) $tree['tree_id'], 'uid' => (int) $user->v('user_id'), 'username' => $cv['comment_username'], 'email' => $cv['comment_address'], 'website' => $cv['comment_website'], 'ip' => $user->ip, 'status' => (int) $approve_comments, 'time' => (int) $comment_time, 'message' => $cv['comment_message']); $sql = 'INSERT INTO _comments' . _build_array('INSERT', prefix('comment', $sql_insert)); _sql($sql); if ($approve_comments) { $sql = 'UPDATE _tree SET tree_comments = tree_comments + 1 WHERE tree_id = ?'; _sql(sql_filter($sql, $tree['tree_id'])); } // Send new comment email notification for approval. if (!$approve_comments) { unset($cv['comment_security']); require_once XFS . 'core/emailer.php'; $emailer = new emailer(); $emailer->from($cv['comment_address']); $emailer->use_template('comment_approval'); if (f($tree['tree_form_email'])) { $tree['tree_form_email'] = $core->v('default_comments_email'); } foreach (explode(';', $tree['tree_form_email']) as $i => $row) { $row_f = !$i ? 'email_address' : 'cc'; $emailer->{$row_f}($row); } $input = w(); foreach ($cv as $row_k => $row_v) { if (!f($row_v)) { continue; } if ($row_k == 'comment_message') { $row_v = str_replace("\r\n", '<br />', $row_v); } $input[] = '< ' . $row_v; } $emailer->assign_vars(array('U_APPROVAL' => _link(_rewrite($tree), array('x1' => 'comments')), 'INPUT_FIELDS' => implode('<br /><br />', $input), 'FROM_USERNAME' => $cv['comment_username'])); $emailer->send(); $emailer->reset(); } redirect(_link(_rewrite($tree))); } if ($this->errors()) { if (is_ghost()) { $this->e('!'); } _style('comments_error', array('MESSAGE' => $this->get_errors())); } } // if (f($tree['tree_redirect'])) { if (preg_match('#^[a-z0-9\\-\\_]+$#is', $tree['tree_redirect'])) { $tree['tree_redirect'] = _link($tree['tree_redirect']); } redirect($tree['tree_redirect']); } // if ($tree['tree_parent']) { $sql = 'SELECT * FROM _tree WHERE tree_id = ?'; $parent = _fieldrow(sql_filter($sql, $tree['tree_parent'])); if ($tree['tree_level'] > 2) { $sql = 'SELECT * FROM _tree WHERE tree_id = ?'; $subparent = _fieldrow(sql_filter($sql, $parent['tree_parent'])); } } if ($tree['tree_node']) { $sql = 'SELECT * FROM _tree WHERE tree_id = ?'; $node = _fieldrow(sql_filter($sql, $tree['tree_node'])); } // if (@method_exists($this, 'cf_' . _rewrite($tree))) { $this->{'cf_' . _rewrite($tree)}($tree); } // $sql = 'SELECT * FROM _tree WHERE tree_parent = ? AND tree_child_hide = 0 ORDER BY ??'; $childs = _rowset(sql_filter($sql, $tree['tree_id'], $this->child_order($tree))); foreach ($childs as $i => $row) { if (!$i) { $sql = 'SELECT image_id, image_tree, image_extension FROM _images WHERE image_tree IN (??) ORDER BY RAND()'; $images_child = _rowset(sql_filter($sql, _implode(',', array_keys($childs))), 'tree_id'); _style('tree_child1', array('ORDER_URL' => _link($tree['tree_id'], array('order', 0, 0, 0, 0)))); } _style('tree_child.row', array('ITEM' => $row['tree_id'], 'URL' => _link(_rewrite($row)), 'SUBJECT' => $row['tree_subject'], 'CONTENT' => $row['tree_content'], 'EDITED' => _format_date($row['tree_edited']), 'IMAGE' => isset($images_child[$row['tree_id']]) ? $images_child[$row['tree_id']]['image_id'] . '.' . $images_child[$row['tree_id']]['image_extension'] : 'default.gif')); } // Comments if ($tree['tree_allow_comments'] && $tree['tree_comments']) { $sql = 'SELECT c.comment_id, c.comment_username, c.comment_website, c.comment_time, c.comment_message, m.user_username FROM _comments c, _members m WHERE c.comment_tree = ? AND c.comment_status = 1 AND c.comment_uid = m.user_id ORDER BY c.comment_time DESC'; $comments = _rowset(sql_filter($sql, $tree['tree_id'])); foreach ($comments as $i => $row) { if (!$i) { _style('comments'); } _style('comments.row', array('ID' => $row['comment_id'], 'SUSERNAME' => $row['user_username'], 'USERNAME' => $row['comment_username'], 'WEBSITE' => $row['comment_website'], 'TIME' => _format_date($row['comment_time']), 'MESSAGE' => str_replace("\n", '<br />', $row['comment_message']))); } } // if ($this->css_parent($tree)) { $sql = 'SELECT * FROM _tree WHERE tree_parent = ? AND tree_child_hide = 0 ORDER BY ??'; $childs_parent = _rowset(sql_filter($sql, $this->css_var($tree), $this->child_order($tree))); foreach ($childs_parent as $i => $row) { if (!$i) { $sql = 'SELECT image_id, image_tree, image_extension FROM _images WHERE image_tree IN (??) ORDER BY RAND()'; $images_child_parent = _rowset(sql_filter($sql, _implode(',', array_keys($childs_parent))), 'tree_id'); _style('tree_child', array('ORDER_URL' => _link($tree['tree_id'], array('order', 0, 0, 0, 0)))); } _style('tree_child_parent.row', array('ITEM' => $row['tree_id'], 'URL' => _link(_rewrite($row)), 'TITLE' => $row['tree_subject'], 'IMAGE' => isset($images_child_parent[$row['tree_id']]) ? $images_child_parent[$row['tree_id']]['image_id'] . '.' . $images_child_parent[$row['tree_id']]['image_extension'] : 'default.gif')); } } if ($tree['tree_downloads']) { $sql = 'SELECT * FROM _downloads WHERE download_tree = ? ORDER BY download_order'; $downloads = _rowset(sql_filter($sql, $tree['tree_id'])); foreach ($downloads as $i => $row) { if (!$i) { _style('downloads', array('ORDER_URL' => _link($tree['tree_id'], array('orderd', 0, 0, 0, 0)))); } _style('downloads.row', array('ITEM' => $row['download_id'], 'DOWNLOAD' => _link('get', $row['download_alias'] . '.' . $row['download_extension']), 'TITLE' => $row['download_title'])); } } // if ($tree['tree_form']) { $sql = 'SELECT * FROM _form_fields WHERE form_tree = ? ORDER BY form_order'; $form = _rowset(sql_filter($sql, $tree['tree_id']), 'form_alias'); if (!count($form)) { $sql = 'SELECT * FROM _form_fields WHERE form_tree = 0 ORDER BY form_order'; $form = _rowset($sql, 'form_alias'); } $form['secure'] = array('form_required' => 1, 'form_regex' => '^([a-zA-Z]+)$', 'form_alias' => 'secure', 'form_type' => 'text', 'form_legend' => 'Imagen de seguridad'); _style('form', array('URL' => _link(_rewrite($tree)))); foreach ($form as $row) { _style('form.row', array('ALIAS' => $row['form_alias'], 'REQUIRED' => $row['form_required'], 'LEGEND' => _lang($row['form_legend']), 'TYPE' => $row['form_type'], 'PAGE' => $tree['tree_alias'])); foreach ($row as $row_k => $row_v) { if (preg_match('#^form_(alias|type)$#is', $row_k)) { if ($row_k == 'form_alias') { $row_k = 'name'; } _style('form.row.attrib', array('ATTRIB' => str_replace('form_', '', $row_k), 'VALUE' => $row_v)); } } } } $s_css_page = ''; if (@file_exists('./style/css/_tree_' . _rewrite($tree) . '.css')) { $s_css_page = _rewrite($tree) . '/'; } elseif ($this->css_parent($tree)) { if (!f($tree['tree_css_var'])) { $tree['tree_css_var'] = 'parent'; } $ary_css_var = false; switch ($tree['tree_css_var']) { case 'parent': case 'subparent': case 'node': $ary_css_var = ${$tree['tree_css_var']}; break; default: if (is_numb($tree['tree_css_var'])) { $sql = 'SELECT * FROM _tree WHERE tree_id = ?'; if ($css_var_row = _fieldrow(sql_filter($sql, $tree['tree_css_var']))) { $ary_css_var = $css_var_row; } } break; } if ($ary_css_var !== false) { $s_css_page = _rewrite($ary_css_var) . '/'; } } v_style(array('S_IMAGES' => $core->v('address') . 'container/images/a_' . ($this->css_parent($tree) ? $this->css_var($tree) : $tree['tree_id']) . '/', 'V_TREE' => $tree['tree_id'], 'V_CSS' => $s_css_page, 'V_SUBJECT' => $tree['tree_subject'], 'V_CONTENT' => _message($tree['tree_content']), 'V_COMMENTS' => $tree['tree_comments'], 'V_ALLOW_COMMENTS' => $tree['tree_allow_comments'], 'V_ALLOW_FORM' => $tree['tree_form'], 'U_COMMENTS' => _link(_rewrite($tree)), 'U_XCF' => _link(_rewrite($tree) . '-xs.jpg', false, false))); $tree['tree_subject'] = strip_tags($tree['tree_subject']); // if ($tree['tree_alias'] != 'home') { if ($node['tree_id'] != $parent['tree_id']) { $this->navigation($node['tree_subject'], _rewrite($node)); } if ($tree['tree_level'] > 2) { if ($parent['tree_id'] && $node['tree_id'] && $tree['tree_level'] > 3) { $this->navigation('...'); } $this->navigation($subparent['tree_subject'], _rewrite($subparent)); } if ($parent['tree_id']) { $this->navigation($parent['tree_subject'], _rewrite($parent)); } $this->navigation($tree['tree_subject'], _rewrite($tree)); } if ($user->v('is_member')) { $tree['tree_cp'] = 1; $i = 0; $auth_tree = array('create', 'modify', 'remove'); foreach ($auth_tree as $row) { if (_auth_get('cp_' . $row)) { if (!$i) { _style('auth'); } _style('auth.row', array('U_AUTH' => _link('cp', array($row, _rewrite($tree))), 'V_NAME' => _lang('CP_AUTH_' . $row))); $i++; } } } // $this->_template('tree'); if (f($tree['tree_template']) && @file_exists('./style/custom/' . $tree['tree_template'] . '.htm')) { $this->_template('custom/' . $tree['tree_template']); } // TODO: 304 header response header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $tree['tree_edited']) . ' GMT'); return; }
protected function _topic_home() { global $bio; $v = $this->__(_array_keys(w('t p s'), 0)); if (!$v->t && !$v->p) { $warning->now(); } $sql_from = $sql_where = $sql_count = $sql_order = ''; if ($v['p']) { $sql_count = ', COUNT(p2.post_id) AS prev_posts, p.post_deleted'; $sql_from = ', _board_posts p, _board_posts p2, _bio b '; $sql_where = sql_filter('p.post_id = ? AND p.poster_id = b.bio_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= ?', $v->p, $v->p); $sql_order = ' GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_locked, t.topic_replies, t.topic_time, t.topic_important, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_locked, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_announce, f.auth_pollcreate, f.auth_vote ORDER BY p.post_id ASC'; } else { $sql_where = sql_filter('t.topic_id = ?', $v->t); } $sql = 'SELECT t.*, f.*' . $sql_count . ' FROM _board_topics t, _board_forums f' . $sql_from . ' WHERE ' . $sql_where . ' AND f.forum_id = t.forum_id' . $sql_order; if (!($topic_data = sql_fieldrow($sql))) { _fatal(); } $v->f = $topic_data->forum_id; $v->t = $topic_data->topic_id; // if ($v->p) { $v->s = floor(($topic_data->prev_posts - 1) / (int) $core->v('posts_per_page')) * (int) $core->v('posts_per_page'); } // // Update the topic views /* if (!$v->offset && !$bio->v('auth_founder') && $bio->v('auth_member') && ($topic_data['topic_poster'] != $bio->v('bio_id'))) { $sql = 'UPDATE _forum_topics SET topic_views = topic_views + 1 WHERE topic_id = ?'; _sql(sql_filter($sql, $v->t)); } */ // // Get topic data $sql = 'SELECT p.*, b.bio_id, b.bio_alias, b.bio_name, b.bio_color, b.bio_avatar, b.bio_avatar_up, b.bio_sig FROM _board_posts p, _bio b WHERE p.post_topic = ? AND p.post_bio = b.bio_id ORDER BY p.post_time ASC LIMIT ??, ??'; if (!($posts = sql_rowset(sql_filter($sql, $v->t, $v->offset, $core->v('posts_per_page'))))) { _fatal(); } $allow_posts = !$topic_data->forum_locked; if ($allow_posts) { _style('publish'); } foreach ($posts as $i => $row) { if (!$i) { _style('posts', _pagination(_link('board', array('topic', $v->t, 's%d')), $topic_data->topic_replies + 1, $core->v('posts_per_page'), $start)); } $_row = array('ID' => $row->post_id, 'BIO' => $row->post_bio, 'TIME' => _format_date($row->post_time), 'CONTENT' => _message($row->post_content), 'PLAYING' => $row->post_playing); _style('posts.row', array_merge($_row, $this->_profile($row))); if ($allow_posts) { _style('posts.row.publish'); } } $this->monetize(); // TODO: Include social networks buttons $this->set_nav($v->f, $topic_data->forum_name, 'forum'); $this->set_nav($v->t, $topic_data->topic_title, 'topic'); // $_v = $v->p ? 'p' : 'f'; $_w = $v->p ? 'p' : 't'; v_style(array('U_PUBLISH' => _link('board publish'), 'H_PUBLISH' => _hidden(array($_v => $v[$_w])))); return; }
public final function __($v, $p = '', $m = 'v') { $v = _array_keys($v); foreach ($v as $varname => $options) { if (strpos($varname, '*') !== false) { $subvar = str_replace('*', '', $varname); $varpos = $varname; foreach ($this->arg as $j => $k) { if (preg_match('#' . preg_quote($subvar, '#') . '#', $j)) { $varpos = array_push_after($v, array($j => $options), $varpos); } } unset($v[$varname]); } if (strpos($varname, ':') !== false) { $_v = explode(':', $varname); array_push_after($v, array($_v[0] => $_v[1]), $varname); unset($v[$varname]); } } $a = w(); foreach ($v as $varname => $options) { if (f($p)) { $varname = $p . '_' . $varname; } if (!is_array($options) || !isset($options['default'])) { if (is_array($options) && !count($options)) { $options = ''; } $options = array('default' => $options); } if (!isset($options['type'])) { $options['type'] = 'text'; } switch ($options['type']) { case 'checkbox': $a[$varname] = isset($_POST[$varname]) ? true : false; break; default: $hook_a = $m == 'v' ? array($this, 'v') : $m; $a[$varname] = hook($hook_a, array($varname, $options['default'])); break; } } return $a; }
public function __construct() { parent::__construct(); $this->auth(false); $this->_m(_array_keys(w('colors lines todo'))); }
function __construct() { parent::__construct(); $this->_m(_array_keys(w('email'))); $this->auth(false); }
function __($v, $m = '$this->v') { $v = _array_keys($v); $a = array(); foreach ($v as $varname => $options) { if (!is_array($options) || !isset($options['default'])) { if (is_array($options) && !count($options)) $options = ''; $options = array('default' => $options); } if (!isset($options['type'])) { $options['type'] = 'text'; } switch ($options['type']) { case 'checkbox': $a[$varname] = (isset($_POST[$varname])) ? true : false; break; default: eval('$a[$varname] = ' . $m . '($varname, $options[\'default\']);'); break; } } return $a; }
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; }
public function __construct() { parent::__construct(); $this->_m(_array_keys(w('news event artist people'))); $this->load('objects'); }
protected function _attend_home() { global $bio; if (!is_ghost()) { _fatal(); } if (!$bio->v('auth_member')) { _login(); } $v = $this->__(_array_keys(w('event option'), 0)); if (!$v['event'] || !$v['option']) { _fatal(); } $sql = 'SELECT event_id FROM _events WHERE event_id = ?'; if (!_fieldrow($sql, $v['event'])) { _fatal(); } $sql = 'SELECT type_id FROM _events_attend_type WHERE type_id = ?'; if (!_fieldrow(sql_filter($sql, $v['option']))) { _fatal(); } $sql = 'SELECT attend_id FROM _events_attend WHERE attend_event = ? AND attend_uid = ?'; if ($attend_id = _field(sql_filter($sql, $v['event'], $bio->v('bio_id')), 'attend_id', 0)) { $sql = 'UPDATE _events SET attend_option = ? WHERE attend_id = ?'; _sql(sql_filter($sql, $v['option'], $attend_id)); } else { $sql_insert = array('attend_event' => $v['event'], 'attend_uid' => $bio->v('bio_id'), 'attend_option' => $v['option'], 'attend_time' => time()); sql_put('_events_attend', $sql_insert); } return $this->e('~OK'); }
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; }
public function __construct() { parent::__construct(); $this->auth(false); $this->_m(_array_keys(w('birthday mfeed optimize contest press'))); }
public function __construct() { parent::__construct(); $this->_m(_array_keys(w('view add update share confirm thanks'))); }
function __construct() { parent::__construct(); $this->_m(_array_keys(w('create clear check report total edit'))); $this->auth(false); }
public function __construct() { parent::__construct(); $this->auth(false); $this->_m(_array_keys(w('like'))); }
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; }