+
+
+
+
+ forbidden
+
+
+
+ you don't have permission to access this resource
+
+
+EOF
+);
+
+ return true;
+ }
+
+ return false;
+ }
+}
+
+?>
diff --git a/Upload/inc/plugins/sm/classes/WildcardPluginInstallerInterface010000.php b/Upload/inc/plugins/sm/classes/WildcardPluginInstallerInterface010000.php
new file mode 100644
index 0000000..1fe26d6
--- /dev/null
+++ b/Upload/inc/plugins/sm/classes/WildcardPluginInstallerInterface010000.php
@@ -0,0 +1,13 @@
+
diff --git a/Upload/inc/plugins/sm/classes/index.html b/Upload/inc/plugins/sm/classes/index.html
new file mode 100644
index 0000000..0fd964c
--- /dev/null
+++ b/Upload/inc/plugins/sm/classes/index.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+ forbidden
+
+
+
+ you don't have permission to access this resource
+
+
diff --git a/Upload/inc/plugins/sm/forum.php b/Upload/inc/plugins/sm/forum.php
new file mode 100644
index 0000000..990d9a8
--- /dev/null
+++ b/Upload/inc/plugins/sm/forum.php
@@ -0,0 +1,156 @@
+
Please make sure IN_MYBB is defined.');
+}
+
+smInitialize();
+
+/**
+ * add hooks and include functions only when appropriate
+ *
+ * return void
+ */
+function smInitialize()
+{
+ global $mybb, $plugins, $templatelist;
+
+ $plugins->add_hook('global_intermediate', 'smBuildPopup');
+
+ // only add the xmlhttp hook if required
+ if (THIS_SCRIPT == 'xmlhttp.php' &&
+ $mybb->input['action'] == 'sm') {
+ $plugins->add_hook('xmlhttp', 'smXmlhttp');
+ }
+
+ $templatelist .= ',sm_popup';
+}
+
+/**
+ * handles AJAX for Smile Menu
+ *
+ * @return void
+ */
+function smXmlhttp()
+{
+ global $mybb;
+
+ $ajaxFunction = "smXmlhttp{$mybb->input['mode']}";
+ if ($mybb->input['action'] != 'sm' ||
+ !function_exists($ajaxFunction)) {
+ return;
+ }
+
+ $ajaxFunction();
+ return;
+}
+
+function smCacheSmilies()
+{
+ global $cache, $mybb, $theme;
+
+ static $localCache = null;
+
+ if ($localCache === null) {
+ $localCache = array();
+
+ $smilies = $cache->read("smilies");
+ if (is_array($smilies) &&
+ !empty($smilies)) {
+ foreach ($smilies as $sid => $smilie) {
+ $smilie['find'] = explode("\n", $smilie['find']);
+ $smilie['image'] = str_replace("{theme}", $theme['imgdir'], $smilie['image']);
+
+ foreach ($smilie['find'] as $s) {
+ $localCache[$s] = array(
+ 'title' => $smilie['name'],
+ 'code' => $s,
+ 'url' => $smilie['image'],
+ );
+ }
+ }
+ } else {
+ $localCache = false;
+ }
+ }
+
+ if ($localCache === false) {
+ return false;
+ }
+
+ return $localCache;
+}
+
+/**
+ * search for usernames beginning with search text and echo JSON
+ *
+ * @return void
+ */
+function smXmlhttpLoad()
+{
+ global $mybb, $db, $cache;
+
+ $smilies = smCacheSmilies();
+
+ if (empty($smilies)) {
+ exit;
+ }
+
+ $json = json_encode($smilies);
+
+ // send our headers.
+ header('Content-type: application/json');
+ echo($json);
+ exit;
+}
+
+/**
+ * output the popup HTML
+ *
+ * @return void
+ */
+function smBuildPopup() {
+ global $mybb, $lang, $theme, $templates, $smAutocomplete;
+
+ if (!$lang->sm) {
+ $lang->load('sm');
+ }
+
+ if ($mybb->settings['sm_minify_js']) {
+ $min = '.min';
+ }
+
+ $mybb->settings['sm_min_width'] = (int) $mybb->settings['sm_min_width'];
+
+ $smAutocomplete = <<
+
+
+
+EOF;
+
+ eval("\$smAutocomplete .= \"" . $templates->get('sm_popup') . "\";");
+}
+
+?>
diff --git a/Upload/inc/plugins/sm/index.html b/Upload/inc/plugins/sm/index.html
new file mode 100644
index 0000000..0fd964c
--- /dev/null
+++ b/Upload/inc/plugins/sm/index.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+ forbidden
+
+
+
+ you don't have permission to access this resource
+
+
diff --git a/Upload/inc/plugins/sm/install.php b/Upload/inc/plugins/sm/install.php
new file mode 100644
index 0000000..c57e899
--- /dev/null
+++ b/Upload/inc/plugins/sm/install.php
@@ -0,0 +1,231 @@
+
Please make sure IN_MYBB is defined.');
+}
+
+/**
+ * used by MyBB to provide relevant information about the plugin and
+ * also link users to updates
+ *
+ * @return array plugin info
+ */
+function sm_info()
+{
+ global $db, $lang, $mybb, $cp_style;
+
+ if (!$lang->sm) {
+ $lang->load('sm');
+ }
+
+ $settingsLink = smBuildSettingsLink();
+
+ // if MyAlerts is installed
+ if ($settingsLink) {
+ $settingsLink = <<
+ {$settingsLink}
+
+EOF;
+
+ $buttonPic = "styles/{$cp_style}/images/sm/donate.gif";
+ $smDescription = <<
+
+
+ {$lang->sm_description}
+
+ |
+
+
+
+
+
+ |
+
+
+EOF;
+ } else {
+ $smDescription = $lang->sm_description;
+ }
+
+ $name = "Smile Menu";
+ $author = "Wildcard";
+
+ // return the info
+ return array(
+ 'name' => $name,
+ 'description' => $smDescription,
+ 'website' => 'https://github.com/WildcardSearch/Smile-Menu',
+ 'version' => SMILEMENU_VERSION,
+ 'author' => $author,
+ 'authorsite' => 'https://www.rantcentralforums.com/',
+ 'compatibility' => '18*',
+ 'codename' => 'sm',
+ );
+}
+
+/**
+ * check to see if the plugin is installed
+ *
+ * @return bool true if installed, false if not
+ */
+function sm_is_installed()
+{
+ return smGetSettingsgroup();
+}
+
+/**
+ *
+ *
+ * @return void
+ */
+function sm_install()
+{
+ global $db, $lang;
+
+ if (!$lang->sm) {
+ $lang->load('sm');
+ }
+
+ SmileMenuInstaller::getInstance()->install();
+}
+
+/**
+ * edit the footer template
+ *
+ * @return void
+ */
+function sm_activate()
+{
+ global $plugins, $db, $cache, $lang, $smOldVersion;
+
+ if (!$lang->sm) {
+ $lang->load('sm');
+ }
+
+ /* // version check
+ $smOldVersion = SmileMenuCache::getInstance()->getVersion();
+ if (version_compare($smOldVersion, SMILEMENU_VERSION, '<') &&
+ $smOldVersion != '' &&
+ $smOldVersion != 0) {
+ require MYBB_ROOT . 'inc/plugins/sm/upgrade.php';
+ } */
+
+ require_once MYBB_ROOT . '/inc/adminfunctions_templates.php';
+
+ // update the version (so we don't try to upgrade next round)
+ SmileMenuCache::getInstance()->setVersion(SMILEMENU_VERSION);
+
+ // edit the templates
+ find_replace_templatesets('footer', '#^(.*?)$#s', '$1{$smAutocomplete}');
+}
+
+/**
+ *
+ *
+ * @return void
+ */
+function sm_deactivate()
+{
+ require_once MYBB_ROOT . '/inc/adminfunctions_templates.php';
+
+ find_replace_templatesets('footer', "#" . preg_quote('{$smAutocomplete}') . "#i", '');
+}
+
+/**
+ * delete setting group and settings, templates,
+ * and the style sheet
+ *
+ * undo MyAlerts integration and unset the cached version
+ *
+ * @return void
+ */
+function sm_uninstall()
+{
+ SmileMenuInstaller::getInstance()->uninstall();
+
+ SmileMenuCache::getInstance()->clear();
+}
+
+/**
+ * settings
+ */
+
+/**
+ * retrieves the plugin's settings group gid if it exists
+ * attempts to cache repeat calls
+ *
+ * @return int setting group id
+ */
+function smGetSettingsgroup()
+{
+ static $gid;
+
+ // if we have already stored the value
+ if (!isset($gid)) {
+ global $db;
+
+ // otherwise we will have to query the db
+ $query = $db->simple_select("settinggroups", "gid", "name='sm_settings'");
+ $gid = (int) $db->fetch_field($query, 'gid');
+ }
+ return $gid;
+}
+
+/**
+ * builds the URL to modify plugin settings if given valid info
+ *
+ * @param - $gid is an integer representing a valid settings group id
+ * @return string setting group URL
+ */
+function smBuildSettingsURL($gid)
+{
+ if ($gid) {
+ return 'index.php?module=config-settings&action=change&gid='.$gid;
+ }
+}
+
+/**
+ * builds a link to modify plugin settings if it exists
+ *
+ * @return setting group link HTML
+ */
+function smBuildSettingsLink()
+{
+ global $lang;
+
+ if (!$lang->sm) {
+ $lang->load('sm');
+ }
+
+ $gid = smGetSettingsgroup();
+
+ // does the group exist?
+ if ($gid) {
+ // if so build the URL
+ $url = smBuildSettingsURL($gid);
+
+ // did we get a URL?
+ if ($url) {
+ // if so build the link
+ return <<{$lang->sm_plugin_settings}
+EOF;
+ }
+ }
+ return false;
+}
+
+?>
diff --git a/Upload/inc/plugins/sm/install_data.php b/Upload/inc/plugins/sm/install_data.php
new file mode 100644
index 0000000..84228e9
--- /dev/null
+++ b/Upload/inc/plugins/sm/install_data.php
@@ -0,0 +1,220 @@
+ array(
+ 'group' => array(
+ 'name' => 'sm_settings',
+ 'title' => $lang->sm_plugin_settings_title,
+ 'description' => $lang->sm_settingsgroup_description,
+ 'disporder' => '102',
+ 'isdefault' => 0,
+ ),
+ 'settings' => array(
+ 'sm_max_items' => array(
+ 'sid' => '0',
+ 'name' => 'sm_max_items',
+ 'title' => $lang->sm_max_items_title,
+ 'description' => $lang->sm_max_items_description,
+ 'optionscode' => 'text',
+ 'value' => '5',
+ 'disporder' => '10',
+ ),
+ 'sm_min_width' => array(
+ 'sid' => '0',
+ 'name' => 'sm_min_width',
+ 'title' => $lang->sm_min_width_title,
+ 'description' => $lang->sm_min_width_description,
+ 'optionscode' => 'text',
+ 'value' => '120',
+ 'disporder' => '20',
+ ),
+ 'sm_full_text_search' => array(
+ 'sid' => '0',
+ 'name' => 'sm_full_text_search',
+ 'title' => $lang->sm_full_text_search_title,
+ 'description' => $lang->sm_full_text_search_description,
+ 'optionscode' => 'yesno',
+ 'value' => '0',
+ 'disporder' => '30',
+ ),
+ 'sm_lock_selection' => array(
+ 'sid' => '0',
+ 'name' => 'sm_lock_selection',
+ 'title' => $lang->sm_lock_selection_title,
+ 'description' => $lang->sm_lock_selection_description,
+ 'optionscode' => 'yesno',
+ 'value' => '1',
+ 'disporder' => '40',
+ ),
+ 'sm_minify_js' => array(
+ 'sid' => '0',
+ 'name' => 'sm_minify_js',
+ 'title' => $lang->sm_minify_js_title,
+ 'description' => $lang->sm_minify_js_desc,
+ 'optionscode' => 'yesno',
+ 'value' => '1',
+ 'disporder' => '50',
+ ),
+ )
+ )
+);
+
+$templates = array(
+ 'sm' => array(
+ 'group' => array(
+ 'prefix' => 'sm',
+ 'title' => $lang->sm,
+ ),
+ 'templates' => array(
+ 'sm_popup' => <<