#606 Upgrade to latest GameQ v3 version

This commit is contained in:
Ulrich Block 2015-09-05 20:24:29 +02:00
parent 2b28892a6f
commit cff0e7c37c

View File

@ -40,7 +40,7 @@ if ((!isset($admin_id) or $main != 1) or (isset($admin_id) and !$pa['gimages']))
header('Location: admin.php');
die('No acces');
}
include(EASYWIDIR . '/third_party/gameq/GameQ.php');
include(EASYWIDIR . '/third_party/gameq/GameQ/Autoloader.php');
include(EASYWIDIR . '/stuff/keyphrasefile.php');
$sprache = getlanguagefile('images', $user_language, $resellerLockupID);
@ -153,47 +153,55 @@ if ($ui->w('action', 4, 'post') and !token(true)) {
if (!$ui->smallletters('action', 2, 'post') or $ui->id('import', 1, 'post') == 1) {
// Protocol list code taken from https://github.com/Austinb/GameQ/blob/v2/examples/list.php
$protocols_path = GAMEQ_BASE . 'gameq/protocols/';
$protocols = array();
// Protocol list code taken from https://github.com/Austinb/GameQ/blob/v2/examples/list.php
$protocols_path = EASYWIDIR . '/third_party/gameq/GameQ/Protocols/';
// Grab the dir with all the classes available
$dir = dir($protocols_path);
$protocols = array();
// Now lets loop the directories
while (false !== ($entry = $dir->read()))
{
if(!is_file($protocols_path.$entry))
{
while (false !== ($entry = $dir->read())) {
if(!is_file($protocols_path . $entry)) {
continue;
}
// Figure out the class name
$class_name = 'GameQ_Protocols_' . ucfirst(pathinfo($entry, PATHINFO_FILENAME));
$class_name = ucfirst(pathinfo($entry, PATHINFO_FILENAME));
// Lets get some info on the class
$reflection = new ReflectionClass($class_name);
// Check to make sure we can actually load the class
try {
require_once($protocols_path . $entry);
// Lets get some info on the class
$reflection = new ReflectionClass('GameQ\Protocols\\' . $class_name);
// Check to make sure we can actually load the class
if(!$reflection->IsInstantiable()) {
continue;
}
// Load up the class so we can get info
$class = new $class_name;
$classGeneratedName = 'GameQ\Protocols\\' . $class_name;
$class = new $classGeneratedName;
$ReflectionName = new ReflectionProperty(get_class($class), 'name');
$ReflectionName->setAccessible(true);
$ReflectionNameLong = new ReflectionProperty(get_class($class), 'name_long');
$ReflectionNameLong->setAccessible(true);
// Add it to the list
$protocols[$class->name()] = $class->name_long();
$protocols[$ReflectionName->getValue($class)] = $ReflectionNameLong->getValue($class);
// Unset the class
unset($class);
} catch (ReflectionException $e) {
$errors['reflection'] = $e->getMessage();
}
unset($class, $ReflectionName, $ReflectionNameLong);
} catch (ReflectionException $e) {
$errors[] = $e->getMessage();
}
}
// Close the directory