function getErrorString($errstr) { $errstr = trim($errstr); $XML = "<log>\n <date>" . date("Y-m-d H:i:m") . "</date>\n <uid>" . @UserParameters::getUserId() . "</uid>\n <command>" . @GlobalParameters::getCommand() . "</command>\n <ip>" . getRealIP() . "</ip>\n" . get_caller_method() . "\n <body><![CDATA[\n" . $errstr . "\n ]]></body>\n</log>" . PHP_EOL; return $XML; }
public static function forDebug($message, $needVarDump = false) { $output = ob_get_contents(); @ob_end_clean(); ob_start(); echo "<ID:" . UserParameters::getUserId() . ">\n"; echo get_caller_method(); echo '<print>' . PHP_EOL; print_r($message); echo '</print>' . PHP_EOL; if ($needVarDump) { echo '<var_dump>' . PHP_EOL; var_dump($message); echo '</var_dump>' . PHP_EOL; } echo "</ID:" . UserParameters::getUserId() . ">\n"; $outputDebug = ob_get_contents(); ob_end_clean(); ob_start(); fwrite(getLog(LOG_USER_DEBUG), $outputDebug . PHP_EOL . PHP_EOL); echo $output; }
public function update() { if ($this->teamId != UserParameters::getUserId()) { return new ErrorPoint(ErrorPoint::CODE_SECURITY, "Техническая ошибка", ErrorPoint::TYPE_SYSTEM); } if ($this->getIsFriend()) { $sql_template = "UPDATE footballers_friends SET\nlevel = %d,\nis_active = %d,\ntype = %d,\nsuper = %d,\nhealth_down = %d,\nlogger = '%s'\nWHERE\nowner_vk_id = %d AND\nvk_id = %d"; $sql = sprintf($sql_template, $this->getLevel(), $this->getIsActive(), $this->getType(), $this->getIsSuper(), $this->getHealthDown(), get_caller_method() . "\n\n" . json_encode(JSONPrepare::footballer($this)) . $this->teamId . "|" . UserParameters::getUserId() . $this->SQL, UserParameters::getUserId(), $this->getId()); /* $footballerInRAM = RAM::getInstance()->getFootballerFriendById($this->getId()); if($footballerInRAM === false){ $currentIndex = RAM::getInstance()->getMaxObjectIndexForTeam(UserParameters::getUserId(), RAM::RAM_TYPE_FOOTBALLER_FRIEND); RAM::getInstance()->setFootballerFriend($this, UserParameters::getUserId(), $currentIndex); }else{ RAM::getInstance()->setFootballerFriend($this); }*/ } else { $sql_template = "UPDATE footballers SET\nlevel = %d,\nis_active = %d,\nsuper = %d,\nhealth_down = %d,\nlogger = '%s'\nWHERE\nowner_vk_id = %d AND\nfootballer_id = %d"; $sql = sprintf($sql_template, $this->getLevel(), $this->getIsActive(), $this->getIsSuper(), $this->getHealthDown(), get_caller_method() . "\n\n" . json_encode(JSONPrepare::footballer($this)) . $this->teamId . "|" . UserParameters::getUserId() . $this->SQL, UserParameters::getUserId(), $this->getId()); /* $footballerInRAM = RAM::getInstance()->getFootballerById($this->getId(), UserParameters::getUserId()); if($footballerInRAM === false){ $currentIndex = RAM::getInstance()->getMaxObjectIndexForTeam(UserParameters::getUserId(), RAM::RAM_TYPE_FOOTBALLER);; RAM::getInstance()->setFootballer($this, UserParameters::getUserId(), $currentIndex); }else{ RAM::getInstance()->setFootballer($this, UserParameters::getUserId()); }*/ } $result = SQL::getInstance()->query($sql); if ($result instanceof ErrorPoint) { return $result; } }