本文整理汇总了PHP中w函数的典型用法代码示例。如果您正苦于以下问题:PHP w函数的具体用法?PHP w怎么用?PHP w使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read_dir
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;
}
示例2: home
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;
}
示例3: request_var
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;
}
示例4: __construct
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;
}
示例5: home
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;
}
示例6: _home
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);
}
示例7: home
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;
}
示例8: year_list
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;
}
示例9: _ticket_members
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);
}
示例10: access
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;
}
示例11: home
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;
}
示例12: in
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());
}
示例13: index
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']))
);
}
}
}
}
示例14: __construct
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;
}
示例15: home
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);
}