/** * Gets plugins activated and installed. */ public function getPlugins() { include_once "core/lib/io.php"; $io = new InputOutput(); //Gets all directory info inside modules i.e. activated and unactivated plugins $allPlugins = $io->listFiles("modules"); //Returns all plugins with activity status. return $allPlugins; }
/** * List all pages in a directory. */ public function getMenuItems() { //Load File Abstraction Layer $io = new InputOutput(); //Ensure that the menu exists before loading if (!file_exists("data/modules/Menu/items/menu_items.dat")) { print "Menu Module not loaded. Please reinstall the menu module"; die; } //Lists the pages in a directory $pages = $io->openFile("data/modules/Menu/items/menu_items.dat"); $pages = explode("|*outer*|", $pages); for ($i = 0; $i < count($pages); $i++) { //Convert int array $pages[$i] = explode("|*inter*|", $pages[$i]); } return $pages; }
/** * */ public function migrate() { InputOutput::display(_("Executes all migrations")); $migrationManager = new Manager($module, 'production'); $cmd = $this->getPhinxCallLine() . 'migrate '; $cmd .= '-c ' . $migrationManager->getPhinxConfigurationFile(); $cmd .= '-e ' . $this->module; shell_exec($cmd); }
/** * Returns the active locale * Kevin Bluett July 2011 */ public function getListOfLocale() { include_once "core/lib/io.php"; //Setup the Input Output system $io = new InputOutput(); $locales = $io->listFiles("core/lang/"); $fullText = $locales; for ($i = 0; $i < count($locales); $i++) { /* Static keyword is used to ensure the file is loaded only once */ $translations = NULL; $lang_file = 'core/lang/' . $locales[$i]; $lang_file_content = file_get_contents($lang_file); /* Load the language file as a JSON object and transform it into an associative array */ include_once "core/lib/JSON.php"; $js = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); $translations = $js->decode($lang_file_content); $fullText[$i] = $translations['full_lang']; } return array($locales, $fullText); }
/** * This function checks for an update for a particular module at the lotuscms website. */ public function checkForModuleUpdate($req) { if (isset($_SESSION['MODUPDATE'])) { print $_SESSION['MODUPDATE']; exit; } else { include_once "core/lib/RemoteFiles.php"; include_once "core/lib/ModuleInfo.php"; //Get information on update status of each plugin. //Setup remote file requestor $rf = new RemoteFiles(); //Get site version $version = file_get_contents("data/config/site_version.dat"); $data = ""; if (isset($_SESSION['MOD_LCMS_ORG_RESPONSE_URL'])) { $data = $_SESSION['MOD_LCMS_ORG_RESPONSE_URL']; } if (file_exists("data/lcmscache/mod_update.dat") && empty($data)) { include_once "core/lib/io.php"; $io = new InputOutput(); $data = $io->openFile("data/lcmscache/mod_update.dat"); $_SESSION['MOD_LCMS_ORG_RESPONSE_URL'] = $data; //Finally delete the cache unlink("data/lcmscache/mod_update.dat"); } else { //Collect information on module updates. $data = $rf->getURL("http://cdn.modules.lotuscms.org/lcms-3-series/versioncontrol/allversioncheck.php?m={$req}&v={$version}"); } //Save response in session in case it is required later $_SESSION['MOD_LCMS_ORG_RESPONSE_URL'] = $data; //Output $out = ""; if (empty($data)) { print "<p class='msg error'><strong>Error:</strong> cannot connect to lotuscms.org</p>"; exit; } //Get list of plugins $m = explode("|", $data); $l = new Locale(); //Loop through each update response. for ($i = 0; $i < count($m); $i++) { //Split name & version number $getFull = explode(":", $m[$i]); //Get full number of plugin $nv = (double) $getFull[1]; //Get current version include_once "modules/" . $getFull[0] . "/" . $getFull[0] . "ModuleInfo.php"; $name = $getFull[0] . "ModuleInfo"; //Load info class $info = new $name(); //Load info $info->ModuleInfo(); //Get current version number $cv = (double) $info->getVersion(); //If new version is actually newer than installed. if ($cv < $nv) { $out .= '<p class="msg error">' . $l->localize("Module") . ': ' . $getFull[0] . ' ' . $l->localize("is out of date") . ' [' . $l->localize("version") . ': ' . $getFull[1] . ']. <a href="index.php?system=Modules&page=updateCheck&req=' . $getFull[0] . '">' . $l->localize("Update") . '</a></p>'; } } print $out; $_SESSION['MODUPDATE'] = $out; exit; } }
/** * This function checks for an update for a particular module at the lotuscms website. */ protected function checkForModuleUpdate($req, $saveInfo) { if (isset($_SESSION['MOD_LCMS_ORG_RESPONSE'])) { return $_SESSION['MOD_LCMS_ORG_RESPONSE']; } else { include_once "core/lib/RemoteFiles.php"; include_once "core/lib/ModuleInfo.php"; //Get information on update status of each plugin. //Setup remote file requestor $rf = new RemoteFiles(); //Get site version $version = file_get_contents("data/config/site_version.dat"); $data = ""; if (isset($_SESSION['MOD_LCMS_ORG_RESPONSE_URL']) && !$saveInfo) { if (!empty($_SESSION['MOD_LCMS_ORG_RESPONSE_URL'])) { $data = $_SESSION['MOD_LCMS_ORG_RESPONSE_URL']; } } else { if (file_exists("data/lcmscache/mod_update.dat")) { include_once "core/lib/io.php"; $io = new InputOutput(); $data = $io->openFile("data/lcmscache/mod_update.dat"); $_SESSION['MOD_LCMS_ORG_RESPONSE_URL'] = $data; //Finally delete the cache unlink("data/lcmscache/mod_update.dat"); } else { //Collect information on module updates. $data = $rf->getURL("http://cdn.modules.lotuscms.org/lcms-3-series/versioncontrol/allversioncheck.php?m={$req}&v={$version}"); //If preloader is getting info, save it to file if ($saveInfo && !empty($data)) { include_once "core/lib/io.php"; $io = new InputOutput(); $io->saveFile("data/lcmscache/mod_update.dat", $data); return null; } } } //Output $out = ""; if (empty($data)) { if (file_exists("data/lcmscache/mod_update.dat")) { unlink("data/lcmscache/mod_update.dat"); } return false; } $modArray = array(); //Get list of plugins $m = explode("|", $data); //Loop through each update response. for ($i = 0; $i < count($m); $i++) { //Split name & version number $getFull = explode(":", $m[$i]); //Get full number of plugin $nv = (double) $getFull[1]; //Get current version include_once "modules/" . $getFull[0] . "/" . $getFull[0] . "ModuleInfo.php"; $name = $getFull[0] . "ModuleInfo"; //Load info class $info = new $name(); //Load info $info->ModuleInfo(); //Get current version number $cv = (double) $info->getVersion(); //If new version is actually newer than installed. if ($cv < $nv) { $modArray[$getFull[0]] = true; } else { $modArray[$getFull[0]] = false; } } //Response $_SESSION['MOD_LCMS_ORG_RESPONSE'] = $modArray; return $modArray; } }
<?php /** * * GPL v4 * LotusCMS 2010. * * Written by Kevin Bluett * */ //Start the session. session_start(); include_once "core/lib/io.php"; $io = new InputOutput(); $out = $io->openFile("style/comps/admin/install.html"); $id = 1; if (isset($_GET['step'])) { $id = $_GET['step']; } if ($id == 1) { //Put Step number in $out = str_replace("%STEP%", "1", $out); $perms = substr(base_convert(fileperms("data/config/site_title.dat"), 10, 8), 3); $perms1 = substr(base_convert(fileperms("cache/index.html"), 10, 8), 3); $perms2 = substr(base_convert(fileperms("modules/Dashboard/DashViewPlugin.php"), 10, 8), 3); $perms3 = substr(base_convert(fileperms("style/admin.php"), 10, 8), 3); $perms4 = substr(base_convert(fileperms("core/lib/io.php"), 10, 8), 3); $content = "<p><strong>Please continue to next step once all of the below boxes are green:</strong></p>"; if ($perms != "777" && $perms != "666") { $content .= "<p class='message error'>'data' directory not recursively set permissions to 777.</p>"; } else {
function getPageContent($page_id, $container_id = 0, $checkactive = true) { if (!$page_id) { // Pear Error goes here. } $res = $this->getPages($page_id); $page_info = $res->fetchRow(); $res->free(); $res = InputOutput::getPageTemplateContainers($page_info['page_template_id']); $template_containers = array(); while ($row = $this->prepareOutputContent($res->fetchRow())) { $template_containers[] = array('id' => $row['id'], 'var' => $row['container_var']); } $page_content = array(); foreach ($template_containers as $template_container) { if ($container_id == 0 || $container_id == $template_container['id']) { $sql = "SELECT * FROM page p, page_content pc WHERE p.id = {$page_id} AND pc.page_id = p.id"; $sql .= " AND pc.page_template_container_id = " . $template_container['id']; $sql .= " ORDER BY"; $sql .= " pc.page_template_container_id,"; $sql .= " content_order, pc.id"; $res = $this->db->query($sql); while ($row = $this->prepareOutputContent($res->fetchRow())) { if ($row['timed_end'] != '0000-00-00 00:00:00' && strtotime($row['timed_end']) < time()) { $this->deletePageContent($row['id']); } else { $io = InputOutput::singleton($row['content_object']); $cres = $io->getRecords($row['content_object_id'], $checkactive); if (!DB::isError($cres)) { $crow = $this->prepareOutputContent($cres->fetchRow()); if ($crow) { $page_content[$template_container['var']][] = array('id' => $crow['id'], 'page_template_container_id' => $row['page_template_container_id'], 'object' => $io->getObject(), 'object_name' => $io->getObjectName(), 'headline' => $crow['cms_headline'], 'page_content_id' => $row['id'], 'timed_start' => $row['timed_start'], 'timed_end' => $row['timed_end']); } } } } } } return $page_content; }