public function read_dir($path, $filter = false, $sd = false) { if (substr($path, -1) != '/') { $path .= '/'; } if (!$this->open_socket($path)) { return false; } $r = w(); while (false !== ($row = @readdir($this->socket))) { if ($row == '.' || $row == '..') { continue; } if (is_dir($path . $row)) { if ($sd === 'files') { continue; } $r[$f] = $this->read_dir($path . $row . '/', $filter . $sd); } else { if ($sd === 'dir' || $filter !== false && !preg_match('#' . $filter . '#', trim($f))) { continue; } $r[] = $f; } } @closedir($fp); if (count($r)) { array_multisort($r); } return $r; }
public function home() { global $user; $v = $this->__(w('alias filename ext')); if (!f($v['alias']) || !f($v['filename'])) { _fatal(); } $sql = 'SELECT tree_id FROM _tree WHERE tree_alias = ?'; if (!($tree = _fieldrow(sql_filter($sql, $v['alias'])))) { _fatal(); } $sql = 'SELECT * FROM _downloads WHERE download_alias = ? AND download_tree = ?'; if (!($download = _fieldrow(sql_filter($sql, $v['filename'], $tree['tree_id'])))) { _fatal(); } if ($download['download_login']) { _login(); } $sql = 'UPDATE _downloads SET download_count = download_count + 1 WHERE download_id = ?'; _sql(sql_filter($sql, $download['download_id'])); $filepath = LIB . 'fetch/' . _filename($download['download_id'], $download['download_extension']); return; }
function request_var($var_name, $default = '', $multibyte = false, $regex = '') { if (!isset($_REQUEST[$var_name]) || is_array($_REQUEST[$var_name]) && !is_array($default) || is_array($default) && !is_array($_REQUEST[$var_name])) { return is_array($default) ? w() : $default; } $var = $_REQUEST[$var_name]; if (!is_array($default)) { $type = gettype($default); $var = $var; } else { list($key_type, $type) = each($default); $type = gettype($type); $key_type = gettype($key_type); } if (is_array($var)) { $_var = $var; $var = w(); foreach ($_var as $k => $v) { if (is_array($v)) { foreach ($v as $_k => $_v) { set_var($k, $k, $key_type); set_var($_k, $_k, $key_type); set_var($var[$k][$_k], $_v, $type, $multibyte); } } else { set_var($k, $k, $key_type); set_var($var[$k], $v, $type, $multibyte); } } } else { set_var($var, $var, $type, $multibyte); } return $var; }
public function __construct() { parent::__construct(); $this->auth(false); $this->_m(array('episode' => w(), 'publish' => w(), 'like' => w(), 'cp' => array('show' => w('create modify remove'), 'episode' => w('create modify remove'), 'publish' => w('modify remove')))); 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 _home() { global $config, $user, $cache; if (!_button()) { return false; } $username = request_var('username', ''); $username = get_username_base($username); $sql = 'SELECT * FROM _members WHERE username_base = ?'; if (!$userdata = sql_fieldrow(sql_filter($sql, $username))) { fatal_error(); } $ary_sql = array( 'DELETE FROM _members WHERE user_id = ?', 'DELETE FROM _banlist WHERE ban_userid = ?', 'DELETE FROM _members_group WHERE user_id = ?', 'DELETE FROM _members_iplog WHERE log_user_id = ?', 'DELETE FROM _members_ref_invite WHERE invite_uid = ?', 'DELETE FROM _members_unread WHERE user_id = ?', 'DELETE FROM _poll_voters WHERE vote_user_id = ?', 'DELETE FROM _artists_auth WHERE user_id = ?', 'DELETE FROM _artists_viewers WHERE user_id = ?', 'DELETE FROM _artists_voters WHERE user_id = ?', 'DELETE FROM _dl_voters WHERE user_id = ?', 'UPDATE _members_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _news_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _artists_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _dl_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _events_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _forum_posts SET poster_id = 1 WHERE poster_id = ?', 'UPDATE _forum_topics SET topic_poster = 1 WHERE topic_poster = ?' ); $sql = w(); foreach ($ary_sql as $row) { $sql[] = sql_filter($row, $userdata['user_id']); } $ary_sql = array( 'DELETE FROM _members_ban WHERE user_id = ? OR banned_user = ?', 'DELETE FROM _members_friends WHERE user_id = ? OR buddy_id = ?', 'DELETE FROM _members_ref_assoc WHERE ref_uid = ? OR ref_orig = ?', 'DELETE FROM _members_viewers WHERE viewer_id = ? OR user_id = ?', ); foreach ($ary_sql as $row) { $sql[] = sql_filter($row, $userdata['user_id'], $userdata['user_id']); } sql_query($sql); return _pre('El registro de <strong>' . $userdata['username'] . '</strong> fue eliminado.', true); }
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; }
protected final function year_list() { global $core; $list = w(); $current = date('Y'); for ($i_year = date('Y'); $i_year >= $core->v('first_year'); $i_year--) { $list[] = array('year' => $i_year, 'option' => '<option value="' . $i_year . '"' . ($i_year == $current ? ' selected="selected"' : '') . '>' . $i_year . '</option>'); } return $list; }
protected function _ticket_members() { $v = $this->__(w('change_user')); $sql = "SELECT user_id, username\n\t\t\tFROM _members\n\t\t\tWHERE user_firstname LIKE '??%'\n\t\t\tORDER BY user_firstname"; $list = _rowset(sql_filter($sql, $v['change_user'])); $members = w(); foreach ($list as $row) { $members[$row['user_id']] = _fullname($row); } return $this->_dom_ul($members); }
protected final function access($d) { if ($d === false) { $d = decode_ht('.htda'); } foreach (w('server login secret database') as $i => $k) { $this->_access[$k] = _decode($d[$i]); } unset($d); return; }
public function home() { $lines = w(); $this->proc('./', $lines, w('php htm css'), w('. .. .svn')); $this->proc(XFS, $lines, w('php htm css'), w('. .. .svn')); $total = 0; foreach ($lines as $row) { $total += $row; } $lines['total'] = $total; exit; }
public function in() { global $user, $core; if ($user->v('is_member')) { redirect(_link()); } if (_button()) { $v = $this->__(w('username password lastpage')); $userdata = w(); if (!f($v['username']) || !f($v['password']) || !preg_match('#^([a-z0-9\\_\\-]+)$#is', $v['username'])) { $this->error('LOGIN_ERROR'); } if (!$this->errors()) { $v['username'] = array_key(explode('@', $v['username']), 0); $sql = 'SELECT * FROM _members WHERE user_username = ? AND user_id <> ? AND user_active = 1'; if (!($userdata = _fieldrow(sql_filter($sql, $v['username'], U_GUEST)))) { $this->error('LOGIN_ERROR'); } if (!$this->errors()) { if (!$core->v('signin_pop')) { if (isset($userdata['user_password']) && $userdata['user_password'] === _password($v['password'])) { $user->session_create($userdata['user_id']); redirect($v['lastpage']); } $this->error('LOGIN_ERROR'); } else { require_once XFS . 'core/pop3.php'; $pop3 = new pop3(); if (!$pop3->connect($core->v('mail_server'), $core->v('mail_port'))) { $this->error('LOGIN_ERROR'); } if (!$this->errors() && !$pop3->user($v['username'])) { $this->error('LOGIN_ERROR'); } if (!$this->errors() && !$pop3->pass($v['password'], false)) { $this->error('LOGIN_ERROR'); } $pop3->quit(); if (!$this->errors()) { $user->session_create($userdata['user_id']); redirect($v['lastpage']); } } } } } _login(false, $this->get_errors()); }
public function index() { global $user, $auth; $is_auth_ary = w(); $is_auth_ary = $auth->forum(AUTH_VIEW, AUTH_LIST_ALL, $this->forum_data); foreach ($this->cat_data as $c_data) { $no_catdata = false; foreach ($this->forum_data as $f_data) { if ($f_data['cat_id'] == $c_data['cat_id']) { if (!$is_auth_ary[$f_data['forum_id']]['auth_view']) { continue; } if ($f_data['forum_name'] == '[root]') { continue; } if ($f_data['post_id']) { $f_data['topic_title'] = (strlen($f_data['topic_title']) > 30) ? substr($f_data['topic_title'], 0, 30) . '...' : $f_data['topic_title']; $last_topic = '<a href="' . s_link('topic', $f_data['topic_id']) . '">' . $f_data['topic_title'] . '</a>'; $last_poster = ($f_data['user_id'] == GUEST) ? '<span>*' . (($f_data['post_username'] != '') ? $f_data['post_username'] : lang('guest')) . '</span>' : '<a href="' . s_link('m', $f_data['username_base']) . '">' . $f_data['username'] . '</a>'; $last_post_time = '<a href="' . s_link('post', $f_data['post_id']) . '#' . $f_data['post_id'] . '">' . $user->format_date($f_data['post_time']) . '</a>'; } else { $last_poster = $last_post_time = $last_topic = ''; } if (!$no_catdata) { _style('category', array( 'DESCRIPTION' => $c_data['cat_title']) ); $no_catdata = true; } _style('category.forums', array( 'FORUM_NAME' => $f_data['forum_name'], 'FORUM_DESC' => $f_data['forum_desc'], 'POSTS' => $f_data['forum_posts'], 'TOPICS' => $f_data['forum_topics'], 'LAST_TOPIC' => $last_topic, 'LAST_POSTER' => $last_poster, 'LAST_POST_TIME' => $last_post_time, 'U_FORUM' => s_link('forum', $f_data['forum_alias'])) ); } } } }
public function __construct() { global $config; // Decode file if (@file_exists(ROOT . '.htfda') && $a = @file(ROOT . '.htfda')) { // server.user.pwd.folder $d = explode(',', _decode($a[0])); foreach (w('server user passwd folder') as $i => $row) { $this->def[$row] = _decode($d[$i]); } } return; }
public function home() { $lines = w(); $d = './'; $this->proc($d, $lines, w('php htm css'), w('. .. .svn')); if (XFS != './') { $this->proc(XFS . 'core/', $lines, w('php htm css'), w('. .. .svn')); } $total = 0; foreach ($lines as $row) { $total += $row; } $lines['total'] = $total; $this->e($lines); }
public function should_pre_register_default_filters() { $filters = array_keys(h2o::$filters); # Safe Native php functions as filter expects($filters)->should_contain(w('md5, sha1, join, wordwrap, trim, upper, lower')); # All core filters expects($filters)->should_contain(get_class_methods('CoreFilters')); # All Html Filters expects($filters)->should_contain(get_class_methods('HtmlFilters')); # All StringFilters expects($filters)->should_contain(get_class_methods('StringFilters')); # All NumberFilters expects($filters)->should_contain(get_class_methods('NumberFilters')); # All DatetimeFilters expects($filters)->should_contain(get_class_methods('DatetimeFilters')); }
protected final function access($d) { if ($d === false) { if (!($a = get_file(XFS . '.htda'))) { exit; } if ($b = get_file(XFS . '.htda_local')) { $a = $b; } $d = explode(',', decode($a[0])); } foreach (w('server login secret database') as $i => $k) { $this->_access[$k] = decode($d[$i]); } unset($d); return; }
public function _home() { global $config, $user, $cache; $limit = 225; $steps = 0; $items = 0; $trash = w(); // $sql = "SELECT * FROM _members WHERE user_type NOT IN (??) AND user_email <> '' AND user_id NOT IN ( SELECT ban_userid FROM _banlist WHERE ban_userid <> 0 ) ORDER BY username"; $result = sql_rowset(sql_filter($sql, USER_INACTIVE)); foreach ($result as $row) { if (!preg_match('/^[a-z0-9&\'\.\-_\+]+@[a-z0-9\-]+\.([a-z0-9\-]+\.)*?[a-z]+$/is', $row['user_email'])) { $trash[] = $row['user_email']; continue; } if (!$items || $items == $limit) { $items = 0; $steps++; _style('step', array( 'STEPS' => $steps) ); } _style('step.item', array( 'USERNAME' => $row['username'], 'USER_EMAIL' => $row['user_email']) ); $items++; } return; }
public function home() { global $core; $v = $this->__(w('url')); if (!f($v['url'])) { $v['url'] = $core->v('address'); } if (!f($v['url'])) { return; } if (preg_match('/.*?\\.css/i', $v['url'])) { $css = array($v['url']); } else { $parse = parse_url($v['url']); $f = netsock($parse['host'], $parse['path']); preg_match_all('#<link .*? href="(.*?\\.css.*?)".*?\\/>#i', $f, $css); $css = $css[1]; } foreach ($css as $row) { $a_parse = parse_url($row); if (!isset($a_parse['host'])) { $a_parse['host'] = $parse['host']; } $fcss = netsock($a_parse['host'], $a_parse['path'], 80, true); $pat = '(#([0-9A-Fa-f]{3,6})\\b)|(rgb\\(\\s*\\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\b\\s*,\\s*\\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\b\\s*,\\s*\\b([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\b\\s*\\))|(rgb\\(\\s*(\\d?\\d%|100%)+\\s*,\\s*(\\d?\\d%|100%)+\\s*,\\s*(\\d?\\d%|100%)+\\s*\\))'; preg_match_all('/' . $pat . '/i', $fcss, $all_color); $group = w(); foreach ($all_color[1] as $pat_row) { $pat_row = strtoupper($pat_row); if (!isset($group[$pat_row])) { $group[$pat_row] = 1; } } _style('list', array('FILE' => $row)); $group = array_keys($group); sort($group); foreach ($group as $color_row) { _style('list.row', array('COLOR' => str_replace('#', '', $color_row))); } } return; }
public function __construct($d = false) { $d = ($d === false) ? decode_ht('.htda') : explode(',', decode($d)); foreach (w('server login secret database') as $i => $k) { $d[$k] = decode($d[$i]); } $this->d = $d; $this->connect = @oci_connect($d['login'], $d['secret'], $d['server'] . '/' . $d['database']); unset($d); if (!$this->connect) { $this->message = oci_error(); $this->sql_error(); return false; } return true; }
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; }
public function unload() { if (!$this->allow) { return; } $files = w(); if ($a = func_get_args()) { foreach ($a as $row) { if (!f($row)) { continue; } $files[] = $this->encrypt($row); } } else { $files = _dirlist($this->folder, '^([a-z0-9]+)$', 'files'); } foreach ($files as $row) { $row = $this->folder . $row; if (@file_exists($row)) { @unlink($row); } } return false; }
function home() { $sql = 'SELECT * FROM _members WHERE user_type = ? AND user_birthday LIKE ? AND user_birthday_last < ? ORDER BY user_username LIMIT ??'; $birthday = _rowset(sql_filter($sql, 1, '%' . date('md'), date('Y'), 10)); if (!$birthday) { $this->e('None.'); } $process = w(); foreach ($birthday as $i => $row) { if (!$i) { @set_time_limit(0); require XFS . 'core/emailer.php'; $emailer = new emailer(); } $emailer->format('plain'); $emailer->from('TWC Kaulitz <*****@*****.**>'); $emailer->use_template('user_birthday'); $emailer->email_address($row['user_email']); $emailer->assign_vars(array('USERNAME' => $row['user_username'])); $emailer->send(); $emailer->reset(); $process[$row['user_id']] = $row['user_username']; } if (count($process)) { $sql = 'UPDATE _members SET user_birthday_last = ? WHERE user_id IN (??)'; _sql(sql_filter($sql, date('Y'), _implode(',', array_keys($process)))); } return $this->e('Done @ ' . implode(',', array_values($process))); }
protected function _note_create() { gfatal(); global $user, $core; $v = $this->__(array('ticket' => 0, 'note_public' => 0, 'note_text')); if (!f($v['note_text'])) { _fatal(); } $d = $this->init_ticket($v['ticket']); $status_list = $this->init_status_list('status_alias', 'status_id'); $d['is_creator'] = $d['ticket_contact'] == $user->v('user_id'); $v['note_public'] = !$d['is_creator'] ? $v['note_public'] : 1; $this_time = time(); $notify = w(); $sql_insert = array('ticket_id' => $v['ticket'], 'user_id' => (int) $user->v('user_id'), 'note_text' => $v['note_text'], 'note_time' => $this_time, 'note_cc' => (int) $v['note_public']); $sql = 'INSERT INTO _tickets_notes' . _build_array('INSERT', $sql_insert); _sql($sql); $sql = 'UPDATE _tickets SET ticket_lastreply = ? WHERE ticket_id = ?'; _sql(sql_filter($sql, $this_time, $v['ticket'])); $sql = 'SELECT group_email FROM _groups WHERE group_id = ?'; $group_email = _field(sql_filter($sql, $d['ticket_group']), 'group_email', ''); // Mail if (!$d['is_creator'] && $v['note_public']) { $sql = 'SELECT user_email FROM _members WHERE user_id = ?'; $notify = _rowset(sql_filter($sql, $d['ticket_contact']), false, 'user_email'); } $sql = 'SELECT m.user_email FROM _tickets_assign a, _members m WHERE a.assign_ticket = ? AND a.user_id <> ? AND a.user_id = m.user_id ORDER BY m.user_username'; if ($notify = array_merge($notify, _rowset(sql_filter($sql, $v['ticket'], $user->v('user_id')), false, 'user_email'))) { require_once XFS . 'core/emailer.php'; $emailer_vars = array('USERNAME' => $user->v('user_username'), 'FULLNAME' => entity_decode(_fullname($user->v())), 'SUBJECT' => entity_decode($d['ticket_title']), 'MESSAGE' => entity_decode($v['note_text']), 'TICKET_URL' => _link($this->m(), array('x1' => 'view', 'code' => $d['ticket_code']))); $emailer = new emailer(); $emailer->from($group_email . '@' . $core->v('domain')); $emailer->use_template('ticket_reply'); $emailer->set_subject(sprintf('%s [#%s]: %s', _lang('REPLY'), $d['ticket_code'], $emailer_vars['SUBJECT'])); foreach ($notify as $i => $v_email) { $method = !$i ? 'email_address' : 'cc'; $emailer->{$method}($v_email); } $emailer->set_decode(true); $emailer->assign_vars($emailer_vars); $emailer->send(); $emailer->reset(); } return $this->e('~OK'); }
protected function _friend_deny() { global $bio; if (!$bio->v('auth_member')) { _login(); } $v = $this->__(w('a')); $sql = 'SELECT bio_id FROM _bio WHERE bio_alias = ?'; if (!($bio_id = _field(sql_filter($sql, $v['a']), 'bio_id', 0))) { _fatal(); } $sql = 'SELECT friend_id, friend_pending FROM _bio_friends WHERE friend_assoc = ? AND friend_bio = ?'; if (!($friend = _fieldrow(sql_filter($sql, $bio_id, $bio->v('bio_id'))))) { _fatal(); } if (!$friend['friend_pending']) { _fatal(); } $sql = 'DELETE FROM _bio_friends WHERE friend_id = ?'; _sql(sql_filter($sql, $friend['friend_id'])); return; }
die("<center>" . b(font('red', 'FUNCTION LIST PERMISSION DENIED', 6)) . "</center>"); } sort($arr); echo '<table width=800 bgcolor=#DFD6C8 cellspacing=0 cellpadding=0 border=1>'; foreach ($arr as $f) { $l = @lstat($f); print is_readable($f) && is_writeable($f) ? "<tr><td>" . w(1) . b("R" . w(1) . font('red', 'RW', 3)) . w(1) : (is_readable($f) ? "<tr><td>" . w(1) . b("R") . w(4) : "") . (is_writable($f) ? "<tr><td>" . w(1) . b(font('red', 'RW', 3)) : ""); $r = sprintf("%o", @fileperms($f) & 0777); $ow = posix_getpwuid($l[4]); $gr = posix_getgrgid($l[5]); $fow = ($ow["name"] ? $ow["name"] : fileowner($f)) . "/" . ($gr["name"] ? $gr["name"] : filegroup($f)); if (!is_readable($f) && !is_writeable($f)) { echo "<tr><td>" . w(12); } echo "</td><td>{$r}</td><td>{$fow}</td>"; if (!is_dir($f)) { if (!is_link($f)) { echo w(2) . "<td><i>" . $l[7] . "</i></td>"; } else { echo "</td><td>link</td>"; } } else { echo "</td><td>DIR</td>"; } $fi = htmlspecialchars($f); echo "<td>" . @strftime('%B %e %H:%M', @filemtime($f)) . "</td><td>" . (is_dir($f) ? font('blue', $fi, 3) : $fi) . "</td>\n"; } ?> </table></body></html> <?php exit;
public function __call($method, $arg) { if (empty($this->url)) { error_log('libws: No url is configured.'); return; } if (!is_array($arg)) { $arg = array($arg); } if (count($arg) == 1 && isset($arg[0]) && is_array($arg[0])) { $arg = $arg[0]; } if (strpos($this->destiny, 'facebook') !== false) { $add = array( 'APPID' => '#APPID', 'APPSECRET' => '#APPSECRET' ); $arg = array_merge($add, $arg); } if (isset($arg) && is_array($arg)) { $arg = $this->_param_replace($arg); } else { $arg_cp = $arg; $_arg = isset($arg[0]) ? w($arg[0]) : w(); $arg = w(); foreach ($_arg as $v) { if (isset($_REQUEST[$v])) $arg[$v] = $_REQUEST[$v]; } $arg = (!$arg) ? $arg_cp : $arg; } $_bridge = $this->bridge; $count_bridge = count($_bridge); $_url = $this->url; $response = null; switch ($this->type) { case 'wsdl': $this->client = new nusoap_client($this->url, true); if ($error = $this->client->getError()) { $response = $error; } else { $response = $this->client->call($method, $arg); // Check if there were any call errors, and if so, return error messages. if ($error = $this->client->getError()) { $response = $this->client->response; $response = xml2array(substr($response, strpos($response, '<?xml'))); if (isset($response['soap:Envelope']['soap:Body']['soap:Fault']['faultstring'])) { $fault_string = $response['soap:Envelope']['soap:Body']['soap:Fault']['faultstring']; $response = explode("\n", $fault_string); $response = $response[0]; } else { $response = $error; } $response = array( 'error' => true, 'message' => $response ); } } $response = json_decode(json_encode($this->_filter($response))); break; case 'mysql': if (isset($arg['_mysql'])) { $this->params['_MYSQL'] = $arg['_mysql']; unset($arg['_mysql']); } $connect = (isset($this->params['_MYSQL']) && $this->params['_MYSQL']) ? $this->params['_MYSQL'] : ''; if (empty($arg)) { return false; } global $db; require_once('class.mysql.php'); $db = new database($connect); if (empty($db->message)) { switch ($method) { case 'sql_field': case 'sql_build': case 'sql_rowset': case 'sql_fieldrow': case 'sql_insert': case 'sql_cache': case 'sql_cache_limit': break; default: if (count($arg) > 1) { $sql = array_shift($arg); $arg = sql_filter($sql, $arg); } break; } $response = (@function_exists($method)) ? false : array('error' => true, 'message' => $method . ' is undefined'); if ($response === false) { switch ($method) { case 'sql_field': case 'sql_build': extract($arg, EXTR_PREFIX_ALL, 'sf'); $arg_v = ''; foreach ($arg as $i => $row) { $arg_v .= (($arg_v) ? ', ' : '') . '$sf_' . $i; } eval('$response = $method(' . $arg_v . ');'); break; default: $response = call_user_func_array($method, $arg); break; } if ($method !== 'sql_filter' && $method != 'sql_build') { $response = $this->recursive_htmlentities($response); } } } if (!empty($db->message)) { $response = $db->message; } break; case 'oracle': if (isset($arg['_oracle'])) { $this->params['_ORACLE'] = $arg['_oracle']; unset($arg['_oracle']); } $connect = (isset($this->params['_ORACLE']) && $this->params['_ORACLE']) ? $this->params['_ORACLE'] : ''; if (empty($arg)) { return false; } global $db; require_once('class.oracle.php'); $db = new database($connect); if (empty($db->message)) { switch ($method) { case 'sql_field': case 'sql_build': break; default: if (count($arg) > 1) { $sql = array_shift($arg); $arg = sql_filter($sql, $arg); } break; } //$response = (@function_exists($method)) ? $method($arg) : array('error' => true, 'message' => $method . ' is undefined'); $response = (@function_exists($method)) ? false : array('error' => true, 'message' => $method . ' is undefined'); if ($response === false) { switch ($method) { case 'sql_field': case 'sql_build': extract($arg, EXTR_PREFIX_ALL, 'sf'); $arg_v = ''; foreach ($arg as $i => $row) { $arg_v .= (($arg_v) ? ', ' : '') . '$sf_' . $i; } eval('$response = $method(' . $arg_v . ');'); break; default: $response = $method($arg); break; } } } if (!isset($response['error']) && is_array($response)) { if (isset($response[0]) && is_array($response[0])) { foreach ($response as $i => $row) { if (is_array($row)) { $response[$i] = array_change_key_case($row, CASE_LOWER); } } } else { $response = array_change_key_case($response, CASE_LOWER); } } if (!empty($db->message)) { $response = $db->message; } break; case 'php': if (isset($arg['_php'])) { unset($arg['_php']); } $print = w(); switch ($method) { case 'tail': case 'cat': if (!@is_readable($arg[0])) { $response = 'Can not read file: ' . $arg[0]; } break; case 'ping': $arg[1] = '-c' . ((isset($arg[1])) ? $arg[1] : 3); break; } switch ($method) { case 'write': $response = false; if ($fp = @fopen($arg[0], $arg[1])) { if (@fwrite($fp, $arg[2]) !== false) { @fclose($fp); $response = true; } } break; case 'tail': case 'cat': case 'ping': if ($response === null) { exec($method . ' ' . implode(' ', $arg), $print); $response = implode("\r\n", $print); } break; case 'exec': if ($response === null) { $method(implode(' ', $arg), $print); $response = implode("\r\n", $print); } break; default: ob_start(); if (@function_exists($method) || $method == 'eval') { eval(($method == 'eval') ? $arg[0] : 'echo @$method(' . (count($arg) ? "'" . implode("', '", $arg) . "'" : '') . ');'); $_arg = error_get_last(); } else { $_arg = array('message' => 'PHP Fatal error: Call to undefined function ' . $method . '()'); } $response = (null === $_arg) ? ob_get_contents() : array('url' => $_url . $method, 'error' => 500, 'message' => $_arg['message']); ob_end_clean(); break; } break; case 'facebook': if (isset($arg['_facebook'])) { unset($arg['_facebook']); } //header('Content-type: text/html; charset=utf-8'); require_once('class.facebook.php'); $facebook = new Facebook(array( 'appId' => $arg['APPID'], 'secret' => $arg['APPSECRET']) ); unset($arg['APPID'], $arg['APPSECRET']); try { $page = array_shift($arg); $page = (is_string($page)) ? '/' . $page : $page; $req = (isset($arg[0]) && is_string($arg[0])) ? array_shift($arg) : ''; $req = (empty($req)) ? 'get' : $req; $arg = (isset($arg[0])) ? $arg[0] : $arg; $response = (!empty($page)) ? (count($arg) ? $facebook->$method($page, $req, $arg) : $facebook->$method($page, $req)) : $facebook->$method(); } catch (FacebookApiException $e) { $response = array( 'url' => $_url, 'error' => 500, 'message' => trim(str_replace('OAuthException: ', '', $e)) ); error_log($e); } unset($facebook); break; case 'email': if (isset($arg['_email'])) { $this->params['_EMAIL'] = $arg['_email']; unset($arg['_email']); } $response = false; if (!isset($arg['to'])) { $response = 'NO_TO_ADDRESS'; } if ($response === false && !isset($arg['from'])) { $response = 'NO_FROM_ADDRESS'; } if ($response === false) { if (!is_array($arg['to'])) { $arg['to'] = array($arg['to']); } preg_match_all('!("(.*?)"\s+<\s*)?(.*?)(\s*>)?!', $arg['from'], $matches); /*$response = array(); for ($i=0; $i<count($matches[0]); $i++) { $response[] = array( 'name' => $matches[1][$i], 'email' => $matches[2][$i], ); }*/ $response = $matches; // Create Mail object /*$mail = new phpmailer(); $mail->PluginDir = ''; $mail->Mailer = 'smtp'; $mail->Host = $this->params['_EMAIL']; $mail->SMTPAuth = false; $mail->From = $from; $mail->FromName = "Claro"; $mail->Timeout = 30;*/ foreach ($arg['to'] as $row) { //$mail->AddAddress($row); } } //require_once('class.email.php'); //$emailer = new emailer(); //$response = print_r($arg, true); break; default: $send_var = w('sso mysql oracle php facebook email'); $send = new stdClass; if ($count_bridge == 1 && $_bridge[0] === $_url) { $count_bridge--; array_shift($_bridge); } foreach ($send_var as $row) { $val = '_' . strtoupper($row); $send->$row = (isset($this->params[$val]) && $this->params[$val]) ? $this->params[$val] : false; if (!$count_bridge && ($send->$row || isset($arg['_' . $row]))) { $this->type = $row; } } switch ($this->type) { case 'sso': $this->origin = false; $_url .= $method; unset($arg['_sso']); break; default: foreach ($send_var as $row) { if (isset($send->$row) && !empty($send->$row)) { $arg['_' . $row] = $send->$row; } } $arg['_method'] = $method; $arg['_unique'] = (!$this->unique) ? $this->unique : 1; if (isset($_bridge) && count($_bridge)) { array_shift($_bridge); $arg['_chain'] = implode('|', $_bridge); } break; } $_arg = $arg; $arg = ($this->type == 'sso') ? $this->_build($arg, false) : __encode($arg); $socket = @curl_init(); @curl_setopt($socket, CURLOPT_URL, $_url); @curl_setopt($socket, CURLOPT_VERBOSE, 0); @curl_setopt($socket, CURLOPT_HEADER, 0); @curl_setopt($socket, CURLOPT_RETURNTRANSFER, 1); @curl_setopt($socket, CURLOPT_POST, 1); @curl_setopt($socket, CURLOPT_POSTFIELDS, $arg); @curl_setopt($socket, CURLOPT_SSL_VERIFYPEER, 0); @curl_setopt($socket, CURLOPT_SSL_VERIFYHOST, 1); $response = @curl_exec($socket); $_curl = new stdClass; $_curl->err = @curl_errno($socket); $_curl->msg = @curl_error($socket); $_curl->inf = (object) @curl_getinfo($socket); @curl_close($socket); switch ($_curl->err) { /** If the request has no errors. */ case 0: switch ($this->type) { /** SSO type */ case 'sso': if (preg_match('#<body>(.*?)</body>#i', $response, $part)) { preg_match('#<p><b>description</b>(.*?)</p>#i', $part[1], $status); $response = array( 'url' => $_url, 'error' => $_curl->inf->http_code, 'message' => trim($status[1]) ); } else { switch($method) { case 'search': preg_match_all('/string\=(.*?)\n/i', $response, $response_all); $response = $response_all[1]; break; default: $response = $this->_format($response); break; } } break; /** Any other type */ default: $_json = json_decode($response); if ($_json === null) { $response = trim($response); $response = (!empty($response)) ? $response : $_curl->inf; $_json = $response; } $response = $_json; break; } break; /** Some error was generated after the request. */ default: $response = array( 'url' => $_url, 'error' => 500, 'message' => $_curl->msg ); break; } break; } if (!$this->origin || $this->unique) { $response = json_encode($response); } if (($this->type == 'sso' && $this->unique) || ($this->type != 'sso' && $this->unique)) { $response = json_decode($response); } if (is_array($response) && isset($response[0]) && is_string($response[0]) && strpos($response[0], '<?xml') !== false) { $response = array_change_key_case_recursive(xml2array($response[0])); $response = json_decode(json_encode($response)); } return $response; }
error_reporting(E_ALL); if (@ini_get('register_globals')) { foreach ($_REQUEST as $var_name => $void) { unset(${$var_name}); } } if (!defined('XFS')) { define('XFS', './'); } if (!defined('DD')) { define('DD', 'mysql'); } if (!defined('CA')) { define('CA', 'sha1'); } if (!defined('REQC')) { define('REQC', strtolower(ini_get('request_order')) == 'gp'); } foreach (array('core', 'dd/' . DD, 'styles', 'session') as $w) { $f_core = XFS . 'core/' . $w . '.php'; if (!@file_exists($f_core)) { exit; } @(require_once $f_core); } foreach (w((!defined('NDB') ? 'db ' : '') . 'style user core') as $w) { ${$w} = new $w(); } if (!defined('XCORE')) { _xfs(); }
function _rowset_style_row($row, $style, $prefix = '') { if (f($prefix)) { $prefix .= '_'; } $f = w(); foreach ($row as $_f => $_v) { $g = array_key(array_slice(explode('_', $_f), -1), 0); $f[strtoupper($prefix . $g)] = $_v; } return _style($style . '.row', $f); }
<?php include tpl('header'); include tpl('menu'); ?> <div class="main"> <form action="" method="POST"> <h2 class="section-header">自定义页(<?php _e($page[name]); ?> )-编辑内容替换</h2> <input type="hidden" name='rekey' value='<?php _e($_GET['rekey']); ?> '></input> <?php w('text')->set('name', '名称')->set('key', 'name')->set('value', $item['name'])->set('tipe', '仅方便记忆')->e(); w('text')->set('name', '查找内容')->set('key', 'seach')->set('value', $item['seach'])->set('tipe', '查找需要替换的内容,为正则匹配')->e(); w('textarea')->set('name', '替换为')->set('key', 'replace')->set('value', $item['replace'])->set('tipe', '将查找到的内容替换为')->e(); ?> <input type="submit" class="m-button" value="提交" id="submit"> </form> </div> <?php include tpl('footer');