Welcome to Geeklog, Anonymous Saturday, April 20 2024 @ 09:25 am EDT

Geeklog Forums

PHP header/footer?


Theophile

Anonymous
I am using Jinzora music server and it support embedded php headers and footers. This allows you to specify php files to "wrap" Jinzora in. In the absence of true Geeklog/Jinzora integration, doing this wrapping would be a good substitute. But the headers and footers in Geeklog are thtml and when I specify them as the headers and footers, they don't render right. Am I out of luck here? Is it possible to isolate which part of index.php refernces the header and then pull that out and make it a separate header.php file or something?

Any help would be appreciated! Thanks!
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
How about wrapping Jinzora in Geeklog? As outlined here, for example.

bye, Dirk
 Quote

Theophile

Anonymous
Interesting!

I opened Jinzora's index.php file and added this to the top:
Text Formatted Code
<?php
require_once('/var/www/localhost/htdocs/lib-common.php');
$ret = COM_siteHeader();

$ret .=

 

and this to the end:
Text Formatted Code
$ret .= COM_siteFooter();
echo $ret;
?>

 


but it doesn't work. The header and footer do not display and I get an SQL error in the error.log which reads:
Thu 23 Mar 2006 07:47:46 PM CST - 1146: Table 'jinzoracvs.gl_vars' doesn't exist. SQL in question: UPDATE gl_vars SET value = value + 1 WHERE name = 'totalhits'


Strung together, my index.php file is this:
Text Formatted Code
<?php
require_once('/var/www/localhost/htdocs/lib-common.php');
$ret .= COM_siteHeader();

define('JZ_SECURE_ACCESS','true');
        /**
        * - JINZORA | Web-based Media Streamer -  
        *
        * Jinzora is a Web-based media streamer, primarily desgined to stream MP3s
        * (but can be used for any media file that can stream from HTTP).
        * Jinzora can be integrated into a CMS site, run as a standalone application,
        * or integrated into any PHP website.  It is released under the GNU GPL.
        *
        * - Resources -
        * - Jinzora Author: Ross Carlson <ross@jasbone.com>
        * - Web: http://www.jinzora.org
        * - Documentation: http://www.jinzora.org/docs 
        * - Support: http://www.jinzora.org/forum
        * - Downloads: http://www.jinzora.org/downloads
        * - License: GNU GPL <http://www.gnu.org/copyleft/gpl.html>
        *
        * - Contributors -
        * Please see http://www.jinzora.org/team.html
        *
        * - Code Purpose -
        * - This page directs 'traffic' to the proper Jinzora component.
        *
        * @since 01.11.05
        * @author Ross Carlson <ross@jinzora.org>
        * @author Ben Dodson <ben@jinzora.org>
        */
       
        // TODO: make a function jz_init that has all the session / user setup.
        session_name('jinzora-session');
        session_start();

  $_SESSION['jz_load_time'] = microtime();
        // Let's set the error reporting level
        //@error_reporting(E_ERROR);
       
        // Right away lets set the time we started

        // Now we'll need to figure out the path stuff for our includes
        // This is critical for CMS modes
        $include_path = ""; $link_root = ""; $cms_type = "standalone"; $cms_mode = "false";
  $backend = ""; $jz_lang_file = ""; $skin = ""; $my_frontend = "";
        if (isset($_GET['op'])){
                // This has got to be postnuke...
                $include_path = "modules/". $_GET['name']. "/";
                $link_root = "modules.php?";
                $cms_type = "postnuke";
                $cms_mode = "true";
        } else if (isset($_GET['name']) and !isset($_GET['op'])){
                // This has got to be phpnuke
                $include_path = "modules/". $_GET['name']. "/";
                // Now we need to see if it's CPGNuke
                if (stristr($_SERVER['SCRIPT_NAME'],"index.php")){
                        $link_root = "index.php?";
                        $cms_type = "cpgnuke";
                        $cms_mode = "true";
                } else {
                        $link_root = "modules.php?";
                        $cms_type = "phpnuke";
                        $cms_mode = "true";
                }
        } else if (isset($_GET['option'])){
                // This has got to be mambo
                $include_path = "components/". $_GET['option']. "/";
                $link_root = "index.php?";
                $cms_type = "mambo";
                $cms_mode = "true";
        }

        $web_path = $include_path;
        $install_complete = "no";

        @include_once($include_path. 'system.php');        
        @include_once($include_path. 'settings.php');  
        @include_once($include_path. "lang/${jz_language}-simple.php");
        @include_once($include_path. "lang/${jz_language}-extended.php");
        include_once($include_path. "lib/general.lib.php");
        include_once($include_path. 'services/class.php');

        writeLogData("messages","Index: --------------- Beginning Jinzora session ---------------");
       
        // Load our external services:
        writeLogData("messages","Index: Loading default services");
        $jzSERVICES = new jzServices();
        $jzSERVICES->loadStandardServices();

        if ($cms_mode == "true") {
                writeLogData("messages","Index: Setting up CMS variables");
                $ar = $jzSERVICES->cmsGETVars();
                foreach ($ar as $id => $val) {
                        $link_root .= $id . "=" . $val . "&";
                }
        }
                                               
        if (isset($_GET['install'])){
                // Now let's include the right file
                if ($_GET['install'] == "step7") {
                        if (isset($_POST['submit_step6_more']))
                                $_GET['install'] = 'step6';
                }
                include_once($include_path. 'install/'. $_GET['install']. ".php");
                exit();
        }
        $force_install = false;
        if ($install_complete == "no") {
          $force_install = true;
        } else {
          $cv = explode(".",$config_version);
          $v = explode(".",$version);
          if (!($cv[0] == $v[0] && $cv[1] == $v[1])) {
            $force_install = true;
          }
        }
             if ($force_install){
                // To make upgrades easy let's see if they have a settings file already
                // If they do we'll include the new one first so the new variable are already
                $root_dir = ""; $media_dirs = "";
                // populated for them
                if (is_file('settings.php')){
                        @include_once($include_path. 'settings.php');
                        // Let's let them know we are upgrading
                        $upgrade = "Yes";
                }
                // Ok, it hasn't been installed so let's send them to the installer
                include_once($include_path. 'install/step1.php');
                exit();
        }

        // let's fix all of our variables.
        // see "url.php" for details.
        writeLogData("messages","Index: Cleaning POST and GET variables");
        $_GET = unurlize($_GET);
        $_POST = unpostize($_POST);

        writeLogData("messages","Index: Checking theme settings");
       
        // Now set up our backend; this is required for all Jinzora components.
        writeLogData("messages","Index: Including backend functions");
        include_once($include_path. 'backend/backend.php');
        include_once($include_path. 'frontend/display.php');


        // reset our this_page in case we need to add some temporary variables (frontend, etc.)
        $this_page = setThisPage();
       
        writeLogData("messages","Index: Checking for searching");
        if (isset($_GET['doSearch'])) {
                $_GET['action'] = "search";
                if (isset($_GET['song_title'])) {
                        $_GET['search_query'] = $_GET['song_title'];     
                }
                if (!isset($_GET['search_type'])) {
                        $_GET['search_type'] = "ALL";
                }
        }
       
        // copy the POST variables for a basic search to GET variables so we don't do it twice.
        // just do a powersearch with post variables.
        if (isset($_POST['doSearch'])) {
          $_GET['action'] = "search";
          $_GET['search_query'] = $_POST['search_query'];
          $_GET['search_type'] = $_POST['search_type'];
        }

        // support setting the path via POST:
        if (isset($_POST['jz_path'])) {
          $jz_path = $_POST['jz_path'];
        }
       
        if (isset($_GET['jz_path'])) {
          $jz_path = $_GET['jz_path'];
        } else if (!isset($jz_path)) {
          $jz_path = "";
        }

        // maybe they set hierarchy as a string for some reason:
        if (is_string($hierarchy))
     $hierarchy = explode("/",$hierarchy);
     
     // * * COMMAND LINE JINZORA * * //
     // Do something and die.
     if (isset($argv) && sizeof($argv) > 0 && $_SERVER['argc'] > 0) {
       $exit = true;
       switch ($argv[1]) {

         // UPDATE
   case "force_update":
                $force_update = true;
   case "update":
                 if (!isset($force_update)) {
                   $force_update = false;
                 }
         
         if (isset($argv[2])) {
           $node = new jzMediaNode($argv[2]);
         } else {
           $node = new jzMediaNode();
         }
         // Should this force the update? Set the last param here...
         writeLogData("messages","Command line Jinzora: Updating the node cache");
         updateNodeCache($node,true,"cli",$force_update);
         break;
         // LYRICS SCAN:
       case "scan_lyrics":
         if (isset($argv[2])) {
           $node = new jzMediaNode($argv[2]);
         } else {
           $node = new jzMediaNode();
         }
         $tracks = $node->getSubNodes("tracks",-1);
         $nfound = 0;
         $nmissed = 0;
         $nskipped = 0;
         foreach ($tracks as $track) {
           $meta = $track->getMeta();
           if (isNothing($meta['lyrics'])) {
             $lyrics = $jzSERVICES->getLyrics($track);
             if (!isNothing($lyrics)) {
               echo 'FOUND: ' . $track->getPath("String") . "n";
               $meta['lyrics'] = $lyrics;
               $nfound++;
               $track->setMeta($meta);
             } else {
               echo 'NO MATCH: ' . $track->getPath("String") . "n";
               $nmissed++;
             }
           } else {
             echo 'SKIPPING: ' . $track->getPath("String") . "n";
             $nskipped++;
           }
         }
         echo 'Found: ' . $nfound . "n";
         echo 'Not Found: ' . $nmissed . "n";
         echo 'Skipped: ' . $nskipped . "n";
         echo 'Total: ';
         echo $nfound + $nmissed + $nskipped;
         echo "n";
         break;
         // LIST
   case "list":
         if (isset($argv[3])) {
           $root = new jzMediaNode($argv[3]);
         } else {
           $root = new jzMediaNode();
         }
         switch ($argv[2]) {
         case "genre":
         case "genres":
           $list = $root->getSubNodes("nodes",distanceTo("genre",$root));
           break;
         case "artist":
         case "artists":
           $list = $root->getSubNodes("nodes",distanceTo("artist",$root));
           break;
         case "album":
         case "albums":
           $list = $root->getSubNodes("nodes",distanceTo("album",$root));
           break;
         case "track":
         case "tracks":
           $list = $root->getSubNodes("tracks",-1);
           break;
         }
         if (isset($list)) {
           foreach ($list as $el) {
             echo $el->getName() . "n";
           }
         }
         break;

         // TODO: Generate, Search, Pull playlist, stats

         // HELP:
         case "help":
         case "-h":
                 echo "Usage: n";
                 echo "php index.php update [root]n";
                 echo "           Updates the cachen";
                 echo "php index.php force_update [root]n";
                 echo "           Updates the cache, ignoring file modification times.n";
                 echo "php index.php list [genres|artists|albums|tracks] [root]n";
                 echo "           Lists content.n";
                 echo "php index.php scan_lyrics [root]n";
                 echo "           Scans for missing lyrics.n";
         break;
                default:
                         $exit = false;
                 }
                 if ($exit) {
                         exit();
                 }
         }
         // ** END COMMAND LINE JINZORA ** //

        // set up our user.
        writeLogData("messages","Index: Setting up the user object");
        $jzUSER = new jzUser(); // class handles _SESSION stuff.

        writeLogData("messages","Index: Loading user services");

        $jzSERVICES->loadUserServices();       
        if ($_POST['action'] != "login") {
          handleUserInit();
          writeLogData("messages","Index: Including the icons");
          include_once($include_path. "frontend/icons.lib.php");
          writeLogData("messages","Index: Creating a new frontend object");
        } else {
          handleSetFrontend();
        }

        writeLogData("messages","Index: Testing the frontend file for security and including");
        @include_once($include_path.'frontend/frontends/'.$my_frontend.'/settings.php');
       
        // Now let's see what the user was doing?
        if (isset($_GET['action'])){
                if ($_GET['action'] == "logout"){
                        writeLogData("messages","Index: Logging the user out");
                        $jzUSER->logout();
                }
        }

        // handle changing of settings:
        // These affect the session, NOT the user settings.
        // This is handled in general.lib.php: setThisPage().
        if (isset($_POST['action'])){
                if ($_POST['action'] == "popup") {
                        $_GET['action'] = "popup";
                        $_GET['ptype'] = $_POST['ptype'];
                }
        }

        if (checkPermission($jzUSER,"view") === false && (!isset($_POST['action']) || $_POST['action'] != "login" )) {
                // Now are we in CMS mode or what?
                if ($cms_type == "standalone" || $cms_type == "false" || $cms_type == ""){
                        writeLogData("messages","Index: Sending the user to the login page");
                        $fe->loginPage();
                        exit();
                }
        }

        // Detect our current playlist:
        if (isset($_GET['jz_playlist'])) {
                $_SESSION['jz_playlist'] = $_GET['jz_playlist'];
        }
       
        if (isset($_POST['jz_playlist'])) {
                $_SESSION['jz_playlist'] = $_POST['jz_playlist'];
        }

        // Should we use AJAX?
        define('NO_AJAX_LINKS','true');
       
        if (defined('NO_AJAX')) {
                define ('NO_AJAX_LINKS','true');
                define ('NO_AJAX_JUKEBOX','true');
        }

        $_SESSION['jz_path'] = $jz_path;
        // See if the user wants a special feature, like a playlist action or a popup.
        // This is done via the get variable 'action' or the post variable 'action'.
        // Actions include:
        // *******
        // **GET**
        // *******
        //
        // popup
        //    -ptype (type of the popup: genre,artist,album,info
        //    -path (used if path is required)
        //
        // search
        //    -search_query
        //    -search_type
        //
        //
        // email
        //
        // playlist [for on-the-fly, basic playlist generation]
        //    -path
        //    -mode (random|normal; default normal.)
        //    -limit (default max_playlist_length)
        //    -type (specify the type of the path: track|node|playlist; default is to assume node.)
        //    -resample (NOT IMPLEMENTED)
        //
        // ********
        // **POST**
        // ********
        //
        // login [logs a user in]
        //    -field1 is the username
        //    -field2 is the password.
        //
        // mediaAction [handles $_POST requests for media actions.]
        //    -the mode is checked using isset($_POST['MODE']), where 'MODE' is one of:
        //       PLAYBACK:
        //       -sendList (use the provided array $_POST['list'] to make/play a playlist)
        //       -sendListRandom (same as above, but random)
        //       -sendPath (use the provided $_POST['path'] to make/play a playlist)
        //       -sendPathRandom (use the path variable and randomie to make/play a playlist)
        //       OTHER:
        //       -info (get info for the 'list')
        //       -addList  (add the 'list' to the 'playlist')
        //       -addPath (add the 'path' to the 'playlist')
        //
        //    Other variables include:
        //    -path (used if the mode requires a path)
        //    -id (used if the mode requires a list, like sendList or addList. default is SESSION)
        //    -type (used to specify the type of the above list; tracks|nodes)
        //    -limit (default max_playlist_length; used for playback actions.)
        //    -playlist (default session; used to specify which playlist to add elements to
        //               if your mode is addList or addPath)
        //    -query (allows you to limit your results when your mode is sendPath or sendPathRandom
        //    -resample (NOT IMPLEMENTED)
        //
        //
        // generateRandom [creates a random playlist of the specified element type and count.]
        //    -random_play_type
        //    -random_play_genre
        //    -random_play_number
        //    
        // info
        //
       
       
        // For example, if a form is submitted via the POST method and has the folling variables:
        // $_POST['action'] = mediaAction
        // $_POST['path'] = Alternative/311
        // $_POST['sendPathRandom'] = true
        //
        // Jinzora would send the user a randomized playlist containing all of 311's tracks.
        //
        // To do the same via GET variables:
        // $_GET['action'] = playlist
        // $_GET['jz_path'] = Alternative/311
        // $_GET['mode'] = random
        //
       
                // having doSearch set and an action set is a security violation,
                // since it allows executing arbitrary, unscrambled actions.
        // First some security checking:
        if (isset($_POST['update_settings'])) {
                if (!(($_GET['action'] == "popup") && (($_GET['ptype'] == "usermanager") || ($_GET['ptype'] == "preferences")))) {
                        die();
                }
        }
        if (isset($_GET['action'])) {
                switch ($_GET['action']) {
               
                case "login":
                        writeLogData("messages","Index: Displaying the login page");
                  $fe->loginPage();
                  exit();
                  break;
                case "register":
                  writeLogData("messages","Index: Displaying registration page");
                  $fe->registrationPage();
                  exit();
                  break;
                case "search":
                        writeLogData("messages","Index: Displaying the search page results");
                        if (isset($_POST['powersearch'])) {
                                // don't worry about params in a powersearch; handle
                                // it on the results page.
                                $fe->searchResults(false,false,true);
                        } else if ($_GET['search_query'] == "") {
                                $fe->powerSearch();
                                // We cannot do SQL queries before we draw the header (for CMS)
                                // So we have the searchPage handle the query itself.
                                // Keywords are handled in the handleSearch() function
                                // See backend/backend.php.
                        } else {
                          $fe->searchResults($_GET['search_query'], $_GET['search_type']);
                        }
                       
                        exit();
                        break;
                case "powersearch":
                        writeLogData("messages","Index: Displaying the power search page");
                        $fe->powerSearch();
                       
                        exit();
                        break;                 

                case "playlist":
                        writeLogData("messages","Index: Generating playlists");
                  if ($jzUSER->getSetting('stream') === false && $jzUSER->getSetting('lofi') === false) {
                    exit();
                  }
                        if (isset($_GET['type']) && $_GET['type'] == "playlist") {
                          // TODO: could pass the ID as a paramater and not automatically update the session variable.
                          $pid = false;
                          if (isset($_GET['jz_pl_id'])) {
                            $pid = $_GET['jz_pl_id'];
                          }
                          $pl = $jzUSER->loadPlaylist($pid);
                                if ($_GET['mode'] == "random") {
                                  $pl = $pl->getSmartPlaylist();
                                }
                                $pl->play();
                        }
                        else if (isset($_GET['type']) && $_GET['type'] == "track") {
                                // send file directly if method == direct.
                                // otherwise send a playlist.
                                // TODO: if method = direct, do things like update playcount.
                                // and also validate user (pass username / md5(password) in URL)
                                $el = &new jzMediaTrack($_GET['jz_path']);
                                $pl = &new jzPlaylist();
                                $pl->add($el);
                                if (isset($_GET['clip'])) {
                                  setGlobal("CLIP_MODE",true);
                                }
                                $pl->play();
                        } else {
                          // Ok, was this a radio playlist or standard
                                if (isset($_GET['mode']) && $_GET['mode'] == "radio"){
                                        // Let's set the limit
                                        $lim = (isset($_GET['limit'])) ? $_GET['limit'] : false;
                                       
                                        // Now let's get the tracks from the primary artist
                                        $el = &new jzMediaNode($_GET['jz_path']);
                                        $pl = new jzPlaylist();
                                        $pl->add($el);
                                        $pl = $pl->getSmartPlaylist($lim,"radio");
                                        $pl->play();
                                } else {
                                        $el = &new jzMediaNode($_GET['jz_path']);
                                        $rand = (isset($_GET['mode']) && $_GET['mode'] == "random") ? true : false;
                                        $lim = (isset($_GET['limit'])) ? $_GET['limit'] : false;
                                        $tlist = $el->getSubNodes("tracks",-1,$rand,$lim);
                                        if ($rand === false) {
                                          sortElements($tlist,"number");
                                        }
                                        $pl = &new jzPlaylist($tlist);
                                        $pl->play();
                                }
                        }
                        exit();
                        break;
                case "jukebox":
                        // Do we need to use the standard jukebox or not?
                        // Now did they have a subcommand?
                  if ($jzUSER->getSetting('jukebox_admin') === false && $jzUSER->getSetting('jukebox_queue') === false) {
                    echo 'insufficient permissions.';
                    exit();
                  }
                        if (isset($_GET['subaction']) or isset($_POST['subaction'])){
                                // Now let's pass our command
                                if (isset($_GET['command'])){
                                        $command = $_GET['command'];
                                }
                                if (isset($_POST['command'])){
                                        $command = $_POST['command'];
                                }
                                // Let's include the Jukebox classes
                                writeLogData("messages","Index: Passing command: ". $command. " to the jukebox");
                                include_once($include_path. "jukebox/class.php");
                                $jb = new jzJukebox();
                                $jb->passCommand($command);
                        }
                        //flushdisplay();
                        usleep(750000);
                        if (isset($_GET['frame'])){
                                include_once($include_path. "frontend/frontends/jukezora/topframe.php");
                                exit();
                        } else {
                                include_once($include_path. "jukebox.php");
                                exit();
                        }
                break;

                case "generateRandom":
                        writeLogData("messages","Index: Generating a random playlist");
                  if ($jzUSER->getSetting('stream') === false && $jzUSER->getSetting('lofi') === false) {
                    exit();
                  }
                        $pl = &new jzPlaylist();
                        // Let's time it.
                        $timer = microtime_float();
                        $pl->generate($_GET['random_play_type'],$_GET['random_play_number'],$_GET['random_play_genre']);
                        $timer = round(microtime_float() - $timer,2);
                        if ($_GET['random_play_genre'] != "") {
                          writeLogData('playback', "generated random playlist of ". $_GET['random_play_number'] . " tracks from genre '" . $_GET['random_play_genre'] . "' in $timer seconds.");
                        } else {
                          writeLogData('playback', "generated random playlist of ". $_GET['random_play_number'] ." tracks in $timer seconds.");
                        }
                        $pl->play();
                        exit();
                        break;
                case "download":
                        writeLogData("messages","Index: Beginning a file download for: ". $_GET['jz_path']);
                        //while (@ob_end_flush());
                        if ($_GET['type'] == "track") {
                          $el = &new jzMediaTrack($_GET['jz_path']);
                          if (!checkStreamLimit($el)){
                            // TODO: AJAX this so we don't come to a page, but get a Javascript alert.
                            echo word('Sorry, you have reached your download limit.');
                            exit();
                          }
                                // Are they downloading something resampled?
                                if (stristr($_GET['jz_path'],"data/resample")){
                                        $name = $el->getPath();
                                        $name = $name[sizeof($name)-1];
                                        sendMedia($_GET['jz_path'], $name, $resample, "", true);
                                } else {
                                        $el->increaseDownloadCount();
                                        $name = $el->getPath();
                                        $name = $name[sizeof($name)-1];
                                        sendMedia($el->getFileName("host"),$name, $resample, "", true);
                                }
                                exit();
                        } else if ($_GET['type'] == "playlist") {
                                $pl = $jzUSER->loadPlaylist($_GET['jz_pl_id']);
                                $pl->download();
                        } else {
                                $pl = new jzPlaylist();
                                $el = &new jzMediaNode($_GET['jz_path']);
                                if ($el->getLevel() == 0) { die(); }
                                $pl->add($el);
                                $pl->rename($el->getName());
                                $pl->download();
                        }
                        exit();
                  break;


                        /** Not yet...
                case "import":
                        if (isset($_GET['query']))
                                $node->mediaImport("jzLibrary","URL");
                        else {
                                echo "<form>URL: <input type="text" name="query">";
                                echo '<input type="hidden" name="'.jz_encode("jz_path").'" value="'.jz_encode($_GET['jz_path']).'">';
                                echo '<input type="hidden" name="'.jz_encode("action").'" value="'.jz_encode("import").'">';
                                echo '<br><input type="submit" value="Import Media"></form>';
                        }
                        exit();
                        break;
                       
                case "export":
                        $node->mediaExport("jzLibrary");
                        exit();
                        break;

                        **/
                }
               
        }
        /* * * * * * * * * */
        // // // // // // / /
        /*******************/
        if (isset($_POST['action'])) {
                switch ($_POST['action']) {
                case "login":
                  if (isset($_POST['self_register'])) {       
                        writeLogData("messages","Index: Showing the self registration page");
                    $fe->registrationPage();
                    exit();
                  }
                        $remember = (isset($_POST['remember'])) ? true : false;
                        if ($_POST['field2'] == "cms-user") {
                          die("Security breach detected.");
                        }
                        if (($jzUSER->login($_POST['field1'],$_POST['field2'], $remember)) === false) {
                                writeLogData("messages","Index: Displaying the login page");
                                $fe->loginPage(true);
                                exit();
                        }
                        if ($jzUSER->getSetting('view') === false) {
                          $fe->loginPage();
                          exit();
                        }                      
                        $jzSERVICES->loadUserServices();
                        handleUserInit();
                        writeLogData("messages","Index: Including the icons");
                        include_once($include_path. "frontend/icons.lib.php");
                        break;
                case "mediaAction":
                        writeLogData("messages","Index: Preforming a media action");
                  if (isset($_POST['randomize']) && $_POST['randomize'] == "true") {
                    unset($_POST['sendList']);
                    $_POST['sendListRandom'] = "true";
                  }

                        $exit = true;
                        if (isset($_POST['jz_path']) && (isset($_POST['sendPath']) || isset($_POST['sendPathRandom'])
                                 || ((isset($_POST['sendList']) || isset($_POST['sendListRandom'])) && sizeof($_POST['jz_list']) == 0))) {
                          $guy = &new jzMediaNode($_POST['jz_path']);
                               
                                // should we do any filtering?
                                if (isset($_POST['doquery']) && $_POST['query'] != "") {
                                        if ($_POST['how'] == "search") {
                                                $root = &new jzMediaNode();
                                                $pl = &new jzPlaylist($root->search(stripSlashes($_POST['query']),"tracks",-1));      
                                        }
                                        else  {
                                                $pl = &new jzPlaylist($guy->search(stripSlashes($_POST['query']),"tracks",-1));       
                                        }
                                } else {
                                        $pl = &new jzPlaylist(array($guy));
                                }
                               
                                if (isset($_POST['sendPathRandom']) || isset($_POST['sendListRandom'])) {
                                        $pl->flatten();
                                        $pl->shuffle();
                                       
                                        if (isset($_POST['limit'])) {
                                                $pl->truncate($_POST['limit']);
                                        }
                                }
                                else if (isset($_POST['limit'])) {
                                        $pl->flatten();
                                        $pl->truncate($_POST['limit']);
                                }
                               
                                $pl->play();
                        }
                        else if (isset($_POST['info'])) {
                                echo "get info for the given list.";
                        }
                        else if (isset($_POST['addList']) && sizeof($_POST['jz_list']) > 0) {
                                $exit = false;
                                $pl = $jzUSER->loadPlaylist();
                                if (!is_object($pl)) {
                                  $pl = new jzPlaylist();
                                }
                                $pl->addFromForm();
                                $jzUSER->storePlaylist($pl);

                                if (!defined('NO_AJAX_JUKEBOX')) {
                                  $blocks = new jzBlocks();
                                  $blocks->playlistDisplay();
                                  exit();
                                }
                        }
                        else if ((isset($_POST['jz_path']) && isset($_POST['addPath']))
                                 || (isset($_POST['addList']) && sizeof($_POST['jz_list']) == 0)) {
                                 
                                $exit = false;
                                $guy = &new jzMediaNode($_POST['jz_path']);
                               
                                if (isset($_POST['doquery']) && $_POST['query'] != "") {
                                  if ($_POST['how'] == "search") {
                                    $root = &new jzMediaNode();
                                    $list = $root->search(stripSlashes($_POST['query']),"tracks",-1); 
                                  }
                                  else  {
                                    $list = $guy->search(stripSlashes($_POST['query']),"tracks",-1);  
                                  }
                                 
                                  $pl = $jzUSER->loadPlaylist();
                                  $pl->add($list);
                                  $jzUSER->storePlaylist($pl);

                                  if (!defined('NO_AJAX_JUKEBOX')) {
                                    $blocks = new jzBlocks();
                                    $blocks->playlistDisplay();
                                    exit();
                                  }

                                } else {
                                  $pl = $jzUSER->loadPlaylist();
                                  $pl->add($guy);
                                  $jzUSER->storePlaylist($pl);

                                  if (!defined('NO_AJAX_JUKEBOX')) {
                                    $blocks = new jzBlocks();
                                    $blocks->playlistDisplay();
                                    exit();
                                  }
                                }
                        }
                        else {
                          $pl = new jzPlaylist();
                          $pl->addFromForm();
                          $pl->flatten();

                          if (isset($_POST['limit'])) {
                            $pl->truncate($_POST['limit']);
                          }
                         
                          if (isset($_POST['sendListRandom'])) {
                            $pl->shuffle();
                          }

                          $pl->play();
                        }
                        if ($exit) {
                                exit();
                        }
                        break;
                case "playlistAction":
                        writeLogData("messages","Index: Preforming a playlist action");
                        if ($jzUSER->getSetting('stream') === false && $jzUSER->getSetting('lofi') === false && $jzUSER->getSetting('download') === false) {
                                exit();
                        }
                        $exit = true;
                        $pl = $jzUSER->loadPlaylist();
                        if (isset($_POST['downloadlist'])) {
                                if ($jzUSER->getSetting('download') === false) {
                                        exit();
                                }
                                $pl->download();
                        } else if (isset($_POST['createlist'])) {
                                if (strlen($_POST['playlistname']) > 0) {
                                        $pl = new jzPlaylist();
                                        $jzUSER->storePlaylist($pl,$_POST['playlistname']);
                                        $_SESSION['jz_playlist'] = $pl->getID();
                                }
                                $exit = false;
                        } else if (isset($_POST['noaction'])) {
                                $exit = false;
                        } else {
                                if (isset($_POST['mode'])) {
                                        $pl = $pl->getSmartPlaylist();
                                }
                                if ($jzUSER->getSetting('stream') === false && $jzUSER->getSetting('lofi') === false) {
                                        exit();
                                }
                                $pl->play();
                        }
                        if ($exit) exit();
                        break;
                case "generateRandom":
                        writeLogData("messages","Index: Generating a random playlist");
                  if ($jzUSER->getSetting('stream') === false && $jzUSER->getSetting('lofi') === false) {
                    exit();
                  }
                        $pl = &new jzPlaylist();
                        // Let's time it.
                        $timer = microtime_float();
                        $pl->generate($_POST['random_play_type'],$_POST['random_play_number'],$_POST['random_play_genre']);
                        $timer = round(microtime_float() - $timer,2);
                        if ($_POST['random_play_genre'] != "") {
                          writeLogData('playback', "generated random playlist of ". $_POST['random_play_number'] . " tracks from genre '" . $_POST['random_play_genre'] . "' in $timer seconds.");
                        } else {
                          writeLogData('playback', "generated random playlist of ". $_POST['random_play_number'] ." tracks in $timer seconds.");
                        }
                        $pl->play();
                        exit();
                        break;
                }
        }

// Last thing: we want to draw a standard page, since we did not previously exit.
// TODO: check for specialty pages (search,playlistmanager,etc)

        // Let's count how many of everything we have
        if (!isset($_SESSION['jz_num_genres'])){
                $root = &new jzMediaNode();
                $_SESSION['jz_num_genres'] = $root->getSubNodeCount("nodes",distanceTo("genre"));
                $_SESSION['jz_num_artists'] = $root->getSubNodeCount("nodes",distanceTo("artist"));
                $_SESSION['jz_num_albums'] = $root->getSubNodeCount("nodes",distanceTo("album"));
        }

        // The header file defines our drawPage function.
  $maindiv = (isset($_GET['maindiv']) || isset($_POST['maindiv'])) ? true : false;
        $fe->standardPage($node,$maindiv);

$ret .= COM_siteFooter();
echo $ret;
?>


 


Any tips on getting this tweaked? Thanks a lot!
 Quote

Theophile

Anonymous
*bump*

I'd really, really like to get this to work. Anyone have any ideas?
 Quote

Status: offline

suprsidr

Forum User
Full Member
Registered: 12/29/04
Posts: 555
Location:Champaign, Illinois
I'll look into integration, but for now - mine is setup in a staticpage with an inline frame like this:
Text Formatted Code
<iframe width="100%" height="1200" frameborder="0" src="http://mysite.com/jinzora2/index.php"></iframe>
 


and since staticpages use gl security, you can restrict access.
FlashYourWeb and Your Gallery with the E2 XML Media Player for Gallery2 - http://www.flashyourweb.com
 Quote

Theophile

Anonymous
Thanks! That works fine for now.

Are you working on getting integration working? This would be a really great pairing, Geeklog/Jinzora.

Please let me know if you do get this working.
 Quote

All times are EDT. The time is now 09:25 am.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content