本文整理汇总了PHP中Armory::Log方法的典型用法代码示例。如果您正苦于以下问题:PHP Armory::Log方法的具体用法?PHP Armory::Log怎么用?PHP Armory::Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Armory
的用法示例。
在下文中一共展示了Armory::Log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LoadTemplate
public static function LoadTemplate($template_name, $overall = false)
{
if ($overall) {
$template = __ARMORYDIRECTORY__ . '/admin/template/overall/overall_' . $template_name . '.php';
} else {
$template = __ARMORYDIRECTORY__ . '/admin/template/' . $template_name . '.php';
}
if (file_exists($template)) {
include $template;
} else {
Armory::Log()->writeError('%s : unable to find template "%s" (template theme: %s, overall: %d, path: %s)!', __METHOD__, $template_name, self::GetTemplateTheme(), (int) $overall, $template);
}
}
示例2: GetServerTypeByString
/**
* Returns server type ID
* @category Utils class
* @access public
* @param string $server
* @return int
**/
public function GetServerTypeByString($server)
{
$server = strtolower($server);
if ($server == 'mangos') {
return SERVER_MANGOS;
} elseif ($server == 'trinity') {
return SERVER_TRINITY;
}
Armory::Log()->writeError('%s : unsupported server type ("%s")!', __METHOD__, $server);
return UNK_SERVER;
}
示例3: GetExtendedCost
/**
* Returns extended cost info for $costId cost.
* @category Mangos class
* @access public
* @param int $costId
* @return array
**/
public function GetExtendedCost($costId)
{
if ($costId == 0) {
return false;
}
if ($costId < 0) {
$costId = abs($costId);
}
$costInfo = Armory::$aDB->selectRow("SELECT * FROM `ARMORYDBPREFIX_extended_cost` WHERE `id`=%d LIMIT 1", $costId);
if (!$costInfo) {
Armory::Log()->writeError('%s : wrong cost id: #%d', __METHOD__, $costId);
return false;
}
$extended_cost = array();
for ($i = 1; $i < 6; $i++) {
if ($costInfo['item' . $i] > 0) {
$extended_cost[$i]['count'] = $costInfo['item' . $i . 'count'];
$extended_cost[$i]['icon'] = Items::GetItemIcon($costInfo['item' . $i]);
$extended_cost[$i]['id'] = $costInfo['item' . $i];
}
}
return $extended_cost;
}
示例4: die
die($errorDBVersion);
}
}
/* Check config version */
if (!defined('CONFIG_VERSION') || !isset(Armory::$armoryconfig['configVersion'])) {
if (isset(Armory::$armoryconfig['checkVersionType']) && Armory::$armoryconfig['checkVersionType'] == 'log') {
Armory::Log()->writeError('ArmoryChecker : unable to detect Configuration version!');
} else {
die('<b>ConfigVersion error:</b> unable to detect Configuration version!');
}
} else {
if (CONFIG_VERSION != Armory::$armoryconfig['configVersion']) {
$CfgError = sprintf('<b>ConfigVersion error:</b> your config version is outdated (current: %s, expected: %s).<br />
Please, update your config file from configuration.php.default', Armory::$armoryconfig['configVersion'], CONFIG_VERSION);
if (isset(Armory::$armoryconfig['checkVersionType']) && Armory::$armoryconfig['checkVersionType'] == 'log') {
Armory::Log()->writeError('ArmoryChecker : %s', $CfgError);
} else {
die($CfgError);
}
}
}
/* Check maintenance */
if (Armory::$armoryconfig['maintenance'] == true && !defined('MAINTENANCE_PAGE')) {
header('Location: maintenance.xml');
exit;
}
if (!defined('skip_utils_class')) {
if (!(include __ARMORYDIRECTORY__ . '/includes/classes/class.utils.php')) {
die('<b>Error:</b> unable to load utils class!');
}
$utils = new Utils();
示例5: LoadItem
public function LoadItem($item_entry, $itemGuid = 0, $ownerGuid = 0)
{
$item_row = Armory::$wDB->selectRow("SELECT * FROM `item_template` WHERE `entry` = '%d' LIMIT 1", $item_entry);
if (!$item_row) {
Armory::Log()->writeError('%s : item #%d (GUID: %d) was not found in `item_template` table.', __METHOD__, $item_entry, $itemGuid);
return false;
}
// FlagsExtra check
if (isset($item_row['FlagsExtra'])) {
$item_row['Flags2'] = $item_row['FlagsExtra'];
unset($item_row['FlagsExtra']);
// For compatibility
}
// Assign variables
foreach ($item_row as $field => $value) {
$this->{$field} = $value;
}
// Create arrays
// Item mods
for ($i = 0; $i < MAX_ITEM_PROTO_STATS + 1; $i++) {
$key = $i + 1;
if (isset($this->{'stat_type' . $key})) {
$this->ItemStat[$i] = array('type' => $this->{'stat_type' . $key}, 'value' => $this->{'stat_value' . $key});
}
}
// Item damages
for ($i = 0; $i < MAX_ITEM_PROTO_DAMAGES + 1; $i++) {
$key = $i + 1;
if (isset($this->{'dmg_type' . $key})) {
$this->Damage[$i] = array('type' => $this->{'dmg_type' . $key}, 'min' => $this->{'dmg_min' . $key}, 'max' => $this->{'dmg_max' . $key});
}
}
// Item spells
for ($i = 0; $i < MAX_ITEM_PROTO_SPELLS + 1; $i++) {
$key = $i + 1;
if (isset($this->{'spellid_' . $key})) {
$this->Spells[$i] = array('spellid' => $this->{'spellid_' . $key}, 'trigger' => $this->{'spelltrigger_' . $key}, 'charges' => $this->{'spellcharges_' . $key}, 'ppmRate' => $this->{'spellppmRate_' . $key}, 'cooldown' => $this->{'spellcooldown_' . $key}, 'category' => $this->{'spellcategory_' . $key}, 'categorycooldown' => $this->{'spellcategorycooldown_' . $key});
}
}
// Item sockets
for ($i = 0; $i < MAX_ITEM_PROTO_SOCKETS + 1; $i++) {
$key = $i + 1;
if (isset($this->{'socketColor_' . $key})) {
$this->Socket[$i] = array('color' => $this->{'socketColor_' . $key}, 'content' => $this->{'socketContent_' . $key});
}
}
$this->m_guid = $itemGuid;
// Can have NULL value.
$this->m_owner = $ownerGuid;
// Can have NULL value.
$this->loaded = true;
return true;
}
示例6: BuildOpposingTeamList
/**
* Build opponents list for current arena team
* @category Arenateams class
* @access public
* @return array
**/
public function BuildOpposingTeamList()
{
if (!$this->arenateamid) {
Armory::Log()->writeError('%s : arenateamid not provided', __METHOD__);
return false;
}
$game_ids = Armory::$cDB->select("SELECT DISTINCT `gameid` FROM `armory_game_chart` WHERE `teamid`=%d", $this->arenateamid);
if (!$game_ids) {
Armory::Log()->writeLog('%s : unable to find any game for teamId %d', __METHOD__, $this->arenateamid);
return false;
}
$all_games = array();
$counter = count($game_ids);
foreach ($game_ids as $game) {
$all_games[] = $game['gameid'];
}
$game_chart = Armory::$cDB->select("\n SELECT\n `armory_game_chart`.`gameid`,\n `armory_game_chart`.`teamid`,\n `armory_game_chart`.`guid`,\n COUNT(`armory_game_chart`.`teamid`) AS `countTeam`,\n `arena_team`.`name`,\n `arena_team`.`type`\n FROM `armory_game_chart` AS `armory_game_chart`\n LEFT JOIN `arena_team` AS `arena_team` ON `arena_team`.`arenateamid`=`armory_game_chart`.`teamid`\n WHERE `armory_game_chart`.`gameid` IN (%s) AND `armory_game_chart`.`teamid` <> %d\n GROUP BY `armory_game_chart`.`gameid`", $all_games, $this->arenateamid);
if (!$game_chart) {
Armory::Log()->writeError('%s : game_ids were fetched from DB, but script was unable to get data for these matches from characters DB (arenateamid:%d)', __METHOD__, $this->arenateamid);
return false;
}
$chart_data = array();
foreach ($game_chart as $team) {
if (!isset($chart_data[$team['teamid']])) {
// Do not add same teams more than 1 time
$rating_change = Armory::$cDB->select("SELECT `gameid`, `changeType`, `ratingChange` FROM `armory_game_chart` WHERE `teamid`=%d AND `gameid` IN (%s)", $team['teamid'], $all_games);
$rd = 0;
if ($rating_change) {
$exists = array();
foreach ($rating_change as $rCh) {
if (!isset($exists[$rCh['gameid']])) {
if ($rCh['changeType'] == 1) {
$rd += $rCh['ratingChange'];
} else {
$rd -= $rCh['ratingChange'];
}
$exists[$rCh['gameid']] = true;
}
}
}
$losses = Armory::$cDB->selectCell("SELECT COUNT(distinct(`gameid`)) FROM `armory_game_chart` WHERE `changeType`=1 AND `teamid`='%d' AND `gameid` IN (%s)", $team['teamid'], $all_games);
$wins = Armory::$cDB->selectCell("SELECT COUNT(distinct(`gameid`)) FROM `armory_game_chart` WHERE `changeType`=2 AND `teamid`='%d' AND `gameid` IN (%s)", $team['teamid'], $all_games);
$chart_data[$team['teamid']] = array('deleted' => $this->TeamExists($team['teamid']) ? 'false' : 'true', 'games' => $losses + $wins, 'losses' => $losses, 'rd' => $rd, 'realm' => Armory::$currentRealmInfo['name'], 'teamName' => $team['name'], 'teamUrl' => sprintf("r=%s&ts=%d&t=%s", urlencode(Armory::$currentRealmInfo['name']), $team['type'], urlencode($team['name'])), 'wins' => $wins);
$chart_data[$team['teamid']]['winPer'] = Utils::GetPercent($chart_data[$team['teamid']]['games'], $chart_data[$team['teamid']]['wins']);
}
}
return $chart_data;
}
示例7: GetRandomSuffixData
/**
* @return array
**/
public function GetRandomSuffixData()
{
if ($this->m_server != SERVER_MANGOS) {
Armory::Log()->writeError('%s : this method is usable with MaNGOS servers only.', __METHOD__);
return false;
}
return array($this->GetUInt32Value(ITEM_FIELD_ENCHANTMENT_8_1), $this->GetUInt32Value(ITEM_FIELD_ENCHANTMENT_9_1), $this->GetUInt32Value(ITEM_FIELD_ENCHANTMENT_10_1));
}
示例8: elseif
Armory::Log()->writeLog('character-select-submit : realm %s not found in database!', $realmName);
continue;
} elseif (!isset(Armory::$realmData[$realm_id])) {
Armory::Log()->writeLog('character-select-submit : connection data to realm %s (ID: %d) not found!', $realmName, $realm_id);
continue;
}
$realm_info = Armory::$realmData[$realm_id];
$db = new Armory::$dbClass($realm_info['host_characters'], $realm_info['user_characters'], $realm_info['pass_characters'], $realm_info['port_characters'], $realm_info['name_characters'], $realm_info['charset_characters']);
if (!$db) {
// Error message will appear in ArmoryDatabaseHandler::ArmoryDatabaseHandler();
continue;
}
$char_data = $db->selectRow("SELECT `guid`, `name`, `class`, `race`, `gender`, `level`, `account` FROM `characters` WHERE `name`='%s' AND `account`=%d LIMIT 1", $utils->escape($_GET['cn' . $i]), $_SESSION['accountId']);
if (!$char_data) {
Armory::Log()->writeLog('character-select-submit : unable to get character data from DB (name: %s, accountId: %d)', $_GET['cn' . $i], $_SESSION['accountId']);
continue;
}
$char_data['realm_id'] = $realm_id;
if (isset($_GET['cn1']) && $i == 1) {
$char_data['selected'] = 1;
} else {
$char_data['selected'] = $i;
}
$char_data['num'] = $i;
$utils->AddCharacterAsSelected($char_data, $realm_id, $i);
}
}
} else {
Armory::Log()->writeLog('character-select-submit : $_GET variable not found!');
}
exit;
示例9: GetGuildRanks
/**
* Returns array with guild rank IDs.
* @category Guilds class
* @access public
* @return array
**/
public function GetGuildRanks()
{
if (!$this->guildId) {
Armory::Log()->writeError('%s : guildId not defined', __METHOD__);
return false;
}
return Armory::$cDB->select("SELECT `rid` AS `id`, `rname` AS `name` FROM `guild_rank` WHERE `guildid`=%d", $this->guildId);
}
示例10: GetItemSourceArray
/**
* Returns array with item sources (for search results)
* @category Search class
* @access private
* @param array $items
* @return array
**/
private function GetItemSourceArray($items)
{
// Get item IDs first
$result_ids = array();
foreach ($items as $item) {
$curr_item_id = 0;
if (!isset($item['id']) && !isset($item['entry'])) {
continue;
} elseif (isset($item['id'])) {
$curr_item_id = $item['id'];
} elseif (isset($item['entry'])) {
$curr_item_id = $item['entry'];
}
if ($curr_item_id == 0) {
continue;
}
$result_ids[] = $curr_item_id;
}
// Get item sources
$data = Armory::$aDB->select("\n SELECT\n `ARMORYDBPREFIX_source`.`item`,\n `ARMORYDBPREFIX_source`.`source`,\n `ARMORYDBPREFIX_source`.`areaKey`,\n `ARMORYDBPREFIX_source`.`areaUrl`,\n `ARMORYDBPREFIX_source`.`isHeroic`,\n `ARMORYDBPREFIX_instance_template`.`name_%s` AS `areaName`,\n `ARMORYDBPREFIX_instance_template`.`id` AS `areaId`\n FROM `ARMORYDBPREFIX_source` AS `ARMORYDBPREFIX_source`\n LEFT JOIN `ARMORYDBPREFIX_instance_template` AS `ARMORYDBPREFIX_instance_template` ON `ARMORYDBPREFIX_instance_template`.`key`=`ARMORYDBPREFIX_source`.`areaKey`\n WHERE `ARMORYDBPREFIX_source`.`item` IN (%s)", Armory::GetLocale(), $result_ids);
if (!$data) {
Armory::Log()->writeError('%s : unable to get item sources from DB!', __METHOD__);
return false;
}
$sources_result = array();
foreach ($data as $entry) {
if (!isset($sources_result[$entry['item']])) {
$sources_result[$entry['item']] = $entry;
}
}
return $sources_result;
}
示例11: GenerateAchievements
private function GenerateAchievements()
{
if (!is_array($this->achievements_storage)) {
Armory::Log()->writeError('%s : unable to generate achievements ID: achievements storage is empty!', __METHOD__);
return false;
}
$this->achievements_id = array();
$ach_storage = array();
$criterias_storage = array();
$latest_count = 0;
foreach ($this->achievements_storage as $achievement) {
if ($latest_count < 6) {
$this->latest_achievements[] = $achievement;
$latest_count++;
}
$ach_storage[$achievement['achievement']] = $achievement;
$this->achievements_id[] = $achievement['achievement'];
}
foreach ($this->achievements_progress_storage as $criteria) {
$criterias_storage[$criteria['criteria']] = $criteria;
}
$this->achievements_storage = $ach_storage;
$this->achievements_progress_storage = $criterias_storage;
unset($ach_storage, $criterias_storage);
return true;
}
示例12: _query
protected function _query($safe_sql, $queryType)
{
// Execute query and calculate execution time
$make_array = array();
$query_start = microtime(true);
$this->queryCount++;
$performed_query = mysql_query($safe_sql, $this->connectionLink);
if (!$performed_query) {
if (!$this->disableNextError) {
Armory::Log()->writeLog('%s : unable to execute SQL query (%s). MySQL error: %s', __METHOD__, $safe_sql, mysql_error($this->connectionLink) ? sprintf('"%s" (Error #%d)', mysql_error($this->connectionLink), mysql_errno($this->connectionLink)) : 'none');
}
if ($this->disableNextError) {
$this->disableNextError = false;
}
return false;
}
$result = false;
switch ($queryType) {
case QueryType::SINGLE_CELL:
$row = mysql_fetch_row($performed_query);
$result = $row[0];
break;
case QueryType::SINGLE_ROW:
$result = mysql_fetch_assoc($performed_query);
if (is_array($result)) {
foreach ($result as $rKey => $rValue) {
if (is_string($rKey)) {
$make_array[$rKey] = $rValue;
}
}
$result = $make_array;
}
break;
case QueryType::MULTIPLY_ROW:
$result = array();
while ($_result = mysql_fetch_assoc($performed_query)) {
if (is_array($_result)) {
foreach ($_result as $rKey => $rValue) {
if (is_string($rKey)) {
$make_array[$rKey] = $rValue;
}
}
$result[] = $make_array;
} else {
$result[] = $_result;
}
}
break;
case QueryType::OBJECT_QUERY:
$result = array();
while ($_result = mysql_fetch_object($performed_query)) {
$result[] = $_result;
}
break;
case QueryType::SQL_QUERY:
$result = true;
break;
default:
$result = false;
break;
}
$query_end = microtime(true);
$queryTime = round($query_end - $query_start, 4);
Armory::Log()->writeSql('[%s ms]: %s', $queryTime, $safe_sql);
$this->queryTimeGeneration += $queryTime;
return $result;
}
示例13: ConvertArray
protected function ConvertArray($source)
{
if (!is_array($source)) {
Armory::Log()->writeError('%s : source must have array type!', __METHOD__);
return null;
}
$returnString = null;
$count = count($source);
for ($i = 0; $i < $count; $i++) {
if (!isset($source[$i])) {
continue;
}
if ($i) {
$returnString .= ", '" . $this->SanitizeString($source[$i]) . "'";
} else {
$returnString .= "'" . $this->SanitizeString($source[$i]) . "'";
}
}
return $returnString;
}
示例14: LoadTableFromDB
public static function LoadTableFromDB($table)
{
if (!self::$db) {
Armory::Log()->writeError('%s : DB is not initialized!', __METHOD__);
return false;
}
self::$db_table = $table;
$table_data = self::$db->select("DESCRIBE %s", self::$db_table);
if (!$table_data) {
return false;
}
$td = array();
$i = 0;
foreach ($table_data as $tbl) {
$td[] = array('name' => $tbl['Field'], 'key' => $tbl['Key'] == 'PRI' ? true : false);
}
return $td;
}
示例15: GetItemByEntry
/**
* Return item handler by item entry (from item storage)
* Note: m_items must be initialized in Characters::BuildCharacter()!
* @category Characters class
* @access public
* @param int $entry
* @return object
**/
public function GetItemByEntry($entry)
{
if (!is_array($this->m_items)) {
Armory::Log()->writeError('%s : m_items must be an array!', __METHOD__);
return false;
}
foreach ($this->m_items as $mItem) {
if ($mItem->GetEntry() == $entry) {
return $mItem;
}
}
return false;
}