[available] Easy Player Link "Content-Management-System"

You can talk about ManiaScript for ManiaPlanet here

Moderator: English Moderator

mees
Posts: 90
Joined: 21 Sep 2011, 08:55
Location: H Town
Contact:

Re: [available] Easy Player Link "Content-Management-System"

Post by mees »

es kann keine verbindung mit dem server hergestellt werden fehler 404
lolracer
Posts: 31
Joined: 04 Nov 2011, 12:20

Re: [available] Easy Player Link "Content-Management-System"

Post by lolracer »

danke für den Tipp...hat leider nix gebracht den Pfad in maniacodedonation.php zu ändern.

bei mir kommt immer der fehler beim mapdownload

unknow resource type :cry:
mees
Posts: 90
Joined: 21 Sep 2011, 08:55
Location: H Town
Contact:

Re: [available] Easy Player Link "Content-Management-System"

Post by mees »

Hab mein Donate problem gelöst;) hab das Donate von EPL aus der Homeseite und Config rausgenommen , und selbst ein Neues geschrieben was ich als zusätzliches Topplugin in die Homeseite eingefügt habe. Dazu Maniacodes in xml ,und siehe da funzt Alles und bedankt sich Brav :clap: Also bei mir funzen jetzt Alle Downloads und das Donate auch :yes:

Nächste Aufgabe für mich wird werden das ich meine Skins und Mods im Randomplugin noch hinnbekomm :shock:
lolracer
Posts: 31
Joined: 04 Nov 2011, 12:20

Re: [available] Easy Player Link "Content-Management-System"

Post by lolracer »

na da gratuliere ich Dir...gute Arbeit. :3

Wenn du willst, kannst ja die Codes, die du für donate gemacht hast...(.xml u. .php) hier mal posten.

Vielleicht kann ich daraus dann schließen, wie ich das mit meinem nicht funktionierenden Map Download umschreiben kann.

gruß
lolracer
mees
Posts: 90
Joined: 21 Sep 2011, 08:55
Location: H Town
Contact:

Re: [available] Easy Player Link "Content-Management-System"

Post by mees »

Werde die Mappage mal bei mir testen mal schauen ob ich den fehler finde !! ;P
lolracer
Posts: 31
Joined: 04 Nov 2011, 12:20

Re: [available] Easy Player Link "Content-Management-System"

Post by lolracer »

das finde ich prima von Dir !

bin schon mal gespannt, ob du auch die download Probleme bei den Maps hast.
mees
Posts: 90
Joined: 21 Sep 2011, 08:55
Location: H Town
Contact:

Re: [available] Easy Player Link "Content-Management-System"

Post by mees »

hier die maps.php

Code: Select all

<?php
  function maps_getMaps(){
    global $maps_directories;
  
    $maps = array();
    foreach($maps_directories as $maps_directory_url=>$maps_directory) {
      if(is_dir($maps_directory)){
        if($sd = opendir($maps_directory)){
          while(($file = readdir($sd))!==false){
            if(is_file($maps_directory . $file) && preg_match('/\.Map\.Gbx$/i', $file)){
              $map = null;
              $map = maps_getMap($maps_directory, $maps_directory_url, $file);
              if($map!=null){
                //sort the maps
                $creationtime = filectime($maps_directory.$file);
                while(array_key_exists($creationtime, $maps)){
                  $creationtime++;
                }
                $maps[$creationtime] = $map;
              }
            }
          }
          closedir($sd);
        }
      }
    }
    krsort($maps);
    return $maps;    
  }
  
  function maps_getMap($directory, $directory_url, $file){
    $map = array();
    $map['file'] = $directory.$file;
    $map['url'] = $directory_url.$file;
    $map['simplename'] = preg_replace('/[\W]/i', '_', preg_replace('/\.Map\.Gbx$/i', '', $file));
    $map['thumbnail'] = maps_getThumbnail(preg_replace('/\.Map\.Gbx$/i', '', $file));
    return $map;
  }
  
  function maps_getMapWithDetails($map){
    $content = file_get_contents($map['file']);
    $start = strpos($content, '<header');
    $end = strpos($content, '</header>');
    if($start && $end){
      $xml = new SimpleXMLElement(substr($content, $start, $end-$start+strlen('</header>')));

      foreach($xml->ident->attributes() as $name=>$value) {
        $map[$name] = (string)$value;
      }
      foreach($xml->desc->attributes() as $name=>$value) {
        $map[$name] = (string)$value;
      }
      foreach($xml->times->attributes() as $name=>$value) {
        $map[$name] = (string)$value;
      }
    }
    return $map;
  }
  
  function maps_getMapIncludedScreenshot($map){
    $content = file_get_contents($map['file']);
    $start = strpos($content, '<Thumbnail.jpg>');
    $end = strpos($content, '</Thumbnail.jpg>');
    if($start && $end){
      $imgsrc = imagecreatefromstring(substr($content, $start+strlen('<Thumbnail.jpg>'), $end-($start+strlen('<Thumbnail.jpg>'))));
      //mirror image vertically
      $imgdest = imagecreatetruecolor (256, 256);
      for($i=0; $i<256; $i++){
        imagecopy($imgdest, $imgsrc, 0, 255-$i, 0, $i, 256, 1);
      }
      $map['includedScreenshot'] = $imgdest; 
    }
    return $map;
  }
  
  function maps_getThumbnail($name){
    global $maps_thumbnails_directories;
    global $maps_thumbnails_extensions;
    
    foreach ($maps_thumbnails_directories as $thumbnails_directory_url=>$thumbnails_directory) {
      foreach($maps_thumbnails_extensions as $extension){
        if(file_exists("$thumbnails_directory$name.$extension")){
          return "$thumbnails_directory_url$name.$extension";
        }
      }
    }
    return null;   
  }
  
  function maps_getTime($t){
    $m = floor($t/60000);
    if($m<1){
      $m = 0;
    }
    $t = $t-($m*60000);
    $s = floor($t/1000);
    $t = $t-($s*1000);
    if($s<1){
      $s = '00';
    }else if($s<10){
      $s = "0".$s;
    }
    if($t<1){
      $t = '000';
    }else if($t<10){
       $t = "00".$t;
    }else if($t<100){
       $t = "0".$t;
    }
    return "$m:$s.$t";
  }
  
  function maps_displayMap($map, $position){
    global $maps_authors;
    global $mapscontent_color;
    global $content_colorhighlight;
    global $contenttop_image;
	global $contentbottom_image;
	global $title;
    global $text_color;
    global $manialink;
    global $server;
    $map = maps_getMapWithDetails($map);
    
    $y = 57;
    if($position>4*2-1){
      $y = $y - 48*2;
      $position = $position - 4*2;
    }else if($position>4-1){
      $y = $y - 48;
      $position = $position - 4;
   }
    $x = -160 + 80*$position;
    

    $thumbnail = $map['thumbnail'];
    $name = $map['name'];    
    $author = $map['author'];
    if(array_key_exists($author, $maps_authors)){
      $author = $maps_authors[$author];
    }
    $authortime = maps_getTime($map['authortime']);
    $mood = $map['mood'];
    $coppers = $map['displaycost']."C";
    $simplename = $map['simplename'];      
    $infos=file('./Content/Maps/Info/'.$simplename.'.txt');
	$shareurl = 'http://maniahome.maniaplanet.com/share/send/'; // Base URL
	$shareparams = array('link' => ''.$manialink.':map?'.$simplename.'', 'message' => 'like the map: '.$name.' $zat $h['.$manialink.'?maps]'.$title.'$h'); // Parameters
	$shareurl = $shareurl.'?'.http_build_query($shareparams); // Automatically escapes the parameters
	$shareurl = htmlentities($shareurl, ENT_QUOTES, 'UTF-8'); // Escapes the string to use it in a XML attribute

    
	echo "    <label id='' posn='160 83 -10' textsize='15.5' halign='right' textcolor='ffff' text='\$w\$oMAPS' />"; echo "\n";
    echo "  <frame posn='$x $y 1'>"; echo "\n";
    echo "    <quad id='' posn='2 -0.5 -10' sizen='76 45' style='Bgs1InRace' substyle='BgWindow2' />"; echo "\n";
    echo "    <quad id='' posn='2.4 -7 -5' sizen='75.2 32' bgcolor='$mapscontent_color' />"; echo "\n";
    if($thumbnail!=null){
      echo "    <quad id='' posn='27 -7' sizen='50.6 32' image='$thumbnail' />"; echo "\n";
    }else{
      echo "    <quad id='' posn='27 -7' sizen='50.6 32' image='${server}manialink.php?MapScreenshot=$simplename".htmlspecialchars('&')."/.jpg' />"; echo "\n";
    }
    echo "    <quad id='' posn='2.5 1.6 -3' sizen='10 10'  style='UIConstructionSimple_Buttons' substyle='Challenge' />"; echo "\n";
    echo "    <label id='' posn='11 -1.6' textsize='3' sizen='65 6' textcolor='$text_color' text='".htmlspecialchars($name, ENT_QUOTES, 'UTF-8')."' />"; echo "\n";
    echo "    <quad id='' posn='4 -32.3 -4' sizen='8 9' style='UIConstructionSimple_Buttons' substyle='Item' />"; echo "\n";
    echo "    <quad id='' posn='3 -32.3' sizen='10 9' style='Icons128x128_1' substyle='ChallengeAuthor' />"; echo "\n";
    echo "    <label id='' posn='4 -41' sizen='50 9' textsize='3' textcolor='$text_color' text='".htmlspecialchars($author, ENT_QUOTES, 'UTF-8')."' />"; echo "\n";
    echo "    <quad id='' posn='2.5 -8 10' sizen='6 5' halign='left' style='Icons128x128_1' substyle='Save'/>"; echo "\n";
    echo "    <label id='' posn='9 -9.5 6' halign='left' textsize='1' textcolor='0f0' text='\$s\$0f0".$infos[0]."' />"; echo "\n";
    echo "    <quad id='' posn='1 -13' sizen='8 8' style='UIConstructionSimple_Buttons' substyle='AuthorTime' />"; echo "\n";
    echo "    <label id='' posn='8 -15' textsize='3' sizen='18 6' textcolor='$text_color' text='$authortime' />"; echo "\n";
    echo "    <quad id='' posn='2.25 -19.5' sizen='7 7' style='Icons64x64_1' substyle='ToolLeague1' />"; echo "\n";
    echo "    <label id='' posn='9 -21' textsize='3' sizen='18 6' textcolor='$text_color' text='$mood' />"; echo "\n";
    echo "    <quad id='' posn='1.25 -25.5' sizen='8 8' style='UIConstructionSimple_Buttons' substyle='Stats' />"; echo "\n";
    echo "    <label id='' posn='9 -27.5' textsize='3' sizen='18 6' textcolor='$text_color' text='$coppers' />"; echo "\n";
    echo "    <label id='' posn='9 -29' textsize='3' sizen='18 6' textcolor='$text_color' text='$maps_map_price' />"; echo "\n";
    //echo "    <quad id='' posn='66.6 -37.5 10' sizen='8 8' halign='center' style='Icons64x64_1' substyle='Maximize' manialink='' />"; echo "\n";
    echo "    <quad id='' posn='74 -37.5 10' sizen='8 8' halign='center' style='Icons64x64_1' substyle='Save' manialink='$manialink:map?$simplename' />"; echo "\n";
    echo "    <frame posn='53 -37.5 10' >";
	echo "    <quad sizen='8 9' posn='2 -0.5 3' manialink='$shareurl' image='${server}Content/share.png'  imagefocus='${server}Content/share2.png'/>"; echo "\n";
	echo "  </frame>"; echo "\n"; 
	echo "  </frame>"; echo "\n";  
  }

  function maps_displayPages($n, $total){
    global $manialink;
    global $text_color;
    global $maps_map_price;
    $mapscount = count(glob('./Content/Maps/' . "*.Map.Gbx"));
 
    
	echo "  <frame posn='-30 69'>"; echo "\n";
    echo "    <quad id='' posn='64 -1.5' halign='left' sizen='6 6' style='ManiaPlanetLogos' substyle='IconPlanets' />"; echo "\n";
    echo "    <label id='' posn='70 -2.5' halign='left' textsize='3' textcolor='ffff' text='$maps_map_price $0afPlanets' /> "; echo "\n";
    echo "    <label id='' posn='93 -2.5' halign='left' textsize='3' textcolor='ffff' text='for each of $mapscount maps.' /> "; echo "\n";
    echo "  <quad id='' halign='left' posn='0 -1 -7' sizen='60 7' style='Bgs1InRace' substyle='BgWindow2' />"; echo "\n";
    echo "  <quad id='' halign='left' posn='62 -1 -7' sizen='82 7' style='Bgs1InRace' substyle='BgWindow2' />"; echo "\n";
    $link = '';
    if($n!=1){
      $link = "manialink='$manialink?Maps=1' ";
    }    
    echo "    <quad id='' posn='0 0.5' sizen='10 10' style='Icons64x64_1' substyle='ArrowFirst' $link/>"; echo "\n";
    $link = '';
    if($n!=1){
      $link = "manialink='$manialink?Maps=".($n-1)."' ";
    }
    echo "    <quad id='' posn='10 0.5' sizen='10 10' style='Icons64x64_1' substyle='ArrowPrev' $link/>"; echo "\n";
    $link = '';
    if($n!=$total){
      $link = "manialink='$manialink?Maps=".($n+1)."' ";
    }
    echo "    <quad id='' posn='40 0.5' sizen='10 10' style='Icons64x64_1' substyle='ArrowNext' $link/>"; echo "\n";
    $link = '';
    if($n!=$total){
      $link = "manialink='$manialink?Maps=$total' ";
    }
    echo "    <quad id='' posn='50 0.5' sizen='10 10' style='Icons64x64_1' substyle='ArrowLast' $link/>"; echo "\n";
    echo "    <label id='' posn='30 -4.5' halign='center' valign='center' textsize='3' textcolor='$text_color' text='$n/$total' /> "; echo "\n";
    echo "  </frame>"; echo "\n";
  }
  
  function maps_displayMaps(){
    maps_displayMapsAt(1);
  }
  
  function maps_displayMapsAt($n){
    $maps = maps_getMaps();
    $number_of_maps = count($maps);
    if($n==null || !is_numeric($n) || $n<1 || $n>(ceil($number_of_maps/12))){
      $n = 1;
    }
    startPage();
    $displayed_maps = array_splice($maps, ($n-1)*12, min($n*12, $number_of_maps));
    for($i=0; $i<count($displayed_maps); $i++){
      maps_displayMap($displayed_maps[$i], $i);
    }
    maps_displayPages($n, max(1, ceil($number_of_maps/12)));
    endPage();
  }
  
  function maps_displayMapsScreenshot($mapName){
    $found = null;
    $maps = maps_getMaps();
    foreach($maps as $map) {
       if($map['simplename']==$mapName){
          $found = $map;
       }
    }
    if($found!=null){
      $found = maps_getMapIncludedScreenshot($found);
      header('Content-Type: image/jpeg');
      imagejpeg($found['includedScreenshot']);
    }else{
      header("HTTP/1.0 404 Not Found");
    }
  }
  
  function maps_displayManiacodeMap(){
    $found = null;
    $maps = maps_getMaps();
    foreach($_GET as $key=>$value) {
      if($found==null){
        $found = null;
        foreach($maps as $map) {
           if($map['simplename']==$key){
              $found = $map;
           }
        }
      }
    }
    
    if($found!=null){
      $found = maps_getMapWithDetails($found);
      $name = $found['name'];
      $url = $found['url'];
	  $infos=file('./Content/Maps/Info/'.$simplename.'.txt');
	  $infos[0]=str_replace("\n","",$infos[0]);
      header('Content-Type: text/xml; charset=utf-8');
      echo '<?xml version="1.0" encoding="UTF-8"?'.'>'; echo "\n";
      echo "<maniacode>"; echo "\n";
      echo "  <install_map>"; echo "\n";
      echo "    <name>".htmlspecialchars($name, ENT_QUOTES, 'UTF-8')."</name>"; echo "\n";
      echo "    <url>".htmlspecialchars($url, ENT_QUOTES, 'UTF-8')."</url>"; echo "\n";
      echo "  </install_map>"; echo "\n";
      $infos[0]=str_replace("\n","",$infos[0]);
	  $infos[0]++;
	  $datei=fopen('./Content/Maps/Info/'.$simplename.'.txt','w');
	  fwrite($datei,$infos[0]);
	  fclose($datei);
	  echo "</maniacode>";
    }
  }

  function maps_mapsHandle($force){
    if($force){
       //default page
       maps_displayMapsAt(1);
    }else if(isset($_GET['Maps'])){
      maps_displayMapsAt($_GET['Maps']);
      return true;
    }else if(isset($_GET['MapScreenshot'])){
      maps_displayMapsScreenshot($_GET['MapScreenshot']);
      return true;
    }
    return false;
  }
?>
funzt bei mir so :3
lolracer
Posts: 31
Joined: 04 Nov 2011, 12:20

Re: [available] Easy Player Link "Content-Management-System"

Post by lolracer »

na erstmal vielen Dank für deine Mühen.

mal ne frage:

wenn du eine neue map hinzufügst in den .../Content/Maps/ Ordner

und die map zum downloaden auf deinem ML anklickst,

wird dann eine .txt Datei mit dem Mapnamen automatisch in den .../Content/Maps/Info Ordner geschrieben.

---------------------------------------------------------------------------

bei mir wird da nix in den Info Ordner geschrieben....

und die downloads der Maps gehen leider auch nicht...obwohl ich deine map.php benutzt habe...
die war aber eh identisch mit der von mir

also ich weiss wirklich nicht, wieso das bei mir nicht geht...hmmmm grübel grübel :roll: :roll:
mees
Posts: 90
Joined: 21 Sep 2011, 08:55
Location: H Town
Contact:

Re: [available] Easy Player Link "Content-Management-System"

Post by mees »

ja schreibt die txt datei von selbst wenn der ordner die rechte hat , so ist das jedenfalls bei mir
lolracer
Posts: 31
Joined: 04 Nov 2011, 12:20

Re: [available] Easy Player Link "Content-Management-System"

Post by lolracer »

ich hab jetzt mal eine editierte map.php von Quick Link benutzt....und siehe da...

es funktioniert

der counter für die einzelnen maps, wie oft die schon runtergeladen wurden funzt zwar nicht
und die .txt dateien für die einzelnen maps werden auch nicht automatisch geschrieben

...aber was solls.

:3
Post Reply

Return to “ManiaScript”

Who is online

Users browsing this forum: No registered users and 1 guest