/** * get all smilies */ public function load_smilies() { // default smilies $icons = BBSmile_Util::getDefaultSmilies(); if ($this->getVar('activate_auto') == 1) { $smiliepath_auto = DataUtil::formatForOS($this->getVar('smiliepath_auto')); $handle = opendir($smiliepath_auto); if ($handle != false) { while ($file = readdir($handle)) { if ($file != '.' && $file != '..' && $file != 'index.tpl' && $file != 'CVS') { if (preg_match("/(.*?)(.gif|.jpg|.jpeg|.png)\$/i", $file, $matches) != 0) { $icons[$matches[1]] = array('type' => 1, 'imgsrc' => $matches[0], 'alt' => $matches[1], 'alias' => '', 'short' => ":" . $matches[1] . ":", 'active' => '1'); } } } } } return $icons; }
/** * upgrade module */ public function upgrade($oldversion) { switch ($oldversion) { case '2.1': // reset all modvars to default $this->setVar('smiliepath', 'modules/BBSmile/images/smilies'); $this->setVar('activate_auto', '1'); $this->setVar('remove_inactive', '1'); $this->setVar('smiliepath_auto', 'modules/BBSmile/images/smilies_auto'); $this->setVar('smilie_array', BBSmile_Util::getDefaultSmilies()); // load the 'auto' smilies ModUtil::loadApi($this->name, 'admin', true); ModUtil::apiFunc($this->name, 'admin', 'updatesmilies', array('forcereload' => 1)); // create hook HookUtil::registerProviderBundles($this->version->getHookProviderBundles()); case '3.0.0': // current version } return true; }