Mcrypt for Magento on 10.6.3

Hello all,
I just got a new Mac Mini and things are up an running. I am running the base Apache 2.2, PHP 5.3.1, MySQL stuff and would like to get a local test install of Magento up and running. I need mcrypt and there seem to be several tutorials for 10.5 on the boards, but I'd like any tips for installing it under Snow Leopard Server.
I can get around terminal fine, but have very little experience compiling source so step by step would really help me. Thanks!

Try Macports: http://www.macports.org
I use it all the time. I did a search and see mcrypt is available. Basically, this is just normal *NIX software, but what Macports does, is handle the compiling and package management aspects.
It is a command line tool: port. So, the command "sudo port install mcrypt" should take care of installing mcrypt. By default, Macports creates a directory structure under "/opt" where everything is installed.
I hope this helps.

Similar Messages

  • Can i make a new layout for magento using Muse?

    The company i work for has a site on magento, an e-commerce (duh) and i would really like to give it a completely new look.
    Is this possible using adobe muse? Im not a programmer i know the basics and i have some great ideas but i need to know
    if i can make this happen on muse and then throw it on magento. Does anyone know how or have any experience?
    Thanks!

    Hi,
    Using Adobe muse you can develop a website, but you will not be able to use it as Magento theme directly. You will need to Export your site as html (in Muse) and make some changes in the html part, that is used in magento. You can check this guide, how you develop Magento theme from html
    Tutorial: Introduction to Magento Theme Development
    Hope this helps.

  • Indesign Exporting PDF to Web for Magento website Troubleshoot.

    Hi guys, usually I'm the one throwing advice to people rather than recieving it. I'm currently working for a company that uses a magento website. I was hired less than a month ago and apparently, no one knows who created the previous pdf's but we'll get to that... There's alot of problems going on here.
    First and foremost, the website we have has a link that you can click on to bring up these documents for viewing/printing. The predecessors and I upload them in pdf format and need to be pdfs. I use indesign to create/edit these older pdf's. When I export the files and then view them they look great (in acrobat). Then after I upload them, there are many things that can go wrong, but they ALWAYS go wrong.
    As a "high-quality print" pdf they all crash saying "an internal error occured". The steps that happen are, they begin to load, and according to the load bar at the bottom they get about halfway or so (this is on a Mac). Then a white screen and the error shows up. This is the same for Windows as well (except the load bar is a circle and fills all the way to 11o'clock). It tends to render all the way or halfway with Windows but never looks right.
    As an interactive pdf, the same happens as above, but it's much faster to crash and a second error pops up about acrobat (I can't remember the exact wording but I figure that it's in direct correlation with the first error message). Also, there is no interactive part to my pdf, it's just some basic shapes with fill, multiple pictures and some text.
    All other options go all crazy. Some load with glitches, some don't. Here's a screen shot of the best looking one....
    This is based off the PC because it actually shows something, which usually loads it as normal colors. Those lines however are always there and always inverted colors.
    Now for the screwy part, because I'm a graphic designer I automatically blame the website and internet stuff, but we have figured out it MUST be a pdf because of a few things.
    1. JPGs load correctly, even when the files are larger than the pdfs. This specific one was 3MB as a jpeg compared to the 2.6MB pdf. We can't use jpgs because they're multiple page documents...
    2. Single page high-quality print pdfs seem to have a 50-50 shot of loading correctly. The other thing is the older pdf's (as in before I got here) are loaded up fine and work great.
    3. EPS's are WAY too big and are saved as single pages as well.
    4. GIF's and anything else, the quality of the images suffer and they need to be print capable.
    So it's gotta be pdf or I'm going to be in a world of hurt.
    Here's a few more things in case you're wondering. I've got all images and internal pdf's linked properly. I've saved them embedded and not embedded. The only thing missing is a font, but that shouldn't change anything? I've saved it as a PDF 5,6,7 & 8. No avail... I've saved as RGB and CMYK, pretty much anything and everything I've done, I've tried, I've failed. I'm out of ideas... maybe somehow rastercizing/flattening images into one layer would work? But I don't know how to do that in ID. By the way, I have access to the CS6 suite in both Mac and PC so I can work either way.
    Thanks and sorry for the lengthy situation, I just figure it'll help solve the problem quicker.
    A Beatles Fan

    Given that you have no problems viewing the PDF files directly in Acrobat after they are exported from InDesign, I think you can safely assume that the problem isn't InDesign, the format of the contents (whether EPS, JPEG, PDF, etc.), the options used to export the PDF, etc.
    The symptoms would point to the PDF file being corrupted either as part of the upload to the website or in the download.
    Have you tried doing a file compare – even just a comparision of the physical file length – between the PDF file directly after export from InDesign and the PDF file you download from the website? My guess is that the length is different and likewise, the contents differ.
    One area to look at is that of whether either the upload or download function of this website is trying to treat PDF files as ASCII files and thus, mucking around with what it thinks are line endings – CR, LF, CR/LF, etc. – making “fixes” that in fact corrupt the PDF files. PDF files are always binary files. All network operations with such files should be done with binary protocols (FTP is one file transfer protocol that often messes up with this).
    Check into this and let us know what you find.
              - Dov

  • My CPU usage upto 99% when trying to create admin acount in Magento.

    It has been almost 2 days by now i have been trying to install Magento in MAMP server.
    Majento installs database tables sucessfully then when trying to create a admin account for Magento it stucks ... and hungs up the browser..
    I am using MAMP , PHP 5.3.5 safari web browser and when see the activity monitor i found httpd --99% cpu usage.
    Why is this happening?
    Can't i install Magento in Macbook Pro? is this the limitation on MAC?
    I have lost 2 days by now...Not found any solution...
    Is Windows the solution Now?

    Have you tried Magento support forums?
    http://www.magentocommerce.com/boards/viewthread/2137/

  • Magento support in DW CS5

    Hi There,
    I just downloaded the trial of Dreamweaver CS5. I must say I was pleasantly suprised by the list of files that 'discover' mode found in a Drupal site I was working on. In combination with the documentation of the Zen Theme I was able to do some customisation pretty quick.
    Now I am wondering: will this support for frameworks be extended to other platforms? Or can the community extend it? I am particularly looking for Magento support. This system is hard to theme and it would be great to have different view on the files involved.
    Thanks in advance,
    B

    You need to set the environment. as follows

  • How can i run Pear on my Mac Server?

    Hello
    i need urgent help to run Pear on my Mac Server. I am building up a local Enviroment for Magento and need Pear running.
    Would be very happy if somebody can help me out.
    Many Thanks!

    Welcome to the forums.
    First, please ensure you have a current and complete backup of your disks and your data. If you should make a mistake or if the installation should tip over and scribble on something, then that backup (or a reinstallation) is your best and easiest path back to an operational system.
    As for your question around loading PEAR/PECL tools onto 10.6 Snow Leopard, Google finds [this|http://clickontyler.com/blog/2008/01/how-to-install-pear-in-mac-os-x-leop ard> and [this|http://stackoverflow.com/questions/628838/how-to-set-up-pear-on-mac-os-x- 10-5-leopard] and [this|http://discussions.apple.com/thread.jspa?threadID=2602597&tstart=105], and one or more of these postings might get you going here.
    (One other thing that's happened with Snow Leopard and Snow Leopard Server was the upgrade to php 5.3 and more recently to 5.3.3. Based on various postings, PEAR tends to toss deprecated errors because of this; php is newer than the code. This might have been fixed in a newer PEAR.)
    The other piece you'll need to load is mcrypt. [Here is a recent thread on Magento and php and mcrypt|http://discussions.apple.com/thread.jspa?threadID=2722257].
    There are various related discussions of installing Magento on Mac OS X and Mac OS X Server over in the Magento forums, as well.

  • "Search in Files" inside .ini files

    I use the site search and search in file features in Dreamweaver quite often but I just discovered that if I have a folder full of .ini files and I need to search globally inside those files Dreamweaver returns no results.
    Apparently, DW is unable to search inside files other than HTML, PHP, CSS, JS, etc. But it won't search in .ini files or any weird (for DW) file extensions.
    I once was able to set up my DW to look inside PHTML files (Used by Magento) as well as applying code coloring to them as it would on PHP files.
    I suspect this is a similar process but I wanted to make sure I was not seeing things. Is DW really that dense that will not search inside a file with an extension it doesn't know?
    By the way, I did add .ini to the recognizable files in preferences, but obviously that's not enough to have DW search inside them.
    OFF TOPIC COMMENT
    Another weird thing I just noticed is that the "asset" and other modules will only work in WYSIWYG view. Meaning that if I save a color in my assets I cannot use it to insert it in a CSS file. Not even in code view. I have to be in the visual editor for it to work, but then it's useless to me.
    Incidentally, some time ago I found that the visual editor in DW is actually very useful when working with dynamic websites like Drupal or wordpress. Especially when dealing with very large pages with lots of CSS files.
    However, no one IO know would or should build their sites in the visual editor. It's simly a bad way to work. Why would adobe limit the use of the "assets" pane (and the "History pane too now that I remember)  to the visual editor is beyond me in this day and age.
    I do a lot of tasks where it would be greast to copy a procedure like a substiotution and have DW repeat the same procedure on other pages or similar code snippets. Yet, it won't alow me.
    I love Dreamweaver and I am actually writing a book on how to use it with the likes of wordpress, drupal, etc. It cuts dowen development and design time by less than a third. If those things worked everywhere instead of just in the visual editor it would cut down even more on the time it ntakes to design dynamic website templates.
    Sorry about the rant.
    Thank you for any help.

    Hi David, I too have worked closely on a lot of software projects and I am well aware of the limitations. In fact, that's one of the reasons I lioke to work on open source projects because of the vast talent pool they can utilize. Private companies, no matter how big, neet to triage new development according to their resources.
    By the way, adding the .ini files to the extension.txt files in Dreamweaver is pretty easy. Since code coloring is not an issue that's really the only change I need to make. When I integrated the PHTML file extension for Magento I had to make a lot more changes (still manageable though).
    One of your comments, about DW keeping its legacy features in a changing web development world, made me think that it may be time for Adobe to spawn a different IDE or start thinking about a more modular approach to the application.
    I am writing a book on Dreamweaver integration for Open Source web scripts and when talking to other open source developers, one thing that comes up often is that Dreamweaver is a "bloated" program  (this is not my complaint, by the way).
    Part of the issue is that it needs to keep a lot of quasi-obsolete features so that long time users won't abandon the platform. Which featrures are obsolete is really up to each user. For me the WYSIWYG view is certainly not something I would use to design web sites, but should Adobe get rid of it,  it would absolutely destroy my workflow since I use it to rapidly target HTML, CSS and even Core PHP code in the template and the file system of the scripts I work with.
    The new "Live view" in CS4 was a welcome addition, especially since the basic page rendering in DW leaves a lot to be desired (Incidentally Microsnot "Expression" page rendering is a lot better, making the live view feature less exceptional except when troubleshooting JS based effects).
    Anyway, that said, DW is an extensible program and there are a lot of thrid party utilities written for Dreamweaver. Couldn't the Adobe team use this extensibility to make improvements to the interface and even use it to add or subctract features from the main application?
    I think they are mising an opportunity here to capture a wider audience. DW could ship with a minimal set of features and the team could choose to release their own add-ons so that users could build their own application.
    I think that approach would silence a lot of critics, since the basic app would now be a lot slimmer, while still giving power and legacy users the features they need a-la-carte.
    I am actually hioping that once my book comes out (if it ever does: the publishing world moves at a snail's pace) it may give the DW team a new perspective on how to use Dreamweaver in a modern web development enviroment, but honestly my biggest hope is for one of the current open source projects like Eclipse to look at my development system and maybe add some Dreamweaver-like features so that finally there would be a real open source alternative to Dreamweaver. In turn, I believe that will make DW move a bit more quickly in adding new features and shedding the obsolete ones.
    Anyway, thank you again for the links, I did submit my suggestions. I am not holding my breath but we'll see.
    Take care

  • One of my javascript is interfering with other javascript in the nav dropdown menu

    I'm using javascript for a slideshow and scrolling images within my home page. The wire thing is that I realized that now there is another javascript in the page that I don't remember calling myself and it seems that is connecting both of the slideshows and also is interfering with the drop down menu script, which now is not working.
    I used Magento, so the header is no part of the same page. I'm not sure if is a Magento or a Dreamweaver thing, that this new javascript was placed in the home page.
    Here is the url: http://www.southsunbeads.com
    These two javascripts go with the main top slideshow: src="http://www.southsunbeads.com/website/slideshow/jquery-1.2.6.pack.js">
    <script type="text/javascript" src="http://www.southsunbeads.com/website/slideshow/simplegallery.js">
    This one is part of the scroll image at the bottom: <script type="text/javascript" src="http://www.southsunbeads.com/website/carousel/stepcarousel.js">
    But then I have this one, which is the one is causing all the problems, and apparently is connecting everything together, when I tried to remove it, the slideshows stop working.
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    I don't know javascript, so I have no idea how to fix this problem. Basically what I need is that the menu on the top doesn't get affected by these other javascripts.
    Can anyone help??
    Thanks

    pchinique wrote:
    ...and yes, that's what I did.
    See how smart I am ?
    Given the fact that the contents of that textarea is getting displayed within a predefined DIV container of a template, I´m convinced that Magento rather expects the user to insert standard text like a product description -- what will obviously work, is surrounding certain text elements with simple html markup like "strong", but that´s supposedly all you should do.
    You´re certainly right when assuming that you´d rather have to convert your Dreamweaver document into a Magento template, and with every CMS out there the template creation process can be quite a learning curve.
    Have never used Magento, but here´s what I found (among others) when googling for "magento tutorials":
    http://www.siteground.com/tutorials/magento/
    http://net.tutsplus.com/tutorials/php/magento-for-designers-part-i/
    When googling "magento template tutorials" there´s a list of tutorials covering this particular aspect.
    Cheers,
    Günter

  • Process of ordering stacks at commerce/shipping.asp

    Hello,
    I have set up the e-commerce package and I tried to make an ordering of some products.
    The process of ordering stacks at the shipping phase (this means that there is no button continue for steping to billing) with the following output:
    "Freight rates are not available for this user.
    Rates have not been defined for this order: the subtotal or weight of the order does not meet the cost structure of any defined rate."
    I suspect that something must be configured in the database. Could you please describe me what?
    Thanks in advance.
    Best Regards
    Vassilis Giatilis

    Hello,
    if you want to set up e-commerce on top of SAP Busness One
    i would like suggest you go for Magento Commerce with SAP Business one
    for more details about this you can visit sboeconnect.com
    Magento is todays word fastest growing e-commerce platform, with SAP Business One you can really create enterprise e-commerce
    hope this will help you
    rakesh
    sboeconnect.com

  • PHP arrow operator problem

    I'm half way through writing a web interface for mpd. I needed a way to interact with it so I searched around and found this. It's a php class that interfaces with mpd.
    I downloaded it and it comes with an example php file for using it. The only problem is that when I use the example page it just prints out anything after the arrow operator. As far as I'm aware the arrow operator is for accessing class methods and variables but I've never actually done any OOP with PHP.
    Anyway here is the example file:
    <?
    * mpd-class-example.php - Example interface using mpd.class.php
    * Version 1.2, released 05/05/2004
    * Copyright (C) 2003-2004 Benjamin Carlisle ([email protected])
    * http://mpd.24oz.com/ | http://www.musicpd.org/
    * This program illustrates the basic commands and usage of the MPD class.
    * *** PLEASE NOTE *** My intention in including this file is not to provide you with an
    * out-of-the-box MPD jukebox, but instead to provide a general understanding of how I saw
    * the class as being utilized. If you'd like to see more examples, please let me know. But
    * this should provide you with a good starting point for your own program development.
    * This program is free software; you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation; either version 2 of the License, or
    * (at your option) any later version.
    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    * GNU General Public License for more details.
    * You should have received a copy of the GNU General Public License
    * along with this program; if not, write to the Free Software
    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    ?>
    <HTML>
    <style type="text/css"><!-- .defaultText { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; color: #111111} .err { color: #DD3333 } --></style>
    <BODY class="defaultText">
    <?
    include('mpd.class.php');
    $myMpd = new mpd('localhost',2100);
    if ( $myMpd->connected == FALSE ) {
    echo "Error Connecting: " . $myMpd->errStr;
    } else {
    switch ($_REQUEST[m]) {
    case "add":
    if ( is_null($myMpd->PLAdd($_REQUEST[filename])) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    case "rem":
    if ( is_null($myMpd->PLRemove($_REQUEST[id])) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    case "setvol":
    if ( is_null($myMpd->SetVolume($_REQUEST[vol])) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    case "play":
    if ( is_null($myMpd->Play()) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    case "stop":
    if ( is_null($myMpd->Stop()) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    case "pause":
    if ( is_null($myMpd->Pause()) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    default:
    break;
    ?>
    <DIV ALIGN=CENTER>[ <A HREF="<? echo $_SERVER[PHP_SELF] ?>">Refresh Page</A> ]</DIV>
    <HR>
    <B>Connected to MPD Version <? echo $myMpd->mpd_version ?> at <? echo $myMpd->host ?>:<? echo $myMpd->port ?></B><BR>
    State:
    <?
    switch ($myMpd->state) {
    case MPD_STATE_PLAYING: echo "MPD is Playing [<A HREF='".$_SERVER[PHP_SELF]."?m=pause'>Pause</A>] [<A HREF='".$_SERVER[PHP_SELF]."?m=stop'>Stop</A>]"; break;
    case MPD_STATE_PAUSED: echo "MPD is Paused [<A HREF='".$_SERVER[PHP_SELF]."?m=pause'>Unpause</A>]"; break;
    case MPD_STATE_STOPPED: echo "MPD is Stopped [<A HREF='".$_SERVER[PHP_SELF]."?m=play'>Play</A>]"; break;
    default: echo "(Unknown State!)"; break;
    ?>
    <BR>
    Volume: <? echo $myMpd->volume ?> [ <A HREF='<? echo $_SERVER[PHP_SELF] ?>?m=setvol&vol=0'>0</A> | <A HREF='<? echo $_SERVER[PHP_SELF] ?>?m=setvol&vol=25'>25</A> | <A HREF='<? echo $_SERVER[PHP_SELF] ?>?m=setvol&vol=75'>75</A> | <A HREF='<? echo $_SERVER[PHP_SELF] ?>?m=setvol&vol=100'>100</A> ]<BR>
    Uptime: <? echo secToTimeStr($myMpd->uptime) ?><BR>
    Playtime: <? echo secToTimeStr($myMpd->playtime) ?><BR>
    <? if ( $myMpd->state == MPD_STATE_PLAYING or $myMpd->state == MPD_STATE_PAUSED ) { ?>
    Currently Playing: <? echo $myMpd->playlist[$myMpd->current_track_id]['Artist']." - ".$myMpd->playlist[$myMpd->current_track_id]['Title'] ?><BR>
    Track Position: <? echo $myMpd->current_track_position."/".$myMpd->current_track_length." (".(round(($myMpd->current_track_position/$myMpd->current_track_length),2)*100)."%)" ?><BR>
    Playlist Position: <? echo ($myMpd->current_track_id+1)."/".$myMpd->playlist_count." (".(round((($myMpd->current_track_id+1)/$myMpd->playlist_count),2)*100)."%)" ?><BR>
    <? } ?>
    <HR>
    <B>Playlist - Total: <? echo $myMpd->playlist_count ?> tracks (Click to Remove)</B><BR>
    <?
    if ( is_null($myMpd->playlist) ) echo "ERROR: " .$myMpd->errStr."\n";
    else {
    foreach ($myMpd->playlist as $id => $entry) {
    echo ( $id == $myMpd->current_track_id ? "<B>" : "" ) . ($id+1) . ". <A HREF='".$_SERVER[PHP_SELF]."?m=rem&id=".$id."'>".$entry['Artist']." - ".$entry['Title']."</A>".( $id == $myMpd->current_track_id ? "</B>" : "" )."<BR>\n";
    ?>
    <HR>
    <B>Sample Search for the String 'U2' (Click to Add to Playlist)</B><BR>
    <?
    $sl = $myMpd->Search(MPD_SEARCH_ARTIST,'U2');
    if ( is_null($sl) ) echo "ERROR: " .$myMpd->errStr."\n";
    else {
    foreach ($sl as $id => $entry) {
    echo ($id+1) . ": <A HREF='".$_SERVER[PHP_SELF]."?m=add&filename=".urlencode($entry['file'])."'>".$entry['Artist']." - ".$entry['Title']."</A><BR>\n";
    if ( count($sl) == 0 ) echo "<I>No results returned from search.</I>";
    // Example of how you would use Bulk Add features of MPD
    // $myarray = array();
    // $myarray[0] = "ACDC - Thunderstruck.mp3";
    // $myarray[1] = "ACDC - Back In Black.mp3";
    // $myarray[2] = "ACDC - Hells Bells.mp3";
    // if ( is_null($myMpd->PLAddBulk($myarray)) ) echo "ERROR: ".$myMpd->errStr."\n";
    ?>
    <HR>
    <B>Artist List</B><BR>
    <?
    if ( is_null($ar = $myMpd->GetArtists()) ) echo "ERROR: " .$myMpd->errStr."\n";
    else {
    while(list($key, $value) = each($ar) ) {
    echo ($key+1) . ". " . $value . "<BR>";
    $myMpd->Disconnect();
    // Used to make number of seconds perty.
    function secToTimeStr($secs) {
    $days = ($secs%604800)/86400;
    $hours = (($secs%604800)%86400)/3600;
    $minutes = ((($secs%604800)%86400)%3600)/60;
    $seconds = (((($secs%604800)%86400)%3600)%60);
    if (round($days)) $timestring .= round($days)."d ";
    if (round($hours)) $timestring .= round($hours)."h ";
    if (round($minutes)) $timestring .= round($minutes)."m";
    if (!round($minutes)&&!round($hours)&&!round($days)) $timestring.=" ".round($seconds)."s";
    return $timestring;
    ?>
    </BODY></HTML>
    The class file:
    <?php
    * mpd.class.php - PHP Object Interface to the MPD Music Player Daemon
    * Version 1.2, Released 05/05/2004
    * Copyright (C) 2003-2004 Benjamin Carlisle ([email protected])
    * http://mpd.24oz.com/ | http://www.musicpd.org/
    * This program is free software; you can redistribute it and/or modify
    * it under the terms of the GNU General Public License as published by
    * the Free Software Foundation; either version 2 of the License, or
    * (at your option) any later version.
    * This program is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    * GNU General Public License for more details.
    * You should have received a copy of the GNU General Public License
    * along with this program; if not, write to the Free Software
    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    // Create common command definitions for MPD to use
    define("MPD_CMD_STATUS", "status");
    define("MPD_CMD_STATISTICS", "stats");
    define("MPD_CMD_VOLUME", "volume");
    define("MPD_CMD_SETVOL", "setvol");
    define("MPD_CMD_PLAY", "play");
    define("MPD_CMD_STOP", "stop");
    define("MPD_CMD_PAUSE", "pause");
    define("MPD_CMD_NEXT", "next");
    define("MPD_CMD_PREV", "previous");
    define("MPD_CMD_PLLIST", "playlistinfo");
    define("MPD_CMD_PLADD", "add");
    define("MPD_CMD_PLREMOVE", "delete");
    define("MPD_CMD_PLCLEAR", "clear");
    define("MPD_CMD_PLSHUFFLE", "shuffle");
    define("MPD_CMD_PLLOAD", "load");
    define("MPD_CMD_PLSAVE", "save");
    define("MPD_CMD_KILL", "kill");
    define("MPD_CMD_REFRESH", "update");
    define("MPD_CMD_REPEAT", "repeat");
    define("MPD_CMD_LSDIR", "lsinfo");
    define("MPD_CMD_SEARCH", "search");
    define("MPD_CMD_START_BULK", "command_list_begin");
    define("MPD_CMD_END_BULK", "command_list_end");
    define("MPD_CMD_FIND", "find");
    define("MPD_CMD_RANDOM", "random");
    define("MPD_CMD_SEEK", "seek");
    define("MPD_CMD_PLSWAPTRACK", "swap");
    define("MPD_CMD_PLMOVETRACK", "move");
    define("MPD_CMD_PASSWORD", "password");
    define("MPD_CMD_TABLE", "list");
    // Predefined MPD Response messages
    define("MPD_RESPONSE_ERR", "ACK");
    define("MPD_RESPONSE_OK", "OK");
    // MPD State Constants
    define("MPD_STATE_PLAYING", "play");
    define("MPD_STATE_STOPPED", "stop");
    define("MPD_STATE_PAUSED", "pause");
    // MPD Searching Constants
    define("MPD_SEARCH_ARTIST", "artist");
    define("MPD_SEARCH_TITLE", "title");
    define("MPD_SEARCH_ALBUM", "album");
    // MPD Cache Tables
    define("MPD_TBL_ARTIST","artist");
    define("MPD_TBL_ALBUM","album");
    class mpd {
    // TCP/Connection variables
    var $host;
    var $port;
    var $password;
    var $mpd_sock = NULL;
    var $connected = FALSE;
    // MPD Status variables
    var $mpd_version = "(unknown)";
    var $state;
    var $current_track_position;
    var $current_track_length;
    var $current_track_id;
    var $volume;
    var $repeat;
    var $random;
    var $uptime;
    var $playtime;
    var $db_last_refreshed;
    var $num_songs_played;
    var $playlist_count;
    var $num_artists;
    var $num_albums;
    var $num_songs;
    var $playlist = array();
    // Misc Other Vars
    var $mpd_class_version = "1.2";
    var $debugging = FALSE; // Set to TRUE to turn extended debugging on.
    var $errStr = ""; // Used for maintaining information about the last error message
    var $command_queue; // The list of commands for bulk command sending
    // =================== BEGIN OBJECT METHODS ================
    /* mpd() : Constructor
    * Builds the MPD object, connects to the server, and refreshes all local object properties.
    function mpd($srv,$port,$pwd = NULL) {
    $this->host = $srv;
    $this->port = $port;
    $this->password = $pwd;
    $resp = $this->Connect();
    if ( is_null($resp) ) {
    $this->errStr = "Could not connect";
    return;
    } else {
    list ( $this->mpd_version ) = sscanf($resp, MPD_RESPONSE_OK . " MPD %s\n");
    if ( ! is_null($pwd) ) {
    if ( is_null($this->SendCommand(MPD_CMD_PASSWORD,$pwd)) ) {
    $this->connected = FALSE;
    return; // bad password or command
    if ( is_null($this->RefreshInfo()) ) { // no read access -- might as well be disconnected!
    $this->connected = FALSE;
    $this->errStr = "Password supplied does not have read access";
    return;
    } else {
    if ( is_null($this->RefreshInfo()) ) { // no read access -- might as well be disconnected!
    $this->connected = FALSE;
    $this->errStr = "Password required to access server";
    return;
    /* Connect()
    * Connects to the MPD server.
    * NOTE: This is called automatically upon object instantiation; you should not need to call this directly.
    function Connect() {
    if ( $this->debugging ) echo "mpd->Connect() / host: ".$this->host.", port: ".$this->port."\n";
    $this->mpd_sock = fsockopen($this->host,$this->port,$errNo,$errStr,10);
    if (!$this->mpd_sock) {
    $this->errStr = "Socket Error: $errStr ($errNo)";
    return NULL;
    } else {
    while(!feof($this->mpd_sock)) {
    $response = fgets($this->mpd_sock,1024);
    if (strncmp(MPD_RESPONSE_OK,$response,strlen(MPD_RESPONSE_OK)) == 0) {
    $this->connected = TRUE;
    return $response;
    break;
    if (strncmp(MPD_RESPONSE_ERR,$response,strlen(MPD_RESPONSE_ERR)) == 0) {
    $this->errStr = "Server responded with: $response";
    return NULL;
    // Generic response
    $this->errStr = "Connection not available";
    return NULL;
    /* SendCommand()
    * Sends a generic command to the MPD server. Several command constants are pre-defined for
    * use (see MPD_CMD_* constant definitions above).
    function SendCommand($cmdStr,$arg1 = "",$arg2 = "") {
    if ( $this->debugging ) echo "mpd->SendCommand() / cmd: ".$cmdStr.", args: ".$arg1." ".$arg2."\n";
    if ( ! $this->connected ) {
    echo "mpd->SendCommand() / Error: Not connected\n";
    } else {
    // Clear out the error String
    $this->errStr = "";
    $respStr = "";
    // Check the command compatibility:
    if ( ! $this->_checkCompatibility($cmdStr) ) {
    return NULL;
    if (strlen($arg1) > 0) $cmdStr .= " \"$arg1\"";
    if (strlen($arg2) > 0) $cmdStr .= " \"$arg2\"";
    fputs($this->mpd_sock,"$cmdStr\n");
    while(!feof($this->mpd_sock)) {
    $response = fgets($this->mpd_sock,1024);
    // An OK signals the end of transmission -- we'll ignore it
    if (strncmp(MPD_RESPONSE_OK,$response,strlen(MPD_RESPONSE_OK)) == 0) {
    break;
    // An ERR signals the end of transmission with an error! Let's grab the single-line message.
    if (strncmp(MPD_RESPONSE_ERR,$response,strlen(MPD_RESPONSE_ERR)) == 0) {
    list ( $junk, $errTmp ) = split(MPD_RESPONSE_ERR . " ",$response );
    $this->errStr = strtok($errTmp,"\n");
    if ( strlen($this->errStr) > 0 ) {
    return NULL;
    // Build the response string
    $respStr .= $response;
    if ( $this->debugging ) echo "mpd->SendCommand() / response: '".$respStr."'\n";
    return $respStr;
    /* QueueCommand()
    * Queues a generic command for later sending to the MPD server. The CommandQueue can hold
    * as many commands as needed, and are sent all at once, in the order they are queued, using
    * the SendCommandQueue() method. The syntax for queueing commands is identical to SendCommand().
    function QueueCommand($cmdStr,$arg1 = "",$arg2 = "") {
    if ( $this->debugging ) echo "mpd->QueueCommand() / cmd: ".$cmdStr.", args: ".$arg1." ".$arg2."\n";
    if ( ! $this->connected ) {
    echo "mpd->QueueCommand() / Error: Not connected\n";
    return NULL;
    } else {
    if ( strlen($this->command_queue) == 0 ) {
    $this->command_queue = MPD_CMD_START_BULK . "\n";
    if (strlen($arg1) > 0) $cmdStr .= " \"$arg1\"";
    if (strlen($arg2) > 0) $cmdStr .= " \"$arg2\"";
    $this->command_queue .= $cmdStr ."\n";
    if ( $this->debugging ) echo "mpd->QueueCommand() / return\n";
    return TRUE;
    /* SendCommandQueue()
    * Sends all commands in the Command Queue to the MPD server. See also QueueCommand().
    function SendCommandQueue() {
    if ( $this->debugging ) echo "mpd->SendCommandQueue()\n";
    if ( ! $this->connected ) {
    echo "mpd->SendCommandQueue() / Error: Not connected\n";
    return NULL;
    } else {
    $this->command_queue .= MPD_CMD_END_BULK . "\n";
    if ( is_null($respStr = $this->SendCommand($this->command_queue)) ) {
    return NULL;
    } else {
    $this->command_queue = NULL;
    if ( $this->debugging ) echo "mpd->SendCommandQueue() / response: '".$respStr."'\n";
    return $respStr;
    /* AdjustVolume()
    * Adjusts the mixer volume on the MPD by <modifier>, which can be a positive (volume increase),
    * or negative (volume decrease) value.
    function AdjustVolume($modifier) {
    if ( $this->debugging ) echo "mpd->AdjustVolume()\n";
    if ( ! is_numeric($modifier) ) {
    $this->errStr = "AdjustVolume() : argument 1 must be a numeric value";
    return NULL;
    $this->RefreshInfo();
    $newVol = $this->volume + $modifier;
    $ret = $this->SetVolume($newVol);
    if ( $this->debugging ) echo "mpd->AdjustVolume() / return\n";
    return $ret;
    /* SetVolume()
    * Sets the mixer volume to <newVol>, which should be between 1 - 100.
    function SetVolume($newVol) {
    if ( $this->debugging ) echo "mpd->SetVolume()\n";
    if ( ! is_numeric($newVol) ) {
    $this->errStr = "SetVolume() : argument 1 must be a numeric value";
    return NULL;
    // Forcibly prevent out of range errors
    if ( $newVol < 0 ) $newVol = 0;
    if ( $newVol > 100 ) $newVol = 100;
    // If we're not compatible with SETVOL, we'll try adjusting using VOLUME
    if ( $this->_checkCompatibility(MPD_CMD_SETVOL) ) {
    if ( ! is_null($ret = $this->SendCommand(MPD_CMD_SETVOL,$newVol))) $this->volume = $newVol;
    } else {
    $this->RefreshInfo(); // Get the latest volume
    if ( is_null($this->volume) ) {
    return NULL;
    } else {
    $modifier = ( $newVol - $this->volume );
    if ( ! is_null($ret = $this->SendCommand(MPD_CMD_VOLUME,$modifier))) $this->volume = $newVol;
    if ( $this->debugging ) echo "mpd->SetVolume() / return\n";
    return $ret;
    /* GetDir()
    * Retrieves a database directory listing of the <dir> directory and places the results into
    * a multidimensional array. If no directory is specified, the directory listing is at the
    * base of the MPD music path.
    function GetDir($dir = "") {
    if ( $this->debugging ) echo "mpd->GetDir()\n";
    $resp = $this->SendCommand(MPD_CMD_LSDIR,$dir);
    $dirlist = $this->_parseFileListResponse($resp);
    if ( $this->debugging ) echo "mpd->GetDir() / return ".print_r($dirlist)."\n";
    return $dirlist;
    /* PLAdd()
    * Adds each track listed in a single-dimensional <trackArray>, which contains filenames
    * of tracks to add, to the end of the playlist. This is used to add many, many tracks to
    * the playlist in one swoop.
    function PLAddBulk($trackArray) {
    if ( $this->debugging ) echo "mpd->PLAddBulk()\n";
    $num_files = count($trackArray);
    for ( $i = 0; $i < $num_files; $i++ ) {
    $this->QueueCommand(MPD_CMD_PLADD,$trackArray[$i]);
    $resp = $this->SendCommandQueue();
    $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLAddBulk() / return\n";
    return $resp;
    /* PLAdd()
    * Adds the file <file> to the end of the playlist. <file> must be a track in the MPD database.
    function PLAdd($fileName) {
    if ( $this->debugging ) echo "mpd->PLAdd()\n";
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLADD,$fileName))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLAdd() / return\n";
    return $resp;
    /* PLMoveTrack()
    * Moves track number <origPos> to position <newPos> in the playlist. This is used to reorder
    * the songs in the playlist.
    function PLMoveTrack($origPos, $newPos) {
    if ( $this->debugging ) echo "mpd->PLMoveTrack()\n";
    if ( ! is_numeric($origPos) ) {
    $this->errStr = "PLMoveTrack(): argument 1 must be numeric";
    return NULL;
    if ( $origPos < 0 or $origPos > $this->playlist_count ) {
    $this->errStr = "PLMoveTrack(): argument 1 out of range";
    return NULL;
    if ( $newPos < 0 ) $newPos = 0;
    if ( $newPos > $this->playlist_count ) $newPos = $this->playlist_count;
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLMOVETRACK,$origPos,$newPos))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLMoveTrack() / return\n";
    return $resp;
    /* PLShuffle()
    * Randomly reorders the songs in the playlist.
    function PLShuffle() {
    if ( $this->debugging ) echo "mpd->PLShuffle()\n";
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLSHUFFLE))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLShuffle() / return\n";
    return $resp;
    /* PLLoad()
    * Retrieves the playlist from <file>.m3u and loads it into the current playlist.
    function PLLoad($file) {
    if ( $this->debugging ) echo "mpd->PLLoad()\n";
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLLOAD,$file))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLLoad() / return\n";
    return $resp;
    /* PLSave()
    * Saves the playlist to <file>.m3u for later retrieval. The file is saved in the MPD playlist
    * directory.
    function PLSave($file) {
    if ( $this->debugging ) echo "mpd->PLSave()\n";
    $resp = $this->SendCommand(MPD_CMD_PLSAVE,$file);
    if ( $this->debugging ) echo "mpd->PLSave() / return\n";
    return $resp;
    /* PLClear()
    * Empties the playlist.
    function PLClear() {
    if ( $this->debugging ) echo "mpd->PLClear()\n";
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLCLEAR))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLClear() / return\n";
    return $resp;
    /* PLRemove()
    * Removes track <id> from the playlist.
    function PLRemove($id) {
    if ( $this->debugging ) echo "mpd->PLRemove()\n";
    if ( ! is_numeric($id) ) {
    $this->errStr = "PLRemove() : argument 1 must be a numeric value";
    return NULL;
    if ( ! is_null($resp = $this->SendCommand(MPD_CMD_PLREMOVE,$id))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->PLRemove() / return\n";
    return $resp;
    /* SetRepeat()
    * Enables 'loop' mode -- tells MPD continually loop the playlist. The <repVal> parameter
    * is either 1 (on) or 0 (off).
    function SetRepeat($repVal) {
    if ( $this->debugging ) echo "mpd->SetRepeat()\n";
    $rpt = $this->SendCommand(MPD_CMD_REPEAT,$repVal);
    $this->repeat = $repVal;
    if ( $this->debugging ) echo "mpd->SetRepeat() / return\n";
    return $rpt;
    /* SetRandom()
    * Enables 'randomize' mode -- tells MPD to play songs in the playlist in random order. The
    * <rndVal> parameter is either 1 (on) or 0 (off).
    function SetRandom($rndVal) {
    if ( $this->debugging ) echo "mpd->SetRandom()\n";
    $resp = $this->SendCommand(MPD_CMD_RANDOM,$rndVal);
    $this->random = $rndVal;
    if ( $this->debugging ) echo "mpd->SetRandom() / return\n";
    return $resp;
    /* Shutdown()
    * Shuts down the MPD server (aka sends the KILL command). This closes the current connection,
    * and prevents future communication with the server.
    function Shutdown() {
    if ( $this->debugging ) echo "mpd->Shutdown()\n";
    $resp = $this->SendCommand(MPD_CMD_SHUTDOWN);
    $this->connected = FALSE;
    unset($this->mpd_version);
    unset($this->errStr);
    unset($this->mpd_sock);
    if ( $this->debugging ) echo "mpd->Shutdown() / return\n";
    return $resp;
    /* DBRefresh()
    * Tells MPD to rescan the music directory for new tracks, and to refresh the Database. Tracks
    * cannot be played unless they are in the MPD database.
    function DBRefresh() {
    if ( $this->debugging ) echo "mpd->DBRefresh()\n";
    $resp = $this->SendCommand(MPD_CMD_REFRESH);
    // Update local variables
    $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->DBRefresh() / return\n";
    return $resp;
    /* Play()
    * Begins playing the songs in the MPD playlist.
    function Play() {
    if ( $this->debugging ) echo "mpd->Play()\n";
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PLAY) )) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->Play() / return\n";
    return $rpt;
    /* Stop()
    * Stops playing the MPD.
    function Stop() {
    if ( $this->debugging ) echo "mpd->Stop()\n";
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_STOP) )) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->Stop() / return\n";
    return $rpt;
    /* Pause()
    * Toggles pausing on the MPD. Calling it once will pause the player, calling it again
    * will unpause.
    function Pause() {
    if ( $this->debugging ) echo "mpd->Pause()\n";
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PAUSE) )) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->Pause() / return\n";
    return $rpt;
    /* SeekTo()
    * Skips directly to the <idx> song in the MPD playlist.
    function SkipTo($idx) {
    if ( $this->debugging ) echo "mpd->SkipTo()\n";
    if ( ! is_numeric($idx) ) {
    $this->errStr = "SkipTo() : argument 1 must be a numeric value";
    return NULL;
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PLAY,$idx))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->SkipTo() / return\n";
    return $idx;
    /* SeekTo()
    * Skips directly to a given position within a track in the MPD playlist. The <pos> argument,
    * given in seconds, is the track position to locate. The <track> argument, if supplied is
    * the track number in the playlist. If <track> is not specified, the current track is assumed.
    function SeekTo($pos, $track = -1) {
    if ( $this->debugging ) echo "mpd->SeekTo()\n";
    if ( ! is_numeric($pos) ) {
    $this->errStr = "SeekTo() : argument 1 must be a numeric value";
    return NULL;
    if ( ! is_numeric($track) ) {
    $this->errStr = "SeekTo() : argument 2 must be a numeric value";
    return NULL;
    if ( $track == -1 ) {
    $track = $this->current_track_id;
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_SEEK,$track,$pos))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->SeekTo() / return\n";
    return $pos;
    /* Next()
    * Skips to the next song in the MPD playlist. If not playing, returns an error.
    function Next() {
    if ( $this->debugging ) echo "mpd->Next()\n";
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_NEXT))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->Next() / return\n";
    return $rpt;
    /* Previous()
    * Skips to the previous song in the MPD playlist. If not playing, returns an error.
    function Previous() {
    if ( $this->debugging ) echo "mpd->Previous()\n";
    if ( ! is_null($rpt = $this->SendCommand(MPD_CMD_PREV))) $this->RefreshInfo();
    if ( $this->debugging ) echo "mpd->Previous() / return\n";
    return $rpt;
    /* Search()
    * Searches the MPD database. The search <type> should be one of the following:
    * MPD_SEARCH_ARTIST, MPD_SEARCH_TITLE, MPD_SEARCH_ALBUM
    * The search <string> is a case-insensitive locator string. Anything that contains
    * <string> will be returned in the results.
    function Search($type,$string) {
    if ( $this->debugging ) echo "mpd->Search()\n";
    if ( $type != MPD_SEARCH_ARTIST and
    $type != MPD_SEARCH_ALBUM and
    $type != MPD_SEARCH_TITLE ) {
    $this->errStr = "mpd->Search(): invalid search type";
    return NULL;
    } else {
    if ( is_null($resp = $this->SendCommand(MPD_CMD_SEARCH,$type,$string))) return NULL;
    $searchlist = $this->_parseFileListResponse($resp);
    if ( $this->debugging ) echo "mpd->Search() / return ".print_r($searchlist)."\n";
    return $searchlist;
    /* Find()
    * Find() looks for exact matches in the MPD database. The find <type> should be one of
    * the following:
    * MPD_SEARCH_ARTIST, MPD_SEARCH_TITLE, MPD_SEARCH_ALBUM
    * The find <string> is a case-insensitive locator string. Anything that exactly matches
    * <string> will be returned in the results.
    function Find($type,$string) {
    if ( $this->debugging ) echo "mpd->Find()\n";
    if ( $type != MPD_SEARCH_ARTIST and
    $type != MPD_SEARCH_ALBUM and
    $type != MPD_SEARCH_TITLE ) {
    $this->errStr = "mpd->Find(): invalid find type";
    return NULL;
    } else {
    if ( is_null($resp = $this->SendCommand(MPD_CMD_FIND,$type,$string))) return NULL;
    $searchlist = $this->_parseFileListResponse($resp);
    if ( $this->debugging ) echo "mpd->Find() / return ".print_r($searchlist)."\n";
    return $searchlist;
    /* Disconnect()
    * Closes the connection to the MPD server.
    function Disconnect() {
    if ( $this->debugging ) echo "mpd->Disconnect()\n";
    fclose($this->mpd_sock);
    $this->connected = FALSE;
    unset($this->mpd_version);
    unset($this->errStr);
    unset($this->mpd_sock);
    /* GetArtists()
    * Returns the list of artists in the database in an associative array.
    function GetArtists() {
    if ( $this->debugging ) echo "mpd->GetArtists()\n";
    if ( is_null($resp = $this->SendCommand(MPD_CMD_TABLE, MPD_TBL_ARTIST))) return NULL;
    $arArray = array();
    $arLine = strtok($resp,"\n");
    $arName = "";
    $arCounter = -1;
    while ( $arLine ) {
    list ( $element, $value ) = split(": ",$arLine);
    if ( $element == "Artist" ) {
    $arCounter++;
    $arName = $value;
    $arArray[$arCounter] = $arName;
    $arLine = strtok("\n");
    if ( $this->debugging ) echo "mpd->GetArtists()\n";
    return $arArray;
    /* GetAlbums()
    * Returns the list of albums in the database in an associative array. Optional parameter
    * is an artist Name which will list all albums by a particular artist.
    function GetAlbums( $ar = NULL) {
    if ( $this->debugging ) echo "mpd->GetAlbums()\n";
    if ( is_null($resp = $this->SendCommand(MPD_CMD_TABLE, MPD_TBL_ALBUM, $ar ))) return NULL;
    $alArray = array();
    $alLine = strtok($resp,"\n");
    $alName = "";
    $alCounter = -1;
    while ( $alLine ) {
    list ( $element, $value ) = split(": ",$alLine);
    if ( $element == "Album" ) {
    $alCounter++;
    $alName = $value;
    $alArray[$alCounter] = $alName;
    $alLine = strtok("\n");
    if ( $this->debugging ) echo "mpd->GetAlbums()\n";
    return $alArray;
    //***************************** INTERNAL FUNCTIONS ******************************//
    /* _computeVersionValue()
    * Computes a compatibility value from a version string
    function _computeVersionValue($verStr) {
    list ($ver_maj, $ver_min, $ver_rel ) = split("\.",$verStr);
    return ( 100 * $ver_maj ) + ( 10 * $ver_min ) + ( $ver_rel );
    /* _checkCompatibility()
    * Check MPD command compatibility against our internal table. If there is no version
    * listed in the table, allow it by default.
    function _checkCompatibility($cmd) {
    // Check minimum compatibility
    $req_ver_low = $this->COMPATIBILITY_MIN_TBL[$cmd];
    $req_ver_hi = $this->COMPATIBILITY_MAX_TBL[$cmd];
    $mpd_ver = $this->_computeVersionValue($this->mpd_version);
    if ( $req_ver_low ) {
    $req_ver = $this->_computeVersionValue($req_ver_low);
    if ( $mpd_ver < $req_ver ) {
    $this->errStr = "Command '$cmd' is not compatible with this version of MPD, version ".$req_ver_low." required";
    return FALSE;
    // Check maxmum compatibility -- this will check for deprecations
    if ( $req_ver_hi ) {
    $req_ver = $this->_computeVersionValue($req_ver_hi);
    if ( $mpd_ver > $req_ver ) {
    $this->errStr = "Command '$cmd' has been deprecated in this version of MPD.";
    return FALSE;
    return TRUE;
    /* _parseFileListResponse()
    * Builds a multidimensional array with MPD response lists.
    * NOTE: This function is used internally within the class. It should not be used.
    function _parseFileListResponse($resp) {
    if ( is_null($resp) ) {
    return NULL;
    } else {
    $plistArray = array();
    $plistLine = strtok($resp,"\n");
    $plistFile = "";
    $plCounter = -1;
    while ( $plistLine ) {
    list ( $element, $value ) = split(": ",$plistLine);
    if ( $element == "file" ) {
    $plCounter++;
    $plistFile = $value;
    $plistArray[$plCounter]["file"] = $plistFile;
    } else {
    $plistArray[$plCounter][$element] = $value;
    $plistLine = strtok("\n");
    return $plistArray;
    /* RefreshInfo()
    * Updates all class properties with the values from the MPD server.
    * NOTE: This function is automatically called upon Connect() as of v1.1.
    function RefreshInfo() {
    // Get the Server Statistics
    $statStr = $this->SendCommand(MPD_CMD_STATISTICS);
    if ( !$statStr ) {
    return NULL;
    } else {
    $stats = array();
    $statLine = strtok($statStr,"\n");
    while ( $statLine ) {
    list ( $element, $value ) = split(": ",$statLine);
    $stats[$element] = $value;
    $statLine = strtok("\n");
    // Get the Server Status
    $statusStr = $this->SendCommand(MPD_CMD_STATUS);
    if ( ! $statusStr ) {
    return NULL;
    } else {
    $status = array();
    $statusLine = strtok($statusStr,"\n");
    while ( $statusLine ) {
    list ( $element, $value ) = split(": ",$statusLine);
    $status[$element] = $value;
    $statusLine = strtok("\n");
    // Get the Playlist
    $plStr = $this->SendCommand(MPD_CMD_PLLIST);
    $this->playlist = $this->_parseFileListResponse($plStr);
    $this->playlist_count = count($this->playlist);
    // Set Misc Other Variables
    $this->state = $status['state'];
    if ( ($this->state == MPD_STATE_PLAYING) || ($this->state == MPD_STATE_PAUSED) ) {
    $this->current_track_id = $status['song'];
    list ($this->current_track_position, $this->current_track_length ) = split(":",$status['time']);
    } else {
    $this->current_track_id = -1;
    $this->current_track_position = -1;
    $this->current_track_length = -1;
    $this->repeat = $status['repeat'];
    $this->random = $status['random'];
    $this->db_last_refreshed = $stats['db_update'];
    $this->volume = $status['volume'];
    $this->uptime = $stats['uptime'];
    $this->playtime = $stats['playtime'];
    $this->num_songs_played = $stats['songs_played'];
    $this->num_artists = $stats['num_artists'];
    $this->num_songs = $stats['num_songs'];
    $this->num_albums = $stats['num_albums'];
    return TRUE;
    /* ------------------ DEPRECATED METHODS -------------------*/
    /* GetStatistics()
    * Retrieves the 'statistics' variables from the server and tosses them into an array.
    * NOTE: This function really should not be used. Instead, use $this->[variable]. The function
    * will most likely be deprecated in future releases.
    function GetStatistics() {
    if ( $this->debugging ) echo "mpd->GetStatistics()\n";
    $stats = $this->SendCommand(MPD_CMD_STATISTICS);
    if ( !$stats ) {
    return NULL;
    } else {
    $statsArray = array();
    $statsLine = strtok($stats,"\n");
    while ( $statsLine ) {
    list ( $element, $value ) = split(": ",$statsLine);
    $statsArray[$element] = $value;
    $statsLine = strtok("\n");
    if ( $this->debugging ) echo "mpd->GetStatistics() / return: " . print_r($statsArray) ."\n";
    return $statsArray;
    /* GetStatus()
    * Retrieves the 'status' variables from the server and tosses them into an array.
    * NOTE: This function really should not be used. Instead, use $this->[variable]. The function
    * will most likely be deprecated in future releases.
    function GetStatus() {
    if ( $this->debugging ) echo "mpd->GetStatus()\n";
    $status = $this->SendCommand(MPD_CMD_STATUS);
    if ( ! $status ) {
    return NULL;
    } else {
    $statusArray = array();
    $statusLine = strtok($status,"\n");
    while ( $statusLine ) {
    list ( $element, $value ) = split(": ",$statusLine);
    $statusArray[$element] = $value;
    $statusLine = strtok("\n");
    if ( $this->debugging ) echo "mpd->GetStatus() / return: " . print_r($statusArray) ."\n";
    return $statusArray;
    /* GetVolume()
    * Retrieves the mixer volume from the server.
    * NOTE: This function really should not be used. Instead, use $this->volume. The function
    * will most likely be deprecated in future releases.
    function GetVolume() {
    if ( $this->debugging ) echo "mpd->GetVolume()\n";
    $volLine = $this->SendCommand(MPD_CMD_STATUS);
    if ( ! $volLine ) {
    return NULL;
    } else {
    list ($vol) = sscanf($volLine,"volume: %d");
    if ( $this->debugging ) echo "mpd->GetVolume() / return: $vol\n";
    return $vol;
    /* GetPlaylist()
    * Retrieves the playlist from the server and tosses it into a multidimensional array.
    * NOTE: This function really should not be used. Instead, use $this->playlist. The function
    * will most likely be deprecated in future releases.
    function GetPlaylist() {
    if ( $this->debugging ) echo "mpd->GetPlaylist()\n";
    $resp = $this->SendCommand(MPD_CMD_PLLIST);
    $playlist = $this->_parseFileListResponse($resp);
    if ( $this->debugging ) echo "mpd->GetPlaylist() / return ".print_r($playlist)."\n";
    return $playlist;
    /* ----------------- Command compatibility tables --------------------- */
    var $COMPATIBILITY_MIN_TBL = array(
    MPD_CMD_SEEK => "0.9.1" ,
    MPD_CMD_PLMOVE => "0.9.1" ,
    MPD_CMD_RANDOM => "0.9.1" ,
    MPD_CMD_PLSWAPTRACK => "0.9.1" ,
    MPD_CMD_PLMOVETRACK => "0.9.1" ,
    MPD_CMD_PASSWORD => "0.10.0" ,
    MPD_CMD_SETVOL => "0.10.0"
    var $COMPATIBILITY_MAX_TBL = array(
    MPD_CMD_VOLUME => "0.10.0"
    } // ---------------------------- end of class ------------------------------
    ?>
    and the HTML output:
    <HTML>
    <style type="text/css"><!-- .defaultText { font-family: Arial, Helvetica, sans-serif; font-size: 9pt; font-style: normal; font-weight: normal; color: #111111} .err { color: #DD3333 } --></style>
    <BODY class="defaultText">
    connected == FALSE ) {
    echo "Error Connecting: " . $myMpd->errStr;
    } else {
    switch ($_REQUEST[m]) {
    case "add":
    if ( is_null($myMpd->PLAdd($_REQUEST[filename])) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    case "rem":
    if ( is_null($myMpd->PLRemove($_REQUEST[id])) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    case "setvol":
    if ( is_null($myMpd->SetVolume($_REQUEST[vol])) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    case "play":
    if ( is_null($myMpd->Play()) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    case "stop":
    if ( is_null($myMpd->Stop()) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    case "pause":
    if ( is_null($myMpd->Pause()) ) echo "<SPAN CLASS=err>ERROR: " .$myMpd->errStr."</SPAN>";
    break;
    default:
    break;
    ?>
    <DIV ALIGN=CENTER>[ <A HREF="<? echo $_SERVER[PHP_SELF] ?>">Refresh Page</A> ]</DIV>
    <HR>
    <B>Connected to MPD Version mpd_version ?> at host ?>:port ?></B><BR>
    State:
    state) {
    case MPD_STATE_PLAYING: echo "MPD is Playing [<A HREF='".$_SERVER[PHP_SELF]."?m=pause'>Pause</A>] [<A HREF='".$_SERVER[PHP_SELF]."?m=stop'>Stop</A>]"; break;
    case MPD_STATE_PAUSED: echo "MPD is Paused [<A HREF='".$_SERVER[PHP_SELF]."?m=pause'>Unpause</A>]"; break;
    case MPD_STATE_STOPPED: echo "MPD is Stopped [<A HREF='".$_SERVER[PHP_SELF]."?m=play'>Play</A>]"; break;
    default: echo "(Unknown State!)"; break;
    ?>
    <BR>
    Volume: volume ?> [ <A HREF='<? echo $_SERVER[PHP_SELF] ?>?m=setvol&vol=0'>0</A> | <A HREF='<? echo $_SERVER[PHP_SELF] ?>?m=setvol&vol=25'>25</A> | <A HREF='<? echo $_SERVER[PHP_SELF] ?>?m=setvol&vol=75'>75</A> | <A HREF='<? echo $_SERVER[PHP_SELF] ?>?m=setvol&vol=100'>100</A> ]<BR>
    Uptime: uptime) ?><BR>
    Playtime: playtime) ?><BR>
    state == MPD_STATE_PLAYING or $myMpd->state == MPD_STATE_PAUSED ) { ?>
    Currently Playing: playlist[$myMpd->current_track_id]['Artist']." - ".$myMpd->playlist[$myMpd->current_track_id]['Title'] ?><BR>
    Track Position: current_track_position."/".$myMpd->current_track_length." (".(round(($myMpd->current_track_position/$myMpd->current_track_length),2)*100)."%)" ?><BR>
    Playlist Position: current_track_id+1)."/".$myMpd->playlist_count." (".(round((($myMpd->current_track_id+1)/$myMpd->playlist_count),2)*100)."%)" ?><BR>
    <HR>
    <B>Playlist - Total: playlist_count ?> tracks (Click to Remove)</B><BR>
    playlist) ) echo "ERROR: " .$myMpd->errStr."\n";
    else {
    foreach ($myMpd->playlist as $id => $entry) {
    echo ( $id == $myMpd->current_track_id ? "<B>" : "" ) . ($id+1) . ". <A HREF='".$_SERVER[PHP_SELF]."?m=rem&id=".$id."'>".$entry['Artist']." - ".$entry['Title']."</A>".( $id == $myMpd->current_track_id ? "</B>" : "" )."<BR>\n";
    ?>
    <HR>
    <B>Sample Search for the String 'U2' (Click to Add to Playlist)</B><BR>
    Search(MPD_SEARCH_ARTIST,'U2');
    if ( is_null($sl) ) echo "ERROR: " .$myMpd->errStr."\n";
    else {
    foreach ($sl as $id => $entry) {
    echo ($id+1) . ": <A HREF='".$_SERVER[PHP_SELF]."?m=add&filename=".urlencode($entry['file'])."'>".$entry['Artist']." - ".$entry['Title']."</A><BR>\n";
    if ( count($sl) == 0 ) echo "<I>No results returned from search.</I>";
    // Example of how you would use Bulk Add features of MPD
    // $myarray = array();
    // $myarray[0] = "ACDC - Thunderstruck.mp3";
    // $myarray[1] = "ACDC - Back In Black.mp3";
    // $myarray[2] = "ACDC - Hells Bells.mp3";
    // if ( is_null($myMpd->PLAddBulk($myarray)) ) echo "ERROR: ".$myMpd->errStr."\n";
    ?>
    <HR>
    <B>Artist List</B><BR>
    GetArtists()) ) echo "ERROR: " .$myMpd->errStr."\n";
    else {
    while(list($key, $value) = each($ar) ) {
    echo ($key+1) . ". " . $value . "<BR>";
    $myMpd->Disconnect();
    // Used to make number of seconds perty.
    function secToTimeStr($secs) {
    $days = ($secs%604800)/86400;
    $hours = (($secs%604800)%86400)/3600;
    $minutes = ((($secs%604800)%86400)%3600)/60;
    $seconds = (((($secs%604800)%86400)%3600)%60);
    if (round($days)) $timestring .= round($days)."d ";
    if (round($hours)) $timestring .= round($hours)."h ";
    if (round($minutes)) $timestring .= round($minutes)."m";
    if (!round($minutes)&&!round($hours)&&!round($days)) $timestring.=" ".round($seconds)."s";
    return $timestring;
    ?>
    </BODY></HTML>
    As you can see it doesn't seem to understand the pointer operator. Do I have to enable anything in the PHP config files or something?

    It's set up correctly. Also, it does parse PHP, just not after the arrow.
    Here is my php.ini:
    ; With mbstring support this will automatically be converted into the encoding
    ; given by corresponding encode setting. When empty mbstring.internal_encoding
    ; is used. For the decode settings you can distinguish between motorola and
    ; intel byte order. A decode setting cannot be empty.
    ; http://php.net/exif.encode-unicode
    ;exif.encode_unicode = ISO-8859-15
    ; http://php.net/exif.decode-unicode-motorola
    ;exif.decode_unicode_motorola = UCS-2BE
    ; http://php.net/exif.decode-unicode-intel
    ;exif.decode_unicode_intel = UCS-2LE
    ; http://php.net/exif.encode-jis
    ;exif.encode_jis =
    ; http://php.net/exif.decode-jis-motorola
    ;exif.decode_jis_motorola = JIS
    ; http://php.net/exif.decode-jis-intel
    ;exif.decode_jis_intel = JIS
    [Tidy]
    ; The path to a default tidy configuration file to use when using tidy
    ; http://php.net/tidy.default-config
    ;tidy.default_config = /usr/local/lib/php/default.tcfg
    ; Should tidy clean and repair output automatically?
    ; WARNING: Do not use this option if you are generating non-html content
    ; such as dynamic images
    ; http://php.net/tidy.clean-output
    tidy.clean_output = Off
    [soap]
    ; Enables or disables WSDL caching feature.
    ; http://php.net/soap.wsdl-cache-enabled
    soap.wsdl_cache_enabled=1
    ; Sets the directory name where SOAP extension will put cache files.
    ; http://php.net/soap.wsdl-cache-dir
    soap.wsdl_cache_dir="/tmp"
    ; (time to live) Sets the number of second while cached file will be used
    ; instead of original one.
    ; http://php.net/soap.wsdl-cache-ttl
    soap.wsdl_cache_ttl=86400
    ; Sets the size of the cache limit. (Max. number of WSDL files to cache)
    soap.wsdl_cache_limit = 5
    [sysvshm]
    ; A default size of the shared memory segment
    ;sysvshm.init_mem = 10000
    [ldap]
    ; Sets the maximum number of open links or -1 for unlimited.
    ldap.max_links = -1
    [mcrypt]
    ; For more information about mcrypt settings see http://php.net/mcrypt-module-open
    ; Directory where to load mcrypt algorithms
    ; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
    ;mcrypt.algorithms_dir=
    ; Directory where to load mcrypt modes
    ; Default: Compiled in into libmcrypt (usually /usr/local/lib/libmcrypt)
    ;mcrypt.modes_dir=
    [dba]
    ;dba.default_handler=
    ; Local Variables:
    ; tab-width: 4
    ; End:
    Last edited by BaconPie (2010-11-04 20:11:33)

  • Adobe Muse wie einen Shop integrieren?

    Hallo zusammen,
    ich plane eine Website mit Muse zu erstellen, bzw. sollte es eher ein Internet-Shop werden.
    Gibt es Möglichkeiten dies zu verwirklichen?
    Ich habe im Internet Ecwid (http://www.ecwid.com/de) gefunden, dieses sollte erlauben per Widget den Shop in der mit Muse erstellten Website anzeigen zu lassen. Benutzen würden wir aber gerne Magento (Ecommerce Software & Ecommerce Platform Solutions | Magento).
    Gibt es eventuell noch andere Möglichkeiten? Oder hat jemand bereits Erfahrungen mit Ecwid, Magento?
    Hoffe hier kann mir jemand weiterhelfen :-)
    Grüße

    There,
    Please take a look at these posts for a similar discussion :
    Re: Can i make a new layout for magento using Muse?
    Adobe Muse & Magento
    Regards,
    Aish

  • Can you use Magento with Firefox. I can't browse for images when I trying to add an image to my website.

    I go to my magento pages and want to insert an image. The box comes up but the browse button doesn't work.

    Thank you for your answer but it hasn't helped. I am trying to browse my own computer's files of photos for an image to upload to magento. The browse button doesn't do anything. This is the first version of Firefox I have used (#23). I am trying to see if Firefox will work better for my business than other browsers. So my cache is pretty empty just magento and magento help.
    When i scroll over the browse button this message appears at bottom (I took a snapshot of the screen):
    javascript:openBrowser('srcbrowser','src'...advanced_image_image_browser_callback');
    When I click browse it goes to photos uploaded already with this code across the top: https://harmanscheese.com/js/tiny_mce/plugins/advimage/image.htm

  • Mcrypt on mac osx lion

    Hello,
    Has anyone already tried to install magento web shop on a mac Lion Server (10.7) succesfully?
    I tried to install the magento software but cannot succeed because of a missing dependency: Mcrypt.
    I have tried to install the mcrypt from macports (sudo port install mcrypt) succesfully and also by hand.
    But it won't show up in my php info page as available. (I have enable_dl On in the php.ini)
    If anyone can help me, thanks!

    Not sure if you solved this, but I got it worked out on Snow Leopard using Michael Gracie's article (and all the comments) here:
    http://michaelgracie.com/2009/09/23/plugging-mcrypt-into-php-on-mac-os-x-snow-le opard-10-6-1/
    I see he's now updated it for Lion here:
    http://michaelgracie.com/2011/07/21/plugging-mcrypt-into-php-on-mac-os-x-lion-10 -7/
    Hope that helps!

  • How can i pass array as argument in magento api method calling using sudzc API in iphone Native APP

    0down votefavorite
    I am implementing magento standard api method in native iphone app. I use webservice generated by sudzc. To call method I use:
    [service call:self action:@selector(callHandler:) sessionId:@" " resourcePath:@" " args:@""];
    When I used methods e.g. cart.info or product.info in which I have to pass one parameter; it gives valid response. But when I used method e.g. cart_product.add in which I have to pass an argument as value of array it gives error
    SQLSTATE[42000]: Syntax error or access violation:
        1064 You have an error in your SQL syntax;
        check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
    I have tested in SOAP UI also. There also it gives me same error. But same method works in PHP file. Even I tried by creating same soap request which I created using JavaScript but still it doesn't work.
    Can anyone help me to pass array as a parameter using sudzc api to call magento web services?

    There is an error in your SQL.

  • Is there a way for users to add products in the front-end using a Web-App?

    I am racking my brains trying to figure out a way to let users add products to the front-end on their own.
    I am building a site for a client who needs users to be able to create there own storefront, kind of like ebay. Here is exactly the functionality I want: Supplier Frontend Products Upload - Magento Connect
    There HAS to be a way to do this with a web app even if it means writing in some code...can anyone suggest a way to do this?

    In short, out of box no, but is possible.
    Solution 1: Hosted on BC, external interface that interfaces with BC API, requires external hosted server.
    Solution 2: Wait until v3 of the API comes out... no timeline from Adobe given. This would remove the need for the external API server.
    Can do both solutions for you but solution 2 wont work until adobe allows it.

Maybe you are looking for

  • How can I view less hours in iCal on my iPad

    On my Mac like in iCloud, I have the option in iCal to view 6 hours, which makes the space bigger and I can input more appointments at smaller time intervals. How can I do this on my iPad

  • Is there a limit to the number of apps that can be Hidden from view in Family Sharing?

    I've just set up a Family Share and have issued invitations to a couple of family members. I'm trying to take full advantage of the "Hide" feature that's available in the Purchased list in the App Store app, mostly to hide really old apps that I have

  • Itunes 10.7 for Windows 7 does not recognize iPod touch 4g

    Anyone having the same problem? I have uninstalled and reinstalled several times and still no iPod recognition by iTunes. Although my computer recognizes it as a camera.iTunes says no program is assciated with difxinst64.exe Has anyone run into this

  • Witch video adapter to buy

    Hi dear i just bought my macbook white (MC240BZ/A) and i want to know if the M9320G/A MINI-DVI -> VGA adapter is compatible with my MAC, could you help-me please ? best regards hudnes

  • Depriciation error.

    Hi, one asset Document has been posted after Actual date, 12 days after the capitalization of asset say asset supposed to  capitalized on 4.11.2008 but document has been posted on 16 th of the month, so first i need to change asset calculation and ca