Skip to content

Instantly share code, notes, and snippets.

.phpbb-ads-center {
text-align: center;
}
.phpbb-ads-center * {
margin: 0 auto;
}
@rxu
rxu / GAd1
Created September 27, 2017 14:23
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- 2017.08.01 -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-6052584654693494"
data-ad-slot="5495024367"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
@rxu
rxu / install
Created September 25, 2017 16:29
@rxu
rxu / ex.php
Created August 15, 2017 04:18
Blind ternary
preg_match_all('#<!-- BEGIN (.*?) -->(.*?)<!-- END .*? -->#s', $template, $matches, PREG_SET_ORDER) ?:
preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $template, $matches, PREG_SET_ORDER);
@rxu
rxu / gist:a304b4fd08cc14d595fd
Created November 3, 2015 17:11
db_text update fix
$sql = 'UPDATE ' . $this->table . "
SET config_value = '" . $this->db->sql_escape($value) . "'
WHERE config_value <> '" . $this->db->sql_escape($value) . "'
AND config_name = '" . $this->db->sql_escape($key) . "'";
$this->db->sql_query($sql);
@rxu
rxu / gist:fb4ca2b931e89be5db54
Last active October 22, 2015 17:12
statuses
$statuses_closed = array(self::STATUS_IMPLEMENTED, self::STATUS_DUPLICATE, self::STATUS_INVALID);
$statuses = array_merge($statuses_closed, array(self::STATUS_NEW, self::STATUS_PROGRESS));
$status = (in_array($status, $statuses)) ? $this->db->sql_in_set('idea_status', $status) :
(($status == -1) ? $this->db->sql_in_set('idea_status', $statuses_closed, true) : $this->db->sql_in_set('idea_status', $statuses, true));
@rxu
rxu / cache_ext_autoloaders.php
Created October 9, 2015 15:45
phpBB 3.1 cache ext autoloaders
/**
* Load the autoloaders added by the extensions.
*
* @param string $phpbb_root_path Path to the phpbb root directory.
*/
function phpbb_load_extensions_autoloaders($phpbb_root_path, $phpEx)
{
$cache_filename = $phpbb_root_path . 'cache/autoload.' . $phpEx;
if (!file_exists($cache_filename))
'ACP_BOARDRULES_FONT_ICON' => 'Значок ссылки',
'ACP_BOARDRULES_FONT_ICON_EXPLAIN' => 'Введите имя значка из набора <a href="https://fortawesome.github.io/Font-Awesome/icons/" target="_blank">Font Awesome</a> для отображения рядом со ссылкой на правила. Оставьте поле пустым, чтобы значок не отображался.',
'ACP_BOARDRULES_FONT_ICON_INVALID' => 'Имя значка ссылки содержит неверные символы.',
$sql = 'SELECT COUNT(p.post_id) AS posts, p.poster_id, u.username, u.user_colour
FROM phpbb_posts p, phpbb_users u
WHERE p.topic_id = ' . (int) $topic_id . '
AND p.poster_id = u.user_id
GROUP BY p.poster_id
ORDER BY posts DESC';
@rxu
rxu / gist:da473e83cbf6477764c5
Created September 12, 2015 17:53
user_get_id_name() example
$username_ary = array();
// Selecting usernames for user_id of 22, 3, 14 (for example)
$user_id_ary = array(22, 3, 14);
user_get_id_name($user_id_ary, $username_ary);
var_dump($username_ary);