function setupQuery($task, $blank_user = FALSE) { $mes = e107::getMessage(); $this->arrayData = array(); $xml = e107::getXml(); $file = $this->feedUrl; $mes->addDebug("rss_import::setupQuery - \$task: " . $task); $mes->addDebug("rss_import::setupQuery - \$file: " . $file); switch ($task) { case 'news': case 'page': case 'links': // $rawData = $xml->getRemoteFile($file); // print_a($rawData); $array = $xml->loadXMLfile($file, 'advanced'); // $mes->addDebug("rss - setupQuery - RSS array: ".print_a($array,true)); if ($array === FALSE || $file === FALSE) { $mes->addError("No data returned from : " . $file); return FALSE; } foreach ($array['channel']['item'] as $val) { $this->arrayData[] = $val; } $this->arrayData = array_reverse($this->arrayData); // most recent last. reset($this->arrayData); break; default: return FALSE; } $this->copyUserInfo = !$blank_user; $this->currentTask = $task; return TRUE; }
function setupQuery($task, $blank_user = FALSE) { $this->arrayData = array(); $xml = e107::getXml(); $file = $this->feedUrl; switch ($task) { case 'news': case 'page': case 'links': // $rawData = $xml->getRemoteFile($file); // print_a($rawData); $array = $xml->loadXMLfile($file, 'advanced'); if ($array === FALSE || $file === FALSE) { return FALSE; } foreach ($array['channel']['item'] as $val) { $this->arrayData[] = $val; } $this->arrayData = array_reverse($this->arrayData); // most recent last. reset($this->arrayData); break; default: return FALSE; } $this->copyUserInfo = !$blank_user; $this->currentTask = $task; return TRUE; }
public function releaseCheck($mode = 'plugin', $cache = TRUE) { global $e107cache; if (!$this->getOption('releaseUrl')) { return; } $cacheString = $mode . 'UpdateCheck'; $e107cache->CachePageMD5 = md5($cacheString . $this->getOption('curFolder') . $this->getOption('curVersion', 1.0)); if ($cache == TRUE && ($cacheData = $e107cache->retrieve($cacheString, 3600, TRUE))) { require_once e_HANDLER . "message_handler.php"; $emessage =& eMessage::getInstance(); $emessage->add($cacheData); $e107cache->CachePageMD5 = ""; return; } $xml = e107::getXml(); $feed = $this->getOption('releaseUrl'); if (substr($feed, -4) == ".php") { $feed .= "?folder=" . $this->getOption('curFolder') . "&version=" . $this->getOption('curVersion'); } if ($rawData = $xml->loadXMLfile($feed, TRUE)) { if (!$rawData[$mode][1]) { $rawData[$mode] = $rawData; } $txt = ""; $lan_text = $mode == "theme" ? ADLAN_162 : ADLAN_163; foreach ($rawData[$mode] as $val) { $name = $val['@attributes']['name']; $folder = $val['@attributes']['folder']; $version = $val['@attributes']['version']; $url = $val['@attributes']['url']; if ($folder == $this->getOption('curFolder') && version_compare($version, $this->getOption('curVersion')) == 1) { $txt .= $lan_text . " <a href='" . $url . "'>" . $name . " v" . $version . "</a><br />"; break; } } if ($txt) { require_once e_HANDLER . "message_handler.php"; $emessage =& eMessage::getInstance(); $emessage->add($txt); if ($cache == TRUE) { $e107cache->set($cacheString, $txt, TRUE); } $e107cache->CachePageMD5 = ""; } } }
function pluginOnline() { global $plugin; $tp = e107::getParser(); $frm = e107::getForm(); $caption = "Search Online"; $e107 = e107::getInstance(); $xml = e107::getXml(); $mes = e107::getMessage(); $mes->addWarning("This area is experimental and may produce unpredictable results."); $from = intval($_GET['frm']); // $file = SITEURLBASE.e_PLUGIN_ABS."release/release.php"; // temporary testing $file = "http://e107.org/feed?frm=" . $from; $xml->setOptArrayTags('plugin'); // make sure 'plugin' tag always returns an array $xdata = $xml->loadXMLfile($file, 'advanced'); $total = $xdata['@attributes']['total']; //TODO use admin_ui including filter capabilities by sending search queries back to the xml script. // XML data array. $c = 1; foreach ($xdata['plugin'] as $r) { $row = $r['@attributes']; $data[] = array('plugin_id' => $c, 'plugin_icon' => vartrue($row['icon'], e_IMAGE . "admin_images/plugins_32.png"), 'plugin_name' => $row['name'], 'plugin_folder' => $row['folder'], 'plugin_date' => vartrue($row['date']), 'plugin_category' => vartrue($r['category'][0]), 'plugin_author' => vartrue($row['author']), 'plugin_version' => $row['version'], 'plugin_description' => $tp->text_truncate(vartrue($r['description'][0]), 200), 'plugin_website' => vartrue($row['authorUrl']), 'plugin_url' => $row['url'], 'plugin_notes' => ''); $c++; } // print_a($data); $fieldList = $this->fields; unset($fieldList['plugin_checkboxes']); $text = "\n\t\t\t<form action='" . e_SELF . "?" . e_QUERY . "' id='core-plugin-list-form' method='post'>\n\t\t\t\t<fieldset id='core-plugin-list'>\n\t\t\t\t\t<legend class='e-hideme'>" . $caption . "</legend>\n\t\t\t\t\t<table class='table adminlist'>\n\t\t\t\t\t\t" . $frm->colGroup($fieldList, $this->fieldpref) . $frm->thead($fieldList, $this->fieldpref) . "\n\t\t\t\t\t\t<tbody>\n\t\t"; foreach ($data as $key => $val) { // print_a($val); $text .= "<tr>"; foreach ($this->fields as $v => $foo) { if (!in_array($v, $this->fieldpref) || $v == 'plugin_checkboxes') { continue; } // echo '<br />v='.$v; $text .= "<td class='" . vartrue($this->fields[$v]['class'], 'left') . "'>" . $frm->renderValue($v, $val[$v], $this->fields[$v]) . "</td>\n"; } $text .= "<td class='center'>" . $this->options($val) . "</td>"; $text .= "</tr>"; } $text .= "\n\t\t\t\t\t\t</tbody>\n\t\t\t\t\t</table>"; $text .= "\n\t\t\t\t</fieldset>\n\t\t\t</form>\n\t\t"; $amount = 30; if ($total > $amount) { $parms = $total . "," . $amount . "," . $from . "," . e_SELF . '?mode=' . $_GET['mode'] . '&frm=[FROM]'; $text .= "<div style='text-align:center;margin-top:10px'>" . $tp->parseTemplate("{NEXTPREV={$parms}}", TRUE) . "</div>"; } e107::getRender()->tablerender(ADLAN_98 . " :: " . $caption, $mes->render() . $text); }
public function import_configuration() { $this->logLine('Starting configuration import'); // PRE-CONFIG start - create and register blank config instances - do not load! $config_aliases = array('core', 'core_backup', 'emote', 'menu', 'search', 'notify'); foreach ($config_aliases as $alias) { e107::getConfig($alias, false)->clearPrefCache(); } // PRE-CONFIG end // Basic stuff to get the handlers/classes to work. // $udirs = "admin/|plugins/|temp"; // $e_SELF = $_SERVER['PHP_SELF']; // $e_HTTP = preg_replace("#".$udirs."#i", "", substr($e_SELF, 0, strrpos($e_SELF, "/"))."/"); //define("MAGIC_QUOTES_GPC", (ini_get('magic_quotes_gpc') ? true : false)); // define('CHARSET', 'utf-8'); // define("e_LANGUAGE", $this->previous_steps['language']); // define('e_SELF', 'http://'.$_SERVER['HTTP_HOST']) . ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_FILENAME']); $themeImportFile = array(); $themeImportFile[0] = $this->e107->e107_dirs['THEMES_DIRECTORY'] . $this->previous_steps['prefs']['sitetheme'] . "/install.xml"; $themeImportFile[1] = $this->e107->e107_dirs['THEMES_DIRECTORY'] . $this->previous_steps['prefs']['sitetheme'] . "/install/install.xml"; $themeImportFile[3] = $this->e107->e107_dirs['CORE_DIRECTORY'] . "xml/default_install.xml"; if (vartrue($this->previous_steps['generate_content'])) { foreach ($themeImportFile as $file) { if (is_readable($file)) { $XMLImportfile = $file; break; } } } else { $XMLImportfile = $this->e107->e107_dirs['CORE_DIRECTORY'] . "xml/default_install.xml"; } $tp = e107::getParser(); define('PREVIEWTHEMENAME', ""); // Notice Removal. include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'] . $this->previous_steps['language'] . "/lan_prefs.php"); include_lan($this->e107->e107_dirs['LANGUAGES_DIRECTORY'] . $this->previous_steps['language'] . "/admin/lan_theme.php"); //should be 'add' not 'replace' - but 'add' doesn't insert arrays correctly. // [SecretR] should work now - fixed log errors (argument noLogs = true) change to false to enable log e107::getXml()->e107Import($XMLImportfile, 'add', true, false); // Add missing core pref values $this->logLine('Core prefs written'); //Create default plugin-table entries. // e107::getConfig('core')->clearPrefCache(); e107::getPlugin()->update_plugins_table(); $this->logLine('Plugins table updated'); // Install Theme-required plugins if (vartrue($this->previous_steps['install_plugins'])) { if ($themeInfo = $this->get_theme_xml($this->previous_steps['prefs']['sitetheme'])) { if (isset($themeInfo['plugins']['plugin'])) { foreach ($themeInfo['plugins']['plugin'] as $k => $plug) { $this->install_plugin($plug['@attributes']['name']); $this->logLine('Theme-related plugin installed: ' . $plug['@attributes']['name']); } } } } // Media import /* e107::getMedia()->import('news',e_IMAGE.'newspost_images/') //TODO remove when news are pluginized ->import('page',e_IMAGE.'custom/') //TODO remove when pages are pluginized // ->importIcons(e_PLUGIN) - icons for plugins are imported on install ->importIcons(e_IMAGE."icons/") ->importIcons(e_THEME.$this->previous_steps['prefs']['sitetheme']."/images/") ->importIcons(e_THEME.$this->previous_steps['prefs']['sitetheme']."/icons/"); $this->logLine('Media imported to media manager'); */ e107::getSingleton('e107plugin')->save_addon_prefs(); // save plugin addon pref-lists. eg. e_latest_list. $this->logLine('Addon prefs saved'); $tm = e107::getSingleton('themeHandler'); $tm->noLog = true; // false to enable log $tm->setTheme($this->previous_steps['prefs']['sitetheme']); // Admin log fix - don't allow logs to be called inside pref handler e107::getConfig('core')->setParam('nologs', false); // change to true to enable log $pref = e107::getConfig('core')->getPref(); // Set Preferences defined during install - overwriting those that may exist in the XML. $this->previous_steps['prefs']['sitelanguage'] = $this->previous_steps['language']; $this->previous_steps['prefs']['sitelang_init'] = $this->previous_steps['language']; $this->previous_steps['prefs']['siteadmin'] = $this->previous_steps['admin']['display']; $this->previous_steps['prefs']['siteadminemail'] = $this->previous_steps['admin']['email']; $this->previous_steps['prefs']['install_date'] = time(); $this->previous_steps['prefs']['siteurl'] = e_HTTP; $this->previous_steps['prefs']['sitetag'] = LAN_PREF_2; $this->previous_steps['prefs']['sitedisclaimer'] = LAN_PREF_3; $this->previous_steps['prefs']['replyto_name'] = $this->previous_steps['admin']['display']; $this->previous_steps['prefs']['replyto_email'] = $this->previous_steps['admin']['email']; // Cookie name fix, ended up with 406 error when non-latin words used $cookiename = preg_replace('/[^a-z0-9]/i', '', trim($this->previous_steps['prefs']['sitename'])); $this->previous_steps['prefs']['cookie_name'] = ($cookiename ? substr($cookiename, 0, 4) . '_' : 'e_') . 'cookie'; ### URL related prefs // set all prefs so that they are available, required for adminReadModules() - it checks which plugins are installed e107::getConfig('core')->setPref($this->previous_steps['prefs']); $url_modules = eRouter::adminReadModules(); $url_locations = eRouter::adminBuildLocations($url_modules); $url_config = eRouter::adminBuildConfig(array(), $url_modules); $this->previous_steps['prefs']['url_aliases'] = array(); $this->previous_steps['prefs']['url_config'] = $url_config; $this->previous_steps['prefs']['url_modules'] = $url_modules; $this->previous_steps['prefs']['url_locations'] = $url_locations; eRouter::clearCache(); $this->logLine('Core URL config set to default state'); // Set prefs, save e107::getConfig('core')->setPref($this->previous_steps['prefs']); e107::getConfig('core')->save(FALSE, TRUE); // save preferences made during install. $this->logLine('Core prefs set to install choices'); // Create the admin user - replacing any that may be been included in the XML. $ip = $_SERVER['REMOTE_ADDR']; $userp = "1, '{$this->previous_steps['admin']['display']}', '{$this->previous_steps['admin']['user']}', '', '" . md5($this->previous_steps['admin']['password']) . "', '', '{$this->previous_steps['admin']['email']}', '', '', 0, " . time() . ", 0, 0, 0, 0, 0, '{$ip}', 0, '', 0, 1, '', '', '0', '', " . time() . ", ''"; $qry = "REPLACE INTO {$this->previous_steps['mysql']['prefix']}user VALUES ({$userp})"; $this->dbqry("REPLACE INTO {$this->previous_steps['mysql']['prefix']}user VALUES ({$userp})"); $this->logLine('Admin user created'); mysql_close($this->dbLink); return false; }
/** * Get array of file types (file extensions) which are permitted - reads an XML-formatted definition file. * (Similar to @See{get_allowed_filetypes()}, but expects an XML file) * * @param string $def_file - name of an XML-formatted file, which is sought in the E_ADMIN directory * @param string $file_mask - comma-separated list of allowed file types - only those specified in both $file_mask and $def_file are returned * * @return array - where key is the file type (extension); value is max upload size */ function get_XML_filetypes($def_file = FALSE, $file_mask = '') { $ret = array(); if ($def_file === FALSE) { return $ret; } if ($file_mask) { $file_array = explode(',', $file_mask); foreach ($file_array as $k => $f) { $file_array[$k] = trim($f); } } if ($def_file && is_readable(e_SYSTEM . $def_file)) { $xml = e107::getXml(); // class tag should be always array $xml->setOptArrayTags('class'); $temp_vars = $xml->loadXMLfile(e_SYSTEM . $def_file, 'filetypes', false); if ($temp_vars === FALSE) { echo "Error reading XML file: {$def_file}<br />"; return $ret; } foreach ($temp_vars['class'] as $v1) { $v = $v1['@attributes']; if (check_class($v['name'])) { $current_perms[$v['name']] = array('type' => $v['type'], 'maxupload' => $v['maxupload']); $a_filetypes = explode(',', $v['type']); foreach ($a_filetypes as $ftype) { $ftype = strtolower(trim(str_replace('.', '', $ftype))); // File extension if (!$file_mask || in_array($ftype, $file_array)) { // We can load this extension if (isset($ret[$ftype])) { $ret[$ftype] = file_size_decode($v['maxupload'], $ret[$ftype], 'gt'); // Use largest value } else { $ret[$ftype] = file_size_decode($v['maxupload']); } } } } } } return $ret; }
function parse_plugin_xml($plugName, $where = null) { $tp = e107::getParser(); // loadLanFiles($plugName, 'admin'); // Look for LAN files on default paths $xml = e107::getXml(); $mes = e107::getMessage(); // $xml->setOptArrayTags('extendedField,userclass,menuLink,commentID'); // always arrays for these tags. // $xml->setOptStringTags('install,uninstall,upgrade'); if (null === $where) { $where = 'plugin.xml'; } $this->plug_vars = $xml->loadXMLfile(e_PLUGIN . $plugName . '/' . $where, 'advanced'); if ($this->plug_vars === FALSE) { $mes->addError("Error reading {$plugName}/plugin.xml"); return FALSE; } $this->plug_vars['category'] = isset($this->plug_vars['category']) ? $this->manage_category($this->plug_vars['category']) : "misc"; $this->plug_vars['folder'] = $plugName; // remove the need for <folder> tag in plugin.xml. if (varset($this->plug_vars['description'])) { if (is_array($this->plug_vars['description'])) { if (isset($this->plug_vars['description']['@attributes']['lan']) && defined($this->plug_vars['description']['@attributes']['lan'])) { // Pick up the language-specific description if it exists. $this->plug_vars['description']['@value'] = constant($this->plug_vars['description']['@attributes']['lan']); } } else { $diz = $this->plug_vars['description']; unset($this->plug_vars['description']); $this->plug_vars['description']['@value'] = $diz; } } // Very useful debug code.to compare plugin.php vs plugin.xml /* $testplug = 'forum'; if($plugName == $testplug) { $plug_vars1 = $this->plug_vars; $this->parse_plugin_php($testplug); $plug_vars2 = $this->plug_vars; ksort($plug_vars2); ksort($plug_vars1); echo "<table> <tr><td><h1>PHP</h1></td><td><h1>XML</h1></td></tr> <tr><td style='border-right:1px solid black'>"; print_a($plug_vars2); echo "</td><td>"; print_a($plug_vars1); echo "</table>"; } */ // TODO search for $this->plug_vars['adminLinks']['link'][0]['@attributes']['primary']==true. $this->plug_vars['administration']['icon'] = varset($this->plug_vars['adminLinks']['link'][0]['@attributes']['icon']); $this->plug_vars['administration']['caption'] = varset($this->plug_vars['adminLinks']['link'][0]['@attributes']['description']); $this->plug_vars['administration']['iconSmall'] = varset($this->plug_vars['adminLinks']['link'][0]['@attributes']['iconSmall']); $this->plug_vars['administration']['configFile'] = varset($this->plug_vars['adminLinks']['link'][0]['@attributes']['url']); return TRUE; }
function available_langpacks() { $xml = e107::getXml(); $feed = e107::getPref('xmlfeed_languagepacks'); $text = ''; if ($rawData = $xml->loadXMLfile($feed, TRUE)) { if (!varset($rawData['language'])) { return FALSE; } $text .= "<div class='block-text'>" . LANG_LAN_35 . "</div>"; $text .= "<table class='table adminlist'>"; foreach ($rawData['language'] as $val) { $att = $val['@attributes']; $name = $att['folder']; $languages[$name] = array('name' => $att['name'], 'author' => $att['author'], 'authorURL' => $att['authorURL'], 'folder' => $att['folder'], 'version' => $att['version'], 'date' => $att['date'], 'compatibility' => $att['compatibility'], 'url' => $att['url']); } ksort($languages); $text .= "<thead>\n\t\t<tr>\n\t\t<th>" . LANG_LAN_108 . "</th>\n\t\t<th>" . LANG_LAN_109 . "</th>\n\t\t<th>" . LANG_LAN_110 . "</th>\n\t\t<th>" . LANG_LAN_111 . "</th>\n\t\t<th>" . LANG_LAN_112 . "</th>\n\t\t<th>" . LANG_LAN_113 . "</th>\n\t\t</tr>\n\t\t</thead>\n\t\t<tbody>"; foreach ($languages as $value) { $text .= "<tr>\n\t\t\t\t<td>" . $value['name'] . "</td>\n\t\t\t\t<td>" . $value['version'] . "</td>\n\t\t\t\t<td><a href='" . $value['authorURL'] . "'>" . $value['author'] . "</a></td>\n\t\t\t\t<td>" . $value['date'] . "</td>\n\t\t\t\t<td>" . $value['compatibility'] . "</td>\n\t\t\t\t\n\t\t\t\t<td><a href='" . $value['url'] . "'>" . LANG_LAN_114 . "</a></td>\n\t\t\t\t</tr>"; } $text .= "</tbody></table>"; return $text; } }
function pluginXml() { //TODO Plugin.xml Form Fields. . $data = array('main' => array('name', 'lang', 'version', 'date', 'compatibility'), 'author' => array('name', 'url'), 'summary' => array('summary'), 'description' => array('description'), 'keywords' => array('one', 'two'), 'category' => array('category'), 'copyright' => array('copyright')); // Load old plugin.php file if it exists; $legacyFile = e_PLUGIN . $this->pluginName . "/plugin.php"; if (file_exists($legacyFile)) { $eplug_name = $eplug_author = $eplug_url = $eplug_description = ""; $eplug_tables = array(); require_once $legacyFile; $mes = e107::getMessage(); $mes->addInfo("Loading plugin.php file"); $defaults = array("main-name" => $eplug_name, "author-name" => $eplug_author, "author-url" => $eplug_url, "description-description" => $eplug_description, "summary-summary" => $eplug_description); if (count($eplug_tables) && !file_exists(e_PLUGIN . $this->pluginName . "/" . $this->pluginName . "_sql.php")) { $cont = ''; foreach ($eplug_tables as $tab) { if (strpos($tab, "INSERT INTO") !== FALSE) { continue; } $cont .= "\n" . str_replace("\t", " ", $tab); } if (file_put_contents(e_PLUGIN . $this->pluginName . "/" . $this->pluginName . "_sql.php", $cont)) { $info = str_replace('[x]', $this->pluginName . "_sql.php", EPL_ADLAN_132); $mes->addInfo($info, 'default', true); $red = e107::getRedirect(); $red->redirect(e_REQUEST_URL, true); // $red->redirect(e_SELF."?mode=create&newplugin=".$this->pluginName."&createFiles=1&step=2",true); } else { $msg = str_replace('[x]', $this->pluginName . "_sql.php", EPL_ADLAN_133) . "<br />"; $msg .= str_replace(array('[x]', '[y]'), array($this->pluginName . "_sql.php", $cont), EPL_ADLAN_134); $mes->addWarning($msg); } } } $existingXml = e_PLUGIN . $this->pluginName . "/plugin.xml"; if (file_exists($existingXml)) { $p = e107::getXml()->loadXMLfile($existingXml, true); // print_a($p); $defaults = array("main-name" => varset($p['@attributes']['name']), "author-name" => varset($p['author']['@attributes']['name']), "author-url" => varset($p['author']['@attributes']['url']), "description-description" => varset($p['description']), "summary-summary" => varset($p['summary'], $p['description']), "category-category" => varset($p['category']), "keywords-one" => varset($p['keywords']['word'][0]), "keywords-two" => varset($p['keywords']['word'][1])); unset($p); } $text = "<table class='table adminform'>"; foreach ($data as $key => $val) { $text .= "<tr><td>{$key}</td><td>\n\t\t\t\t<div class='controls'>"; foreach ($val as $type) { $nm = $key . '-' . $type; $name = "xml[{$nm}]"; $size = count($val) == 1 ? 'span7 col-md-7' : 'span2 col-md-2'; $text .= "<div class='{$size}'>" . $this->xmlInput($name, $key . "-" . $type, vartrue($defaults[$nm])) . "</div>"; } $text .= "</div></td></tr>"; } $text .= "</table>"; return $text; }
exit; } if (ADMIN && e_AJAX_REQUEST && varset($_GET['mode']) == 'addons') { $type = $_GET['type'] == 'plugin' ? 'plugin' : 'theme'; $tag = 'infopanel_' . $type; $cache = e107::getCache(); $cache->setMD5('_'); if ($text = $cache->retrieve($tag, 180, true)) { echo $text; if (e_DEBUG === true) { echo "<span class='label label-warning'>Cached</span>"; } exit; } if ($data = e107::getXml()->getRemoteFile('http://e107.org/feed/?limit=3&type=' . $type, 3)) { $rows = e107::getXml()->parseXml($data, 'advanced'); // print_a($rows); // exit; $link = $type == 'plugin' ? e_ADMIN . "plugin.php?mode=online" : e_ADMIN . "theme.php?mode=online"; $text = "<div style='margin-top:10px'>"; foreach ($rows[$type] as $val) { $meta = $val['@attributes']; $img = $type == 'theme' ? $meta['thumbnail'] : $meta['icon']; $text .= '<div class="media">'; $text .= '<div class="media-left"> <a href="' . $link . '"> <img class="media-object img-rounded" src="' . $img . '" style="width:100px"> </a> </div> <div class="media-body"> <h4 class="media-heading"><a href="' . $link . '">' . $meta['name'] . ' v' . $meta['version'] . '</a> <small>— ' . $meta['author'] . '</small></h4>
/** * Burnsy - This is just a test * */ function checkCoreUpdate() { // Check if there's a core e107 update available // Get site version if (is_readable(e_ADMIN . "ver.php")) { include e_ADMIN . "ver.php"; // $e107info['e107_version']; } else { // Find alternate way to get local site version or throw an error } // Check for updates for currently installed version $localVersion = (int) $e107info['e107_version']; switch ($localVersion) { case 0: // Local version is <= 0.7 // Run update routine for 0.x break; case 1: // Local version is == 1.x // Run update routine for 1.x break; case 2: // Local version is == 2.x // Run update routine for 2.x // Get newest available release version $xml = e107::getXml(); $file = "http://e107.org/releases.php?mode=2"; $xdata = $xml->loadXMLfile($file, true, false); // Check for update if ($e107info['e107_version'] < $xdata['core']['@attributes']['version']) { // If there is a new version of e107 available, notify Site Admin by email, make a log entry, and notify Admin in Admin Area, $versionTest = false $pref = e107::getPref(); require_once e_HANDLER . 'mail.php'; $message = "There is a new version of e107 available. Please visit http://www.e107.org for further details."; sendemail($pref['siteadminemail'], "e107 - Update(s) Available For " . $pref['sitename'], $message, $pref['siteadmin'], $pref['siteadminemail'], $pref['siteadmin']); // Add entry to the log e107::getAdminLog()->add("Update(s) Available", "There is a new version of e107 available. Please visit http://www.e107.org for further details.", 3); $versionTest = $xdata['core']['@attributes']['version']; } else { // If there is not a new version of e107 available, $versionTest = false $versionTest = false; } break; } //$versionTest = "{CHECK THE VERSION}"; // If out of date, return some text, if up-to-date , return false; $che = e107::getCache(); $che->setMD5(e_LANGUAGE); if ($versionTest) { $che->set("releasecheck", $versionTest, TRUE); return $versionTest; // e107::getMessage()=>addInfo($versionTest); } else { $che->set("releasecheck", 'false', TRUE); return false; } }
function preview() { $file = $this->feedUrl; $array = e107::getXml()->loadXMLfile($file, 'advanced'); // print_a($array); // raw xml data; foreach ($array['channel']['item'] as $src) { // $data = $this->process('description', $src); // $this->process('sef',$src); $data = $this->copyNewsData($target, $src); print_a($data); } }
function parse_theme_xml($path) { $tp = e107::getParser(); $xml = e107::getXml(); // loadLanFiles($path, 'admin'); // Look for LAN files on default paths // layout should always be an array. $xml->setOptArrayTags('layout'); $xml->setOptStringTags('menuPresets,customPages'); $vars = $xml->loadXMLfile(e_THEME . $path . '/theme.xml', true, true); $vars['name'] = varset($vars['@attributes']['name']); $vars['version'] = varset($vars['@attributes']['version']); $vars['date'] = varset($vars['@attributes']['date']); $vars['compatibility'] = varset($vars['@attributes']['compatibility']); $vars['releaseUrl'] = varset($vars['@attributes']['releaseUrl']); $vars['email'] = varset($vars['author']['@attributes']['email']); $vars['website'] = varset($vars['author']['@attributes']['url']); $vars['author'] = varset($vars['author']['@attributes']['name']); $vars['info'] = varset($vars['description']); $vars['category'] = $this->getThemeCategory(varset($vars['category'])); $vars['xhtmlcompliant'] = varset($vars['compliance']['@attributes']['xhtml']); $vars['csscompliant'] = varset($vars['compliance']['@attributes']['css']); $vars['path'] = $path; $vars['@attributes']['default'] = varset($vars['@attributes']['default']) && strtolower($vars['@attributes']['default']) == 'true' ? 1 : 0; unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description']); // Compile layout information into a more usable format. $custom = array(); foreach ($vars['layouts'] as $layout) { foreach ($layout as $key => $val) { $name = $val['@attributes']['name']; unset($val['@attributes']['name']); $lays[$name] = $val; if (isset($val['customPages'])) { $custom[$name] = array_filter(explode(" ", $val['customPages'])); } } } $vars['layouts'] = $lays; $vars['path'] = $path; $vars['custompages'] = $custom; /* $mes = e107::getMessage(); if($path == "bootstrap") { $mes->addDebug("<h2>".$path."</h2>"); $mes->addDebug(print_a($vars,true)); $mes->addDebug("<hr />"); } */ return $vars; }
// echo "Key: {$k} Class: {$c} Delete: {$_POST['file_line_delete'][$k]} List: {$_POST['file_type_list'][$k]} Size: {$_POST['file_maxupload'][$k]}<br />"; $file_text .= " <class name='{$c}' type='{$_POST['file_type_list'][$k]}' maxupload='" . vartrue($_POST['file_maxupload'][$k], ini_get('upload_max_filesize')) . "' />\n"; } } $file_text .= "</e107Filetypes>\n"; if (($handle = fopen(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES, 'wt')) == FALSE || fwrite($handle, $file_text) == FALSE || fclose($handle) == FALSE) { $text = UPLLAN_61 . e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES; } else { $text = ''; $text .= '<br />' . UPLLAN_59 . e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES . '. ' . UPLLAN_60 . e_ADMIN . e_READ_FILETYPES . '<br />'; } $ns->tablerender(LAN_FILETYPES, $text); } $current_perms = array(); if ($edit_upload_list && is_readable(e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES) || !$edit_upload_list && is_readable(e_ADMIN . e_READ_FILETYPES)) { $xml = e107::getXml(); $source_file = $edit_upload_list ? e_UPLOAD_TEMP_DIR . e_SAVE_FILETYPES : e_ADMIN . e_READ_FILETYPES; $temp_vars = $xml->loadXMLfile($source_file, true, false); if ($temp_vars === FALSE) { echo "Error parsing XML file!"; } else { foreach ($temp_vars['class'] as $v1) { $v = $v1['@attributes']; $current_perms[$v['name']] = array('type' => $v['type'], 'maxupload' => $v['maxupload']); } } } elseif (is_readable(e_ADMIN . 'filetypes.php')) { $source_file = 'filetypes.php'; $current_perms[e_UC_MEMBER] = array('type' => implode(',', array_keys(get_allowed_filetypes('filetypes.php', ''))), 'maxupload' => '2M'); if (is_readable(e_ADMIN . 'admin_filetypes.php')) { $current_perms[e_UC_ADMIN] = array('type' => implode(',', array_keys(get_allowed_filetypes('admin_filetypes.php', ''))), 'maxupload' => '2M');
function parse_theme_xml($path) { $tp = e107::getParser(); $xml = e107::getXml(); // loadLanFiles($path, 'admin'); // Look for LAN files on default paths // layout should always be an array. $xml->setOptArrayTags('layout,screenshots/image'); $xml->setOptStringTags('menuPresets,customPages,custompages'); // $vars = $xml->loadXMLfile(e_THEME.$path.'/theme.xml', true, true); // $oldvars = $vars = $xml->loadXMLfile(e_THEME . $path . '/theme.xml', 'advanced', true); // must be 'advanced' if ($path == "bootstrap3") { // echo "<table class='table table-bordered'> // <tr><th>old</th><th>new parser</th></tr> // <tr><td>".print_a($oldvars,true)."</td><td>".print_a($vars,true)."</td></tr></table>"; } $vars['name'] = varset($vars['@attributes']['name']); $vars['version'] = varset($vars['@attributes']['version']); $vars['date'] = varset($vars['@attributes']['date']); $vars['compatibility'] = varset($vars['@attributes']['compatibility']); $vars['releaseUrl'] = varset($vars['@attributes']['releaseUrl']); $vars['email'] = varset($vars['author']['@attributes']['email']); $vars['website'] = varset($vars['author']['@attributes']['url']); $vars['author'] = varset($vars['author']['@attributes']['name']); $vars['info'] = varset($vars['description']); $vars['category'] = $this->getThemeCategory(varset($vars['category'])); $vars['xhtmlcompliant'] = varset($vars['compliance']['@attributes']['xhtml']); $vars['csscompliant'] = varset($vars['compliance']['@attributes']['css']); $vars['path'] = $path; $vars['@attributes']['default'] = varset($vars['@attributes']['default']) && strtolower($vars['@attributes']['default']) == 'true' ? 1 : 0; $vars['preview'] = varset($vars['screenshots']['image']); $vars['thumbnail'] = varset($vars['preview'][0]); if (!empty($vars['themePrefs'])) { foreach ($vars['themePrefs']['pref'] as $k => $val) { $name = $val['@attributes']['name']; $vars['preferences'][$name] = $val['@value']; } } unset($vars['authorEmail'], $vars['authorUrl'], $vars['xhtmlCompliant'], $vars['cssCompliant'], $vars['description'], $vars['screenshots']); // Compile layout information into a more usable format. $custom = array(); /* foreach ($vars['layouts'] as $layout) { foreach ($layout as $key=>$val) { $name = $val['@attributes']['name']; unset($val['@attributes']['name']); $lays[$name] = $val; if(isset($val['customPages'])) { $cusArray = explode(" ", $val['customPages']); $custom[$name] = array_filter($cusArray); } if(isset($val['custompages'])) { $cusArray = explode(" ", $val['custompages']); $custom[$name] = array_filter(explode(" ", $val['custompages'])); } } } */ foreach ($vars['layouts']['layout'] as $k => $val) { $name = $val['@attributes']['name']; unset($val['@attributes']['name']); $lays[$name] = $val; if (isset($val['custompages'])) { if (is_string($val['custompages'])) { $custom[$name] = array_filter(explode(" ", $val['custompages'])); } elseif (is_array($val['custompages'])) { $custom[$name] = $val['custompages']; } } } $vars['layouts'] = $lays; $vars['path'] = $path; $vars['custompages'] = $custom; if (vartrue($vars['stylesheets']['css'])) { $vars['css'] = array(); foreach ($vars['stylesheets']['css'] as $val) { $notadmin = vartrue($val['@attributes']['admin']) ? false : true; $vars['css'][] = array("name" => $val['@attributes']['file'], "info" => $val['@attributes']['name'], "nonadmin" => $notadmin, 'scope' => $val['@attributes']['scope']); } unset($vars['stylesheets']); } // $mes = e107::getMessage(); // DEBUG if ($path == "leasure") { // $mes->addDebug("<h2>".$path."</h2>"); // $mes->addDebug(print_a($vars,true)); // $mes->addDebug("<hr />"); } if ($path == "bootstrap3") { // print_a($vars); // echo "<table class='table'><tr><td>".print_a($vars,true)."</td><td>".print_a($adv,true)."</td></tr></table>"; } return $vars; }
function sc_admin_update() { if (!ADMIN) { return ''; } global $e107cache, $ns, $pref; if (!varset($pref['check_updates'], FALSE)) { return ''; } if (is_readable(e_ADMIN . 'ver.php')) { include e_ADMIN . 'ver.php'; } $feed = "http://sourceforge.net/export/rss2_projfiles.php?group_id=63748&rss_limit=5"; $e107cache->CachePageMD5 = md5($e107info['e107_version']); if ($cacheData = $e107cache->retrieve('updatecheck', 3600, TRUE)) { return $ns->tablerender(LAN_NEWVERSION, $cacheData); } // Don't check for updates if running locally (comment out the next line to allow check - but // remember it can cause delays/errors if its not possible to access the Internet if (strpos(e_SELF, 'localhost') !== FALSE || strpos(e_SELF, '127.0.0.1') !== FALSE) { return ''; } $xml = e107::getXml(); require_once e_HANDLER . "magpie_rss.php"; $ftext = ''; if ($rawData = $xml->getRemoteFile($feed)) { $rss = new MagpieRSS($rawData); list($cur_version, $tag) = explode(" ", $e107info['e107_version']); $c = 0; foreach ($rss->items as $val) { $search = array(strstr($val['title'], '('), 'e107', 'released', ' v'); $version = trim(str_replace($search, '', $val['title'])); if (version_compare($version, $cur_version) == 1) { $ftext = "<a rel='external' href='" . $val['link'] . "' >e107 v" . $version . "</a><br />\n"; break; } $c++; } } else { // Error getting data $ftext = ADLAN_154; } $e107cache->set('updatecheck', $ftext, TRUE); if ($ftext) { return $ns->tablerender(LAN_NEWVERSION, $ftext); } }
function getConfig($config = FALSE) { if (getperms('0')) { $template = "mainadmin.xml"; } elseif (ADMIN) { $template = "admin.xml"; } elseif (USER) { $template = "member.xml"; } else { $template = "public.xml"; } $config = e107::getXml()->loadXMLfile(e_PLUGIN . "tinymce/templates/" . $template, true); //TODO System and theme folder checks for overrides. //TODO Cache! $plug_array = explode(",", $config['tinymce_plugins']); $this->configName = $config['tinymce_name']; $this->config = array('language' => $this->tinymce_lang(), 'mode' => 'specific_textareas', 'editor_selector' => 'e-wysiwyg', 'editor_deselector' => 'e-wysiwyg-off', 'theme' => 'advanced', 'plugins' => $this->filter_plugins($config['tinymce_plugins'])); $this->config += array('theme_advanced_buttons1' => $config['tinymce_buttons1'], 'theme_advanced_buttons2' => vartrue($config['tinymce_buttons2']), 'theme_advanced_buttons3' => vartrue($config['tinymce_buttons3']), 'theme_advanced_buttons4' => vartrue($config['tinymce_buttons4']), 'theme_advanced_toolbar_location' => vartrue($config['theme_advanced_toolbar_location'], 'top'), 'theme_advanced_toolbar_align' => 'left', 'theme_advanced_blockformats' => 'p,h2,h3,blockquote,code', 'dialog_type' => "modal", 'theme_advanced_resizing' => 'false', 'remove_linebreaks' => 'true', 'extended_valid_elements' => vartrue($config['extended_valid_elements']), 'apply_source_formatting' => 'false', 'invalid_elements' => 'p,font,align,script,applet', 'auto_cleanup_word' => 'true', 'cleanup' => 'true', 'convert_fonts_to_spans' => 'true', 'trim_span_elements' => 'true', 'inline_styles' => 'true', 'auto_resize' => 'false', 'debug' => 'false', 'force_br_newlines' => 'true', 'media_strict' => 'false', 'width' => vartrue($config['width'], '100%'), 'convert_newlines_to_brs' => 'true', 'entity_encoding' => 'raw', 'convert_fonts_to_styles' => 'true', 'remove_script_host' => 'true', 'relative_urls' => 'true', 'preformatted' => 'true', 'document_base_url' => SITEURL, 'theme_advanced_styles' => 'border=border;fborder=fborder;tbox=tbox;caption=caption;fcaption=fcaption;forumheader=forumheader;forumheader3=forumheader3', 'verify_css_classes' => 'false'); $this->config['cleanup_callback'] = 'tinymce_e107Paths'; $paste_plugin = strpos($config['tinymce_plugins'], 'paste') !== FALSE ? TRUE : FALSE; if ($paste_plugin) { $this->config += array('paste_text_sticky' => 'true', 'paste_text_sticky_default' => 'true', 'paste_text_linebreaktype' => 'br', 'remove_linebreaks' => 'false', 'paste_create_paragraphs' => 'false', 'paste_create_linebreaks' => 'true', 'paste_use_dialog' => 'true', 'paste_auto_cleanup_on_paste' => 'true', 'paste_convert_middot_lists' => 'false', 'paste_unindented_list_class' => 'unindentedList', 'paste_convert_headers_to_strong' => 'true', 'paste_insert_word_content_callback' => 'convertWord', 'auto_cleanup_word' => 'true'); } if (ADMIN) { $this->config['external_link_list_url'] = e_PLUGIN_ABS . "tiny_mce/filelist.php"; } }
function parse_extended_xml($contents, $no_cache = FALSE) { if ($no_cache == FALSE && $this->extended_xml) { return $this->extended_xml; } $xml = e107::getXml(); $data = $xml->loadXMLfile(e_CORE . "xml/user_extended.xml", true); $ret['version'] = $data['@attributes']['version']; unset($info); foreach ($data['item'] as $item) { if (is_array($item['include_text']) && !count($item['include_text'])) { $item['include_text'] = ''; } $info = array("name" => $item['@attributes']['name'], "text" => "UE_LAN_" . strtoupper($item['@attributes']['name']), "type" => $item['type'], "values" => $item['values'], "default" => $item['default'], "required" => $item['required'], "read" => $item['read'], "write" => $item['write'], "applicable" => $item['applicable'], "include_text" => $item['include_text'], "parms" => $item['include_text'], "regex" => $item['regex']); if (is_array($item['default']) && $item['default'] == '') { $info['default'] = 0; } if ($item['regex']) { $info['parms'] .= $item['include_text'] . "^,^" . $item['regex'] . "^,^LAN_UE_FAIL_" . strtoupper($item['@attributes']['name']); } $ret[$item['@attributes']['name']] = $info; } $this->extended_xml = $ret; return $this->extended_xml; }
private function multiSiteProcess() { $sql = e107::getDb('new'); $mes = e107::getMessage(); $user = $_POST['name']; $pass = $_POST['password']; $server = e107::getMySQLConfig('server'); // $_POST['server']; $database = $_POST['db']; $prefix = $_POST['prefix']; if ($connect = $sql->connect($server, $user, $pass, true)) { $mes->addSuccess(DBLAN_74); if (vartrue($_POST['createdb'])) { if ($sql->gen("CREATE DATABASE " . $database . " CHARACTER SET `utf8`")) { $mes->addSuccess(DBLAN_75); // $sql->gen("CREATE USER ".$user."@'".$server."' IDENTIFIED BY '".$pass."';"); $sql->gen("GRANT ALL ON `" . $database . "`.* TO " . $user . "@'" . $server . "';"); $sql->gen("FLUSH PRIVILEGES;"); } else { $mes->addError(DBLAN_75); return; } } if (!$sql->database($database)) { $mes->addError(DBLAN_76); } $mes->addSuccess(DBLAN_76); if ($this->multiSiteCreateTables($sql, $prefix)) { $coreConfig = e_CORE . "xml/default_install.xml"; $ret = e107::getXml()->e107Import($coreConfig, 'add', true, false, $sql); // Add core pref values $mes->addInfo(print_a($ret, true)); } } else { $mes->addSuccess(DBLAN_74); } if ($error = $sql->getLastErrorText()) { $mes->addError($error); } // print_a($_POST); }
function getConfig($config = false) { $tp = e107::getParser(); $fl = e107::getFile(); if (getperms('0')) { $template = "mainadmin.xml"; } elseif (ADMIN) { $template = "admin.xml"; } elseif (USER) { $template = "member.xml"; } else { $template = "public.xml"; } $configPath = is_readable(THEME . "templates/tinymce/" . $template) ? THEME . "templates/tinymce/" . $template : e_PLUGIN . "tinymce4/templates/" . $template; $config = e107::getXml()->loadXMLfile($configPath, true); //TODO Cache! $this->configName = $config['@attributes']['name']; unset($config['@attributes']); $ret = array('selector' => '.e-wysiwyg', 'theme' => 'modern', 'plugins' => $this->filter_plugins($config['tinymce_plugins']), 'language' => $this->tinymce_lang()); // Loop thru XML parms. foreach ($config as $k => $xml) { $ret[$k] = $xml; } $tPref = e107::pref('tinymce4'); if (!empty($tPref['paste_as_text'])) { $ret['paste_as_text'] = true; } if (!empty($tPref['browser_spellcheck'])) { $ret['browser_spellcheck'] = true; } $formats = array('hilitecolor' => array('inline' => 'span', 'classes' => 'hilitecolor', 'styles' => array('backgroundColor' => '%value'))); //@see http://www.tinymce.com/wiki.php/Configuration:formats $formats = "[\n {title: 'Headers', items: [\n {title: 'Heading 1', block: 'h1'},\n {title: 'Heading 2', block: 'h2'},\n {title: 'Heading 3', block: 'h3'},\n {title: 'Heading 4', block: 'h4'},\n {title: 'Heading 5', block: 'h5'},\n {title: 'Heading 6', block: 'h6'}\n ]},\n\n {title: 'Inline', items: [\n {title: 'Bold', inline: 'b', icon: 'bold'},\n {title: 'Italic', inline: 'em', icon: 'italic'},\n {title: 'Underline', inline: 'span', styles : {textDecoration : 'underline'}, icon: 'underline'},\n {title: 'Strikethrough', inline: 'span', styles : {textDecoration : 'line-through'}, icon: 'strikethrough'},\n {title: 'Superscript', inline: 'sup', icon: 'superscript'},\n {title: 'Subscript', inline: 'sub', icon: 'subscript'},\n {title: 'Code', inline: 'code', icon: 'code'},\n {title: 'Small', inline: 'small', icon: ''},\n ]},\n\n {title: 'Blocks', items: [\n {title: 'Paragraph', block: 'p'},\n {title: 'Blockquote', block: 'blockquote'},\n {title: 'Div', block: 'div'},\n {title: 'Pre', block: 'pre'},\n {title: 'Code Highlighted', block: 'pre', classes: 'prettyprint linenums' }\n ]},\n\n {title: 'Alignment', items: [\n {title: 'Left', block: 'div', classes: 'text-left', icon: 'alignleft'},\n {title: 'Center', block: 'div',classes: 'text-center', icon: 'aligncenter'},\n {title: 'Right', block: 'div', classes: 'text-right', icon: 'alignright'},\n {title: 'Justify', block: 'div', classes: 'text-justify', icon: 'alignjustify'},\n {title: 'No-Wrap', block: 'div', classes: 'text-nowrap', icon: ''},\n {title: 'Image Left', selector: 'img', classes: 'pull-left', styles: {'margin': '0 10px 5px 0' }, icon: 'alignleft'},\n {title: 'Image Right', selector: 'img', classes: 'pull-right', styles: { 'margin': '0 0 5px 10px'}, icon: 'alignright'}\n\n ]},\n\n {title: 'Bootstrap Inline', items: [\n\t\t\t\t {title: 'Label (Default)', inline: 'span', classes: 'label label-default'},\n\t\t\t\t {title: 'Label (Primary)', inline: 'span', classes: 'label label-primary'},\n {title: 'Label (Success)', inline: 'span', classes: 'label label-success'},\n {title: 'Label (Info)', inline: 'span', classes: 'label label-info'},\n {title: 'Label (Warning)', inline: 'span', classes: 'label label-warning'},\n {title: 'Label (Danger)', inline: 'span', classes: 'label label-danger'},\n {title: 'Muted', inline: 'span', classes: 'text-muted'},\n ]},\n\n {title: 'Bootstrap Blocks', items: [\n {title: 'Alert (Success)', block: 'div', classes: 'alert alert-success'},\n {title: 'Alert (Info)', block: 'div', classes: 'alert alert-info'},\n {title: 'Alert (Warning)', block: 'div', classes: 'alert alert-warning'},\n {title: 'Alert (Danger)', block: 'div', classes: 'alert alert-block alert-danger'},\n {title: 'Float Clear', block: 'div', classes: 'clearfix'},\n {title: 'Lead', block: 'p', classes: 'lead'},\n {title: 'Well', block: 'div', classes: 'well'},\n {title: '1/4 Width Block', block: 'div', classes: 'col-md-3 col-sm-12'},\n {title: '3/4 Width Block', block: 'div', classes: 'col-md-9 col-sm-12'},\n {title: '1/3 Width Block', block: 'div', classes: 'col-md-4 col-sm-12'},\n {title: '2/3 Width Block', block: 'div', classes: 'col-md-8 col-sm-12'},\n {title: '1/2 Width Block', block: 'div', classes: 'col-md-6 col-sm-12'},\n ]},\n\n {title: 'Bootstrap Buttons', items: [\n {title: 'Button (Default)', selector: 'a', classes: 'btn btn-default'},\n\t\t\t\t {title: 'Button (Primary)', selector: 'a', classes: 'btn btn-primary'},\n {title: 'Button (Success)', selector: 'a', classes: 'btn btn-success'},\n {title: 'Button (Info)', selector: 'a', classes: 'btn btn-info'},\n {title: 'Button (Warning)', selector: 'a', classes: 'btn-warning'},\n {title: 'Button (Danger)', selector: 'a', classes: 'btn-danger'},\n ]},\n\n\t\t\t\t {title: 'Bootstrap Images', items: [\n\t\t\t\t {title: 'Responsive (recommended)', selector: 'img', classes: 'img-responsive'},\n\t\t\t\t {title: 'Rounded', selector: 'img', classes: 'img-rounded'},\n\t\t\t\t {title: 'Circle', selector: 'img', classes: 'img-circle'},\n {title: 'Thumbnail', selector: 'img', classes: 'img-thumbnail'},\n ]},\n\n\t\t\t\t {title: 'Bootstrap Tables', items: [\n\t\t\t\t {title: 'Bordered', selector: 'table', classes: 'table-bordered'},\n\t\t\t\t {title: 'Condensed', selector: 'table', classes: 'table-condensed'},\n\t\t\t\t {title: 'Hover', selector: 'table', classes: 'table-hover'},\n {title: 'Striped', selector: 'table', classes: 'table-striped'},\n ]},\n\n\n ]"; // $ret['style_formats_merge'] = true; // $ret['visualblocks_default_state'] = true; //pref $ret['style_formats'] = $formats; // json_encode($formats); $ret['link_class_list'] = "[\n {title: 'None', value: ''},\n {title: 'Link', value: 'btn btn-link'},\n {title: 'Alert Link', value: 'alert-link'},\n {title: 'Button (Default)', value: 'btn btn-default'},\n {title: 'Button (Primary)', value: 'btn btn-primary'},\n {title: 'Button (Success)', value: 'btn btn-success'},\n {title: 'Button (Info)', value: 'btn btn-info'},\n {title: 'Button (Warning)', value: 'btn btn-warning'},\n {title: 'Button (Danger)', value: 'btn btn-danger'}\n ]"; // https://github.com/valtlfelipe/TinyMCE-LocalAutoSave /* $ret['setup'] = "function(ed) { ed.addMenuItem('test', { text: 'Clear Floats', context: 'insert', icon: false, onclick: function() { ed.insertContent('<br class=\"clearfix\" />'); } }); }"; */ // e107 Bbcodes. /* $ret['setup'] = "function(ed) { ed.addButton('e107-bbcode', { text: 'bbcode', icon: 'emoticons', onclick: function() { // Open window ed.windowManager.open({ title: 'Example plugin', body: [ {type: 'listbox', name: 'code', label: 'BbCode', values: [ {text: 'Left', value: 'left'}, {text: 'Right', value: 'right'}, {text: 'Center', value: 'center'} ]}, {type: 'textbox', name: 'parm', label: 'Parameters'} ], onsubmit: function(e) { var selected = ed.selection.getContent({format : 'text'}); // alert(selected); // Insert content when the window form is submitted ed.insertContent('[' + e.data.code + ']' + selected + '[/' + e.data.code + ']'); } }); } }); }"; */ // Emoticon Support @see //https://github.com/nhammadi/Smileys if (e107::pref('core', 'smiley_activate', false)) { $emo = e107::getConfig("emote")->getPref(); $pack = e107::pref('core', 'emotepack'); $emotes = array(); $i = 0; $c = 0; foreach ($emo as $path => $co) { $codes = explode(" ", $co); $url = SITEURLBASE . e_IMAGE_ABS . "emotes/" . $pack . "/" . str_replace("!", ".", $path); $emotes[$i][] = array('shortcut' => $codes, 'url' => $url, 'title' => ucfirst($path)); if ($c == 6) { $i++; $c = 0; } else { $c++; } } // print_r($emotes); $ret['extended_smileys'] = json_encode($emotes); } // $ret['skin'] = 'e107admin'; // $ret['skin_url'] = SITEURLBASE.e_PLUGIN_ABS.'tinymce4/skins/e107admin'; $ret['convert_fonts_to_spans'] = false; $ret['content_css'] = e_PLUGIN_ABS . 'tinymce4/editor.css,https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css,http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css'; $ret['relative_urls'] = false; //Media Manager prefers it like this. $ret['preformatted'] = true; $ret['document_base_url'] = SITEURL; // $ret['table_default_attributes'] = json_encode(array('class'=>'table table-striped' )); if (!empty($ret['templates'])) { $ret['templates'] = $tp->replaceConstants($ret['templates'], 'abs'); // $this->getTemplates(); } // $this->config['verify_css_classes'] = 'false'; $text = array(); foreach ($ret as $k => $v) { if ($k == 'external_plugins') { $text[] = 'external_plugins: ' . $this->getExternalPlugins($v); continue; } $text[] = $k . ': ' . $this->convertBoolean($v); } $this->config = implode(",\n", $text); return; // ------------------------------------------------------------------------------------- $cssFiles = $fl->get_files(THEME, "\\.css", '', 2); foreach ($cssFiles as $val) { $css[] = str_replace(THEME, THEME_ABS, $val['path'] . $val['fname']); } $css[] = "{e_WEB_ABS}js/bootstrap/css/bootstrap.min.css"; $content_css = vartrue($config['content_css'], implode(",", $css)); $content_styles = array('Bootstrap Button' => 'btn btn-primary', 'Bootstrap Table' => 'table'); $this->config += array('dialog_type' => "modal", 'theme_advanced_resizing' => 'true', 'remove_linebreaks' => 'false', 'extended_valid_elements' => vartrue($config['extended_valid_elements']), 'apply_source_formatting' => 'true', 'invalid_elements' => 'font,align,script,applet', 'auto_cleanup_word' => 'true', 'cleanup' => 'true', 'convert_fonts_to_spans' => 'true', 'popup_css' => 'false', 'trim_span_elements' => 'true', 'inline_styles' => 'true', 'auto_resize' => 'false', 'debug' => 'true', 'force_br_newlines' => 'true', 'media_strict' => 'false', 'width' => vartrue($config['width'], '100%'), 'forced_root_block' => 'false', 'convert_newlines_to_brs' => 'true', 'entity_encoding' => 'raw', 'convert_fonts_to_styles' => 'true', 'remove_script_host' => 'true', 'relative_urls' => 'false', 'preformatted' => 'true', 'document_base_url' => SITEURL, 'verify_css_classes' => 'false'); // $this->config['cleanup_callback'] = 'tinymce_e107Paths'; $paste_plugin = false; // (strpos($config['tinymce_plugins'],'paste')!==FALSE) ? TRUE : FALSE; if ($paste_plugin) { $this->config += array('paste_text_sticky' => 'true', 'paste_text_sticky_default' => 'true', 'paste_text_linebreaktype' => 'br', 'remove_linebreaks' => 'false', 'paste_create_paragraphs' => 'false', 'paste_create_linebreaks' => 'true', 'paste_use_dialog' => 'true', 'paste_auto_cleanup_on_paste' => 'true', 'paste_convert_middot_lists' => 'false', 'paste_unindented_list_class' => 'unindentedList', 'paste_convert_headers_to_strong' => 'true', 'paste_insert_word_content_callback' => 'convertWord', 'auto_cleanup_word' => 'true'); } if (ADMIN) { // $this->config['external_link_list_url'] = e_PLUGIN_ABS."tiny_mce/filelist.php"; } }
/** * @return xmlClass */ public function client() { return e107::getXml(false); }