Ejemplo n.º 1
1
	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'));
	}
Ejemplo n.º 2
0
	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;
	}
Ejemplo n.º 3
0
	public function _home() {
		global $config, $user, $cache;

		$username = request_var('username', '');
		$ip = request_var('ip', '');

		if (_button() && ($username || $ip)) {
			if ($username) {
				$username_base = get_username_base($username);

				$sql = 'SELECT m.username, l.*
					FROM _members m, _members_iplog l
					WHERE m.user_id = l.log_user_id
						AND m.username_base = ?
					ORDER BY l.log_time DESC';
				$sql = sql_filter($sql, $username_base);
			} else if ($ip) {
				$sql = 'SELECT m.username, l.*
					FROM _members m, _members_iplog l
					WHERE m.user_id = l.log_user_id
						AND l.log_ip = ?
					ORDER BY l.log_time DESC';
				$sql = sql_filter($sql, $ip);
			}
			$result = sql_rowset($sql);

			foreach ($result as $i => $row) {
				if (!$i) _style('log');

				_style('log.row', array(
					'UID' => $row['log_user_id'],
					'USERNAME' => $row['username'],
					'TIME' => $user->format_date($row['log_time']),
					'ENDTIME' => (($row['log_endtime']) ? $user->format_date($row['log_endtime']) : ' '),
					'DIFFTIME' => (($row['log_endtime']) ? _implode(' ', timeDiff($row['log_endtime'], $row['log_time'], true, 1)) : ' '),
					'IP' => $row['log_ip'],
					'AGENT' => $row['log_agent'])
				);
			}
		}

		return;
	}
Ejemplo n.º 4
0
    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)));
    }
Ejemplo n.º 5
0
 protected function _optimize_home()
 {
     $tables = array();
     $sql = 'SHOW TABLES';
     foreach (_rowset($sql) as $row) {
         foreach ($row as $v) {
             $tables[] = $v;
         }
     }
     $sql = 'OPTIMIZE TABLE ' . _implode(', ', $tables);
     _sql($sql);
     return $this->e('Done.');
 }
Ejemplo n.º 6
0
    private function childs($use_child = true)
    {
        global $user;
        $svar = $use_child ? 'child' : 'child2';
        if (!($s_child = count($this->{$svar}))) {
            return;
        }
        $d_images = w();
        if ($this->data['tree_schilds']) {
            $sql = 'SELECT tree_id, image_id, image_extension
				FROM _images
				WHERE tree_id IN (??)
				ORDER BY RAND()';
            $images = _rowset(sql_filter($sql, _implode(',', array_keys($this->{$svar}))));
            foreach ($images as $rows) {
                if (!isset($d_images[$row['tree_id']])) {
                    $d_images[$row['tree_id']] = _filename($row['image_id'], $row['image_extension']);
                }
            }
        }
        _style($svar, array('ORDER_URL' => _link($this->data['tree_id'], array('order', 0, 0, 0, 0))));
        // TODO: Replace _linkf funcion to _link_alias
        foreach ($this->{$svar} as $a => $row) {
            _style($svar . '.item', array('ID' => $row['tree_id'], 'U' => _linkf($a, $row['tree_furl']), 'L' => $user->ls('tree', 'title', $row), 'I' => isset($d_images[$a]) ? $d_images[$a] : 'def.gif', 'DU' => $this->u_dynamic($row)));
        }
        if ($use_child) {
            $this->childs(false);
        }
        return;
    }
Ejemplo n.º 7
0
function _avatar($v)
{
    if (!f($v['bio_avatar'])) {
        return _lib('d', 'no', 'jpg');
    }
    $path = array($v['bio_alias'][0], $v['bio_alias'][1], $v['bio_alias']);
    return _lib(LIB_AVATAR, _implode('/', $path), $v['bio_avatar']) . '#' . $v['bio_avatar_up'];
}
Ejemplo n.º 8
0
use_helper('Field', 'Link');
$item_i18n = $item['SiteI18n'][0];
?>
<div><?php 
echo list_link($item_i18n, 'sites');
?>
</div>
<div><?php 
$routes_quantity = $item['routes_quantity'];
if (is_scalar($routes_quantity) && $routes_quantity > 0) {
    $routes_quantity = __('%1% routes_quantity', array('%1%' => $routes_quantity));
} else {
    $routes_quantity = '';
}
echo _implode(' - ', array(displayWithSuffix($item['elevation'], 'meters'), get_paginated_value_from_list($item['site_types'], 'app_sites_site_types'), $routes_quantity, get_paginated_value_from_list($item['rock_types'], 'mod_sites_rock_types_list')));
?>
</div>


<div><?php 
if (isset($item['linked_docs'])) {
    echo __('access'), ' ';
    include_partial('parkings/parkings4list', array('parkings' => $item['linked_docs']));
}
?>
</div>
<div><?php 
include_partial('documents/regions4list', array('geoassociations' => $item['geoassociations']));
?>
</div>
Ejemplo n.º 9
0
<?php

use_helper('Field', 'Link');
$item_i18n = $item['BookI18n'][0];
?>
<div class="right"><?php 
echo get_paginated_activities($item['activities']);
?>
</div>
<div><?php 
echo list_link($item_i18n, 'books');
?>
</div>
<div>
<?php 
echo _implode(' - ', array($item['author'], $item['editor'], $item['publication_date']));
?>
</div>
<div>
<?php 
echo _implode(' - ', array(get_paginated_value_from_list($item['book_types'], 'mod_books_book_types_list'), get_paginated_value_from_list($item['langs'], 'app_languages_book')));
?>
</div>
<div><?php 
echo picto_tag('picto_images', __('nb_linked_images')), ' ', isset($item['nb_images']) ? $item['nb_images'] : '0', ' ', picto_tag('action_comment', __('nb_comments')), ' ', isset($item['nb_comments']) ? link_to($item['nb_comments'], '@document_comment?module=books&id=' . $item_i18n['id'] . '&lang=' . $item_i18n['culture']) : '0';
?>
</div>
Ejemplo n.º 10
0
	private function remove() {
		global $config, $cache;

		$remove = request_var('s_downloads', array(0));

		if (!count($remove)) {
			return;
		}

		$sql = 'SELECT *
			FROM _dl
			WHERE id IN (??)
				AND ub = ?';
		if ($result = sql_rowset(sql_filter($sql, _implode(',', $remove), $this->object['ub']))) {
			foreach ($result as $row) {
				$path = artist_root($this->object['ub'] . ' media ' . $row['id'] . '.mp3');

				_rm($path);

				$sql = 'DELETE FROM _dl
					WHERE id = ?';
				sql_query(sql_filter($sql, $row['id']));

				$cache->delete('downloads_list');
			}

			redirect(s_link('acp', array('artist_media', 'a' => $this->object['subdomain'])));
		}

		return;
	}
Ejemplo n.º 11
0
function _implode_and($glue, $last_glue, $pieces, $empty = false) {
	$response = _implode($glue, $pieces, $empty);

	$last = strrpos($response, $glue);
	if ($last !== false) {
		$response = substr_replace($response, $last_glue, $last, count($glue) + 1);
	}

	return $response;
}
Ejemplo n.º 12
0
	public function _home() {
		global $config, $user, $cache;

		if (!_button()) {
			return false;
		}

		$topics = request_var('topic_id', '');
		$topics = array_map('intval', explode(',', $topics));

		$forums_id_sql = $topics_id = w();

		$sql = 'SELECT forum_id, topic_id
			FROM _forum_topics
			WHERE topic_id IN (??)';
		$result = sql_rowset(sql_filter($sql, _implode(', ', $topics)));

		foreach ($result as $row) {
			$forums_id_sql[] = (int) $row['forum_id'];
			$topics_id[] = (int) $row['topic_id'];
		}

		$topic_id_sql = _implode(',', $topics_id);

		//
		$sql = 'SELECT post_id
			FROM _forum_posts
			WHERE topic_id IN (??)';
		$posts_id = sql_rowset(sql_filter($sql, $topic_id_sql), false, 'post_id');
		$post_id_sql = _implode(',', $posts_id);

		//
		$sql = 'SELECT vote_id
			FROM _poll_options
			WHERE topic_id IN (??)';
		$votes_id = sql_rowset(sql_filter($sql, $topic_id_sql), false, 'vote_id');
		$vote_id_sql = _implode(',', $votes_id);

		//
		$sql = 'SELECT poster_id, COUNT(post_id) AS posts
			FROM _forum_posts
			WHERE topic_id IN (??)
			GROUP BY poster_id';
		$result = sql_rowset(sql_filter($sql, $topic_id_sql));

		$members_sql = w();
		foreach ($result as $row) {
			$sql = 'UPDATE _members SET user_posts = user_posts - ??
				WHERE user_id = ?';
			$members_sql[] = sql_filter($sql, $row['posts'], $row['poster_id']);
		}

		sql_query($members_sql);

		//
		// Got all required info so go ahead and start deleting everything
		//
		$sql = 'DELETE
			FROM _forum_topics
			WHERE topic_id IN (??)';
		sql_query(sql_filter($sql, $topic_id_sql));

		$sql = 'DELETE
			FROM _forum_topics_fav
			WHERE topic_id IN (??)';
		sql_query(sql_filter($sql, $topic_id_sql));

		if ($post_id_sql != '') {
			$sql = 'DELETE
				FROM _forum_posts
				WHERE post_id IN (??)';
			sql_query(sql_filter($sql, $post_id_sql));
		}

		if ($vote_id_sql != '') {
			$sql = 'DELETE
				FROM _poll_options
				WHERE vote_id IN (??)';
			sql_query(sql_filter($sql, $vote_id_sql));

			$sql = 'DELETE
				FROM _poll_results
				WHERE vote_id IN (??)';
			sql_query(sql_filter($sql, $vote_id_sql));

			$sql = 'DELETE
				FROM _poll_voters
				WHERE vote_id IN (??)';
			sql_query(sql_filter($sql, $vote_id_sql));
		}

		//
		$sql = 'DELETE FROM _members_unread
			WHERE element = 8
				AND item IN (??)';
		sql_query(sql_filter($sql, $topic_id_sql));

		//
		foreach ($forums_id_sql as $forum_id)
		{
			sync_topic_delete($forum_id);
		}

		return _pre('El tema fue eliminado.', true);
	}
Ejemplo n.º 13
0
    $summit_name = $summit_2['name'];
}
echo list_link($item_i18n, 'routes', $summit_name) . ' ' . $has_gps_track;
if (isset($item['name']) && $summit_name != $summit_2['name']) {
    $link = list_link($summit_2, 'summits');
    echo '<br /><small>', __('route linked with', array('%1%' => $link)), '</small>';
}
?>
</div>
<div>
<?php 
$height_diff_up = is_scalar($item['height_diff_up']) ? $item['height_diff_up'] . __('meters') : NULL;
if ($height_diff_up != NULL && is_scalar($item['difficulties_height'])) {
    $height_diff_up .= ' (' . $item['difficulties_height'] . __('meters') . ')';
}
echo _implode(' - ', array(displayWithSuffix($item['max_elevation'], 'meters'), get_paginated_value($item['facing'], 'app_routes_facings'), $height_diff_up, field_route_ratings_data($item, false)));
?>
</div>
<div><?php 
if (isset($item['linked_docs'])) {
    echo __('access'), ' ';
    include_partial('parkings/parkings4list', array('parkings' => $item['linked_docs']));
}
?>
</div>
<div><?php 
include_partial('documents/regions4list', array('geoassociations' => $item['geoassociations']));
?>
</div>
<div><?php 
echo picto_tag('picto_images', __('nb_linked_images')), ' ', isset($item['nb_images']) ? $item['nb_images'] : '0', ' ', picto_tag('action_comment', __('nb_comments')), ' ', isset($item['nb_comments']) ? link_to($item['nb_comments'], '@document_comment?module=routes&id=' . $item_i18n['id'] . '&lang=' . $item_i18n['culture']) : '0', ' ', picto_tag('picto_outings', __('nb_outings')), ' ', isset($item['nb_linked_docs']) ? $item['nb_linked_docs'] : '0';
Ejemplo n.º 14
0
	public function _home() {
		global $config, $user, $cache, $comments;

		if (!_button()) {
			return false;
		}

		$post_mode = request_var('post_mode', 0);
		$post_subject = request_var('post_subject', '');
		$post_message = request_var('post_message', '', true);
		$post_skip = request_var('post_skip', '', true);
		$post_reply = request_var('post_reply', 0);

		$post_message = $comments->prepare($post_message);

		$skip_list = '';
		if (!empty($post_skip)) {
			$e_skip = explode(nr(), $post_skip);

			foreach ($e_skip as $i => $row) {
				$row = get_username_base($row);
				$e_skip[$i] = "'" . sql_escape($row) . "'";
			}

			$sql = 'SELECT user_id
				FROM _members
				WHERE username_base IN (' . _implode(',', $e_skip) . ')';
			$user_skip = sql_rowset($sql, false, 'user_id');

			$skip_list = ' AND u.user_id NOT IN (' . _implode(', ', $user_skip) . ') ';
		}

		switch ($post_mode) {
			case 1:
				$sql = 'SELECT u.user_id, u.username
					FROM _members u
					WHERE u.user_type <> 2
						AND u.user_id NOT IN (SELECT ban_userid FROM _banlist)
						AND u.user_id <> ?' . $skip_list . '
					ORDER BY u.username';
				break;
			case 2:
				$sql = 'SELECT u.user_id, u.username
					FROM _members u
					WHERE u.user_type = 6
						AND u.user_id NOT IN (SELECT ban_userid FROM _banlist)
						AND u.user_id <> ' . $skip_list . '
					ORDER BY u.username';
				break;
			case 3:
				$sql = 'SELECT u.user_id, u.username
					FROM _members_friends b, _members u
					WHERE b.buddy_id = ' . $skip_list . '
						AND b.user_id = u.user_id
						AND u.user_id NOT IN (SELECT ban_userid FROM _banlist)
					ORDER BY u.username';
				break;
		}
		$result = sql_rowset(sql_filter($sql, $user->d('user_id')));

		foreach ($result as $row) {
			$row_message = str_replace('[username]', $row['username'], $post_message);

			$insert = array(
				'privmsgs_subject' => $post_subject,
				'privmsgs_from_userid' => (int) $user->d('user_id'),
				'privmsgs_to_userid' => (int) $row['user_id'],
				'privmsgs_date' => $user->time,
				'msg_ip' => $user->ip,
				'msg_can_reply' => (int) $post_reply,
				'privmsgs_mass' => 1,
				'privmsgs_text' => $row_message
			);
			$dc_id = sql_insert('dc', $insert);

			$sql = 'UPDATE _dc SET parent_id = ?, last_msg_id = ?, msg_deleted = ?
				WHERE msg_id = ?';
			sql_query(sql_filter($sql, $dc_id, $dc_id, $user->d('user_id'), $dc_id));

			$user->save_unread(UH_NOTE, $dc_id, 0, $row['user_id']);

			echo $row['username'] . '<br />';
			flush();
		}

		return;
	}
Ejemplo n.º 15
0
    protected function _groups_modify()
    {
        gfatal();
        global $core;
        $v = $this->__(array('el' => 0, 'r_name', 'r_email', 'r_mod', 'r_color'));
        foreach ($v as $row) {
            if (!f($row)) {
                $this->_error('#FIELD_IS_EMPTY');
            }
        }
        $sql = 'SELECT *
			FROM _groups
			WHERE group_id = ?';
        if (!($group = _fieldrow(sql_filter($sql, $v['el'])))) {
            $this->_error('#GROUPS_NO_EXISTS');
        }
        $mod_list = array_map('trim', explode(',', $v['r_mod']));
        array_unshift($mod_list, 'addquotes');
        $sql = 'SELECT user_id
			FROM _members
			WHERE user_username IN (??)
			ORDER BY user_username';
        if (!($mods_list = _rowset(sql_filter($sql, _implode(',', $mod_list)), false, 'user_id'))) {
            $this->_error('#USER_UNKNOWN');
        }
        $sql = 'UPDATE _groups SET group_name = ?, group_email = ?, group_color = ?
			WHERE group_id = ?';
        _sql(sql_filter($sql, $v['r_name'], $v['r_email'], $v['r_color'], $v['el']));
        $sql = 'UPDATE _groups_members SET member_mod = 0
			WHERE member_group = ?';
        _sql(sql_filter($sql, $v['el']));
        foreach ($mods_list as $row) {
            $sql = 'SELECT member_id
				FROM _groups_members
				WHERE member_uid = ?';
            if (_field(sql_filter($sql, $row), 'member_id', 0)) {
                $sql = 'UPDATE _groups_members SET member_mod = ?
					WHERE member_uid = ?';
                _sql(sql_filter($sql, 1, $row));
            } else {
                $sql_insert = array('group' => $group_id, 'uid' => $row, 'mod' => 1);
                $sql = 'INSERT INTO _groups_members' . _build_array('INSERT', prefix('member', $sql_insert));
                _sql($sql);
            }
        }
        $core->cache_unload();
        return $this->e('~OK');
    }
Ejemplo n.º 16
0
    protected function _artists_home()
    {
        // TODO: Add sorting methods by genre, country & more.
        $v = $this->__(w('by'));
        switch ($v->by) {
            case 'genre':
                // TODO: Add query
                $sql = 'SELECT b.bio_id, b.bio_alias, b.bio_name, b.bio_avatar, b.bio_avatar_up
					FROM _bio b, _bio_type t
					WHERE t.type_alias = ?
						AND b.bio_type = t.type_id
					ORDER BY b.bio_name';
                $artists = sql_rowset(sql_filter($sql, 'artist'));
                break;
            default:
                $allow_by = array('country' => 'c.country_name');
                $s_country = isset($allow_by[$v->by]) ? $allow_by[$v->by] . ',' : '';
                $sql = 'SELECT b.bio_id, b.bio_alias, b.bio_name, b.bio_avatar, b.bio_avatar_up
					FROM _bio b, _bio_type t, _countries c
					WHERE t.type_alias = ?
						AND b.bio_type = t.type_id
						AND b.bio_country = c.country_id
					ORDER BY ?? b.bio_name';
                $artists = sql_rowset(sql_filter($sql, 'artist', $s_country));
                break;
        }
        // Genres
        $sql = 'SELECT g.genre_alias, g.genre_name, r.relation_artist
			FROM _genres g, _genres_relation r
			WHERE g.genre_id = r.relation_genre
				AND r.relation_artist IN (??)
			ORDER BY g.genre_name';
        $genres = sql_rowset(sql_filter($sql, _implode(',', array_subkey($artists, 'bio_id'))), 'relation_artist', false, true);
        $i = 0;
        foreach ($artists as $row) {
            $first_letter = $row->bio_alias[0];
            if (f($v->sort) && $first_letter != $v->sort) {
                continue;
            }
            if (!$i) {
                _style('artists');
            }
            _style('artists.row', _vs(array('URL' => _link_bio($row->bio_alias), 'NAME' => $row->bio_name, 'IMAGE' => _avatar($row), 'GENRE' => _implode(', ', $genres[$row->bio_id])), 'v'));
            $i++;
        }
        if (!$i) {
            _style('artists_none');
        }
        return;
    }
Ejemplo n.º 17
0
<?php

use_helper('Field', 'Link');
$item_i18n = $item['ArticleI18n'][0];
?>
<div class="right"><?php 
echo get_paginated_activities($item['activities']);
?>
</div>
<div><?php 
echo list_link($item_i18n, 'articles');
?>
</div>
<div><?php 
echo _implode(' - ', array(get_paginated_value($item['article_type'], 'mod_articles_article_types_list'), get_paginated_value_from_list($item['categories'], 'mod_articles_categories_list')));
?>
</div>
<div><?php 
echo picto_tag('picto_images', __('nb_linked_images')), ' ', isset($item['nb_images']) ? $item['nb_images'] : '0', ' ', picto_tag('action_comment', __('nb_comments')), ' ', isset($item['nb_comments']) ? link_to($item['nb_comments'], '@document_comment?module=articles&id=' . $item_i18n['id'] . '&lang=' . $item_i18n['culture']) : '0';
?>
</div>
Ejemplo n.º 18
0
function _fullname($d)
{
    if (!isset($d->user_firstname) || !isset($d->user_lastname)) {
        return '';
    }
    return _implode(' ', array_map('trim', array($d->user_firstname, $d->user_lastname)));
}
Ejemplo n.º 19
0
Archivo: _ac.php Proyecto: nopticon/mag
    protected function _connected_home()
    {
        global $bio, $core;
        $totals = w();
        $time_today = _timestamp();
        $bots = get_bots();
        $sql = 'SELECT b.bio_id, b.bio_alias, b.bio_name, b.bio_level, b.bio_show, s.session_ip
			FROM _bio b, _sessions s
			WHERE b.bio_level NOT IN (??)
				((s.session_time >= ?
					AND b.bio_id = s.session_bio)
				OR (b.bio_lastvisit >= ?
					AND b.bio_lastvisit < ?)
				)
			ORDER BY b.bio_name';
        $sessions = sql_rowset(sql_filter($sql));
        $i = 0;
        foreach ($sessions as $row) {
            // Guest
            if ($row->bio_id == 1) {
                if ($row->session_ip != $last_ip) {
                    $totals['guest']++;
                }
                $last_ip = $row->session_ip;
                continue;
            }
            if (!$i) {
                _style('online', array('L_TITLE' => _lang('ONLINE')));
                _style('online.list');
            }
            // Member
            if ($row['bio_id'] != $last_bio_id) {
                $is_bot = isset($bots[$row->bio_id]);
                if ($row->bio_show) {
                    if (!$is_bot) {
                        $totals['visible']++;
                    }
                } else {
                    $totals['hidden']++;
                }
                if (!$is_bot && ($row->bio_show || $bio->v('auth_founder')) || $is_bot && $bio->v('auth_founder')) {
                    _style('online.list.row', array('USERNAME' => $row->bio_name, 'PROFILE' => _link_bio($row->bio_alias)));
                }
            }
            //
            $last_bio_id = $row->bio_id;
            $i++;
        }
        if (!!$totals['visible']) {
            _style('online.none');
        }
        $online_ary = array('MEMBERS_TOTAL' => array_sum($totals), 'MEMBERS_VISIBLE' => $totals['visible'], 'MEMBERS_GUESTS' => $totals['guests'], 'MEMBERS_HIDDEN' => $totals['hidden'], 'MEMBERS_BOT' => $totals['bots']);
        foreach ($online_ary as $lk => $vk) {
            if (!$vk && $lk != 'MEMBERS_TOTAL') {
                continue;
            }
            _style('online.legend.row', array('L_MEMBERS' => _lang($lk . ($vk != 1 ? '2' : '')), 'ONLINE_VALUE' => $vk));
        }
        // Online
        $sql = 'SELECT b.bio_id, b.bio_alias, b.bio_name, b.bio_level, b.bio_show, s.session_ip
			FROM _bio b, _sessions s
			WHERE s.session_time >= ??
				AND b.bio_id = s.session_bio
			ORDER BY b.bio_name, s.session_ip';
        $this->connected(sql_filter($sql, $local_time[0] - 300), 'online', 'MEMBERS_ONLINE');
        // Today online
        $sql = 'SELECT bio_id, bio_alias, bio_name, bio_show, bio_level
			FROM _bio
			WHERE bio_level NOT IN (??)
				AND bio_lastvisit >= ?
				AND bio_lastvisit < ?
			ORDER BY bio_name';
        $this->connected(sql_filter($sql, _implode(',', w(USER_INACTIVE)), $time_today, $time_today + 86399), 'online', 'MEMBERS_TODAY', 'MEMBERS_VISIBLE');
        return;
    }
Ejemplo n.º 20
0
    protected function _view_home()
    {
        global $core, $bio;
        $v = $this->__(array('alias', 't' => 0, 'p' => 0));
        if (!f($v['alias'])) {
            _fatal();
        }
        $v['field'] = !is_numb($v['alias']) ? 'alias' : 'id';
        $sql = 'SELECT *
			FROM _events
			WHERE event_?? = ?';
        if (!($event = _fieldrow(sql_filter($sql, $v['field'], $v['alias'])))) {
            _fatal();
        }
        if ($v['field'] == 'id' && f($event['event_alias'])) {
            redirect(_link($this->m(), $event['event_alias']) . _linkp(array('t' => $v['t'], 'p' => $v['p']), true));
        }
        // Get images
        $sql = 'SELECT *
			FROM _events_images
			WHERE image_event = ?
			ORDER BY image ASC
			LIMIT ??, ??';
        $event_images = _rowset(sql_filter($sql, $event['event_id'], $v['t'], $core->v('thumbs_per_page')));
        foreach ($event_images as $i => $row) {
            if (!$i) {
                _style('thumbnails', _pagination(_link($this->m(), $event['event_alias']), 't:%d', $event['event_images'], $core->v('thumbs_per_page'), $v['t']));
            }
            _style('thumbnails.row', array('U_THUMBNAIL' => _lib(w(LIB_EVENT . ' thumbnail ' . $event['event_id'], $row['image'], 'jpg')), 'U_IMAGE' => _lib(w(LIB_EVENT . ' gallery ' . $event['event_id'], $row['image'], 'jpg')), 'V_FOOTER' => $row['image_footer']));
        }
        if (is_ghost()) {
            return;
        }
        // Statistics
        if (!$v['t'] && !$bio->v('auth_founder')) {
            $this->_stats_store();
        }
        $is_future = $row['event_end'] > time() ? true : false;
        if (!$is_future) {
            // Star for favourites
            if (!($star_type = $core->cache_load('star_type'))) {
                $sql = 'SELECT type_id, type_name
					FROM _events_star_type
					ORDER BY type_order';
                $types = $core->cache_store('star_type', _rowset($sql, 'type_id', 'type_name'));
            }
            $i = 0;
            foreach ($types as $type_id => $type_name) {
                if (!$i) {
                    _style('star_type');
                }
                _style('star_type.row', array('TYPE_ID' => $type_id, 'TYPE_NAME' => $type_name));
                $i++;
            }
        } else {
            $sql = 'SELECT *
				FROM _events_reviews r, _bio b
				WHERE r.review_event = ?
					AND r.review_uid = b.bio_id
				ORDER BY r.review_avg
				LIMIT 0, 5';
            $reviews = _rowset(sql_filter($sql, $event['event_id']), 'review_id');
            $sql = 'SELECT *
				FROM _events_reviews_rate r, _events_reviews_fields f
				WHERE r.rate_review IN (??)
					AND r.rate_field = f.field_id
				ORDER BY f.field_order';
            $reviews_rate = _rowset(sql_filter($sql, _implode(',', array_keys($reviews))), 'rate_review', false, true);
            $i = 0;
            foreach ($reviews as $row) {
                if (!$i) {
                    _style('reviews');
                }
                _style('reviews.row', array('REVIEW_CONTENT' => $row['review_content'], 'REVIEW_' => $row['review_']));
                if (isset($reviews_rate[$row['review_id']])) {
                    foreach ($reviews_rate[$row['review_id']] as $j => $rate) {
                        if (!$j) {
                            _style('reviews.row.rate');
                        }
                        _style('reviews.row.rate.field', array('FIELD' => $rate['field_name'], 'RATE' => $rate['rate_value']));
                    }
                }
                $i++;
            }
        }
        // Who attend
        $sql = 'SELECT at.type_id, at.type_name_next, at.type_name_prev, b.bio_alias, b.bio_name, b.bio_avatar, b.bio_avatar_up
			FROM _events_attend a, _events_attend_type at, _bio b
			WHERE a.attend_event = ?
				AND a.attend_type = at.type_id
				AND a.attend_uid = b.bio_id
			ORDER BY a.attend_time';
        $attend = _rowset(sql_filter($sql, $event['event_id']), 'type_id', false, true);
        $i = 0;
        foreach ($attend as $type_name => $rows) {
            if (!$i) {
                _style('attend');
            }
            $type_name = $is_future ? 'next' : 'prev';
            _style('attend.type', array('TYPE_NAME' => $rows[0]['type_name_' . $type_name]));
            foreach ($rows as $row) {
                _style('attend.type.row', array('BIO_NAME' => $row['bio_name'], 'BIO_AVATAR' => _avatar($row)));
            }
            $i++;
        }
        // Messages
        $ref = _link('events', $event['event_alias']);
        if ($event['event_publish']) {
            if ($event['event_comments']) {
                $sql = 'SELECT c.comment_id, c.comment_time, c.comment_text, b.bio_id, b.bio_alias, b.bio_name, b.bio_avatar, b.bio_avatar_up
					FROM _events_comments c, _bio b
					WHERE c.comment_event = ?
						AND c.comment_active = ?
						AND c.comment_bio = b.bio_id
					ORDER BY c.comment_time DESC
					LIMIT ??, ??';
                $comments = _rowset(sql_filter($sql, $event['event_id'], 1, $v['p'], $core->v('events_comments')));
                foreach ($comments as $i => $row) {
                    if (!$i) {
                        _style('comment_area', _pagination(_link($this->m(), array($event['event_alias'], $v['t'], 's%d')), $topic_data['topic_replies'] + 1, $core->v('posts_per_page'), $start));
                    }
                    _style('comment_area.row', array('BIO_ALIAS' => _link_bio($row['bio_alias']), 'BIO_NAME' => $row['bio_name'], 'BIO_AVATAR' => _avatar($row), 'COMMENT_ID' => $row['comment_id'], 'COMMENT_TIME' => _format_date($row['comment_time']), 'COMMENT_TEXT' => _message($row['comment_text'])));
                }
            }
            _style('comment_publish', array('U_PUBLISH' => _link()));
        }
        //
        if ($event['event_posts']) {
            $reply = array('ref' => $ref, 'start' => $v['p'], 'start_f' => 's', 'rows' => $event['event_posts'], 'rows_page' => $core->v('s_posts'), 'block' => 'posts', 'sql' => 'SELECT p.post_id, p.post_time, p.post_text, b.bio_id, b.bio_alias, b.bio_name, b.bio_avatar, b.bio_avatar_up, b.bio_sig
					FROM _events_posts p, _bio b
					WHERE p.post_event = ?
						AND p.post_active = 1 
						AND p.post_uid = b.bio_id
					ORDER BY p.post_time DESC
					LIMIT {START}, {ROWS_PAGE}');
            $reply['sql'] = sql_filter($reply['sql'], $event['event_id']);
            $this->_replies($reply);
        }
        v_style(_vs(array('SUBJECT' => $event['event_subject'], 'IMAGES' => $event['event_images'], 'START' => _format_date($event['event_start'], 'd F Y'), 'END' => _format_date($event['event_end'], 'd F Y'), 'COMMENTS' => $event['event_posts']), 'event'));
        return;
    }
Ejemplo n.º 21
0
?>
<div><?php 
echo list_link($item_i18n, 'parkings');
?>
</div>
<div><?php 
$snow_clearance_rating = $item['snow_clearance_rating'];
$elevation_field = '';
if (isset($item['lowest_elevation']) && is_scalar($item['lowest_elevation']) && $item['lowest_elevation'] != $item['elevation'] && $snow_clearance_rating != 4) {
    $elevation_field = $item['lowest_elevation'] . __('meters') . __('range separator') . $item['elevation'] . __('meters');
} else {
    if (isset($item['elevation']) && is_scalar($item['elevation'])) {
        $elevation_field = $item['elevation'] . __('meters');
    }
}
$snow_field = '';
if (is_int($snow_clearance_rating) && $snow_clearance_rating != 4) {
    $snow_field = get_paginated_value($item['snow_clearance_rating'], 'mod_parkings_snow_clearance_ratings_list');
}
echo _implode(' - ', array($elevation_field, field_pt_picto_if_set($item, true) . ' ' . get_paginated_value($item['public_transportation_rating'], 'app_parkings_public_transportation_ratings'), $snow_field));
?>
</div>
<div><?php 
include_partial('documents/regions4list', array('geoassociations' => $item['geoassociations']));
?>
</div>
<div><?php 
echo picto_tag('picto_images', __('nb_linked_images')), ' ', isset($item['nb_images']) ? $item['nb_images'] : '0', ' ', picto_tag('action_comment', __('nb_comments')), ' ', isset($item['nb_comments']) ? link_to($item['nb_comments'], '@document_comment?module=parkings&id=' . $item_i18n['id'] . '&lang=' . $item_i18n['culture']) : '0', ' ', picto_tag('picto_routes', __('nb_routes')), ' ', isset($item['nb_linked_docs']) ? $item['nb_linked_docs'] : '0';
?>
</div>
Ejemplo n.º 22
0
Archivo: bio.php Proyecto: nopticon/npt
    public function auth_groups($uid = false)
    {
        if ($uid === false) {
            $uid = $this->v('bio_id');
        }
        $groups = w();
        if ($this->auth_founder($uid)) {
            $groups = array_keys($this->_groups());
        }
        if (!count($groups)) {
            $sql = 'SELECT g.group_id
				FROM _groups g, _groups_members gm
				WHERE g.group_id = gm.member_group
					AND gm.member_uid = ?';
            $groups = sql_rowset(sql_filter($sql, $uid), false, 'group_id');
        }
        return _implode(',', $groups);
    }
Ejemplo n.º 23
0
 public final function get_navigation()
 {
     $format = '<a href="%s">%s</a>';
     $a = w();
     foreach ($this->nav as $k => $v) {
         $a[] = f($v) ? sprintf($format, $v, _lang($k)) : _lang($k);
     }
     return _implode(' &rsaquo; ', $a);
 }
Ejemplo n.º 24
0
}
$item_i18n = $item['OutingI18n'][0];
$activities = $item['activities'];
?>
<div class="right"><?php 
echo get_paginated_activities($activities);
?>
</div>
<div><?php 
echo list_link($item_i18n, 'outings') . ' ' . $has_gps_track;
?>
</div>
<div>
<?php 
echo _implode(' - ', array(format_date($item['date'], 'D'), link_to($item['creator'], '@document_by_id?module=users&id=' . $item['creator_id'])));
?>
</div>
<div>
<?php 
echo _implode(' - ', array(displayWithSuffix($item['max_elevation'], 'meters'), displayWithSuffix($item['height_diff_up'], 'meters'), isset($item['linked_routes']) ? field_route_ratings_data($item, false, false, false, 'html', $activities) : '', get_paginated_value($item['conditions_status'], 'mod_outings_conditions_statuses_list'), field_frequentation_picto_if_set($item, true)));
?>
</div>
<div><?php 
include_partial('documents/regions4list', array('geoassociations' => $item['geoassociations']));
?>
</div>
<div><?php 
echo picto_tag('picto_images', __('nb_linked_images')), ' ', isset($item['nb_images']) ? $item['nb_images'] : '0', ' ', picto_tag('action_comment', __('nb_comments')), ' ', isset($item['nb_comments']) ? link_to($item['nb_comments'], '@document_comment?module=outings&id=' . $item_i18n['id'] . '&lang=' . $item_i18n['culture']) : '0';
?>
</div>
Ejemplo n.º 25
0
Archivo: g.php Proyecto: nopticon/noptc
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
define('XFS', './npt/');
require_once XFS . 'core/core.php';
$key = '';
if (isset($_POST['submit'])) {
    $v = w('server user passwd name');
    $arg = w();
    foreach ($v as $k) {
        $arg[] = encode(request_var('v_' . $k, ''));
    }
    $key = encode(_implode(',', $arg, true));
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="es" lang="es">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>g.passwd</title>
<style type="text/css">
body {
	background: #EEE;
}
body, div, span, input, textarea, a, dt {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
	color: #444;
Ejemplo n.º 26
0
    protected function _gallery_remove()
    {
        global $bio, $warning;
        if (_button()) {
            $v = $this->__(array('picture' => array(0)));
            if (!count($v->picture)) {
                $warning->now();
            }
            $sql = 'SELECT *
				FROM _bio_images
				WHERE image_bio = ?
					AND image_assoc IN (??)
				ORDER BY image_id';
            if (!($images = sql_rowset(sql_filter($sql, $bio->v('bio_id'), _implode(',', $v->picture))))) {
                $warning->now();
            }
            $filepath = array('original' => _lib(), 'thumbnail' => _lib());
            foreach ($images as $row) {
                foreach ($filepath as $path) {
                }
            }
        }
        if ($submit) {
            $v = $this->__(array('s_images' => array(0)));
            $s_images = $v->s_images;
            if (sizeof($s_images)) {
                if ($row = $db->sql_fetchrow($result)) {
                    $delete_images = w();
                    do {
                        $gfile = array($gallery_path . $row['image'] . '.jpg', $thumbs_path . $row['image'] . '.jpg');
                        foreach ($gfile as $image) {
                            if (@is_file($image) && @is_readable($image)) {
                                @chmod($image, 0777);
                                if (@unlink($image)) {
                                    if (!@file_exists($image)) {
                                        if (!isset($delete_images[$row['image']])) {
                                            $delete_images[$row['image']] = true;
                                        }
                                    }
                                }
                            }
                        }
                    } while ($row = $db->sql_fetchrow($result));
                    if (sizeof($delete_images)) {
                        $sql = 'DELETE FROM _bio_pictures 
							WHERE picture_bio = ?
								AND picture_id IN (??)';
                        sql_query(sql_filter($sq, $bio->v('bio_id'), _implode(',', array_keys($delete_images))));
                        if ($deleted_count = sql_affectedrows()) {
                            $sql = 'UPDATE _bio_store
								SET store_value = store_value - ??
								WHERE store_bio = ?';
                            sql_query(sql_filter($sql, $deleted_count, $bio->v('bio_id')));
                        }
                    }
                }
                $db->sql_freeresult($result);
            }
        }
        if (!$error) {
            redirect(_link_control('a', array('a' => $bio->v('bio_alias'), 'x1' => $this->x(1))));
        }
    }
Ejemplo n.º 27
0
    protected function advanced_search($category)
    {
        global $user;
        $z = $this->__(array('_table' => array(0), '_field' => array(0), '_input' => array(''), '_vbox' => array(0)));
        foreach ($z['_input'] as $i => $row) {
            if (!isset($z['_vbox'][$i])) {
                $z['_vbox'][$i] = 0;
            }
            if ($row === '') {
                unset($z['_input'][$i], $z['_table'][$i], $z['_field'][$i], $z['_vbox'][$i]);
            }
        }
        ksort($z['_vbox']);
        $sql = 'SELECT *
			FROM _search_relation r, _search_tables t, _search_categories c
			WHERE r.relation_id IN (' . _implode(',', $z['_field']) . ")\n\t\t\t\tAND r.relation_table = t.table_id\n\t\t\t\tAND t.table_cat = c.category_id\n\t\t\t\tAND c.category_alias = ?\n\t\t\tORDER BY r.relation_field";
        if (!($relation = _rowset(sql_filter($sql, $category)))) {
            return $this->e('NO_TABLE_FIELDS');
        }
        $a_where = $a_where2 = $a_from = $a_cals = $ref = w();
        $i_vbox = $i_and = 0;
        $s_open = false;
        foreach ($z['_field'] as $i => $row) {
            $ref[$row][] = $z['_input'][$i];
        }
        foreach ($relation as $row) {
            $e_tables = array_map('trim', explode(',', trim($row['relation_tables'])));
            foreach ($e_tables as $e_row) {
                if (!in_array($e_row, $a_from)) {
                    $a_from[] = _escape($e_row);
                }
            }
            $e_fields = array_map('trim', explode(',', trim($row['relation_fields'])));
            foreach ($e_fields as $e_row) {
                if (!f($e_row)) {
                    continue;
                }
                if (!in_array($e_row, $a_where)) {
                    $a_where[] = ($i_and ? ' AND ' : '') . $e_row;
                }
                $i_and++;
            }
            if (isset($ref[$row['relation_id']])) {
                foreach ($ref[$row['relation_id']] as $q => $e_row) {
                    $s_sign = 'LIKE';
                    if ($row['relation_input'] == 'calendar') {
                        if (isset($a_cals[$row['relation_field']])) {
                            $e_endcal = explode('/', $e_row);
                            $e_row = _timestamp($e_endcal[1], $e_endcal[0], $e_endcal[2], 23, 59, 59);
                            $s_sign = '<=';
                            unset($a_cals[$row['relation_field']]);
                        } else {
                            $e_row = $this->parse_calendar('calendar', $e_row);
                            $s_sign = '>=';
                            $a_cals[$row['relation_field']] = 1;
                        }
                    }
                    $a_where2[] = ($z['_vbox'][$i_vbox] ? 'AND' : 'OR') . ' ' . $row['relation_field'] . " " . $s_sign . " '" . _escape(str_replace('+', '%', $e_row)) . "'";
                    $i_vbox++;
                }
            }
        }
        $a_where_count = count($a_where2);
        $section = false;
        foreach ($a_where2 as $i => $row) {
            $and = strpos($row, 'AND ') !== false;
            $and_prev = isset($a_where2[$i - 1]) && strpos($a_where2[$i - 1], 'AND ') !== false;
            $and_next = isset($a_where2[$i + 1]) && strpos($a_where2[$i + 1], 'AND ') !== false;
            $last = $i + 1 == $a_where_count;
            $last_next = $i + 2 == $a_where_count;
            $prev_first = !($i - 1);
            $row = str_replace(array('AND ', 'OR '), '', $row);
            if (!$section && (!$i || $and && !$and_prev && !$last || $and && !$and_prev && !$and_next && !$last || !$and && $and_next || $and && $and_prev && !$and_next)) {
                $row = '(' . $row;
                $section = true;
            }
            $row = ($and ? 'AND' : 'OR') . ' ' . $row;
            if ($section && ($last || $and && $and_prev && $and_next || $and && $and_prev && !$and_next && !$last_next || !$and && $and_prev && $last_next && $prev_first || $i && $and && !$and_prev || $last && !$and && $and_prev)) {
                $row .= ')';
                $section = false;
            }
            $a_where2[$i] = $row;
        }
        if ($category == 'ticket') {
            $groups = $user->auth_groups();
            if ($groups != -1) {
                $a_where2[] = 'AND t.ticket_group IN (' . $groups . ') ';
            } else {
                $a_where2[] = 'AND t.ticket_contact = ' . (int) $user->v('user_id');
            }
        }
        if (!count($a_where)) {
            $a_where2[0] = preg_replace('#^(AND|OR) (.*?)#i', '\\2', $a_where2[0]);
        }
        if (count($a_where) == 1) {
            $a_where2[0] = preg_replace('#^OR (.*?)#i', 'AND \\2', $a_where2[0]);
        }
        return array('from' => $a_from, 'where' => array_merge($a_where, $a_where2));
    }
Ejemplo n.º 28
0
    protected function _search_home()
    {
        $v = $this->__(array('q', 'e'));
        ini_set('memory_limit', '100M');
        set_time_limit(0);
        $button = _button();
        if ($button) {
            $build_search = $this->advanced_search($this->m());
            $build = 'SELECT t.*, mb.user_id, mb.user_active, mb.user_firstname, mb.user_lastname
				FROM ' . _implode(', ', $build_search['from']) . '
				WHERE ' . _implode(' ', $build_search['where']) . '
				ORDER BY t.ticket_start DESC';
            redirect(_link($this->m(), array('x1' => 'search', 'q' => array_key(sql_cache($build), 'sid'), 'e' => $v['e'])));
        }
        if (f($v['q'])) {
            $cached = sql_cache('', $v['q']);
            if ($tickets = _rowset($cached['query'])) {
                redirect(_link($this->m(), array('view' => 'search', 'ssid' => $v['q'], 'e' => $v['e'])));
            }
            $button = true;
        }
        $this->advanced_search_form($this->m());
        return v_style(array('IS_SUBMIT' => $button, 'RESULTS_PAGE' => 0, 'U_SEARCH_TAB' => _link($this->m(), array('x1' => 'tab', 'uid' => '*', 'tag' => '?'))));
    }
Ejemplo n.º 29
0
<?php

use_helper('Field', 'Link');
$item_i18n = $item['SummitI18n'][0];
?>
<div><?php 
echo list_link($item_i18n, 'summits');
?>
</div>
<div><?php 
echo _implode(' - ', array(displayWithSuffix($item['elevation'], 'meters'), get_paginated_value($item['summit_type'], 'app_summits_summit_types')));
?>
</div>
<div><?php 
include_partial('documents/regions4list', array('geoassociations' => $item['geoassociations']));
?>
</div>
<div><?php 
echo picto_tag('picto_images', __('nb_linked_images')), ' ', isset($item['nb_images']) ? $item['nb_images'] : '0', ' ', picto_tag('action_comment', __('nb_comments')), ' ', isset($item['nb_comments']) ? link_to($item['nb_comments'], '@document_comment?module=summits&id=' . $item_i18n['id'] . '&lang=' . $item_i18n['culture']) : '0', ' ', picto_tag('picto_routes', __('nb_routes')), ' ', isset($item['nb_linked_docs']) ? $item['nb_linked_docs'] : '0';
?>
</div>
Ejemplo n.º 30
-1
	public function _home() {
		global $config, $user, $cache;

		if (!_button()) {
			return false;
		}

		$from_topic = request_var('from_topic', 0);
		$to_topic = request_var('to_topic', 0);

		if (!$from_topic || !$to_topic || $from_topic == $to_topic) {
			fatal_error();
		}

		$sql = 'SELECT *
			FROM _forum_topics
			WHERE topic_id = ?';
		if (!$row = sql_fieldrow(sql_filter($sql, $from_topic))) {
			fatal_error();
		}

		$sql = 'SELECT *
			FROM _forum_topics
			WHERE topic_id = ?';
		if (!$row = sql_fieldrow(sql_filter($sql, $to_topic))) {
			fatal_error();
		}

		$from_forum_id = (int) $row['forum_id'];
		$from_poll = (int) $row['topic_vote'];
		$to_forum_id = (int) $row['forum_id'];
		$to_poll = (int) $row['topic_vote'];

		if ($from_poll) {
			if ($to_poll) {
				$sql = 'SELECT vote_id
					FROM _poll_options
					WHERE topic_id = ?';
				if ($vote_id = sql_field(sql_filter($sql, $from_topic), 'vote_id', 0)) {
					$sql = array(
						sql_filter('DELETE FROM _poll_voters WHERE vote_id = ?', $vote_id),
						sql_filter('DELETE FROM _poll_results WHERE vote_id = ?', $vote_id),
						sql_filter('DELETE FROM _poll_options WHERE vote_id = ?', $vote_id)
					);
					sql_query($sql);
				}
			} else {
				$sql = 'UPDATE _poll_options SET topic_id = ?
					WHERE topic_id = ?';
				sql_query(sql_filter($sql, $to_topic, $from_topic));
			}
		}

		// Update destination toic
		$sql = 'SELECT topic_views
			FROM _forum_topics
			WHERE topic_id = ?';
		if ($topic_views = sql_field(sql_filter($sql, $from_topic), 'topic_views', 0)) {
			$sql = 'UPDATE _forum_topics SET topic_views = topic_views + ??
				WHERE topic_id = ?';
			sql_query(sql_filter($sql, $topic_views, $to_topic));
		}

		//
		//
		$sql = 'SELECT *
			FROM _forum_topics_fav
			WHERE topic_id = ?';
		$user_ids = sql_rowset(sql_filter($sql, $to_topic), false, 'user_id');

		$sql_user = (sizeof($user_ids)) ? ' AND user_id NOT IN (' . _implode(', ', $user_ids) . ')' : '';

		$sql = array(
			sql_filter('UPDATE _forum_topics_fav SET topic_id = ? WHERE topic_id = ?', $to_topic, $from_topic) . $sql_user,
			sql_filter('DELETE FROM _forum_topics_fav WHERE topic_id = ?', $from_topic),
			sql_filter('UPDATE _forum_posts SET forum_id = ?, topic_id = ? WHERE topic_id = ?', $to_forum_id, $to_topic, $from_topic),
			sql_filter('DELETE FROM _forum_topics WHERE topic_id = ?', $from_topic),
			sql_filter('DELETE FROM _members_unread WHERE element = ? AND item = ?', UH_T, $from_topic),
		);

		if ($from_poll && !$to_poll) {
			$sql[] = sql_filter('UPDATE _forum_topics SET topic_vote = 1 WHERE topic_id = ?', $to_topic);
		}
		sql_query($sql);

		$user->save_unread(UH_T, $to_topic);

		if (in_array($to_forum_id, array(20, 39))) {
			topic_feature($to_topic, 0);
			topic_arkane($to_topic, 0);
		}

		sync_topic_merge('topic', $to_topic);
		sync_topic_merge('forum', $to_forum_id);

		if ($from_forum_id != $to_forum_id) {
			sync_topic_merge('forum', $from_forum_id);
		}

		return;
	}