Skip to content

Instantly share code, notes, and snippets.

View MissAllSunday's full-sized avatar

Michel Mendiola MissAllSunday

  • Ohara
  • CDMX
View GitHub Profile
<?php
return PhpCsFixer\Config::create()
->setUsingCache(false)
->setRules([
'array_syntax' => [
'syntax' => 'long'
],
'ordered_imports' => true,
'binary_operator_spaces' => true,
@MissAllSunday
MissAllSunday / gist:0cc0f67438d1a991c0df
Created May 11, 2015 23:36
fileUpload configuration
function smf_fileUpload(oOptions)
{
// Default values in case oOptions isn't defined.
var dOptions = {
url: smf_prepareScriptUrl(smf_scripturl) + 'action=uploadAttach;sa=add;' + smf_session_var + '=' + smf_session_id,
dataType: 'json',
dropZone: $('.drop_zone'),
singleFileUploads:false,
forceIframeTransport: false,
autoUpload: false,
if (substr($field, 0, 5) == 'cust_' && isset($context['custom_search_fields'][$row['col_name']]))
{
$customJoin[] = 'LEFT JOIN {db_prefix}themes AS t' . $row['col_name'] . ' ON (t' . $row['col_name'] . '.variable = {string:t' . $row['col_name'] . '} AND t' . $row['col_name'] . '.id_theme = 1 AND t' . $row['col_name'] . '.id_member = mem.id_member)';
$query_parameters['t' . $row['col_name']] = $row['col_name'];
$fields += array($customCount++ => 'IFNULL(t' . $row['col_name'] . '.value, {string:blank_string})');
}
// Get the right sort method depending on the cust field type.
if ($row['field_type'] != 'check')
$cpf['columns'][$row['col_name']]['sort'] = array(
'down' => 'LENGTH(t' . $row['col_name'] . '.value) > 0 ASC, IFNULL(t' . $row['col_name'] . '.value, 1=1) DESC, t' . $row['col_name'] . '.value DESC',
'up' => 'LENGTH(t' . $row['col_name'] . '.value) > 0 DESC, IFNULL(t' . $row['col_name'] . '.value, 1=1) ASC, t' . $row['col_name'] . '.value ASC'
);
else
$cpf['columns'][$row['col_name']]['sort'] = array(
'down' => 't' . $row['col_name'] . '.value DESC',
<?php
array (size=12)
'enable_wall' => string '1' (length=1)
'pagination_number' => string '5' (length=1)
'load_more' => string '0' (length=1)
'how_many_mentions' => string '5' (length=1)
'kick_ignored' => string '0' (length=1)
'enable_activityLog' => string '0' (length=1)
'enable_buddies' => string '0' (length=1)
<?php
foreach ($array as $var => $val)
$inserts[] = array($userID, $var, $val);
if (!empty($inserts))
$this->_smcFunc['db_insert']('replace',
'{db_prefix}' . ($this->_tables['options']['table']),
array('member_id' => 'int', 'variable' => 'string-255', 'value' => 'string-65534'),
$inserts,
<?php
function get_all_themes($enable_only = false)
{
global $modSettings, $context, $smcFunc;
// Make our known themes a little easier to work with.
$knownThemes = !empty($modSettings['knownThemes']) ? explode(',',$modSettings['knownThemes']) : array();
// All of them or just the enable ones? each will have a pretty different query.
<?php
if ($enable_only)
$query = '
SELECT th.value, th.variable, th2.id_theme, th2.variable, th2.value
FROM {db_prefix}themes AS th
INNER JOIN {db_prefix}themes AS th2 ON (th2.id_theme = th.id_theme
AND th2.variable IN ({string:theme_dir}, {string:theme_url}, {string:images_url}, {string:name}, {string:theme_layers}, {string:theme_templates}, {string:version}, {string:install_for}, {string:based_on}, {string:enable}))
WHERE th.variable = {string:enable}
AND th.value = 1
Database Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE b.id_board IN (2)
AND bp.id_group IN (2, 4, 3)
AND bp.permission ' at line 6
SELECT MIN(bp.add_deny) AS add_deny
FROM smf_boards AS b
INNER JOIN smf_board_permissions AS bp ON (bp.id_profile = b.id_profile)
LEFT JOIN smf_moderators AS mods ON (mods.id_board = b.id_board AND mods.id_member = 2)
LEFT JOIN smf_moderator_groups AS modgs ON (modgs.id_board = b.id_board AND b.id_group IN (2, 4)
@MissAllSunday
MissAllSunday / gist:5767907
Created June 12, 2013 18:38
Show an image on a submenu entry
// This is the normal code
function RateStats_menu(&$menu_buttons)
{
global $scripturl, $modSettings, $txt;
loadLanguage('RateStats');
$menu_buttons['profile']['sub_buttons']['rateStats'] = array(
'title' => !empty($modSettings['RateStats_menu_name']) ? $modSettings['RateStats_menu_name'] : $txt['RateStats_title_main'],