function sendAll($keys, $values) { $keyString = ''; $valString = ''; for ($i = 0; $i < sizeof($keys); $i++) { $keyString .= $keys[$i]; $valString .= "'" . $values[$i] . "'"; if ($i + 1 < sizeof($keys)) { $keyString .= ','; $valString .= ','; } } sendQuery($keyString, $valString); }
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("CREATE TABLE `events` (\r\n `id` int(11) NOT NULL AUTO_INCREMENT,\r\n `type` varchar(255) DEFAULT NULL,\r\n `cid` int(11) DEFAULT NULL,\r\n `ctype` enum('asset','document','object') DEFAULT NULL,\r\n `date` int(11) DEFAULT NULL,\r\n `user` int(11) DEFAULT NULL,\r\n `title` varchar(255) DEFAULT NULL,\r\n `description` longtext,\r\n PRIMARY KEY (`id`),\r\n KEY `cid` (`cid`),\r\n KEY `ctype` (`ctype`),\r\n KEY `date` (`date`)\r\n) DEFAULT CHARSET=utf8;"); sendQuery("CREATE TABLE `events_data` (\r\n `id` int(11) NOT NULL DEFAULT '0',\r\n `name` varchar(255) DEFAULT NULL,\r\n `type` enum('text','date','document','asset','object','bool') DEFAULT NULL,\r\n `data` text,\r\n KEY `id` (`id`)\r\n) DEFAULT CHARSET=utf8;");
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("DROP TABLE IF EXISTS `website_settings`;"); sendQuery("CREATE TABLE `website_settings` (\r\n\t`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT,\r\n\t`name` VARCHAR(255) NOT NULL DEFAULT '',\r\n\t`type` ENUM('text','document','asset','object','bool') NULL DEFAULT NULL,\r\n\t`data` TEXT NULL,\r\n\t`siteId` INT(11) UNSIGNED NULL DEFAULT NULL,\r\n\t`creationDate` BIGINT(20) UNSIGNED NULL DEFAULT '0',\r\n\t`modificationDate` BIGINT(20) UNSIGNED NULL DEFAULT '0',\r\n\tPRIMARY KEY (`id`),\r\n\tINDEX `name` (`name`),\r\n\tINDEX `siteId` (`siteId`)\r\n)\r\nDEFAULT CHARSET=utf8;"); $configFile = PIMCORE_CONFIGURATION_DIRECTORY . "/website.xml"; $configFileNew = PIMCORE_CONFIGURATION_DIRECTORY . "/website-legacy.xml"; $rawConfig = new Zend_Config_Xml($configFile); $arrayData = $rawConfig->toArray(); $data = array(); foreach ($arrayData as $key => $value) { $setting = new WebsiteSetting(); $setting->setName($key); $type = $value["type"]; $setting->setType($type); $data = $value["data"]; if ($type == "bool") { $data = (bool) $data; } else { if ($type == "document") { $data = Document::getByPath($value["data"]);
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `glossary` ADD COLUMN `casesensitive` tinyint(1) NULL DEFAULT NULL AFTER `language`;");
<?php sendQuery("ALTER TABLE `documents_page` ADD COLUMN `module` varchar(255) NULL DEFAULT NULL AFTER `id`;"); sendQuery("ALTER TABLE `documents_snippet` ADD COLUMN `module` varchar(255) NULL DEFAULT NULL AFTER `id`;"); sendQuery("ALTER TABLE `documents_email` ADD COLUMN `module` varchar(255) NULL DEFAULT NULL AFTER `id`;"); sendQuery("ALTER TABLE `documents_doctypes` ADD COLUMN `module` varchar(255) NULL DEFAULT NULL AFTER `name`;"); function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo $sql; } }
} elseif (!array_key_exists('nameIdSPQualifier', $data)) { $data['nameIdSPQualifier'] = $defNameId['SPNameQualifier']; } if (array_key_exists('url', $_REQUEST)) { $data['url'] = (string) $_REQUEST['url']; } elseif (!array_key_exists('url', $data)) { $data['url'] = SimpleSAML_Module::getModuleURL('exampleattributeserver/attributeserver.php'); } if (!array_key_exists('attributes', $data)) { $data['attributes'] = NULL; } $session->setData('attributequeryexample:data', $dataId, $data, 3600); if (array_key_exists('send', $_REQUEST)) { $nameId = array('Format' => $data['nameIdFormat'], 'Value' => $data['nameIdValue'], 'NameQualifier' => $data['nameIdQualifier'], 'SPNameQualifier' => $data['nameIdSPQualifier']); if (empty($nameId['NameQualifier'])) { $nameId['NameQualifier'] = NULL; } if (empty($nameId['SPNameQualifier'])) { $nameId['SPNameQualifier'] = NULL; } sendQuery($dataId, $data['url'], $nameId); } $t = new SimpleSAML_XHTML_Template(SimpleSAML_Configuration::getInstance(), 'attributequery.php'); $t->data['dataId'] = $dataId; $t->data['url'] = $data['url']; $t->data['nameIdFormat'] = $data['nameIdFormat']; $t->data['nameIdValue'] = $data['nameIdValue']; $t->data['nameIdQualifier'] = $data['nameIdQualifier']; $t->data['nameIdSPQualifier'] = $data['nameIdSPQualifier']; $t->data['attributes'] = $data['attributes']; $t->show();
<?php session_start(); // error rporting: (uncomment if necessary) error_reporting(E_ALL); //Database connection include $_SERVER['DOCUMENT_ROOT'] . '/access/connectMain.php'; //error message if database connection failed if ($db->connect_errno) { echo "Failed to connect to MySQL DB: (" . $db->connect_errno . ") " . $db->connect_error; } //Sets info variables of user from database if (isset($_SESSION['id'])) { $uid = $_SESSION['id']; $query = " SELECT * FROM `userTable` WHERE id = '{$uid}' "; $row = sendQuery($db, $query); list($id, $email, $un, $pw, $active) = setVariables($row); } //returns db variables function setVariables($row) { $dbID = $row[0]; $dbEmail = $row[1]; $dbUsername = $row[2]; $dbPassword = $row[3]; $dbActive = $row[4]; return array($dbID, $dbEmail, $dbUsername, $dbPassword, $dbActive); } //function used to do mysql query's function sendQuery($connection, $query) { $result = mysqli_query($connection, $query);
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `documents_page` ADD COLUMN `prettyUrl` varchar(255) NULL DEFAULT NULL;"); sendQuery("ALTER TABLE `documents_page` ADD UNIQUE INDEX `prettyUrl` (`prettyUrl`(255));");
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `classes` ADD COLUMN `description` text NULL AFTER `name`;");
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo $sql; } } sendQuery("ALTER TABLE `search_backend_data` DROP INDEX `fulltext`;"); sendQuery("ALTER TABLE `search_backend_data` DROP INDEX `fieldcollectiondata`;"); sendQuery("ALTER TABLE `search_backend_data` DROP INDEX `localizeddata`;"); sendQuery("ALTER TABLE `search_backend_data` DROP COLUMN `fieldcollectiondata`;"); sendQuery("ALTER TABLE `search_backend_data` DROP COLUMN `localizeddata`;"); sendQuery("ALTER TABLE `search_backend_data` ADD FULLTEXT INDEX `fulltext` (`data`,`properties`,`fullpath`);"); ?> <b style="color: red;">Please execute the script /pimcore/cli/search-backend-reindex.php manually on the commandline!</b>
function quitAndClose(&$socket) { sendQuery($socket, 'QUIT'); $r = getResult($socket, 'QUIT'); socket_close($socket); $socket = null; print $r; return; }
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `glossary` ADD COLUMN `site` int(11) unsigned NULL DEFAULT NULL;"); sendQuery("ALTER TABLE `glossary` ADD INDEX `site` (`site`);");
<?php /** * Pimcore * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://www.pimcore.org/license * * @copyright Copyright (c) 2009-2010 elements.at New Media Solutions GmbH (http://www.elements.at) * @license http://www.pimcore.org/license New BSD License */ function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } $tableNames = array("documents_doctypes", "glossary", "keyvalue_groups", "keyvalue_keys", "properties_predefined", "redirects", "sites", "staticroutes"); foreach ($tableNames as $tableName) { sendQuery("ALTER TABLE `" . $tableName . "` ADD COLUMN `creationDate` bigint(20) unsigned DEFAULT 0;"); sendQuery("ALTER TABLE `" . $tableName . "` ADD COLUMN `modificationDate` bigint(20) unsigned DEFAULT 0;"); }
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `documents_page` DROP INDEX `prettyUrl`;"); sendQuery("ALTER TABLE `documents_page` ADD INDEX `prettyUrl` (`prettyUrl`);");
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `redirects` ADD COLUMN `expiry` bigint(20) NULL DEFAULT NULL;");
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `users` ADD COLUMN `closeWarning` tinyint(1) NULL DEFAULT NULL;"); $db = Pimcore_Resource::get(); $db->update("users", array("closeWarning" => 1), "type = 'user'");
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `users` ADD COLUMN `welcomescreen` tinyint(1) NULL DEFAULT NULL;");
<?php $con = mysqli_connect("localhost", "root", "", "401"); if (mysqli_connect_errno()) { die("<br>Could not connect:" . mysqli_error()); } $query = "Select * from teacher where Password = "******" and UserName = '******'user'] . "'"; $query = substr($query, 0, strlen($query) - 1) . "' #--"; //$query = str_replace("/", "", $query); $query = preg_replace('{(<br(\\s*/)?>| )+$}i', '', $query); //echo(($query)); $r = sendQuery($query, $con); if (!empty($r)) { $row = $r->fetch_array(MYSQLI_ASSOC); echo json_encode($row); } $con->close(); function sendQuery($q, $con) { //echo "<br>Query: ".$q; $r = mysqli_query($con, $q); //if (!empty($r)) // echo "<br>Successful Query"; //else // echo "<br>Failure Query"; return $r; }
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("RENAME TABLE `events` TO `notes`;"); sendQuery("RENAME TABLE `events_data` TO `notes_data`;");
function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("DELETE FROM `users` WHERE hasCredentials != 1;"); sendQuery("ALTER TABLE `users` DROP COLUMN `hasCredentials`;"); sendQuery("UPDATE `users` SET `active` = 0 WHERE `admin` != 1;"); sendQuery("ALTER TABLE `users` ADD COLUMN `type` enum('user','userfolder','role','rolefolder') NOT NULL DEFAULT 'user' AFTER `parentId`;"); sendQuery("ALTER TABLE `users` CHANGE COLUMN `username` `name` varchar(50) NULL DEFAULT NULL;"); sendQuery("ALTER TABLE `users` ADD COLUMN `permissions` varchar(1000) NULL DEFAULT NULL;"); sendQuery("ALTER TABLE `users` ADD COLUMN `roles` varchar(1000) NULL DEFAULT NULL;"); sendQuery("DELETE FROM `users_permission_definitions` WHERE `key`='update';"); sendQuery("DELETE FROM `users_permission_definitions` WHERE `key`='users';"); sendQuery("DELETE FROM `users_permission_definitions` WHERE `key`='forms';"); sendQuery("ALTER TABLE `users_permission_definitions` DROP COLUMN `translation`;"); sendQuery("DROP TABLE `users_permissions`;"); sendQuery("CREATE TABLE `users_workspaces_asset` (\r\n `cid` int(11) unsigned DEFAULT NULL,\r\n `cpath` varchar(255) DEFAULT NULL,\r\n `userId` int(11) unsigned DEFAULT NULL,\r\n `list` tinyint(1) DEFAULT '0',\r\n `view` tinyint(1) DEFAULT '0',\r\n `publish` tinyint(1) DEFAULT '0',\r\n `delete` tinyint(1) DEFAULT '0',\r\n `rename` tinyint(1) DEFAULT '0',\r\n `create` tinyint(1) DEFAULT '0',\r\n `settings` tinyint(1) DEFAULT '0',\r\n `versions` tinyint(1) DEFAULT '0',\r\n `properties` tinyint(1) DEFAULT '0',\r\n PRIMARY KEY (`cid`, `userId`),\r\n KEY `cid` (`cid`),\r\n KEY `userId` (`userId`)\r\n) DEFAULT CHARSET=utf8;"); sendQuery("CREATE TABLE `users_workspaces_document` (\r\n `cid` int(11) unsigned DEFAULT NULL,\r\n `cpath` varchar(255) DEFAULT NULL,\r\n `userId` int(11) unsigned DEFAULT NULL,\r\n `list` tinyint(1) unsigned DEFAULT '0',\r\n `view` tinyint(1) unsigned DEFAULT '0',\r\n `save` tinyint(1) unsigned DEFAULT '0',\r\n `publish` tinyint(1) unsigned DEFAULT '0',\r\n `unpublish` tinyint(1) unsigned DEFAULT '0',\r\n `delete` tinyint(1) unsigned DEFAULT '0',\r\n `rename` tinyint(1) unsigned DEFAULT '0',\r\n `create` tinyint(1) unsigned DEFAULT '0',\r\n `settings` tinyint(1) unsigned DEFAULT '0',\r\n `versions` tinyint(1) unsigned DEFAULT '0',\r\n `properties` tinyint(1) unsigned DEFAULT '0',\r\n PRIMARY KEY (`cid`, `userId`),\r\n KEY `cid` (`cid`),\r\n KEY `userId` (`userId`)\r\n) DEFAULT CHARSET=utf8;"); sendQuery("CREATE TABLE `users_workspaces_object` (\r\n `cid` int(11) unsigned DEFAULT NULL,\r\n `cpath` varchar(255) DEFAULT NULL,\r\n `userId` int(11) unsigned DEFAULT NULL,\r\n `list` tinyint(1) unsigned DEFAULT '0',\r\n `view` tinyint(1) unsigned DEFAULT '0',\r\n `save` tinyint(1) unsigned DEFAULT '0',\r\n `publish` tinyint(1) unsigned DEFAULT '0',\r\n `unpublish` tinyint(1) unsigned DEFAULT '0',\r\n `delete` tinyint(1) unsigned DEFAULT '0',\r\n `rename` tinyint(1) unsigned DEFAULT '0',\r\n `create` tinyint(1) unsigned DEFAULT '0',\r\n `settings` tinyint(1) unsigned DEFAULT '0',\r\n `versions` tinyint(1) unsigned DEFAULT '0',\r\n `properties` tinyint(1) unsigned DEFAULT '0',\r\n PRIMARY KEY (`cid`, `userId`),\r\n KEY `cid` (`cid`),\r\n KEY `userId` (`userId`)\r\n) DEFAULT CHARSET=utf8;"); sendQuery("RENAME TABLE `assets_permissions` TO `PLEASE_DELETE__assets_permissions`;"); sendQuery("RENAME TABLE `documents_permissions` TO `PLEASE_DELETE__documents_permissions`;"); sendQuery("RENAME TABLE `objects_permissions` TO `PLEASE_DELETE__objects_permissions`;"); //sendQuery("");
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `users` DROP INDEX `name`;"); sendQuery("ALTER TABLE `users` ADD UNIQUE INDEX `type_name` (`type`,`name`);"); sendQuery("ALTER TABLE `users` ADD INDEX `name` (`name`);"); sendQuery("ALTER TABLE `users` ADD INDEX `password` (`password`);");
$attributes = $state['attributeaggregator:attributes']; $attributes_to_send = array(); foreach ($attributes as $name => $params) { if (array_key_exists('values', $params)) { $attributes_to_send[$name] = $params['values']; } else { $attributes_to_send[$name] = array(); } } $attributeNameFormat = $state['attributeaggregator:attributeNameFormat']; $authsource = SimpleSAML_Auth_Source::getById($state["attributeaggregator:authsourceId"]); $src = $authsource->getMetadata(); $dst = $metadata->getMetaDataConfig($state['attributeaggregator:entityId'], 'attributeauthority-remote'); // Sending query try { $response = sendQuery($dataId, $data['url'], $nameId, $attributes_to_send, $attributeNameFormat, $src, $dst); } catch (Exception $e) { throw new SimpleSAML_Error_Exception('[attributeaggregator] Error in sending query. ' . $e); } /* Getting the response */ SimpleSAML_Logger::debug('[attributeaggregator] attributequery - getting response'); if (!$response instanceof SAML2_Response) { throw new SimpleSAML_Error_Exception('Unexpected message received in response to the attribute query.'); } $idpEntityId = $response->getIssuer(); if ($idpEntityId === NULL) { throw new SimpleSAML_Error_Exception('Missing issuer in response.'); } $assertions = $response->getAssertions(); $attributes_from_aa = $assertions[0]->getAttributes(); $expected_attributes = $state['attributeaggregator:attributes'];
return; } $app->response->setStatus(204); }); // Get Average Metrics of a banner $app->get('/getAverageMetrics/:campaignId(/:bannerId)', function ($campaignId, $bannerId = '') use($app, $con) { $query = sprintf("\n SELECT\n COUNT(*) 'TotalOfCalls',\n COUNT(ConversationStartTime) 'AnsweredCalls',\n COUNT(*) - COUNT(ConversationStartTime) 'NotAnsweredCalls',\n COUNT(ConversationStartTime) / COUNT(*) 'AnsweringRate',\n AVG(ConversationStartTime - QueueEntryTime) 'AvgQueueTime',\n AVG(SessionEndTime - ConversationStartTime) 'AvgCallDuration'\n FROM\n Sessions WHERE CampaignId = '%s' AND (BannerId = '%s' OR '%s' = '');", mysqli_real_escape_string($con, $campaignId), mysqli_real_escape_string($con, $bannerId), mysqli_real_escape_string($con, $bannerId)); $result = sendQuery($query); $sessionInfo = mysqli_fetch_assoc($result); header("Content-Type: application/json"); echo json_encode($sessionInfo); }); // Get Full Metrics of a banner $app->get('/getFullMetrics/:campaignId(/:bannerId)', function ($campaignId, $bannerId = '') use($app, $con) { $query = sprintf("SELECT * FROM Sessions WHERE CampaignId = '%s' AND (BannerId = '%s' OR '%s' = '');", mysqli_real_escape_string($con, $campaignId), mysqli_real_escape_string($con, $bannerId), mysqli_real_escape_string($con, $bannerId)); $result = sendQuery($query); $data = []; while ($row = mysqli_fetch_assoc($result)) { array_push($data, $row); } header("Content-Type: application/json"); echo json_encode($data); }); /* ------------------------------------------------------------------------------------------------ * Application Start * -----------------------------------------------------------------------------------------------*/ $app->run(); /* ------------------------------------------------------------------------------------------------ * Helper functions * -----------------------------------------------------------------------------------------------*/ function handleMySqlError($result, $app, $message = '')
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `users` ADD UNIQUE INDEX `name` (`name`(50)), DROP INDEX `username`;");
{ try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("CREATE TABLE `tree_locks` (\r\n `id` int(11) NOT NULL DEFAULT '0',\r\n `type` enum('asset','document','object') NOT NULL DEFAULT 'asset',\r\n `locked` enum('self','propagate') default NULL,\r\n PRIMARY KEY (`id`,`type`),\r\n KEY `id` (`id`),\r\n KEY `type` (`type`),\r\n KEY `locked` (`locked`)\r\n) DEFAULT CHARSET=utf8;"); $db = Pimcore_Resource::get(); // assets $assetLocks = $db->fetchAll("SELECT id,path,filename,locked FROM assets WHERE locked IS NOT NULL AND locked != ''"); foreach ($assetLocks as $lock) { $db->insert("tree_locks", array("id" => $lock["id"], "type" => "asset", "locked" => $lock["locked"])); } sendQuery("ALTER TABLE `assets` DROP COLUMN `locked`;"); // documents $documentLocks = $db->fetchAll("SELECT id,path,`key`,locked FROM documents WHERE locked IS NOT NULL AND locked != ''"); foreach ($documentLocks as $lock) { $db->insert("tree_locks", array("id" => $lock["id"], "type" => "document", "locked" => $lock["locked"])); } sendQuery("ALTER TABLE `documents` DROP COLUMN `locked`;"); // objects $ObjectLocks = $db->fetchAll("SELECT o_id,o_path,o_key,o_locked FROM objects WHERE o_locked IS NOT NULL AND o_locked != ''"); foreach ($ObjectLocks as $lock) { $db->insert("tree_locks", array("id" => $lock["o_id"], "type" => "object", "locked" => $lock["o_locked"])); } sendQuery("ALTER TABLE `objects` DROP COLUMN `o_locked`;");
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("ALTER TABLE `glossary` ADD COLUMN `exactmatch` tinyint(1) NULL DEFAULT NULL AFTER `casesensitive`;");
<?php $con = mysqli_connect("localhost", "root", "", "401"); if (mysqli_connect_errno()) { die("<br>Could not connect:" . mysqli_error()); } $_GET['name']; $query = "Select classes.ID, UserName, Picture, CoverPhoto, ThemeSong, TeacherID, Name, EnrolledStudents, Description \n\t\t\tfrom teacher inner join classes on teacher.ID = classes.TeacherID where teacher.UserName = '******'name'] . "'"; $r = sendQuery($query, $con); $ret = array(); if (!empty($r)) { for ($i = 0; $i < $r->num_rows; $i++) { $row = $r->fetch_array(MYSQLI_ASSOC); $row['files'] = array(); $query2 = "Select * from files where classID = '" . $row['ID'] . "'"; $r2 = sendQuery($query2, $con); for ($j = 0; $j < $r2->num_rows; $j++) { $file = $r2->fetch_array(MYSQLI_ASSOC); array_push($row['files'], $file); } array_push($ret, $row); } echo json_encode($ret); } $con->close(); function sendQuery($q, $con) { //echo "<br>Query: ".$q; $r = mysqli_query($con, $q); //if (!empty($r)) // echo "<br>Successful Query";
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("UPDATE `users` SET `parentId` = 0;");
$appointmentInfo = mysqli_fetch_assoc($result); // delete record sendQuery("DELETE FROM Schedules WHERE Timestamp='{$timestamp}'"); sendEmail('TokBox Demo', '*****@*****.**', $appointmentInfo['Name'], $appointmentInfo['Email'], "Cancelled: Your TokBox appointment on " . $appointmentInfo['Timestring'], "Your appointment on " . $appointmentInfo['Timestring'] . ". has been cancelled. We are sorry for the inconvenience, please reschedule on " . getBaseURL() . "/index.php/"); header("Content-Type: application/json"); echo json_encode($appointmentInfo); }); $app->post('/schedule', function () use($app, $con, $opentok) { $name = $app->request->post("name"); $email = $app->request->post("email"); $comment = $app->request->post("comment"); $timestamp = $app->request->post("timestamp"); $daystring = $app->request->post("daystring"); $session = $opentok->createSession(); $sessionId = $session->getSessionId(); $timestring = $app->request->post("timestring"); $query = sprintf("INSERT INTO Schedules (Name, Email, Comment, Timestamp, Daystring, Sessionid, Timestring) VALUES ('%s', '%s', '%s', '%d', '%s', '%s', '%s')", mysqli_real_escape_string($con, $name), mysqli_real_escape_string($con, $email), mysqli_real_escape_string($con, $comment), intval($timestamp), mysqli_real_escape_string($con, $daystring), mysqli_real_escape_string($con, $sessionId), mysqli_real_escape_string($con, $timestring)); sendQuery($query); sendEmail('TokBox Demo', '*****@*****.**', $name, $email, "Your TokBox appointment on " . $timestring, "You are confirmed for your appointment on " . $timestring . ". On the day of your appointment, go here: " . getBaseURL() . "/index.php/chat/" . $sessionId); $app->render('schedule.php'); }); $app->get('/rep', function () use($app) { $app->render('rep.php'); }); $app->get('/chat/:session_id', function ($session_id) use($app, $con, $apiKey, $opentok) { $result = sendQuery("SELECT * FROM Schedules WHERE Sessionid='{$session_id}'"); $appointmentInfo = mysqli_fetch_assoc($result); $token = $opentok->generateToken($session_id); $app->render('chat.php', array('name' => $appointmentInfo['Name'], 'email' => $appointmentInfo['Email'], 'comment' => $appointmentInfo['Comment'], 'apiKey' => $apiKey, 'session_id' => $session_id, 'token' => $token)); }); $app->run();
<?php function sendQuery($sql) { try { $db = Pimcore_Resource::get(); $db->query($sql); } catch (Exception $e) { echo $e->getMessage(); echo "Please execute the following query manually: <br />"; echo "<pre>" . $sql . "</pre><hr />"; } } sendQuery("CREATE TABLE `http_error_log` (\r\n `id` int(11) NOT NULL AUTO_INCREMENT,\r\n `path` varchar(1000) DEFAULT NULL,\r\n `code` int(3) DEFAULT NULL,\r\n `parametersGet` longtext,\r\n `parametersPost` longtext,\r\n `cookies` longtext,\r\n `serverVars` longtext,\r\n `date` bigint(20) DEFAULT NULL,\r\n PRIMARY KEY (`id`),\r\n KEY `path` (`path`(255)),\r\n KEY `code` (`code`),\r\n KEY `date` (`date`)\r\n) DEFAULT CHARSET=utf8;");