/** * Initialize the mod and it's settings. We can't use a constructor * might change this in the future (either singleton or two classes, * one to handle the integration hooks and one that does the dirty work) * * @global array $modSettings SMF's modSettings variable * @staticvar boolean $done Says if this has been done already * @param boolean $force Force the init to run again if already done * @return void */ public static function init($force = FALSE) { global $modSettings; static $done = FALSE; if ($done && !$force) { return; } $done = TRUE; self::$actions = !empty($modSettings['simplesef_actions']) ? explode(',', $modSettings['simplesef_actions']) : array(); self::$ignoreactions = array_merge(self::$ignoreactions, !empty($modSettings['simplesef_ignore_actions']) ? explode(',', $modSettings['simplesef_ignore_actions']) : array()); self::$aliasactions = !empty($modSettings['simplesef_aliases']) ? unserialize($modSettings['simplesef_aliases']) : array(); self::$useractions = !empty($modSettings['simplesef_useractions']) ? explode(',', $modSettings['simplesef_useractions']) : array(); self::$stripWords = !empty($modSettings['simplesef_strip_words']) ? self::explode_csv($modSettings['simplesef_strip_words']) : array(); self::$stripChars = !empty($modSettings['simplesef_strip_chars']) ? self::explode_csv($modSettings['simplesef_strip_chars']) : array(); self::$topics_base = !empty($modSettings['simplesef_topicsbase']) ? $modSettings['simplesef_topicsbase'] : 'topics/'; // Do a bit of post processing on the arrays above //self::$stripWords = array_filter(self::$stripWords, create_function('$value', 'return !empty($value);')); self::$stripWords = array_filter(self::$stripWords, function ($value) { return !empty($value); }); array_walk(self::$stripWords, 'trim'); //self::$stripChars = array_filter(self::$stripChars, create_function('$value', 'return !empty($value);')); self::$stripChars = array_filter(self::$stripChars, function ($value) { return !empty($value); }); array_walk(self::$stripChars, 'trim'); self::loadBoardNames($force); self::loadExtensions($force); //self::log('Pre-fix GET:' . var_export($_GET, TRUE)); // We need to fix our GET array too... parse_str(preg_replace('~&(\\w+)(?=&|$)~', '&$1=', strtr($_SERVER['QUERY_STRING'], array(';?' => '&', ';' => '&', '%00' => '', "" => ''))), $_GET); //self::log('Post-fix GET:' . var_export($_GET, TRUE), 'Init Complete (forced: ' . ($force ? 'true' : 'false') . ')'); }