public function _home() { global $config, $cache; if (!_button()) { $sql = 'SELECT ub, name FROM _artists ORDER BY name'; return _rowset_style($sql, 'artists'); } $name = request_var('name', ''); $sql = 'SELECT * FROM _artists WHERE name = ?'; if (!$a_data = sql_fieldrow(sql_filter($sql, $name))) { fatal_error(); } $sql = 'SELECT m.user_id, m.user_email FROM _artists_auth a, _members m WHERE a.ub = ? AND a.user_id = m.user_id'; $result = sql_rowset(sql_filter($sql, $a_data['ub'])); $mods = w(); foreach ($result as $row) { $mods[] = $row['user_id']; } if (count($mods)) { foreach ($mods as $i => $each) { $sql = 'SELECT COUNT(user_id) AS total FROM _artists_auth WHERE user_id = ?'; $total = sql_field(sql_filter($sql, $each), 'total', 0); if ($total > 1) { unset($mods[$i]); } } } if (count($mods)) { $sql = 'UPDATE _members SET user_auth_control = 0 WHERE user_id IN (??)'; $d_sql[] = sql_filter($sql, _implode(',', $mods)); } $ary_sql = array( 'DELETE FROM _artists WHERE ub = ?', 'DELETE FROM _artists_auth WHERE ub = ?', 'DELETE FROM _artists_fav WHERE ub = ?', 'DELETE FROM _artists_images WHERE ub = ?', 'DELETE FROM _artists_log WHERE ub = ?', 'DELETE FROM _artists_lyrics WHERE ub = ?', 'DELETE FROM _artists_posts WHERE post_ub = ?', 'DELETE FROM _artists_stats WHERE ub = ?', 'DELETE FROM _artists_viewers WHERE ub = ?', 'DELETE FROM _artists_voters WHERE ub = ?', 'DELETE FROM _artists_votes WHERE ub = ?', 'DELETE FROM _forum_topics WHERE topic_ub = ?', 'DELETE FROM _dl WHERE ub = ?' ); $d_sql = sql_filter($ary_sql, $a_data['ub']); $sql = 'SELECT topic_id FROM _forum_topics WHERE topic_ub = ?'; if ($topics = sql_rowset(sql_filter($sql, $a_data['ub']), false, 'topic_id')) { $d_sql[] = sql_filter('DELETE FROM _forum_posts WHERE topic_id IN (??)', _implode(',', $topics)); } $sql = 'SELECT id FROM _dl WHERE ub = ?'; if ($downloads = sql_rowset(sql_filter($sql, $a_data['ub']), false, 'id')) { $ary_sql = array( 'DELETE FROM _dl_fav WHERE dl_id IN (??)', 'DELETE FROM _dl_posts WHERE download_id IN (??)', 'DELETE FROM _dl_vote WHERE ud IN (??)', 'DELETE FROM _dl_voters WHERE ud IN (??)' ); $d_sql = array_merge($d_sql, sql_filter($ary_sql, _implode(',', $downloads))); } if (!_rm($config['artists_path'] . $a_data['ub'])) { _pre('Error al eliminar directorio de artista.', true); } sql_query($d_sql); // Cache $cache->delete('ub_list a_last_images'); redirect(s_link('a')); }
public function _home() { global $config, $user, $cache; $artist = request_var('a', ''); $redirect = request_var('r', ''); if (!empty($artist)) { redirect(s_link('acp', array($redirect, 'a' => $artist))); } $artist_select = ''; if (!$user->is('founder')) { $sql = 'SELECT ub FROM _artists_auth WHERE user_id = ?'; $artist_select = ' WHERE ub IN (' . _implode(',', sql_rowset(sql_filter($sql, $user->d('user_id')), false, 'ub')) . ') '; } $sql = 'SELECT ub, subdomain, name FROM _artists ?? ORDER BY name'; $artists = sql_rowset(sql_filter($sql, $artist_select)); foreach ($artists as $i => $row) { if (!$i) _style('artist_list'); _style('artist_list.row', array( 'URL' => s_link('acp', array($redirect, 'a' => $row['subdomain'])), 'NAME' => $row['name']) ); } return; }
public function _home() { global $config, $user, $cache; if (!_button()) { return; } $this->id = request_var('msg_id', 0); $sql = 'SELECT * FROM _forum_topics WHERE topic_id = ?'; if (!$this->object = sql_fieldrow(sql_filter($sql, $this->id))) { fatal_error(); } $this->object = (object) $this->object; $this->object->new_value = ($this->object->topic_featured) ? 0 : 1; topic_feature($this->id, $this->object->new_value); $sql_insert = array( 'bio' => $user->d('user_id'), 'time' => time(), 'ip' => $user->ip, 'action' => 'feature', 'old' => $this->object->topic_featured, 'new' => $this->object->new_value ); sql_insert('log_mod', $sql_insert); return redirect(s_link('topic', $this->id)); }
public function _home() { global $config, $user, $cache; $sql = 'SELECT e.event_topic, f.forum_name, t.topic_id, t.topic_title, t.topic_views, t.topic_replies FROM _forum_topics t LEFT JOIN _events e ON e.event_topic = t.topic_id INNER JOIN _forums f ON t.forum_id = f.forum_id WHERE t.forum_id NOT IN (38) ORDER BY t.topic_time DESC LIMIT 100'; $result = sql_rowset($sql); foreach ($result as $i => $row) { if (!$i) _style('topics'); _style('topics.row', array( 'TOPIC_ID' => s_link('topic', $row['topic_id']), 'TOPIC_FORUM' => $row['forum_name'], 'TOPIC_EVENT' => $row['event_topic'], 'TOPIC_TITLE' => $row['topic_title'], 'TOPIC_VIEWS' => $row['topic_views'], 'TOPIC_REPLIES' => $row['topic_replies']) ); } return; }
public function _home() { global $config, $user, $cache; $submit2 = _button('submit2'); if (_button() || $submit2) { $news_id = request_var('news_id', 0); $sql = 'SELECT * FROM _news WHERE news_id = ?'; if (!$news_data = sql_fieldrow(sql_filter($sql, $news_id))) { fatal_error(); } if ($submit2) { $post_subject = request_var('post_subject', ''); $post_desc = request_var('post_desc', '', true); $post_message = request_var('post_text', '', true); if (empty($post_desc) || empty($post_message)) { _pre('Campos requeridos.', true); } $comments = new _comments(); $post_message = $comments->prepare($post_message); $post_desc = $comments->prepare($post_desc); // $sql = 'UPDATE _news SET post_subject = ?, post_desc = ?, post_text = ? WHERE news_id = ?'; sql_query(sql_filter($sql, $post_subject, $post_desc, $post_message, $news_id)); $cache->delete('news'); redirect(s_link('news', $news_id)); } if (_button()) { _style('edit', array( 'ID' => $news_data['news_id'], 'SUBJECT' => $news_data['post_subject'], 'DESC' => $news_data['post_desc'], 'TEXT' => $news_data['post_text']) ); } } if (!_button()) { _style('field'); } return; }
public function _home() { global $config, $user, $cache; if (!_button()) { return false; } $username1 = request_var('username1', ''); $username2 = request_var('username2', ''); if (empty($username1) || empty($username2)) { fatal_error(); } $username_base1 = get_username_base($username1); $username_base2 = get_username_base($username2); $sql = 'SELECT * FROM _members WHERE username_base = ?'; if (!$userdata = sql_fieldrow(sql_filter($sql, $username_base1))) { _pre('El usuario no existe.', true); } $sql = 'SELECT * FROM _members WHERE username_base = ?'; if ($void = sql_fieldrow(sql_filter($sql, $username_base2))) { _pre('El usuario ya existe.', true); } // $sql = 'UPDATE _members SET username = ?, username_base = ? WHERE user_id = ?'; sql_query(sql_filter($sql, $username2, $username_base2, $userdata['user_id'])); $emailer = new emailer(); $emailer->from('info'); $emailer->use_template('username_change', $config['default_lang']); $emailer->email_address($userdata['user_email']); $emailer->assign_vars(array( 'USERNAME' => $userdata['username'], 'NEW_USERNAME' => $username2, 'U_USERNAME' => s_link('m', $username_base2)) ); $emailer->send(); $emailer->reset(); redirect(s_link('m', $username_base2)); return; }
public function _home() { global $config, $cache, $user; if (!_button()) { $sql = 'SELECT cat_id, cat_name FROM _news_cat ORDER BY cat_id'; $result = sql_rowset($sql); foreach ($result as $i => $row) { if (!$i) _style('categories'); _style('categories.row', array( 'CAT_ID' => $row['cat_id'], 'CAT_NAME' => $row['cat_name']) ); } return false; } $t = request_var('news_id', 0); $f = request_var('cat_id', 0); if (!$f || !$t) { fatal_error(); } // $sql = 'SELECT * FROM _news WHERE news_id = ?'; if (!$tdata = sql_fieldrow(sql_filter($sql, $t))) { fatal_error(); } // $sql = 'SELECT * FROM _news_cat WHERE cat_id = ?'; if (!$fdata = sql_fieldrow(sql_filter($sql, $f))) { fatal_error(); } // $sql = 'UPDATE _news SET cat_id = ? WHERE news_id = ?'; sql_query(sql_filter($sql, $f, $t)); return redirect(s_link('news', $t)); }
public function run() { global $cache, $comments; $alias = request_var('alias', ''); if (!empty($alias)) { $sql = 'SELECT * FROM _help_cat c, _help_modules m, _help_faq f WHERE c.help_module = m.module_id AND f.help_id = c.help_id AND m.module_name = ? ORDER BY f.faq_question_es'; $module = sql_rowset(sql_filter($sql, $alias)); foreach ($module as $i => $row) { if (!$i) _style('module', array('TITLE' => $row['help_es'])); _style('module.row', array( 'QUESTION' => $row['faq_question_es'], 'ANSWER' => $comments->parse_message($row['faq_answer_es'])) ); } } if (!$help = $cache->get('help')) { $sql = 'SELECT * FROM _help_cat c, _help_modules m WHERE c.help_module = m.module_id ORDER BY c.help_order'; if ($help = sql_rowset($sql)) { $cache->save('help', $help); } } foreach ($help as $i => $row) { if (!$i) _style('categories'); _style('categories.row', array( 'URL' => s_link('help', $row['module_name']), 'TITLE' => $row['help_es']) ); } return; }
function _artists() { $sql = 'SELECT name, subdomain, genre, datetime, local, location FROM _artists ORDER BY datetime DESC LIMIT 15'; $result = sql_rowset($sql); foreach ($result as $row) { $this->xml[] = array( 'title' => $row['name'], 'link' => s_link('a', $row['subdomain']), 'description' => ($row['genre'] . "<br />" . (($row['local']) ? 'Guatemala' : $row['location'])), 'pubdate' => $row['datetime'] ); } return; }
public function _home() { global $config, $user, $cache, $upload; if (_button()) { $news_id = request_var('news_id', 0); $sql = 'SELECT news_id FROM _news WHERE news_id = ?'; if (!sql_field(sql_filter($sql, $news_id), 'news_id', 0)) { fatal_error(); } $filepath_1 = $config['news_path']; $f = $upload->process($filepath_1, 'add_image', 'jpg'); if (!sizeof($upload->error) && $f !== false) { foreach ($f as $row) { $xa = $upload->resize($row, $filepath_1, $filepath_1, $news_id, array(100, 75), false, false, true); } redirect(s_link()); } _style('error', array( 'MESSAGE' => parse_error($upload->error)) ); } $sql = 'SELECT * FROM _news ORDER BY post_time DESC'; $result = sql_rowset($sql); foreach ($result as $row) { _style('news_list', array( 'NEWS_ID' => $row['news_id'], 'NEWS_TITLE' => $row['post_subject']) ); } return; }
public function _home() { global $config, $user, $cache; $sql = 'SELECT user_id, username, username_base, user_points FROM _members WHERE user_points <> 0 ORDER BY user_points DESC, username'; $result = sql_rowset($sql); foreach ($result as $i => $row) { if (!$i) _style('members'); _style('members.row', array( 'BASE' => s_link('m', $row['username_base']), 'USERNAME' => $row['username'], 'POINTS' => $row['user_points']) ); } return; }
public function _home() { global $config, $user, $cache; $sql = 'SELECT d.*, m.username, m.username_base FROM _radio_dj_log d, _members m WHERE d.log_uid = m.user_id ORDER BY log_time DESC'; $result = sql_rowset($sql); foreach ($result as $i => $row) { if (!$i) _style('report'); _style('report.row', array( 'LINK' => s_link('m', $row['username_base']), 'NAME' => $row['username'], 'TIME' => $user->format_date($row['log_time'])) ); } return; }
public function _home() { global $config, $user, $cache; $this->id = request_var('msg_id', 0); $sql = 'SELECT * FROM _members_posts WHERE post_id = ?'; if (!$this->object = sql_fieldrow(sql_filter($sql, $this->id))) { fatal_error(); } $this->object = (object) $this->object; if (!$user->is('founder') && $user->d('user_id') != $this->object->userpage_id) { fatal_error(); } $sql = 'SELECT username_base FROM _members WHERE user_id = ?'; $username_base = sql_field(sql_filter($sql, $this->object->userpage_id), 'username_base', ''); $sql = 'DELETE FROM _members_posts WHERE post_id = ?'; sql_query(sql_filter($sql, $this->id)); $sql = 'UPDATE _members SET userpage_posts = userpage_posts - 1 WHERE user_id = ?'; sql_query(sql_filter($sql, $this->object->userpage_id)); $user->delete_unread(UH_UPM, $this->id); if ($this->object->post_time > points_start_date() && $this->object->post_time < 1203314400) { //$user->points_remove(1, $this->object->poster_id); } return redirect(s_link('m', $username_base)); }
public function _home() { global $config, $user, $cache; if (!_button()) { return; } $v = _request(array('event' => 0)); $sql = 'SELECT * FROM _events WHERE id = ?'; if (!$object = sql_fieldrow(sql_filter($sql, $v->event))) { fatal_error(); } $sql = 'DELETE FROM _events WHERE id = ?'; sql_query(sql_filter($sql, $v->event)); return redirect(s_link('events')); }
private function create() { $v = _request(array('title' => '', 'author' => '', 'text' => '')); if (_empty($v)) { return; } $sql = 'SELECT * FROM _artists WHERE ub = ?'; if (!$ad = sql_fieldrow(sql_filter($sql, $this->object['ub']))) { return; } $v->ub = $this->object['ub']; sql_insert('artists_lyrics', $v); $sql = 'UPDATE _artists SET lirics = lirics + 1 WHERE ub = ?'; sql_query(sql_filter($sql, $this->object['ub'])); return redirect(s_link('a', $ad['subdomain'])); }
public function _home() { global $config, $user, $cache, $comments; $this->id = request_var('msg_id', 0); $sql = 'SELECT * FROM _forum_posts WHERE post_id = ?'; if (!$this->object->post = sql_fieldrow(sql_filter($sql, $this->id))) { fatal_error(); } $this->object->post = (object) $this->object->post; $sql = 'SELECT * FROM _forum_topics WHERE topic_id = ?'; if (!$this->object->topic = sql_fieldrow(sql_filter($sql, $this->object->post->topic_id))) { fatal_error(); } $this->object->topic = (object) $this->object->topic; if (_button()) { $topic_title = request_var('topic_title', ''); $post_message = $comments->prepare(request_var('message', '', true)); if (!empty($topic_title) && $topic_title != $this->object->topic->topic_title) { $sql = 'UPDATE _forum_topics SET topic_title = ? WHERE topic_id = ?'; sql_query(sql_filter($sql, $topic_title, $this->object->topic->topic_id)); $sql = 'SELECT id FROM _events WHERE event_topic = ?'; if ($this->object->event_id = sql_field(sql_filter($sql, $this->object->topic->topic_id), 'id', 0)) { $sql = 'UPDATE _events SET title = ? WHERE id = ?'; sql_query(sql_filter($sql, $topic_title, $this->object->event_id)); } } if ($post_message != $this->object->post->post_text) { $sql = 'UPDATE _forum_posts SET post_text = ? WHERE post_id = ?'; sql_query(sql_filter($sql, $post_message, $this->id)); $rev = array( 'rev_post' => $this->id, 'rev_uid' => $user->d('user_id'), 'rev_time' => time(), 'rev_ip' => $user->ip, 'rev_text' => $this->object->post->post_text ); sql_insert('forum_posts_rev', $rev); } redirect(s_link('post', $this->id)); } v_style(array( 'V_TOPIC' => ($user->is('founder')) ? $this->object->topic->topic_title : '', 'V_MESSAGE' => $this->object->post->post_text) ); //return page_layout('Editar', 'modcp.edit', $tv); }
ORDER BY p.post_id DESC LIMIT ??'; if ($result = sql_rowset(sql_filter($sql, $config['ub_fans_f'], $config['main_topics']))) { $top_posts = sprintf(lang('top_forum'), count($result)); ?> <div class="head"><img src="/net/icons/forum.gif" width="18" height="18" alt="<?php echo $top_posts; ?>" title="<?php echo $top_posts; ?>" /><?php echo $top_posts; ?></div> <div class="ie-widthfix"> <table width="100%" class="t-collapse" cellpadding="5"> <?php $i = 0; foreach ($result as $row) { $username = ($row['user_id'] != GUEST) ? $row['username'] : (($row['post_username'] != '') ? $row['post_username'] : lang('guest')); $u_topic = ($row['topic_replies']) ? s_link('post', $row['post_id']) . '#' . $row['post_id'] : s_link('topic', $row['topic_id']); ?> <tr<?php echo (($i % 2) ? ' class="dark-color"' : ''); ?>> <td valign="top"><a href="<?php echo $u_topic; ?>"><?php echo $row['topic_title']; ?></a> <span class="soft">|</span> <?php echo $row['topic_replies']; ?>m<br /><?php echo lang('in'); ?> <a class="bold" href="<?php echo s_link('forum', $row['forum_id']); ?>"><?php echo $row['forum_name']; ?></a></td> <td width="15%" align="right" nowrap><?php if ($row['user_id'] != 1) { echo '<a href="' . s_link('m', $row['username_base']) . '">' . $username . '</a>'; } else { echo '<span>*' . $username . '</span>'; } ?><br /><?php echo $user->format_date($row['post_time']); ?></td> </tr> <?php $i++; } ?> </table> </div> <?php }
private function rights() { $acp_dir = ROOT . 'acp/'; $i = 0; $fp = @opendir($acp_dir); while ($row = @readdir($fp)) { if (!preg_match('#([a-z\_]+).php#i', $row, $part) || $row == '_template.php') { continue; } require_once($acp_dir . $row); $acp_alias = $part[1]; $acp_upper = strtoupper($acp_alias); $object_name = '__' . $acp_alias; if (!class_exists($object_name)) { continue; } if (!defined('_ACP')) { define('_ACP', true); } $object = new $object_name(); if ($object->can()) { if (!$i) _style('acp_list'); switch ($acp_alias) { case 'artist_select': continue 2; break; } _style('acp_list.row', array( 'URL' => s_link('acp', $acp_alias), 'NAME' => lang('ACP_' . $acp_alias, $acp_alias), 'IMAGE' => $acp_alias) ); $i++; } } @closedir($fp); return; }
public function user_main() { global $user, $comments; _style('main'); // // Get artists where this member is an authorized member // $sql = 'SELECT au.user_id, a.ub, a.name, a.subdomain, a.images, a.local, a.location, a.genre FROM _artists_auth au, _artists a WHERE au.user_id = ? AND au.ub = a.ub ORDER BY a.name'; if ($selected_artists = sql_rowset(sql_filter($sql, $this->data['user_id']), 'ub')) { $sql = 'SELECT ub, image FROM _artists_images WHERE ub IN (??) ORDER BY RAND()'; $result = sql_rowset(sql_filter($sql, implode(',', array_keys($selected_artists)))); $random_images = w(); foreach ($result as $row) { if (!isset($random_images[$row['ub']])) { $random_images[$row['ub']] = $row['image']; } } a_thumbnails($selected_artists, $random_images, 'USERPAGE_MOD', 'thumbnails'); } // // GET MEMBER FAV ARTISTS // $sql = 'SELECT f.user_id, a.ub, a.name, a.subdomain, a.images, a.local, a.location, a.genre FROM _artists_fav f, _artists a WHERE f.user_id = ? AND f.ub = a.ub ORDER BY RAND()'; if ($result2 = sql_rowset(sql_filter($sql, $this->data['user_id']), 'ub')) { $sql = 'SELECT ub, image FROM _artists_images WHERE ub IN (??) ORDER BY RAND()'; $result_images = sql_rowset(sql_filter($sql, implode(',', array_keys($result2)))); $random_images2 = w(); foreach ($result_images as $row) { if (!isset($random_images2[$row['ub']])) { $random_images2[$row['ub']] = $row['image']; } } $total_a = 0; $selected_artists2 = w(); foreach ($result2 as $row) { if ($total_a < 6) { $selected_artists2[$row['ub']] = $row; } $total_a++; } a_thumbnails($result2, $random_images2, 'USERPAGE_AFAVS', 'thumbnails'); if ($total_a > 6) { _style('main.thumbnails.all'); } } // Latest board posts $sql = "SELECT DISTINCT(t.topic_title), p.post_id, p.post_time, t.topic_color FROM _forum_topics t, _forum_posts p WHERE p.poster_id = ? AND p.forum_id NOT IN (14,15,16,17,20,22,38) AND t.topic_id = p.topic_id GROUP BY p.topic_id ORDER BY p.post_time DESC LIMIT 10"; $result = sql_rowset(sql_filter($sql, $this->data['user_id'])); foreach ($result as $i => $row) { if (!$i) _style('main.lastboard'); _style('main.lastboard.row', array( 'URL' => s_link('post', $row['post_id']) . '#' . $row['post_id'], 'TITLE' => $row['topic_title'], 'TOPIC_COLOR' => $row['topic_color'], 'TIME' => $user->format_date($row['post_time'], 'H:i'), 'DATE' => $user->format_date($row['post_time'], lang('date_format'))) ); } // // GET USERPAGE MESSAGES // $comments_ref = s_link('m', $this->data['username_base']); if ($user->is('member')) { _style('main.post_comment_box', array( 'REF' => $comments_ref) ); } // // User age & birthday // $birthday = ''; $age = 0; if ($this->data['user_birthday']) { $bd_month = gmmktime(0, 0, 0, substr($this->data['user_birthday'], 4, 2) + 1, 0, 0); $birthday = (int) substr($this->data['user_birthday'], 6, 2) . ' ' . $user->format_date($bd_month, 'F') . ' ' . substr($this->data['user_birthday'], 0, 4); $age = date('Y', time()) - intval(substr($this->data['user_birthday'], 0, 4)); if (intval(substr($this->data['user_birthday'], 4, 4)) > date('md', time())) { $age--; } $age .= ' ' . lang('years'); } switch ($this->data['user_gender']) { case 0: $gender = 'NO_GENDER'; break; case 1: $gender = 'MALE'; break; case 2: $gender = 'FEMALE'; break; } $gender = lang($gender); $epbi2 = false; $user_fields = array( //'JOINED' => ($this->data['user_regdate'] && (!$this->data['user_hideuser'] || $epbi2)) ? $user->format_date($this->data['user_regdate']) . sprintf(lang('joined_since'), $memberdays) : '', 'LAST_LOGON' => ($this->data['user_lastvisit'] && (!$this->data['user_hideuser'] || $epbi2)) ? $user->format_date($this->data['user_lastvisit']) : '', 'GENDER' => $gender, 'AGE' => $age, 'BIRTHDAY' => $birthday, 'FAV_GENRES' => $this->data['user_fav_genres'], 'FAV_BANDS' => $this->data['user_fav_artists'], 'LOCATION' => $this->data['user_location'], 'OCCUPATION' => $this->data['user_occ'], 'INTERESTS' => $this->data['user_interests'], 'MEMBER_OS' => $this->data['user_os'] ); $m = 0; foreach ($user_fields as $key => $value) { if ($value == '') continue; if (!$m) { _style('main.general'); $m = 1; } _style('main.general.item', array( 'KEY' => lang($key), 'VALUE' => $value) ); } // // Get Last.fm Feed // !! Disable temporary // // http://ws.audioscrobbler.com/1.0/user//recenttracks.xml // if (!empty($this->data['user_lastfm'])) { // include_once('./interfase/scrobbler.php'); // $scrobbler = new EasyScrobbler($this->data['user_lastfm']); // $list = @$scrobbler->getRecentTracs(); // if (sizeof($list)) { // _style('main.lastfm', array( // 'NAME' => $this->data['user_lastfm'], // 'URL' => 'http://www.last.fm/user/' . $this->data['user_lastfm'] . '/') // ); // foreach ($list as $row) { // _style('main.lastfm.row', array( // 'ARTIST' => $row['ARTIST'], // 'NAME' => $row['NAME'], // 'ALBUM' => $row['ALBUM'], // 'URL' => $row['URL'], // 'TIME' => $user->format_date($row['DATE_UTS'], 'H:i')) // ); // } // } // } // // Get public messages // $comments_ref = s_link('m', $this->data['username_base']); if ($this->data['userpage_posts']) { $comments->reset(); $comments->ref = $comments_ref; $sql = 'SELECT p.*, u2.user_id, u2.username, u2.username_base, u2.user_avatar FROM _members_posts p, _members u, _members u2 WHERE p.userpage_id = ? AND p.userpage_id = u.user_id AND p.post_active = 1 AND p.poster_id = u2.user_id ORDER BY p.post_time DESC LIMIT 50'; $comments->data = array( 'USER_ID_FIELD' => 'userpage_id', 'S_DELETE_URL' => s_link('acp', 'user_post_delete', 'msg_id:%d'), 'SQL' => sql_filter($sql, $this->data['user_id']) ); $comments->view(0, '', $this->data['userpage_posts'], $this->data['userpage_posts'], 'main.posts'); } if ($user->is('member')) { _style('main.box', array( 'REF' => $comments_ref) ); } return true; }
function generate_user_info(&$row, $date_format, $group_mod, &$from, &$posts, &$joined, &$poster_avatar, &$profile_img, &$profile, &$search_img, &$search, &$pm_img, &$pm, &$email_img, &$email, &$www_img, &$www, &$icq_status_img, &$icq_img, &$icq, &$aim_img, &$aim, &$msn_img, &$msn, &$yim_img, &$yim) { global $lang, $images, $config; $from = ( !empty($row['user_from']) ) ? $row['user_from'] : ' '; $joined = $user->format_date($row['user_regdate'], $date_format); $posts = ( $row['user_posts'] ) ? $row['user_posts'] : 0; $poster_avatar = ''; if ($row['user_avatar_type'] && $row['user_id'] != GUEST) { switch( $row['user_avatar_type'] ) { case USER_AVATAR_UPLOAD: $poster_avatar = ( $config['allow_avatar_upload'] ) ? '<img src="' . $config['avatar_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; break; case USER_AVATAR_REMOTE: $poster_avatar = ( $config['allow_avatar_remote'] ) ? '<img src="' . $row['user_avatar'] . '" alt="" border="0" />' : ''; break; case USER_AVATAR_GALLERY: $poster_avatar = ( $config['allow_avatar_local'] ) ? '<img src="' . $config['avatar_gallery_path'] . '/' . $row['user_avatar'] . '" alt="" border="0" />' : ''; break; } } if ( !empty($row['user_viewemail']) || $group_mod ) { $email_uri = ''; $email = ''; } else { $email_img = ' '; $email = ' '; } $temp_url = s_link('m', $row['username_base']); $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>'; $temp_url = s_link('my', array('note', $row['username_base'])); $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>'; $www = ( $row['user_website'] ) ? '<a href="' . $row['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : ''; if ( !empty($row['user_icq']) ) { $icq_status_img = '<a href="http://wwp.icq.com/' . $row['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $row['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>'; $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $row['user_icq'] . '">' . $lang['ICQ'] . '</a>'; } else { $icq_status_img = ''; $icq_img = ''; $icq = ''; } $aim = ( $row['user_aim'] ) ? '<a href="aim:goim?screenname=' . $row['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : ''; $temp_url = s_link('u', $row['username_base']); $msn = ( $row['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : ''; $yim = ( $row['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $row['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : ''; return; }
public function _home() { global $config, $user, $cache, $upload; if (_button()) { $event_id = request_var('event_id', 0); $filepath_1 = $config['events_path'] . 'tmp/'; $filepath_2 = $config['events_path'] . 'gallery/'; $filepath_3 = $filepath_1 . $event_id . '/'; $filepath_4 = $filepath_3 . 'thumbnails/'; $f = $upload->process($filepath_1, 'add_zip', 'zip'); if (!sizeof($upload->error) && $f !== false) { @set_time_limit(0); foreach ($f as $row) { $zip_folder = unzip($filepath_1 . $row['filename'], $filepath_3, true); _rm($filepath_1 . $row['filename']); } if (!empty($zip_folder)) { $zip_folder = substr($zip_folder, 0, -1); $fp = @opendir($filepath_3 . $zip_folder); while ($file = @readdir($fp)) { if (!is_level($file)) { $ftp->ftp_rename($ftp->dfolder() . 'data/tmp/' . $event_id . '/' . $zip_folder . '/' . $file, $ftp->dfolder() . 'data/tmp/' . $event_id . '/' . $file); //@rename($filepath_3 . $zip_folder . '/' . $file, $filepath_3 . $file); } } @closedir($fp); _rm($filepath_3 . $zip_folder); } if (!@file_exists($filepath_4)) { a_mkdir($ftp->dfolder() . 'data/tmp/' . $event_id, 'thumbnails'); } $footer_data = ''; $filerow_list = w(); $count_images = $img = $event_pre = 0; $check_is = w(); if (@file_exists($filepath_2 . $event_id)) { $fp = @opendir($filepath_2 . $event_id); while ($filerow = @readdir($fp)) { if (preg_match('#(\d+)\.(jpg)#is', $filerow)) { $dis = getimagesize($filepath_2 . $event_id . $filerow); $disd = intval(_decode('4e6a4177')); if (($dis[0] > $dis[1] && $dis[0] < $disd) || ($dis[1] > $dis[0] && $dis[1] < $disd)) { $check_is[] = $filerow; continue; } $event_pre++; } } @closedir($fp); if (count($check_is)) { echo lang('dis_invalid'); foreach ($check_is as $row) { echo $row . '<br />'; } exit; } $img = $event_pre; } $filerow_list = array_dir($filepath_3); array_multisort($filerow_list, SORT_ASC, SORT_NUMERIC); foreach ($filerow_list as $filerow) { if (preg_match('#(\d+)\.(jpg)#is', $filerow)) { $row = $upload->_row($filepath_3, $filerow); if (!@copy($filepath_3 . $filerow, $row['filepath'])) { continue; } $img++; $xa = $upload->resize($row, $filepath_3, $filepath_3, $img, array(600, 450), false, true, true, 'w2'); if ($xa === false) { continue; } $xb = $upload->resize($row, $filepath_3, $filepath_4, $img, array(100, 75), false, false); $insert = array( 'event_id' => (int) $event_id, 'image' => (int) $img, 'width' => (int) $xa['width'], 'height' => (int) $xa['height'], 'allow_dl' => 1 ); sql_insert('events_images', $insert); $count_images++; } elseif (preg_match('#(info)\.(txt)#is', $filerow)) { $footer_data = $filerow; } } if (!empty($footer_data) && @file_exists($filepath_3 . $footer_data)) { $footer_info = @file($filepath_3 . $footer_data); foreach ($footer_info as $linerow) { $part = explode(':', $linerow); $part = array_map('trim', $part); $numbs = explode('-', $part[0]); $numbs[1] = (isset($numbs[1])) ? $numbs[1] : $numbs[0]; for ($i = ($numbs[0] + $event_pre), $end = ($numbs[1] + $event_pre + 1); $i < $end; $i++) { $sql = 'UPDATE _events_images SET image_footer = ? WHERE event_id = ? AND image = ?'; sql_query(sql_filter($sql, htmlencode($part[1]), $event_id, $i)); } } _rm($filepath_3 . $footer_data); } $sql = 'SELECT * FROM _events_colab WHERE colab_event = ? AND colab_uid = ?'; if (!$row = sql_fieldrow(sql_filter($sql, $event_ud, $user->d('user_id')))) { $sql_insert = array( 'colab_event' => $event_id, 'colab_uid' => $user->d('user_id') ); sql_insert('events_colab', $sql_insert); } $sql = 'UPDATE _events SET images = images + ?? WHERE id = ?'; sql_query(sql_filter($sql, $count_images, $event_id)); $ftp->ftp_rename($ftp->dfolder() . 'data/tmp/' . $event_id . '/', $ftp->dfolder() . 'data/events/gallery/' . $event_id . '/'); //@rename($filepath_3, $filepath_2 . $event_id); $ftp->ftp_quit(); redirect(s_link('events', $event_id)); } _style('error', array( 'MESSAGE' => parse_error($upload->error)) ); } $sql = 'SELECT * FROM _events WHERE date < ?? ORDER BY date DESC'; $result = sql_rowset(sql_filter($sql, (time() + 86400))); foreach ($result as $row) { _style('event_list', array( 'EVENT_ID' => $row['id'], 'EVENT_TITLE' => (($row['images']) ? '* ' : '') . $row['title'], 'EVENT_DATE' => $user->format_date($row['date'])) ); } return; }
public function object() { global $user, $config, $comments; $offset = request_var('ps', 0); if ($this->data['poster_id'] != $user->d('user_id') && !$offset) { $sql = 'UPDATE _news SET post_views = post_views + 1 WHERE news_id = ?'; sql_query(sql_filter($sql, $this->data['news_id'])); } $news_main = array( 'MESSAGE' => $comments->parse_message($this->data['post_text']), 'POST_TIME' => $user->format_date($this->data['post_time']) ); $sql = 'SELECT user_id, username, username_base, user_avatar, user_posts, user_gender, user_rank FROM _members WHERE user_id = ?'; $result = sql_fieldrow(sql_filter($sql, $this->data['poster_id'])); $user_profile = $comments->user_profile($result); $news_main = array_merge($news_main, _style_uv($user_profile)); _style('mainpost', $news_main); $comments_ref = s_link('news', $this->data['news_alias']); if ($this->data['post_replies']) { $comments->reset(); $comments->ref = $comments_ref; $sql = 'SELECT p.*, m.user_id, m.username, m.username_base, m.user_avatar, m.user_rank, m.user_posts, m.user_gender, m.user_sig FROM _news_posts p, _members m WHERE p.news_id = ? AND p.post_active = 1 AND p.poster_id = m.user_id ORDER BY p.post_time DESC LIMIT ??, ??'; $comments->data = array( 'SQL' => sql_filter($sql, $this->data['news_id'], $offset, $config['posts_per_page']) ); $comments->view($offset, 'ps', $this->data['post_replies'], $config['posts_per_page'], '', '', 'TOPIC_'); } v_style(array( 'CAT_URL' => s_link('news', $this->data['cat_url']), 'CAT_NAME' => $this->data['cat_name'], 'POST_SUBJECT' => $this->data['post_subject'], 'POST_REPLIES' => number_format($this->data['post_replies'])) ); // // Posting box // if ($user->is('member')) { _style('publish', array( 'REF' => $comments_ref) ); } $this->_template = 'news.view'; $this->_title = $this->data['post_subject']; return; }
private function remove() { global $config; $s_images = request_var('ls_images', array(0)); if (sizeof($s_images)) { $common_path = $config['artists_path'] . $this->object['ub'] . '/'; $path = array( $common_path . 'x1/', $common_path . 'gallery/', $common_path . 'thumbnails/', ); $sql = 'SELECT * FROM _artists_images WHERE ub = ? AND image IN (??) ORDER BY image'; $result = sql_rowset(sql_filter($sql, $this->object['ub'], implode(',', $s_images))); $affected = w(); foreach ($result as $row) { foreach ($path as $path_row) { $filepath = $path_row . $row['image'] . '.jpg'; _rm($filepath); } $affected[] = $row['image']; } if (count($affected)) { $sql = 'DELETE FROM _artists_images WHERE ub = ? AND image IN (??)'; sql_query(sql_filter($sql, $this->object['ub'], implode(',', $affected))); $sql = 'UPDATE _artists SET images = images - ?? WHERE ub = ?'; sql_query(sql_filter($sql, sql_affectedrows(), $this->object['ub'])); } } return redirect(s_link('acp', array('artist_gallery', 'a' => $this->object['subdomain']))); }
public function recent_members() { global $user; $sql = 'SELECT username, username_base FROM _members WHERE user_type NOT IN (??) ORDER BY user_regdate DESC LIMIT 10'; $result = sql_rowset(sql_filter($sql, USER_INACTIVE)); foreach ($result as $i => $row) { if (!$i) _style('recent_members'); _style('recent_members.item', array( 'USERNAME' => $row['username'], 'PROFILE' => s_link('m', $row['username_base'])) ); } return true; }
private function create() { $v = _request(array('event' => 0)); if (_empty($v)) { return; } $sql = 'SELECT id, event_alias FROM _events WHERE id = ?'; if (!$event = sql_fieldrow(sql_filter($sql, $v->event))) { return; } $sql = 'SELECT ub FROM _artists_events WHERE a_artist = ? AND a_event = ?'; if (sql_field(sql_filter($sql, $this->object['ub'], $v->event))) { return; } $sql_insert = array( 'a_artist' => $this->object['ub'], 'a_event' => $event['id'] ); sql_insert('artists_events', $sql_insert); return redirect(s_link('events', $event['event_alias'])); }
function user_notification($mode, &$post_data, &$topic_title, &$forum_id, &$topic_id, &$post_id, &$notify_user) { global $config, $lang, $userdata, $user_ip; $current_time = time(); if ($mode == 'delete') { $delete_sql = (!$post_data['first_post'] && !$post_data['last_post']) ? sql_filter(' AND user_id = ? ', $userdata['user_id']) : ''; $sql = 'DELETE FROM _forum_topics_fav WHERE topic_id = ?' . $delete_sql; sql_query(sql_filter($sql, $topic_id)); } else { if ($mode == 'reply') { $sql = 'SELECT ban_userid FROM _banlist'; $result = sql_rowset($sql); $user_id_sql = ''; foreach ($result as $row) { if (isset($row['ban_userid']) && !empty($row['ban_userid'])) { $user_id_sql .= ', ' . $row['ban_userid']; } } $update_watched_sql = ''; $bcc_list_ary = w(); $usr_list_ary = w(); $sql = 'SELECT DISTINCT u.user_id, u.user_email, u.user_lang FROM _forum_topics_fav tw INNER JOIN _members u ON tw.user_id = u.user_id INNER JOIN _members_group ug ON tw.user_id = ug.user_id LEFT OUTER JOIN _auth_access aa ON ug.group_id = aa.group_id, _forums f WHERE tw.topic_id = ? AND tw.user_id NOT IN (??, ??, ??) AND tw.notify_status = ? AND f.forum_id = ? AND u.user_active = 1 AND ( (aa.forum_id = ? AND aa.auth_read = 1) OR f.auth_read <= ? OR (u.user_level = ? AND f.auth_read = ?) OR u.user_level = ? )'; if ($result = sql_rowset(sql_filter($sql, $topic_id, $userdata['user_id'], GUEST, $user_id_sql, TOPIC_WATCH_UN_NOTIFIED, $forum_id, $forum_id, AUTH_REG, USER_MOD, AUTH_MOD, USER_ADMIN))) { @set_time_limit(60); foreach ($result as $row) { if ($row['user_email'] != '') { $bcc_list_ary[$row['user_lang']][] = $row['user_email']; } $update_watched_sql .= ($update_watched_sql != '') ? ', ' . $row['user_id'] : $row['user_id']; } if (sizeof($bcc_list_ary)) { $emailer = new emailer(); $server_name = trim($config['server_name']); $server_protocol = ($config['cookie_secure']) ? 'https://' : 'http://'; $post_url = $server_protocol . $server_name . s_link('post', $post_id) . "#$post_id"; $emailer->from($config['board_email']); $emailer->replyto($config['board_email']); $topic_title = unprepare_message($topic_title); @reset($bcc_list_ary); while (list($user_lang, $bcc_list) = each($bcc_list_ary)) { $emailer->use_template('topic_notify', $user_lang); for ($i = 0; $i < count($bcc_list); $i++) { $emailer->bcc($bcc_list[$i]); } // The Topic_reply_notification lang string below will be used // if for some reason the mail template subject cannot be read // ... note it will not necessarily be in the posters own language! $emailer->set_subject($lang['Topic_reply_notification']); // This is a nasty kludge to remove the username var ... till (if?) // translators update their templates $emailer->msg = preg_replace('#[ ]?{USERNAME}#', '', $emailer->msg); $emailer->assign_vars(array( 'EMAIL_SIG' => '', 'SITENAME' => $config['sitename'], 'TOPIC_TITLE' => $topic_title, 'U_TOPIC' => $post_url, 'U_STOP_WATCHING_TOPIC' => $server_protocol . $server_name . $script_name . '&' . POST_TOPIC_URL . "=$topic_id&unwatch=topic") ); $emailer->send(); $emailer->reset(); } } } if ($update_watched_sql != '') { $sql = 'UPDATE _forum_topics_fav SET notify_status = ? WHERE topic_id = ? AND user_id IN (??)'; sql_query(sql_filter($sql, TOPIC_WATCH_NOTIFIED, $topic_id, $update_watched_sql)); } } $sql = 'SELECT topic_id FROM _forum_topics_fav WHERE topic_id = ? AND user_id = ?'; if ($row = sql_fieldrow(sql_filter($sql, $topic_id, $userdata['user_id']))) { if (!$notify_user && !empty($row['topic_id'])) { $sql = 'DELETE FROM _forum_topics_fav WHERE topic_id = ? AND user_id = ?'; sql_query(sql_filter($sql, $topic_id, $userdata['user_id'])); } else if ($notify_user && empty($row['topic_id'])) { $sql = "INSERT INTO _forum_topics_fav (user_id, topic_id, notify_status) VALUES (" . $userdata['user_id'] . ", $topic_id, 0)"; sql_query($sql); } } } }
function print_layout($error = array()) { global $_submenu, $print_auth, $db, $user, $config, $screen; page_header(); $page_e = explode('/', requested_url()); $folder = array_splice($page_e, 1, 1); $folder = !empty($screen) ? $screen : $folder[0]; $_buildmenu = array(); foreach ($_submenu as $k => $v) { if (!$print_auth[$k]) { continue; } $_buildmenu[] = $k == $folder ? '<strong class="gray">' . $v . '</strong>' : '<a href="' . s_link('print', $k) . '">' . $v . '</a>'; } ?> <div class="vsep-pre"><div class="vsep1"> </div></div> <div class="subtitle-link-container"><div><?php echo implode(' <span class="soft">|</span> ', $_buildmenu); ?> </div></div> <?php // Show requested screen $call_func = 's_print_' . $screen; if (function_exists($call_func)) { ?> <div class="vsep-pre"><div class="vsep1"> </div></div> <form action="<?php echo s_link('print'); ?> " method="post"> <div class="colorbox darkborder pad10"> <div align="center" class="h2"><?php echo $_submenu[$screen]; ?> </div> <div class="ie-widthfix"> <?php show_error($error); ?> <br /> <table cellpadding="5" cellspacing="0" border="1" bordercolor="#999999" class="table-collapse" align="center"> <?php $call_func(); ?> </table> <div align="center"> <?php echo s_hidden(array('screen' => $screen)); ?> <br /> <input type="submit" class="submitdata" name="submit" value="Realizar consulta" /> </div> </div> </div> </form> <?php } page_footer(); }
function layout($where = 1, $error = array(), $params = array()) { global $db, $user, $config, $userdata; page_header(); echo '<div class="vsep-pre"><div class="vsep1"> </div></div>'; switch ($where) { case 1: if (!sizeof($params)) { $params = $userdata; } ?> <div class="vsep-pre"><div class="vsep1"> </div></div> <form action="<?php echo s_link('ranks'); ?> " method="post"> <div class="colorbox darkborder pad10"> <div align="center" class="h2"><?php echo $userdata['username']; ?> </div> <div class="ie-widthfix"> <?php show_error($error); ?> <br /> <table cellpadding="5" cellspacing="0" border="1" bordercolor="#999999" class="table-collapse" align="center"> <tr> <td>Rango Mínimo</td> <td><input type="text" name="user_rank_min" value="<?php echo $params['user_rank_min']; ?> " /></td> </tr> <tr> <td>Rango Máximo</td> <td><input type="text" name="user_rank_max" value="<?php echo $params['user_rank_max']; ?> " /></td> </tr> </table> <div align="center"> <?php echo s_hidden(array('userid' => $userdata['user_id'])); ?> <br /> <input type="submit" class="submitdata" name="submit" value="Realizar consulta" /> </div> </div> </div> </form> <?php break; case 2: $sql = 'SELECT * FROM _users WHERE user_id <> 1 AND user_adm = 0 ORDER BY username'; if ($result = sql_rowset($sql)) { echo '<div class="tdisb pad10 red colorbox dsm ie-widthfix">'; foreach ($result as $row) { echo '<div class="pad4">• <a href="' . s_link('ranks', $row['user_id']) . '">' . $row['username'] . '</a></div>'; } } break; } echo '</div>'; page_footer(); }
public function dl_fav() { if (!$this->auth['user']) { do_login(); } global $user; $is_fav = false; $sql = 'SELECT dl_id FROM _dl_fav WHERE dl_id = ? AND user_id = ?'; if (sql_field(sql_filter($sql, $this->dl_data['id'], $user->d('user_id')), 'dl_id', 0)) { $is_fav = true; } $url = s_link('a', $this->data['subdomain'], 'downloads', $this->dl_data['id']); if ($is_fav) { redirect($url); } $sql_insert = array( 'dl_id' => $this->dl_data['id'], 'user_id' => $user->d('user_id'), 'favtime' => time() ); sql_insert('dl_fav', $sql_insert); $sql = 'UPDATE _members SET user_dl_favs = user_dl_favs + 1 WHERE user_id = ?'; sql_query(sql_filter($sql, $user->d('user_id'))); return redirect($url); }
public function poll() { global $user, $auth, $config, $cache; if (!$topic_id = $cache->get('last_poll_id')) { $sql = 'SELECT t.topic_id FROM _forum_topics t LEFT JOIN _poll_options v ON t.topic_id = v.topic_id WHERE t.forum_id = ? AND t.topic_locked = 0 AND t.topic_vote = 1 ORDER BY t.topic_time DESC LIMIT 1'; if ($row = sql_fieldrow(sql_filter($sql, $config['main_poll_f']))) { $topic_id = $row['topic_id']; $cache->save('last_poll_id', $topic_id); } } $topic_id = (int) $topic_id; if (!$topic_id) { return; } $sql = 'SELECT t.topic_id, t.topic_locked, t.topic_time, t.topic_replies, t.topic_important, t.topic_vote, 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 FROM _forum_topics t, _forums f WHERE t.topic_id = ? AND f.forum_id = t.forum_id'; if (!$topic_data = sql_fieldrow(sql_filter($sql, $topic_id))) { return false; } $forum_id = (int) $topic_data['forum_id']; $sql = 'SELECT vd.*, vr.* FROM _poll_options vd, _poll_results vr WHERE vd.topic_id = ? AND vr.vote_id = vd.vote_id ORDER BY vr.vote_option_id ASC'; if (!$vote_info = sql_rowset(sql_filter($sql, $topic_id))) { return false; } if ($user->is('member')) { $is_auth = w(); $is_auth = $auth->forum(AUTH_VOTE, $forum_id, $topic_data); $sql = 'SELECT vote_user_id FROM _poll_voters WHERE vote_id = ? AND vote_user_id = ?'; $user_voted = (sql_field(sql_filter($sql, $vote_info[0]['vote_id'], $user->d('user_id')), 'vote_user_id', false)) ? true : false; } $poll_expired = ($vote_info[0]['vote_length']) ? (($vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < $current_time) ? true : 0) : 0; _style('poll', array( 'U_POLL_TOPIC' => s_link('topic', $topic_id), 'S_REPLIES' => $topic_data['topic_replies'], 'U_POLL_FORUM' => s_link('forum', $config['main_poll_f']), 'POLL_TITLE' => $vote_info[0]['vote_text']) ); if (!$user->is('member') || $user_voted || $poll_expired || !$is_auth['auth_vote'] || $topic_data['topic_locked']) { $vote_results_sum = 0; foreach ($vote_info as $row) { $vote_results_sum += $row['vote_result']; } _style('poll.results'); foreach ($vote_info as $row) { $vote_percent = ($vote_results_sum) ? $row['vote_result'] / $vote_results_sum : 0; _style('poll.results.item', array( 'CAPTION' => $row['vote_option_text'], 'RESULT' => $row['vote_result'], 'PERCENT' => sprintf("%.1d", ($vote_percent * 100))) ); } } else { _style('poll.options', array( 'S_VOTE_ACTION' => s_link('topic', $topic_id)) ); foreach ($vote_info as $row) { _style('poll.options.item', array( 'POLL_OPTION_ID' => $row['vote_option_id'], 'POLL_OPTION_CAPTION' => $row['vote_option_text']) ); } } return true; }