function register($payload) { $core = core::getInstance(); $stmt = 'INSERT INTO users (id, name, email, user_img, usergroup) VALUES (?,?,?,?,?)'; $core->db->execute($stmt, $payload['sub'], $payload['name'], $payload['email'], $payload['picture'], 2); // usergroup: 0 -admin; 1 - mod; 2 - user return true; }
function pluginsmanagerAdminNotifications() { $core = core::getInstance(); $pluginsManager = pluginsManager::getInstance(); $list = ''; foreach ($pluginsManager->getPlugins() as $plugin) { if (!$pluginsManager->isActivePlugin($plugin->getName())) { $list .= $plugin->getInfoVal('name') . ', '; } } if ($list != '') { show::msg($core->lang("Plugins are inactive") . ' (' . trim($list, ', ') . ')', "info"); } }
function getContent_DB($req) { $core = core::getInstance(); $topics = array(); foreach ($req as $v) { $v->author = $core->db->fetchAll('SELECT * FROM users WHERE id=? LIMIT 1', $v->author)[0]; $t = isset($v->topic_name) ? $v->topic_name : isset($v->topic) ? $v->topic : ""; $t2 = isset($v->text) ? $v->text : isset($v->text) ? $v->text : ""; $v->topic = utf8_encode($t); $v->author->name = utf8_encode($v->author->name); $v->author->email = utf8_encode($v->author->email); $v->description = utf8_encode($v->description); $v->text = utf8_encode($t2); if ($_SESSION['usergroup'] <= $v->ual) { $topics[] = $v; } } return $topics; }
public static function currentUrl() { $core = core::getInstance(); eval($core->callHook('startShowCurrentUrl')); $data = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; eval($core->callHook('endShowCurrentUrl')); echo $data; }
if ($count == 0) { $query = "INSERT INTO `nostarch`.`books` (`bookId`,`title`,`author`,`ISBN13`,`relesedDate`,`summary`,`dateAdded`,`dateUpdated`) VALUES (NULL,:title,:author,:ISBN13,:relesedDate,:summary,:dateAdded,NULL);"; $stmt = core::getInstance()->dbh->prepare($query); #$stmt->bindParam(":title",filter_var($book['imageUrl'],FILTER_SANITIZE_ENCODED)); $stmt->bindParam(":title", filter_var($book['title'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)); echo filter_var($book['pageUrl'], FILTER_SANITIZE_ENCODED) . "<br/>\n"; $stmt->bindParam(":summary", filter_var($book['summary'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)); $stmt->bindParam(":author", filter_var($book['author'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)); $stmt->bindParam(":ISBN13", filter_var($book['ISBN13'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)); $stmt->bindParam(":relesedDate", filter_var($book['releasedDate'], FILTER_SANITIZE_FULL_SPECIAL_CHARS)); echo filter_var($book['MSRP'], FILTER_SANITIZE_FULL_SPECIAL_CHARS) . "<br/>\n"; $stmt->bindParam(":dateAdded", date("Y-m-d H:i:s")); $stmt->execute(); } else { $query = ""; $stmt = core::getInstance()->dbh->prepare($query); $stmt->bindParam(); $stmt->execute(); } } function update($table, $updateData, $whereKey, $whereValue) { $updateString = ''; for ($i = 0; $i < count($updateData); $i++) { list($key, $value) = each($updateData); $updateString .= "`" . $key . "` = " . "'" . $value . "'"; if ($i != count($updateData)) { $updateString .= ' , '; } } $query = "UPDATE `" . $table . "` SET " . $updateString . " WHERE " . $whereKey . " LIKE '" . $whereValue . "'";
* @copyright 2010 Jonathan Coulet (contact@99ko.org) * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ ## Préchauffage... session_start(); defined('ROOT') or exit('No direct script access allowed'); include_once ROOT . 'common/config.php'; include_once COMMON . 'util.class.php'; include_once COMMON . 'core.class.php'; include_once COMMON . 'pluginsManager.class.php'; include_once COMMON . 'plugin.class.php'; include_once COMMON . 'show.class.php'; ## Création de l'instance core $core = core::getInstance(); ## Plugin par défaut du mode public define('DEFAULT_PLUGIN', $core->getConfigVal('defaultPlugin')); ## Plugin par défaut du mode admin define('DEFAULT_ADMIN_PLUGIN', $core->getConfigVal('defaultAdminPlugin')); ## Si le core n'est pas installé on redirige vers le script d'installation if (!$core->isInstalled()) { header('location:' . ROOT . 'install.php'); die; } ## Création de l'istance pluginsManager $pluginsManager = pluginsManager::getInstance(); ## On boucle sur les plugins foreach ($pluginsManager->getPlugins() as $plugin) { // On inclut le fichier PHP principal include_once $plugin->getLibFile();
private function createPlugin($name) { // Instance du core $core = core::getInstance(); // Infos du plugin $infos = util::readJsonFile(PLUGINS . $name . '/param/infos.json'); // Configuration du plugin $config = util::readJsonFile(DATA_PLUGIN . $name . '/config.json'); // Hooks du plugin $hooks = util::readJsonFile(PLUGINS . $name . '/param/hooks.json'); // Config usine $initConfig = util::readJsonFile(PLUGINS . $name . '/param/config.json'); // lang $lang = util::readJsonFile(PLUGINS . $name . '/lang/' . $core->getConfigVal('siteLang') . '.json'); // Derniers checks if (!is_array($config)) { $config = array(); } if (!is_array($hooks)) { $hooks = array(); } // Création de l'objet $plugin = new plugin($name, $config, $infos, $hooks, $initConfig, $lang); return $plugin; }
public function makeUrl($obj) { $core = core::getInstance(); // => Page if ($obj->targetIs() == 'page') { $temp = $core->getConfigVal('defaultPlugin') == 'page' && $obj->getIsHomepage() ? $core->getConfigVal('siteUrl') : $core->getConfigVal('siteUrl') . '/' . $core->makeUrl('page', array('name' => $obj->getName(), 'id' => $obj->getId())); } elseif ($obj->targetIs() == 'url') { $temp = $obj->getTarget(); } else { $temp = $core->getConfigVal('siteUrl') . '/' . $core->makeUrl($obj->getTarget()); } return $temp; }
public function setTitleTag($val) { $core = core::getInstance(); if ($this->isDefaultPlugin) { $val = $core->getConfigVal('siteName') . ' | ' . trim($val); } else { $val = $val . ' | ' . $core->getConfigVal('siteName'); } $this->titleTag = $val; }