function set($table, $getters, $mysqli) { $params = array(); if (!empty($getters)) { $params = $getters; $params['user_id'] = $_SESSION['user_id']; setDatabase($table, $params, $mysqli); } }
<option value="Gemmideld">Gemmideld</option> <option value="Laag">Laag</option> </select> <label>Prioriteit</label> </div> </div> <div class="row"> <div class="col s12"> <button class="btn waves-effect waves-light btn_make light-blue darken-3" type="submit" name="submit">Make <i class="material-icons right">send</i> </button> </div> </div> <?php setDatabase(); ?> </form> </div> </div> </div> </div> </body> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script> <script type="text/javascript" src="js/materialize.js"></script> <script src="js/jquery-ui-1.11.4.custom/jquery-ui.min.js"></script>
/** *Starts Orongo! :) * @param String $paramCurrentPage the current page */ function startOrongo($paramCurrentPage = 'anonymous') { session_start(); define("ROOT", dirname(__FILE__)); define("LIB", ROOT . "/lib"); define("ADMIN", ROOT . "/orongo-admin"); define("CONFIG", ROOT . "/config.php"); define('RANK_ADMIN', 3); define('RANK_WRITER', 2); define('RANK_USER', 1); define('ARTICLE_NOT_EXIST', 2100); define('PAGE_NOT_EXIST', 3100); define('USER_NOT_EXIST', 4100); define('COMMENT_NOT_EXIST', 5100); error_reporting(E_ALL); if (file_exists("orongo-install.php")) { die("If you didn't install OrongoCMS yet, proceed to the <a href='orongo-install.php'>installer</a><br/>If you installed it, please delete orongo-install.php"); } if (!file_exists(CONFIG)) { die("config.php (" . CONFIG . ") was missing!"); } require_once CONFIG; require LIB . '/function_load.php'; try { load(LIB); } catch (Exception $e) { die($e->getMessage()); } setDatabase(new Database(CONFIG)); try { setLanguage(new Language(ADMIN . '/lang/' . Settings::getLanguageName())); } catch (Exception $e) { $msgbox = new MessageBox(); $msgbox->bindException($e); die($msgbox->getImports() . $msgbox->toHTML()); } setCurrentPage($paramCurrentPage); $style = null; try { $style = Settings::getStyle(); } catch (Exception $e) { $msgbox = new MessageBox(); $msgbox->bindException($e); die($msgbox->getImports() . $msgbox->toHTML()); } setMenu(new Menu()); setStyle($style); setDisplay(new Display($style->getStylePath())); setUser(handleSessions()); if (defined('HACK_PLUGINS') && HACK_PLUGINS == true) { Plugin::hackKeys(); } try { setPlugins(Plugin::getActivatedPlugins('orongo-admin/')); } catch (Exception $e) { $msgbox = new MessageBox(); $msgbox->bindException($e); getDisplay()->addObject($msgbox); } //getLanguage()->setTempLanguage(ADMIN . '/lang/en_US'); OrongoDefaultEventHandlers::init(); }
} } $response->setStatusCode(201, 'Created'); $response->setContent("<?xml version='1.0' encoding='ISO-8859-1'?><response><status>OK</status><mensagem>Foram criadas {$total} categorias de um total de " . count($xml) . " de produtos enviados</mensagem></response>"); } else { $response->setStatusCode(401, 'Não autorizado'); $response->setContent("<?xml version='1.0' encoding='ISO-8859-1'?><response><status>ERROR</status><mensagem>Chave inválida</mensagem></response>"); } return $response; }); // Update Categoria $app->post('/update/category/{key}/{codigo}', function ($key, $codigo) use($app, $di) { $response = new Response(); $conta = Contas::findFirst(array('conditions' => array('key' => $key))); if ($conta) { setDatabase($di, $conta->host, $conta->database); $categoria = Categorias::findFirst(array('conditions' => array('sku' => $codigo))); if ($categoria) { $xml = simplexml_load_string($_POST['xml']); $categoria->nome = (string) $xml->nome; if ($categoria->save()) { $response->setStatusCode(200, 'OK'); $response->setContent("<?xml version='1.0' encoding='ISO-8859-1'?><response><status>OK</status><mensagem>Categoria {$codigo} alterada com sucesso</mensagem></response>"); } else { $response->setStatusCode(400, 'Invalid Request'); $errors = array(); foreach ($categoria->getMessages() as $message) { $errors[] = $message->getMessage(); } $response->setContent("<?xml version='1.0' encoding='ISO-8859-1'?><response><status>ERROR</status><mensagem>{$errors[0]}</mensagem></response>"); }