Esempio n. 1
0
 public function getExternalConfig($aRelativePath)
 {
     $Out = Out::getInstance();
     $ConfigPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/sites';
     $BootstrapPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/includes/bootstrap.inc';
     if (!file_exists($ConfigPath)) {
         $Out->pushError($ConfigPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     @(include_once $BootstrapPath);
     $Version = 70000;
     if (defined('VERSION')) {
         $VersionParts = explode('.', VERSION);
         $Version = intval($VersionParts[0]) * 10000 + intval($VersionParts[1]) * 100;
     }
     $Sites = scandir($ConfigPath);
     foreach ($Sites as $SiteDir) {
         if (is_dir($ConfigPath . '/' . $SiteDir) && file_exists($ConfigPath . '/' . $SiteDir . '/settings.php')) {
             @(include_once $ConfigPath . '/' . $SiteDir . '/settings.php');
             if (isset($databases) && isset($databases['default']['default'])) {
                 $DbConfig = $databases['default']['default'];
                 return array('database' => $DbConfig['database'], 'user' => $DbConfig['username'], 'password' => $DbConfig['password'], 'prefix' => $DbConfig['prefix'], 'cookie' => isset($base_url) ? $base_url : 'http://' . $_SERVER['HTTP_HOST'] . '/' . $aRelativePath, 'version' => $Version);
             }
         }
     }
     $Out->pushError(L('NoValidConfig'));
     return null;
 }
function msgQueryLocations($aRequest)
{
    global $gSite;
    global $gGame;
    loadGameSettings();
    $Out = Out::getInstance();
    if (validRaidlead()) {
        $Connector = Connector::getInstance();
        // Locations
        $ListLocations = $Connector->prepare('Select * FROM `' . RP_TABLE_PREFIX . 'Location` WHERE Game = :Game ORDER BY Name');
        $ListLocations->bindValue(':Game', $gGame['GameId'], PDO::PARAM_STR);
        $Locations = array();
        $ListLocations->loop(function ($Data) use(&$Locations) {
            $LocationData = array('id' => $Data['LocationId'], 'name' => $Data['Name'], 'image' => $Data['Image']);
            array_push($Locations, $LocationData);
        });
        $Out->pushValue('location', $Locations);
        // Images
        $Images = @scandir('../themes/icons/' . $gSite['Iconset'] . '/raidsmall');
        $ImageList = array();
        if ($Images != null) {
            foreach ($Images as $Image) {
                if (strripos($Image, '.png') !== false) {
                    array_push($ImageList, $Image);
                }
            }
        }
        $Out->pushValue('locationimage', $ImageList);
    } else {
        $Out->pushError(L('AccessDenied'));
    }
}
Esempio n. 3
0
 public static function getInstance($aRethrow = false)
 {
     if (self::$Instance == null) {
         self::$Instance = new Out();
     }
     return self::$Instance;
 }
 /**
  * @param Out $outputStream The stream where the formatted message has to be written
  * @param MessageInterface $message
  *
  * @throws \Avalonia\Component\Message\Exception\MapperInvalidArgumentException if the given $message is not of the good type
  * @throws \Avalonia\Component\Message\Exception\MapperInvalidDataException if the given $rawData doesn't not contain required headers/attachments/body
  *
  * Writes a formatted message into the output stream
  */
 public function mapMessageToStream(Out $outputStream, MessageInterface $message)
 {
     $outputMessage = '';
     // First, build the query string
     $queryHeadersPrefix = str_replace(".", "\\.", HttpMessage::HTTP_QUERY_HEADER_PREFIX);
     $queryHeadersArray = [];
     foreach ($message->getHeadersByNameFormat(sprintf("/^%s/", $queryHeadersPrefix)) as $name => $value) {
         // remove query. for the header name
         $queryHeadersArray[substr($name, strlen(HttpMessage::HTTP_QUERY_HEADER_PREFIX))] = $value;
     }
     $queryString = http_build_query($queryHeadersArray);
     // Then build the uri
     $uri = $message->getHeader(HttpMessage::HEADER_HTTP_URI);
     if ('' !== $queryString) {
         $uri .= "?" . $queryString;
     }
     // Write command line
     $commandLine = sprintf("%s %s", $message->getHeader(HttpMessage::HEADER_HTTP_METHOD), $uri);
     $httpVersion = $message->getHeader(HttpMessage::HEADER_HTTP_VERSION, static::DEFAULT_HTTP_VERSION);
     if (static::DEFAULT_HTTP_VERSION !== $httpVersion) {
         $commandLine .= " HTTP/" . $httpVersion;
     }
     $outputMessage .= $commandLine . static::CRLF;
     foreach ($message->getHeadersByNameFormat(static::HTTP_HEADER_NAME_PATTERN) as $name => $header) {
         $outputMessage .= sprintf("%s: %s%s", $name, $header, static::CRLF);
     }
     // Write an empty line to end headers section if the HTTP version is 1.x
     // This empty line is not necessary for http 0.9
     $httpVersion = $message->getHeader(HttpMessage::HEADER_HTTP_VERSION);
     if ("0.9" !== $httpVersion && null !== $httpVersion) {
         $outputMessage .= static::CRLF;
     }
     $outputMessage .= $message->getBodyAsString();
     $outputStream->writeString($outputMessage);
 }
 /**
  * @param Out $outputStream The stream where the formatted message has to be written
  * @param MessageInterface $message
  *
  * @throws \Avalonia\Component\Message\Exception\MapperInvalidArgumentException if the given $message is not of the good type
  * @throws \Avalonia\Component\Message\Exception\MapperInvalidDataException if the given $rawData doesn't not contain required headers/attachments/body
  *
  * Writes a formatted message into the output stream
  */
 public function mapMessageToStream(Out $outputStream, MessageInterface $message)
 {
     $outputMessage = '';
     $httpVersion = $message->getHeader(HttpMessage::HEADER_HTTP_VERSION, static::DEFAULT_HTTP_VERSION);
     if (static::DEFAULT_HTTP_VERSION !== $httpVersion) {
         // If http version is 1.x write status line and headers
         $outputMessage .= sprintf('HTTP/%s %s %s%s', $httpVersion, $message->getHeader(HttpMessage::HEADER_HTTP_STATUS_CODE), $message->getHeader(HttpMessage::HEADER_HTTP_STATUS_MESSAGE), static::CRLF);
         foreach ($message->getHeadersByNameFormat(static::HTTP_HEADER_NAME_PATTERN) as $name => $header) {
             $outputMessage .= sprintf("%s: %s%s", $name, $header, static::CRLF);
         }
         // Add empty line to end headers section and write body
         $outputMessage .= static::CRLF;
     }
     $outputMessage .= $message->getBodyAsString();
     $outputStream->writeString($outputMessage);
 }
Esempio n. 6
0
function msgQueryLocale($aRequest)
{
    global $gLocale;
    global $gGame;
    loadGameSettings();
    $EncodedLocale = array();
    $LocaleName = getLocaleName();
    $Flags = PHP_VERSION_ID >= 50400 ? ENT_COMPAT | ENT_XHTML : ENT_COMPAT;
    $Flags = PHP_VERSION_ID >= 50300 ? $Flags | ENT_IGNORE : $Flags;
    // Hardcoded strings
    foreach ($gLocale as $Key => $Value) {
        if ($Value != null) {
            $Encoded = getUTF8($Value);
            //htmlentities(getUTF8($Value), $Flags, 'UTF-8');
            $EncodedLocale[$Key] = $Encoded;
        }
    }
    // Game based strings
    if (isset($gGame['Locales'][$LocaleName])) {
        foreach ($gGame['Locales'][$LocaleName] as $Key => $Value) {
            if ($Value != null) {
                $Encoded = getUTF8($Value);
                //htmlentities(getUTF8($Value), $Flags, 'UTF-8');
                $EncodedLocale[$Key] = $Encoded;
            }
        }
    }
    Out::getInstance()->pushValue('locale', $EncodedLocale);
}
Esempio n. 7
0
 public function actionIndex()
 {
     //取出公告数据
     $notice = Announcement::model()->findAll(array('order' => 'create_time DESC', 'condition' => 'status=:status', 'params' => array(':status' => 2)));
     $notice = CJSON::decode(CJSON::encode($notice));
     Out::jsonOutput($notice);
 }
function msgQueryNewRaidData($aRequest)
{
    $Out = Out::getInstance();
    if (validRaidlead()) {
        $Connector = Connector::getInstance();
        // Settings
        $NewRaidSettings = $Connector->prepare('SELECT Name, IntValue, TextValue FROM `' . RP_TABLE_PREFIX . 'Setting`');
        $IntOfInterest = array('RaidSize', 'RaidStartHour', 'RaidStartMinute', 'RaidEndHour', 'RaidEndMinute', 'StartOfWeek');
        $TextOfInterest = array('RaidMode');
        $Settings = array();
        $NewRaidSettings->loop(function ($Data) use(&$Settings, $IntOfInterest, $TextOfInterest) {
            $KeyValue = array('name' => $Data['Name'], 'value' => null);
            if (in_array($Data['Name'], $IntOfInterest)) {
                $KeyValue['value'] = $Data['IntValue'];
            } elseif (in_array($Data['Name'], $TextOfInterest)) {
                $KeyValue['value'] = $Data['TextValue'];
            }
            array_push($Settings, $KeyValue);
        });
        $Out->pushValue('setting', $Settings);
        // Locations
        msgQueryLocations($aRequest);
    } else {
        $Out->pushError(L('AccessDenied'));
    }
}
Esempio n. 9
0
 public function getExternalConfig($aRelativePath)
 {
     $Out = Out::getInstance();
     $ConfigPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/config.php';
     $DataPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/data';
     if (!file_exists($ConfigPath)) {
         $Out->pushError($ConfigPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     @(include_once $ConfigPath);
     if (!defined('EQDKP_INSTALLED')) {
         $Out->pushError(L('NoValidConfig'));
         return null;
     }
     $Version = 10000;
     $DataFolder = scandir($DataPath);
     foreach ($DataFolder as $Candidate) {
         $LocalConfPath = $DataPath . '/' . $Candidate . '/eqdkp/config/localconf.php';
         if (file_exists($LocalConfPath)) {
             define('EQDKP_INC', 1);
             @(include_once $LocalConfPath);
             $VersionParts = explode('.', $localconf['plus_version']);
             $Version = intval($VersionParts[0]) * 10000 + intval($VersionParts[1]) * 100 + intval($VersionParts[2]);
             break;
         }
     }
     return array('database' => $dbname, 'user' => $dbuser, 'password' => $dbpass, 'prefix' => $table_prefix, 'cookie' => null, 'version' => $Version);
 }
Esempio n. 10
0
 public function actionIndex()
 {
     $shop_id = Yii::app()->request->getParam('shop_id');
     if (!$shop_id) {
         Error::output(Error::ERR_NO_SHOPID);
     }
     //获取该店的留言
     $criteria = new CDbCriteria();
     $criteria->order = 't.order_id DESC';
     $criteria->condition = 't.shop_id=:shop_id AND t.status=:status';
     $criteria->params = array(':shop_id' => $shop_id, ':status' => 1);
     $messageMode = Message::model()->with('members', 'shops', 'replys')->findAll($criteria);
     $message = array();
     foreach ($messageMode as $k => $v) {
         $message[$k] = $v->attributes;
         $message[$k]['shop_name'] = $v->shops->name;
         $message[$k]['user_name'] = $v->members->name;
         $message[$k]['create_time'] = date('Y-m-d H:i:s', $v->create_time);
         $message[$k]['status_text'] = Yii::app()->params['message_status'][$v->status];
         $message[$k]['status_color'] = Yii::app()->params['status_color'][$v->status];
         $_replys = Reply::model()->with('members')->findAll(array('condition' => 'message_id=:message_id', 'params' => array(':message_id' => $v->id)));
         if (!empty($_replys)) {
             foreach ($_replys as $kk => $vv) {
                 $message[$k]['replys'][$kk] = $vv->attributes;
                 $message[$k]['replys'][$kk]['create_time'] = date('Y-m-d H:i:s', $vv->create_time);
                 $message[$k]['replys'][$kk]['user_name'] = $vv->user_id == -1 ? '前台妹子说' : $vv->members->name;
             }
         }
     }
     Out::jsonOutput($message);
 }
Esempio n. 11
0
 public function actionIndex()
 {
     $shop_id = Yii::app()->request->getParam('shop_id');
     if (!$shop_id) {
         Error::output(Error::ERR_NO_SHOPID);
     }
     //查询出改商店的一些详细信息
     $shopData = Shops::model()->findByPk($shop_id);
     if (!$shopData) {
         Error::output(Error::ERR_NO_SHOPID);
     }
     $shopData = CJSON::decode(CJSON::encode($shopData));
     //根据店铺id查询出该店铺的菜单
     $menuData = Menus::model()->with('food_sort', 'image', 'shops')->findAll(array('condition' => 't.shop_id=:shop_id AND t.status=:status', 'params' => array(':shop_id' => $shop_id, ':status' => 2)));
     $data = array();
     foreach ($menuData as $k => $v) {
         $data[$k] = $v->attributes;
         $data[$k]['index_pic'] = $v->index_pic ? Yii::app()->params['img_url'] . $v->image->filepath . $v->image->filename : '';
         $data[$k]['sort_name'] = $v->food_sort->name;
         $data[$k]['shop_name'] = $v->shops->name;
         $data[$k]['create_time'] = Yii::app()->format->formatDate($v->create_time);
         $data[$k]['status'] = Yii::app()->params['menu_status'][$v->status];
         $data[$k]['price'] = $v->price;
     }
     Out::jsonOutput(array('shop' => $shopData, 'menus' => $data));
 }
function msgQueryLocalCredentialsById($aRequest)
{
    $Credentials = UserProxy::getInstance()->getUserCredentialsById($aRequest['UserId'], 'none');
    $Out = Out::getInstance();
    if ($Credentials == null) {
        $Out->pushError(L('NoSuchUser'));
    } else {
        $Out->pushValue('salt', $Credentials['salt']);
        $Out->pushValue('pubkey', $Credentials['key']);
        $Out->pushValue('method', $Credentials['method']);
    }
}
Esempio n. 13
0
 public function prepare($aStatement, $aDriverOptions = array())
 {
     $StatementObj = parent::prepare($aStatement, $aDriverOptions);
     if ($StatementObj === false) {
         $Out = Out::getInstance();
         foreach (parent::errorInfo() as $ErrorLine) {
             $Out->pushError(strval($ErrorLine));
         }
         $Out->writeJSONandStop();
     }
     return new Query($StatementObj);
 }
Esempio n. 14
0
function msgQueryConfig($aRequest)
{
    global $gSite;
    global $gGame;
    $Out = Out::getInstance();
    loadGameSettings();
    $Config = array();
    $Config['AllowRegistration'] = defined('ALLOW_REGISTRATION') && ALLOW_REGISTRATION;
    // Push
    unset($gGame['Locales']);
    $Out->pushValue('site', array_merge($gSite, $Config));
    $Out->pushValue('game', $gGame);
}
Esempio n. 15
0
function api_help($aRequest)
{
    global $gApiHelp;
    $Out = Out::getInstance();
    $Topic = strtolower($aRequest['help']);
    if (isset($gApiHelp[$Topic])) {
        foreach ($gApiHelp[$Topic] as $Name => $Value) {
            $Out->pushValue($Name, $Value);
        }
    } else {
        $Out->pushError('Unknown help topic.');
    }
}
Esempio n. 16
0
function msgUserLink($aRequest)
{
    $Out = Out::getInstance();
    if (validAdmin()) {
        $UserInfo = tryGetUserLink($aRequest['userId']);
        if ($UserInfo != null) {
            $Out->pushValue('syncActive', !defined('ALLOW_GROUP_SYNC') || ALLOW_GROUP_SYNC);
            $Out->pushValue('userid', $aRequest['userId']);
            $Out->pushValue('binding', $UserInfo->BindingName);
            $Out->pushValue('group', $UserInfo->Group);
        }
    } else {
        $Out->pushError(L('AccessDenied'));
    }
}
Esempio n. 17
0
function InstallDB($Prefix)
{
    global $gDatabaseLayout;
    $Out = Out::getInstance();
    $Connector = Connector::getInstance();
    foreach ($gDatabaseLayout as $Name => $Rows) {
        $QueryString = "CREATE TABLE IF NOT EXISTS `" . $Prefix . $Name . "` (";
        $FirstRow = true;
        foreach ($Rows as $Row) {
            $QueryString .= ($FirstRow ? "" : ",") . $Row->CreateText();
            $FirstRow = false;
        }
        $QueryString .= ") ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
        $Connector->exec($QueryString);
    }
}
Esempio n. 18
0
 public function getExternalConfig($aRelativePath)
 {
     $Out = Out::getInstance();
     $ConfigPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/wcf/config.inc.php';
     if (!file_exists($ConfigPath)) {
         $Out->pushError($ConfigPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     @(include_once $ConfigPath);
     // Read cookie
     $Connector = new Connector(SQL_HOST, $dbName, $dbUser, $dbPassword, false);
     $OptionQuery = $Connector->prepare('SELECT optionValue FROM `wcf' . WCF_N . '_option` ' . 'WHERE optionName = "cookie_prefix" AND categoryName = "general.system.cookie" LIMIT 1');
     $OptionData = $OptionQuery->fetchFirst();
     // Build result
     return array('database' => $dbName, 'user' => $dbUser, 'password' => $dbPassword, 'prefix' => WCF_N, 'cookie' => $OptionData['optionValue'], 'version' => 40000);
 }
Esempio n. 19
0
 public function getExternalConfig($aRelativePath)
 {
     $Out = Out::getInstance();
     $ConfigPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/wp-config.php';
     if (!file_exists($ConfigPath)) {
         $Out->pushError($ConfigPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     define('SHORTINIT', true);
     @(include_once $ConfigPath);
     if (!isset($table_prefix)) {
         $Out->pushError(L('NoValidConfig'));
         return null;
     }
     $VersionElements = explode('.', $wp_version);
     $Version = $VersionElements[0] * 10000 + (isset($VersionElements[1]) ? $VersionElements[1] * 100 : 0) + (isset($VersionElements[2]) ? $VersionElements[2] : 0);
     return array('database' => DB_NAME, 'user' => DB_USER, 'password' => DB_PASSWORD, 'prefix' => $table_prefix, 'cookie' => LOGGED_IN_KEY . LOGGED_IN_SALT, 'version' => $Version);
 }
Esempio n. 20
0
function msgUserCreate($aRequest)
{
    require_once dirname(__FILE__) . '/../config/config.php';
    $Out = Out::getInstance();
    if (ALLOW_REGISTRATION) {
        $Salt = UserProxy::generateKey32();
        $NativeBinding = new NativeBinding();
        $HashedPassword = $NativeBinding->hash($aRequest['pass'], $Salt, 'none');
        $PublicMode = defined('PUBLIC_MODE') && PUBLIC_MODE;
        $DefaultGroup = $PublicMode ? 'member' : 'none';
        $Out->pushValue('publicmode', $PublicMode);
        if (!UserProxy::createUser($DefaultGroup, 0, 'none', $aRequest['name'], $HashedPassword, $Salt)) {
            $Out->pushError(L('NameInUse'));
        }
    } else {
        $Out->pushError(L('AccessDenied'));
    }
}
Esempio n. 21
0
function msgQueryUser($aRequest)
{
    $Out = Out::getInstance();
    if (registeredUser()) {
        $CurrentUser = UserProxy::getInstance();
        $CharacterIds = array();
        $CharacterGames = array();
        $CharacterNames = array();
        $CharacterClasses = array();
        $CharacterRoles1 = array();
        $CharacterRoles2 = array();
        $Settings = array();
        foreach ($CurrentUser->Characters as $Character) {
            array_push($CharacterIds, $Character->CharacterId);
            array_push($CharacterGames, $Character->Game);
            array_push($CharacterNames, $Character->Name);
            array_push($CharacterClasses, explode(':', $Character->ClassName));
            array_push($CharacterRoles1, $Character->Role1);
            array_push($CharacterRoles2, $Character->Role2);
        }
        $Out->pushValue('registeredUser', true);
        $Out->pushValue('id', $CurrentUser->UserId);
        $Out->pushValue('name', $CurrentUser->UserName);
        $Out->pushValue('characterIds', $CharacterIds);
        $Out->pushValue('characterGames', $CharacterGames);
        $Out->pushValue('characterNames', $CharacterNames);
        $Out->pushValue('characterClass', $CharacterClasses);
        $Out->pushValue('role1', $CharacterRoles1);
        $Out->pushValue('role2', $CharacterRoles2);
        $Out->pushValue('validUser', validUser());
        $Out->pushValue('isRaidlead', validRaidlead());
        $Out->pushValue('isAdmin', validAdmin());
        $Out->pushValue('settings', $CurrentUser->Settings);
        $Session = Session::get();
        if (isset($Session['Calendar'])) {
            $Out->pushValue('calendar', $Session['Calendar']);
        } else {
            $Out->pushValue('calendar', null);
        }
    } else {
        $Out->pushValue('registeredUser', false);
    }
}
Esempio n. 22
0
 public function getExternalConfig($aRelativePath)
 {
     $Out = Out::getInstance();
     $DefaultsPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/conf/config-defaults.php';
     $ConfigPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/conf/config.php';
     $IndexPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/index.php';
     if (!file_exists($DefaultsPath)) {
         $Out->pushError($DefaultsPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     if (!file_exists($ConfigPath)) {
         $Out->pushError($ConfigPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     $Version = 20000;
     if (file_exists($IndexPath)) {
         $Index = file_get_contents($IndexPath);
         $AppIdx = strpos($Index, 'APPLICATION_VERSION');
         if ($AppIdx !== false) {
             $StripIdx = strpos($Index, ';', $AppIdx);
             $Index = substr($Index, 0, $StripIdx + 1);
             $Index = substr($Index, strpos($Index, '<?php') + 5);
             eval($Index);
             $VersionParts = explode('.', APPLICATION_VERSION);
             $Version = intval($VersionParts[0]) * 10000 + intval($VersionParts[1]) * 100 + intval($VersionParts[2]);
         }
     }
     if (!defined('APPLICATION')) {
         define('APPLICATION', 'Vanilla');
     }
     define('PATH_CACHE', '');
     @(include_once $DefaultsPath);
     @(include_once $ConfigPath);
     if (!isset($Configuration)) {
         $Out->pushError(L('NoValidConfig'));
         return null;
     }
     $CookieConf = $Configuration['Garden']['Cookie'];
     $DbConf = $Configuration['Database'];
     return array('database' => $DbConf['Name'], 'user' => $DbConf['User'], 'password' => $DbConf['Password'], 'prefix' => $DbConf['DatabasePrefix'], 'cookie' => $CookieConf['Name'] . ',' . $CookieConf['HashMethod'] . ',' . $CookieConf['Salt'], 'version' => $Version);
 }
Esempio n. 23
0
 public function getExternalConfig($aRelativePath)
 {
     $Out = Out::getInstance();
     $ConfigPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/Configuration.php';
     $VersionPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/libraries/cms/version/version.php';
     if (!file_exists($ConfigPath)) {
         $Out->pushError($ConfigPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     @(include_once $ConfigPath);
     define('JPATH_PLATFORM', '');
     define('_JEXEC', '');
     @(include_once $VersionPath);
     $Version = 30000;
     if (class_exists("JVersion")) {
         $VersionClass = new JVersion();
         $VersionParts = explode('.', $VersionClass->RELEASE);
         $Version = intval($VersionParts[0]) * 10000 + intval($VersionParts[1]) * 100 + intval($VersionClass->DEV_LEVEL);
     }
     $Config = new JConfig();
     return array('database' => $Config->db, 'user' => $Config->user, 'password' => $Config->password, 'prefix' => $Config->dbprefix, 'cookie' => $Config->secret, 'version' => $Version);
 }
Esempio n. 24
0
 public function getExternalConfig($aRelativePath)
 {
     $ConfigPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/Settings.php';
     if (!file_exists($ConfigPath)) {
         Out::getInstance()->pushError($ConfigPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     @(include_once $ConfigPath);
     if (!isset($mbname)) {
         Out::getInstance()->pushError(L('NoValidConfig'));
         return null;
     }
     $Version = 20000;
     $Connector = new Connector(SQL_HOST, $db_name, $db_user, $db_passwd, false);
     if ($Connector != null) {
         $VersionQuery = $Connector->prepare('SELECT value FROM `' . $db_prefix . 'settings` WHERE variable="smfVersion" LIMIT 1');
         $VersionData = $VersionQuery->fetchFirst();
         $VersionParts = explode('.', $VersionData['value']);
         $Version = intval($VersionParts[0]) * 10000 + intval($VersionParts[1]) * 100 + intval($VersionParts[2]);
     }
     return array('database' => $db_name, 'user' => $db_user, 'password' => $db_passwd, 'prefix' => $db_prefix, 'cookie' => isset($cookiename) ? $cookiename : 'SMFCookie956', 'version' => $Version);
 }
Esempio n. 25
0
 public function getExternalConfig($aRelativePath)
 {
     $Out = Out::getInstance();
     $ConfigPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/includes/config.php';
     $CorePath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/includes/class_core.php';
     if (!file_exists($ConfigPath)) {
         $Out->pushError($ConfigPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     @(include_once $ConfigPath);
     @(include_once $CorePath);
     if (!isset($config)) {
         $Out->pushError(L('NoValidConfig'));
         return null;
     }
     $Version = 30000;
     if (defined('FILE_VERSION')) {
         $VersionParts = explode('.', FILE_VERSION);
         $Version = intval($VersionParts[0]) * 10000 + intval($VersionParts[1]) * 100 + intval($VersionParts[2]);
     }
     return array('database' => $config['Database']['dbname'], 'user' => $config['MasterServer']['username'], 'password' => $config['MasterServer']['password'], 'prefix' => $config['Database']['tableprefix'], 'cookie' => $config['Misc']['cookieprefix'], 'version' => $Version);
 }
Esempio n. 26
0
 protected function doUpgrade($name)
 {
     $upgradeFile = Module::getUpgradeDir() . '/' . $name . '.php';
     if (!is_file($upgradeFile)) {
         return false;
     }
     /** @noinspection PhpIncludeInspection */
     require_once $upgradeFile;
     $class = 'Sprint\\Migration\\' . $name;
     if (!class_exists($class)) {
         return false;
     }
     /** @var Upgrade $obj */
     $obj = new $class();
     $obj->setDebug($this->debug);
     $obj->doUpgrade();
     if ($this->debug) {
         Out::out('Upgrade to version: %s', $name);
     }
     Module::setDbOption('upgrade_version', $name);
     return true;
 }
function msgCommentupdate($aRequest)
{
    if (validUser()) {
        $Connector = Connector::getInstance();
        $RaidId = intval($aRequest['raidId']);
        $UserId = UserProxy::getInstance()->UserId;
        $CheckQuery = $Connector->prepare('SELECT UserId FROM `' . RP_TABLE_PREFIX . 'Attendance` WHERE UserId = :UserId AND RaidId = :RaidId LIMIT 1');
        $CheckQuery->bindValue(':UserId', $UserId, PDO::PARAM_INT);
        $CheckQuery->bindValue(':RaidId', $RaidId, PDO::PARAM_INT);
        if ($CheckQuery->execute()) {
            $UpdateQuery = null;
            if ($CheckQuery->getAffectedRows() > 0) {
                $UpdateQuery = $Connector->prepare('UPDATE `' . RP_TABLE_PREFIX . 'Attendance` ' . 'SET comment = :Comment, LastUpdate = FROM_UNIXTIME(:Timestamp) ' . 'WHERE RaidId = :RaidId AND UserId = :UserId LIMIT 1');
                $UpdateQuery->bindValue(':Timestamp', time(), PDO::PARAM_INT);
            } else {
                $UpdateQuery = $Connector->prepare('INSERT INTO `' . RP_TABLE_PREFIX . 'Attendance` ( CharacterId, UserId, RaidId, Status, Role, Comment ) ' . 'VALUES ( :CharacterId, :UserId, :RaidId, :Status, :Role, :Comment )');
                $UpdateQuery->bindValue(':CharacterId', 0, PDO::PARAM_INT);
                $UpdateQuery->bindValue(':Role', '', PDO::PARAM_STR);
                $UpdateQuery->bindValue(':Status', 'undecided', PDO::PARAM_STR);
            }
            $UpdateQuery->bindValue(':RaidId', $RaidId, PDO::PARAM_INT);
            $UpdateQuery->bindValue(':UserId', $UserId, PDO::PARAM_INT);
            $UpdateQuery->bindValue(':Comment', requestToXML($aRequest['comment'], ENT_COMPAT, 'UTF-8'), PDO::PARAM_STR);
            $UpdateQuery->execute();
        }
        // reload calendar
        $RaidQuery = $Connector->prepare('SELECT Start FROM `' . RP_TABLE_PREFIX . 'Raid` WHERE RaidId = :RaidId LIMIT 1');
        $RaidQuery->bindValue(':RaidId', $RaidId, PDO::PARAM_INT);
        $RaidData = $RaidQuery->fetchFirst();
        $Session = Session::get();
        $ShowMonth = isset($Session['Calendar']) && isset($Session['Calendar']['month']) ? $Session['Calendar']['month'] : intval(substr($RaidData['Start'], 5, 2));
        $ShowYear = isset($Session['Calendar']) && isset($Session['Calendar']['year']) ? $Session['Calendar']['year'] : intval(substr($RaidData['Start'], 0, 4));
        msgQueryCalendar(prepareCalRequest($ShowMonth, $ShowYear));
    } else {
        $Out = Out::getInstance();
        $Out->pushError(L('AccessDenied'));
    }
}
Esempio n. 28
0
 public function getExternalConfig($aRelativePath)
 {
     $Out = Out::getInstance();
     $ConfigPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/config.php';
     if (!file_exists($ConfigPath)) {
         $Out->pushError($ConfigPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     @(include_once $ConfigPath);
     if (!defined('PHPBB_INSTALLED')) {
         $Out->pushError(L('NoValidConfig'));
         return null;
     }
     $Version = 30000;
     $Connector = new Connector(SQL_HOST, $dbname, $dbuser, $dbpasswd, false);
     if ($Connector != null) {
         $VersionQuery = $Connector->prepare('SELECT config_value FROM `' . $table_prefix . 'config` WHERE config_name="version" LIMIT 1');
         $VersionData = $VersionQuery->fetchFirst();
         $VersionParts = explode('.', $VersionData['config_value']);
         $Version = intval($VersionParts[0]) * 10000 + intval($VersionParts[1]) * 100 + intval($VersionParts[2]);
     }
     return array('database' => $dbname, 'user' => $dbuser, 'password' => $dbpasswd, 'prefix' => $table_prefix, 'cookie' => null, 'version' => $Version);
 }
Esempio n. 29
0
 public function getExternalConfig($aRelativePath)
 {
     $Out = Out::getInstance();
     $ConfigPath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/inc/config.php';
     $CorePath = $_SERVER['DOCUMENT_ROOT'] . '/' . $aRelativePath . '/inc/class_core.php';
     if (!file_exists($ConfigPath)) {
         $Out->pushError($ConfigPath . ' ' . L('NotExisting') . '.');
         return null;
     }
     @(include_once $ConfigPath);
     if (!isset($config)) {
         $Out->pushError(L('NoValidConfig'));
         return null;
     }
     include_once $CorePath;
     $Version = 10600;
     if (class_exists("MyBB")) {
         $VersionClass = new MyBB();
         $VersionParts = explode('.', $VersionClass->version);
         $Version = intval($VersionParts[0]) * 10000 + intval($VersionParts[1]) * 100 + intval($VersionParts[2]);
     }
     return array('database' => $config['database']['database'], 'user' => $config['database']['username'], 'password' => $config['database']['password'], 'prefix' => $config['database']['table_prefix'], 'cookie' => null, 'version' => $Version);
 }
Esempio n. 30
-1
function msgRaidList($aRequest)
{
    if (validUser()) {
        global $gGame;
        loadGameSettings();
        $Out = Out::getInstance();
        $Connector = Connector::getInstance();
        // Get next 6 raids
        $NextRaidQuery = $Connector->prepare('Select ' . RP_TABLE_PREFIX . 'Raid.*, ' . RP_TABLE_PREFIX . 'Location.*, ' . RP_TABLE_PREFIX . 'Attendance.CharacterId, ' . RP_TABLE_PREFIX . 'Attendance.UserId, ' . RP_TABLE_PREFIX . 'Attendance.Status, ' . RP_TABLE_PREFIX . 'Attendance.Class, ' . RP_TABLE_PREFIX . 'Attendance.Role, ' . RP_TABLE_PREFIX . 'Attendance.Comment, ' . 'UNIX_TIMESTAMP(' . RP_TABLE_PREFIX . 'Raid.Start) AS StartUTC, ' . 'UNIX_TIMESTAMP(' . RP_TABLE_PREFIX . 'Raid.End) AS EndUTC ' . 'FROM `' . RP_TABLE_PREFIX . 'Raid` ' . 'LEFT JOIN `' . RP_TABLE_PREFIX . 'Location` USING(LocationId) ' . 'LEFT JOIN `' . RP_TABLE_PREFIX . 'Attendance` USING(RaidId) ' . 'LEFT JOIN `' . RP_TABLE_PREFIX . 'Character` USING (CharacterId) ' . 'WHERE ' . RP_TABLE_PREFIX . 'Raid.Start >= FROM_UNIXTIME(:Start) ' . 'AND ' . RP_TABLE_PREFIX . 'Location.Game = :Game ' . 'ORDER BY ' . RP_TABLE_PREFIX . 'Raid.Start, ' . RP_TABLE_PREFIX . 'Raid.RaidId');
        $NextRaidQuery->bindValue(':Start', mktime(0, 0, 0), PDO::PARAM_INT);
        $NextRaidQuery->bindValue(':Game', $gGame['GameId'], PDO::PARAM_STR);
        parseRaidQuery($aRequest, $NextRaidQuery, 6);
        // Load raid history
        $RaidHistoryQuery = $Connector->prepare('Select ' . RP_TABLE_PREFIX . 'Raid.*, ' . RP_TABLE_PREFIX . 'Location.*, ' . 'UNIX_TIMESTAMP(' . RP_TABLE_PREFIX . 'Raid.Start) AS StartUTC, ' . 'UNIX_TIMESTAMP(' . RP_TABLE_PREFIX . 'Raid.End) AS EndUTC ' . 'FROM `' . RP_TABLE_PREFIX . 'Raid` ' . 'LEFT JOIN `' . RP_TABLE_PREFIX . 'Location` USING(LocationId) ' . 'WHERE ' . RP_TABLE_PREFIX . 'Raid.Start < FROM_UNIXTIME(:Start) ' . 'AND ' . RP_TABLE_PREFIX . 'Location.Game = :Game ' . 'ORDER BY Start DESC LIMIT ' . intval($aRequest['offset']) . ', ' . intval($aRequest['count']));
        $RaidHistoryQuery->bindValue(':Start', mktime(0, 0, 0), PDO::PARAM_INT);
        $RaidHistoryQuery->bindValue(':Game', $gGame['GameId'], PDO::PARAM_STR);
        $RaidList = array();
        $RaidHistoryQuery->loop(function ($Data) use(&$RaidList) {
            $StartDate = getdate($Data['StartUTC']);
            $EndDate = getdate($Data['EndUTC']);
            $Raid = array('id' => $Data['RaidId'], 'location' => $Data['Name'], 'stage' => $Data['Stage'], 'image' => $Data['Image'], 'size' => $Data['Size'], 'startDate' => $StartDate['year'] . '-' . leadingZero10($StartDate['mon']) . '-' . leadingZero10($StartDate['mday']), 'start' => leadingZero10($StartDate['hours']) . ':' . leadingZero10($StartDate['minutes']), 'endDate' => $EndDate['year'] . '-' . leadingZero10($EndDate['mon']) . '-' . leadingZero10($EndDate['mday']), 'end' => leadingZero10($EndDate['hours']) . ':' . leadingZero10($EndDate['minutes']));
            array_push($RaidList, $Raid);
        });
        $Out->pushValue('history', $RaidList);
    } else {
        $Out = Out::getInstance();
        $Out->pushError(L('AccessDenied'));
    }
}