コード例 #1
0
ファイル: html_class.php プロジェクト: nuxi/MiningBuddy
 public function __construct()
 {
     // Construct a different html for ingame and the out-of-game browser.
     global $IGB;
     global $VERSION;
     global $MySelf;
     global $TIDY_ENABLE;
     global $width;
     global $URL;
     global $IGB_VISUAL;
     // Enable tidy, if we want to.
     $this->useTidy = $TIDY_ENABLE;
     // In case we are not logged in, or the object does not exist yet.
     if (!is_object($MySelf)) {
         $MySelf = new user(false, false);
     }
     if ($IGB && $IGB_VISUAL) {
         // Use IGB, set header and footer.
         $this->isIGB = true;
         //			$this->header = file_get_contents('./include/ingame/igb-header.txt');
         $this->header = file_get_contents('./include/ingame/igb-header.php');
         if ($MySelf->isValid()) {
             $this->header .= makeMenu();
             $this->header = str_replace("%%RANK%%", $MySelf->getRankName(), $this->header);
             $this->header = str_replace("%%CREDITS%%", number_format(getCredits($MySelf->getID()), 2) . " ISK", $this->header);
             $this->header = str_replace("%%USERNAME%%", ucfirst($MySelf->getUsername()), $this->header);
         }
         $this->header = str_replace("%%SITENAME%%", getConfig("sitename"), $this->header);
         //			$this->footer = file_get_contents('./include/ingame/igb-footer.txt');
         $this->footer = file_get_contents('./include/ingame/igb-footer.php');
         $this->footer = str_replace("%%VERSION%%", $VERSION, $this->footer);
     } else {
         // Use normal browser.
         $this->isIGB = false;
         if ($MySelf->isValid() == 1) {
             //				$this->header = file_get_contents('./include/html/header.txt');
             $this->header = file_get_contents('./include/html/header.php');
         } else {
             //				$this->header = file_get_contents('./include/html/header-notloggedin.txt');
             $this->header = file_get_contents('./include/html/header-notloggedin.php');
         }
         //			$this->footer = file_get_contents('./include/html/footer.txt');
         $domainroot = $_SERVER['HTTP_HOST'];
         // Add page footer
         // use proper footer for sponcered sites.
         if ($domainroot == "miningbuddy.us" or $domainroot == "miningbuddy.de" or $domainroot == "miningbuddy.net") {
             $this->footer = file_get_contents('./include/html/mbh-footer.php');
         } else {
             $this->footer = file_get_contents('./include/html/footer.php');
         }
         // Generate the images.
         $mainLogo = new graphic("title");
         $mainLogo->setText(getConfig("sitename"));
         $mainLogo->setBGColor("2D2D37");
         // this is here to retain some code. Image caching seemed to be pretty useless.
         $imageCaching = false;
         if ($imageCaching) {
             $loginLogo = new graphic("standard");
             $loginLogo->setText(ucfirst($MySelf->getUsername()));
             $loginLogo->setBGColor("2D2D37");
             $loginLogo->setPrefixed(false);
             $versionLogo = new graphic("long");
             $versionLogo->setText($VERSION);
             $versionLogo->setBGColor("2D2D37");
             $versionLogo->setPrefixed(false);
             $rankLogo = new graphic("standard");
             $rankLogo->setText($MySelf->getRankName());
             $rankLogo->setBGColor("2D2D37");
             $rankLogo->setPrefixed(false);
             $moneyLogo = new graphic("standard");
             $moneyLogo->setText(number_format(getCredits($MySelf->getID()), 2) . " ISK");
             $moneyLogo->setDirect(true);
             $moneyLogo->setBGColor("2D2D37");
             $moneyLogo->setPrefixed(false);
         }
         // Replace variables in the header.
         $this->header = str_replace("%%SITENAME%%", getConfig("sitename") . " - " . $VERSION, $this->header);
         $this->header = makeMenu($this->header);
         $thisCharacterID = "";
         if ($MySelf->isValid()) {
             $api = new api($MySelf->getID());
             $thisCharacterID = $api->getCharacterID();
         }
         if ($thisCharacterID == "") {
             $this->header = str_replace("%%PILOT64%%", "", $this->header);
         } else {
             $this->header = str_replace("%%PILOT64%%", "<img width='64' height='64' align='left' src='https://image.eveonline.com/Character/" . $api->getCharacterID() . "_64.jpg' />", $this->header);
         }
         $this->header = str_replace("%%LOGO%%", $mainLogo->render(), $this->header);
         if ($imageCaching) {
             $this->header = str_replace("%%LOGGEDIN%%", $loginLogo->render(), $this->header);
             //
             $this->header = str_replace("%%RANK%%", $rankLogo->render(), $this->header);
             $this->header = str_replace("%%CREDITS%%", $moneyLogo->render(), $this->header);
             $this->footer = str_replace("%%IMG%%", $versionLogo->render(), $this->footer);
         } else {
             $this->header = str_replace("%%LOGGEDIN%%", "&nbsp;&nbsp;" . ucfirst($MySelf->getUsername()), $this->header);
             $this->header = str_replace("%%RANK%%", "&nbsp;&nbsp;" . $MySelf->getRankName(), $this->header);
             $this->header = str_replace("%%CREDITS%%", "&nbsp;&nbsp;" . number_format(getCredits($MySelf->getID()), 2) . " ISK", $this->header);
             $this->footer = str_replace("%%IMG%%", $VERSION, $this->footer);
         }
         $this->header = str_replace("%%USERNAME%%", ucfirst($MySelf->getUsername()), $this->header);
         $this->header = str_replace("%%URL%%", $URL, $this->header);
     }
     $this->header = str_replace("%%VERSION%%", $VERSION, $this->header);
     $this->header .= "<!--header ends here-->";
     $this->footer = "<!--footer starts here-->" . $this->footer;
 }
コード例 #2
0
ファイル: printImage.php プロジェクト: nuxi/MiningBuddy
 *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
 *  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
 *  OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 *  OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 *  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
//$IS_BETA=false;
//$g = new graphic("standard");
//$g->setText("Profile");
//$g->setBGColor("2d2d37");
//die($g->render());
if (isset($_GET['image'])) {
    // Load the preferences.
    $prefs = unserialize(base64_decode($_SESSION["img_" . $_GET['image']]));
    unset($_SESSION["img_" . $_GET['image']]);
    // Create a new empty shell for the  image.
    $p = new graphic($prefs['type']);
    // Restore the old parameters.
    $p->setDirect(true);
    $p->setSecondPass(true);
    $p->setPrefixed($prefs['prefixed']);
    $p->setText($prefs['text']);
    $p->setBGColor($prefs['bgcolor']);
    $p->setTextColor($prefs['color']);
    // Send png header to client.
    header('Content-Type: image/png');
    // Send the image.
    die($p->render());
}