예제 #1
0
 function &loadDefaultsParams($asText)
 {
     global $mosConfig_absolute_path;
     $path = $this->getXmlPath();
     $xmlDoc = new DOMIT_Lite_Document();
     $xmlDoc->resolveErrors(true);
     $params = null;
     if ($xmlDoc->loadXML($path, false, true)) {
         $root =& $xmlDoc->documentElement;
         $tagName = $root->getTagName();
         $isParamsFile = $tagName == 'mosinstall' || $tagName == 'install' || $tagName == 'mosparams';
         if ($isParamsFile && $root->getAttribute('type') == 'xmap_ext') {
             $params =& $root->getElementsByPath('params', 1);
         }
     }
     $result = $asText ? '' : array();
     if (is_object($params)) {
         foreach ($params->childNodes as $param) {
             $name = $param->getAttribute('name');
             $label = $param->getAttribute('label');
             $key = $name ? $name : $label;
             if ($label != '@spacer' && $name != '@spacer') {
                 $value = str_replace("\n", '\\n', $param->getAttribute('default'));
                 if ($asText) {
                     $result .= "{$key}={$value}\n";
                 } else {
                     $result[$key] = $value;
                 }
             }
         }
     }
     return $result;
 }
예제 #2
0
    /**
     * Main conversion/import function. Processes XML file
     */
    function doConversion()
    {
        $kunena_db =& JFactory::getDBO();
        require_once KUNENA_ROOT_PATH . DS . 'includes/domit/xml_domit_lite_include.php';
        if (!$this->silent) {
            ?>
			<script language=JavaScript>
			function showDetail(srcElement) {
				var targetID, srcElement, targetElement, imgElementID, imgElement;
				targetID = srcElement.id + "_details";
				imgElementID = srcElement.id + "_img";

				targetElement = document.getElementById(targetID);
				imgElement = document.getElementById(imgElementID);
				if (targetElement.style.display == "none") {
					targetElement.style.display = "";
					imgElement.src = "images/collapseall.png";
				} else {
					targetElement.style.display = "none";
					imgElement.src = "images/expandall.png";
				}
			}
			</script>
			<style>
			.details {
				font-family: courier;
				background-color: #EEEEEE;
				border: 1px dashed #BBBBBB;
				padding-left: 10px;
				margin-left: 20px;
				margin-top: 5px;
			</style>
<?php 
        }
        $componentBaseDir = '';
        $this->_converterDir = KUNENA_PATH_ADMIN . DS . $this->subdir;
        //initiate XML doc
        $xmlDoc = new DOMIT_Lite_Document();
        $xmlDoc->loadXML($this->converterDir . DS . $this->xmlFileName, false, true);
        //load root element and check XML version (for future use)
        $root =& $xmlDoc->documentElement;
        $comUpgradeVersion = $root->getAttribute("version");
        $importElement =& $root->firstChild;
        $versionNumber = $importElement->getAttribute("version");
        $versionDate = $importElement->getAttribute("date");
        //import mode, run import queries
        $importElement = $root->getElementsByPath('import', 1);
        if (!is_null($importElement)) {
            $this->processNode($importElement, 1);
        }
        if (!$this->silent) {
            ?>
            </table>
<?php 
        }
    }
예제 #3
0
 /**
  * Loads a definition file.
  * @param string $file The name of the file you want to load. Relative to 'installers' directory.
  * @return boolean True if it has loaded the file successfuly
  */
 function loadDefinition($file)
 {
     // Instanciate new parser object
     $xmlDoc = new DOMIT_Lite_Document();
     $xmlDoc->resolveErrors(true);
     // Load XML file
     if (!$xmlDoc->loadXML(JPATH_COMPONENT_ADMINISTRATOR . DS . 'assets' . DS . 'installers' . DS . $file, false, true)) {
         return false;
     }
     $root =& $xmlDoc->documentElement;
     // Check if it is a valid description file
     if ($root->getTagName() != 'jpconfig') {
         return false;
     } elseif ($root->getAttribute('type') != 'installpack') {
         return false;
     }
     // Set basic elements
     $e =& $root->getElementsByPath('name', 1);
     $this->Name = $e->getText();
     $e =& $root->getElementsByPath('package', 1);
     $this->Package = $e->getText();
     $sqlDumpRoot =& $root->getElementsByPath('sqldump', 1);
     $this->SQLDumpMode = $sqlDumpRoot->getAttribute('mode');
     // Get SQL filenames
     if ($sqlDumpRoot->hasChildNodes()) {
         $e = $sqlDumpRoot->getElementsByPath('basedump', 1);
         if (!is_null($e)) {
             $this->BaseDump = $e->getText();
         } else {
             $this->BaseDump = "";
         }
         $e = $sqlDumpRoot->getElementsByPath('sampledump', 1);
         if (!is_null($e)) {
             $this->SampleDump = $e->getText();
         } else {
             $this->SampleDump = "";
         }
     }
     // Get file list
     $this->fileList = array();
     $flRoot =& $root->getElementsByPath('filelist', 1);
     if (!is_null($flRoot)) {
         if ($flRoot->hasChildNodes()) {
             $files = $flRoot->childNodes;
             foreach ($files as $file) {
                 $this->fileList[] = $file->getText();
             }
         }
     }
     return true;
 }
예제 #4
0
/**
* @param string The URL option
*/
function showInstalledComponents($option)
{
    global $database, $mosConfig_absolute_path;
    $query = "SELECT *" . "\n FROM #__components" . "\n WHERE parent = 0" . "\n AND iscore = 0" . "\n ORDER BY name";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    // Read the component dir to find components
    $componentBaseDir = mosPathName($mosConfig_absolute_path . '/administrator/components');
    $componentDirs = mosReadDirectory($componentBaseDir);
    $n = count($rows);
    for ($i = 0; $i < $n; $i++) {
        $row =& $rows[$i];
        $dirName = $componentBaseDir . $row->option;
        $xmlFilesInDir = mosReadDirectory($dirName, '.xml$');
        foreach ($xmlFilesInDir as $xmlfile) {
            // Read the file to see if it's a valid component XML file
            $xmlDoc = new DOMIT_Lite_Document();
            $xmlDoc->resolveErrors(true);
            if (!$xmlDoc->loadXML($dirName . '/' . $xmlfile, false, true)) {
                continue;
            }
            $root =& $xmlDoc->documentElement;
            if ($root->getTagName() != 'mosinstall') {
                continue;
            }
            if ($root->getAttribute("type") != "component") {
                continue;
            }
            $element =& $root->getElementsByPath('creationDate', 1);
            $row->creationdate = $element ? $element->getText() : 'Unknown';
            $element =& $root->getElementsByPath('author', 1);
            $row->author = $element ? $element->getText() : 'Unknown';
            $element =& $root->getElementsByPath('copyright', 1);
            $row->copyright = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorEmail', 1);
            $row->authorEmail = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorUrl', 1);
            $row->authorUrl = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('version', 1);
            $row->version = $element ? $element->getText() : '';
            $row->mosname = strtolower(str_replace(" ", "_", $row->name));
        }
    }
    HTML_component::showInstalledComponents($rows, $option);
}
예제 #5
0
function showInstalledMambots($_option)
{
    global $database, $mosConfig_absolute_path;
    $query = "SELECT id, name, folder, element, client_id" . "\n FROM #__mambots" . "\n WHERE iscore = 0" . "\n ORDER BY folder, name";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    // path to mambot directory
    $mambotBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "mambots");
    $id = 0;
    $n = count($rows);
    for ($i = 0; $i < $n; $i++) {
        $row =& $rows[$i];
        // xml file for module
        $xmlfile = $mambotBaseDir . "/" . $row->folder . '/' . $row->element . ".xml";
        if (file_exists($xmlfile)) {
            $xmlDoc = new DOMIT_Lite_Document();
            $xmlDoc->resolveErrors(true);
            if (!$xmlDoc->loadXML($xmlfile, false, true)) {
                continue;
            }
            $root =& $xmlDoc->documentElement;
            if ($root->getTagName() != 'mosinstall') {
                continue;
            }
            if ($root->getAttribute("type") != "mambot") {
                continue;
            }
            $element =& $root->getElementsByPath('creationDate', 1);
            $row->creationdate = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('author', 1);
            $row->author = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('copyright', 1);
            $row->copyright = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorEmail', 1);
            $row->authorEmail = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorUrl', 1);
            $row->authorUrl = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('version', 1);
            $row->version = $element ? $element->getText() : '';
        }
    }
    HTML_mambot::showInstalledMambots($rows, $_option, $id, $xmlfile);
}
예제 #6
0
 /**
  * Returns component's version info from .xml file
  *
  * @return object Object with two fields: releaseVersion and releaseDate 
  */
 function getVersionInfo()
 {
     static $versionInfo;
     global $mainframe;
     if (!isset($versionInfo)) {
         $versionInfo = new StdClass();
         $versionInfo->releaseVersion = 'x.x.x.x';
         $versionInfo->releaseDate = date('Y');
         $file = JCOMMENTS_ADMIN . DS . 'jcomments.xml';
         if (!is_file($file)) {
             $file = JCOMMENTS_ADMIN . DS . 'jcomments10.xml';
             if (!is_file($file)) {
                 $file = JCOMMENTS_ADMIN . DS . 'jcomments15.xml';
                 if (!is_file($file)) {
                     $file = JCOMMENTS_ADMIN . DS . 'manifest.xml';
                 }
             }
         }
         if (JCOMMENTS_JVERSION == '1.0') {
             require_once $mainframe->getCfg('absolute_path') . DS . 'includes' . DS . 'domit' . DS . 'xml_domit_lite_include.php';
             $xmlDoc = new DOMIT_Lite_Document();
             $xmlDoc->resolveErrors(false);
             if (is_file($file)) {
                 if ($xmlDoc->loadXML($file, false, true)) {
                     $root =& $xmlDoc->documentElement;
                     if (($root->getTagName() == 'mosinstall' || $root->getTagName() == 'install') && $root->getAttribute("type") == "component") {
                         $element =& $root->getElementsByPath('creationDate', 1);
                         $versionInfo->releaseDate = $element ? $element->getText() : date('Y');
                         $element =& $root->getElementsByPath('version', 1);
                         $versionInfo->releaseVersion = $element ? $element->getText() : '';
                     }
                 }
             }
         } else {
             if (JCOMMENTS_JVERSION == '1.5') {
                 $data = JApplicationHelper::parseXMLInstallFile($file);
                 $versionInfo->releaseDate = $data['creationdate'];
                 $versionInfo->releaseVersion = $data['version'];
             }
         }
     }
     return $versionInfo;
 }
예제 #7
0
 /**
  * @param string The name of the control, or the default text area if a setup file is not found
  * @return string HTML
  */
 function render($name = 'params')
 {
     if ($this->_path) {
         if (!is_object($this->_xmlElem)) {
             require_once JPATH_ROOT . DS . 'includes' . DS . 'domit' . DS . 'xml_domit_lite_include.php';
             $xmlDoc = new DOMIT_Lite_Document();
             $xmlDoc->resolveErrors(true);
             if ($xmlDoc->loadXML($this->_path, false, true)) {
                 $root =& $xmlDoc->documentElement;
                 $tagName = $root->getTagName();
                 $isParamsFile = $tagName == 'install' || $tagName == 'params' || $tagName == 'form';
                 if ($isParamsFile && $root->getAttribute('type') == $this->_type) {
                     if ($params =& $root->getElementsByPath('params', 1)) {
                         $this->_xmlElem =& $params;
                     }
                 }
             }
         }
     }
     if (is_object($this->_xmlElem)) {
         $html = array();
         $html[] = '<table width="100%" class="paramlist">';
         $element =& $this->_xmlElem;
         if ($description = $element->getAttribute('description')) {
             // add the params description to the display
             $html[] = '<tr><td colspan="2">' . $description . '</td></tr>';
         }
         $this->_methods = get_class_methods(get_class($this));
         foreach ($element->childNodes as $param) {
             $result = $this->renderParam($param, $name);
             $html[] = '<tr>';
             $html[] = '<td width="40%" align="right" valign="top"><span class="editlinktip">' . $result[0] . '</span></td>';
             $html[] = '<td>' . $result[1] . '</td>';
             $html[] = '</tr>';
         }
         $html[] = '</table>';
         if (count($element->childNodes) < 1) {
             $html[] = "<tr><td colspan=\"2\"><i>" . _NO_PARAMS . "</i></td></tr>";
         }
         return implode("\n", $html);
     } else {
         return "<textarea name=\"{$name}\" cols=\"40\" rows=\"10\" class=\"text_area\">{$this->_raw}</textarea>";
     }
 }
예제 #8
0
/**
* Compiles a list of installed, version 4.5+ templates
*
* Based on xml files found.  If no xml file found the template
* is ignored
*/
function viewTemplates($option, $client)
{
    global $database, $mainframe;
    global $mosConfig_absolute_path, $mosConfig_list_limit;
    $limit = $mainframe->getUserStateFromRequest('viewlistlimit', 'limit', $mosConfig_list_limit);
    $limitstart = $mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0);
    if ($client == 'admin') {
        $templateBaseDir = mosPathName($mosConfig_absolute_path . '/administrator/templates');
    } else {
        $templateBaseDir = mosPathName($mosConfig_absolute_path . '/templates');
    }
    $rows = array();
    // Read the template dir to find templates
    $templateDirs = mosReadDirectory($templateBaseDir);
    $id = intval($client == 'admin');
    if ($client == 'admin') {
        $query = "SELECT template" . "\n FROM #__templates_menu" . "\n WHERE client_id = 1" . "\n AND menuid = 0";
        $database->setQuery($query);
    } else {
        $query = "SELECT template" . "\n FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND menuid = 0";
        $database->setQuery($query);
    }
    $cur_template = $database->loadResult();
    $rowid = 0;
    // Check that the directory contains an xml file
    foreach ($templateDirs as $templateDir) {
        $dirName = mosPathName($templateBaseDir . $templateDir);
        $xmlFilesInDir = mosReadDirectory($dirName, '.xml$');
        foreach ($xmlFilesInDir as $xmlfile) {
            // Read the file to see if it's a valid template XML file
            $xmlDoc = new DOMIT_Lite_Document();
            $xmlDoc->resolveErrors(true);
            if (!$xmlDoc->loadXML($dirName . $xmlfile, false, true)) {
                continue;
            }
            $root =& $xmlDoc->documentElement;
            if ($root->getTagName() != 'mosinstall') {
                continue;
            }
            if ($root->getAttribute('type') != 'template') {
                continue;
            }
            $row = new StdClass();
            $row->id = $rowid;
            $row->directory = $templateDir;
            $element =& $root->getElementsByPath('name', 1);
            $row->name = $element->getText();
            $element =& $root->getElementsByPath('creationDate', 1);
            $row->creationdate = $element ? $element->getText() : 'Nenhum';
            $element =& $root->getElementsByPath('author', 1);
            $row->author = $element ? $element->getText() : 'Unknown';
            $element =& $root->getElementsByPath('copyright', 1);
            $row->copyright = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorEmail', 1);
            $row->authorEmail = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorUrl', 1);
            $row->authorUrl = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('version', 1);
            $row->version = $element ? $element->getText() : '';
            // Get info from db
            if ($cur_template == $templateDir) {
                $row->published = 1;
            } else {
                $row->published = 0;
            }
            $row->checked_out = 0;
            $row->mosname = strtolower(str_replace(' ', '_', $row->name));
            // check if template is assigned
            $query = "SELECT COUNT(*)" . "\n FROM #__templates_menu" . "\n WHERE client_id = 0" . "\n AND template = " . $database->Quote($row->directory) . "\n AND menuid != 0";
            $database->setQuery($query);
            $row->assigned = $database->loadResult() ? 1 : 0;
            $rows[] = $row;
            $rowid++;
        }
    }
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav(count($rows), $limitstart, $limit);
    $rows = array_slice($rows, $pageNav->limitstart, $pageNav->limit);
    HTML_templates::showTemplates($rows, $pageNav, $option, $client);
}
예제 #9
0
function ReadMenuXML($type, $component = -1)
{
    global $mosConfig_absolute_path;
    // XML library
    require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
    // xml file for module
    $xmlfile = $mosConfig_absolute_path . '/administrator/components/com_menus/' . $type . '/' . $type . '.xml';
    $xmlDoc = new DOMIT_Lite_Document();
    $xmlDoc->resolveErrors(true);
    if ($xmlDoc->loadXML($xmlfile, false, true)) {
        $root =& $xmlDoc->documentElement;
        if ($root->getTagName() == 'mosinstall' && ($root->getAttribute('type') == 'component' || $root->getAttribute('type') == 'menu')) {
            // Menu Type Name
            $element =& $root->getElementsByPath('name', 1);
            $name = $element ? trim($element->getText()) : '';
            // Menu Type Description
            $element =& $root->getElementsByPath('description', 1);
            $descrip = $element ? trim($element->getText()) : '';
            // Menu Type Group
            $element =& $root->getElementsByPath('group', 1);
            $group = $element ? trim($element->getText()) : '';
        }
    }
    if ($component != -1 && $name == 'Component') {
        $name .= ' - ' . $component;
    }
    $row[0] = $name;
    $row[1] = $descrip;
    $row[2] = $group;
    return $row;
}
예제 #10
0
/**
* Compiles information to add or edit a module
* @param string The current GET/POST option
* @param integer The unique id of the record to edit
*/
function editMambot($option, $uid, $client)
{
    global $database, $my, $mainframe;
    global $mosConfig_absolute_path;
    $lists = array();
    $row = new mosMambot($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->isCheckedOut($my->id)) {
        mosErrorAlert("O módulo " . $row->title . " está, atualmente, a ser editado por outro administrador");
    }
    if ($client == 'admin') {
        $where = "client_id='1'";
    } else {
        $where = "client_id='0'";
    }
    // get list of groups
    if ($row->access == 99 || $row->client_id == 1) {
        $lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
    } else {
        // build the html select list for the group access
        $lists['access'] = mosAdminMenus::Access($row);
    }
    if ($uid) {
        $row->checkout($my->id);
        if ($row->ordering > -10000 && $row->ordering < 10000) {
            // build the html select list for ordering
            $query = "SELECT ordering AS value, name AS text" . "\n FROM #__mambots" . "\n WHERE folder = " . $database->Quote($row->folder) . "\n AND published > 0" . "\n AND {$where}" . "\n AND ordering > -10000" . "\n AND ordering < 10000" . "\n ORDER BY ordering";
            $order = mosGetOrderingList($query);
            $lists['ordering'] = mosHTML::selectList($order, 'ordering', 'class="inputbox" size="1"', 'value', 'text', intval($row->ordering));
        } else {
            $lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />Este plugin não pode ser reordenado';
        }
        $lists['folder'] = '<input type="hidden" name="folder" value="' . $row->folder . '" />' . $row->folder;
        // XML library
        require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
        // xml file for module
        $xmlfile = $mosConfig_absolute_path . '/mambots/' . $row->folder . '/' . $row->element . '.xml';
        $xmlDoc = new DOMIT_Lite_Document();
        $xmlDoc->resolveErrors(true);
        if ($xmlDoc->loadXML($xmlfile, false, true)) {
            $root =& $xmlDoc->documentElement;
            if ($root->getTagName() == 'mosinstall' && $root->getAttribute('type') == 'mambot') {
                $element =& $root->getElementsByPath('description', 1);
                $row->description = $element ? trim($element->getText()) : '';
            }
        }
    } else {
        $row->folder = '';
        $row->ordering = 999;
        $row->published = 1;
        $row->description = '';
        $folders = mosReadDirectory($mosConfig_absolute_path . '/mambots/');
        $folders2 = array();
        foreach ($folders as $folder) {
            if (is_dir($mosConfig_absolute_path . '/mambots/' . $folder) && $folder != 'CVS') {
                $folders2[] = mosHTML::makeOption($folder);
            }
        }
        $lists['folder'] = mosHTML::selectList($folders2, 'folder', 'class="inputbox" size="1"', 'value', 'text', null);
        $lists['ordering'] = '<input type="hidden" name="ordering" value="' . $row->ordering . '" />Os novos itens, por padrão, serão adicionados ao final da lista. A ordem pode ser alterada após este item serem salvos.';
    }
    $lists['published'] = mosHTML::yesnoRadioList('published', 'class="inputbox"', $row->published);
    $path = $mosConfig_absolute_path . "/mambots/{$row->folder}/{$row->element}.xml";
    if (!file_exists($path)) {
        $path = '';
    }
    // get params definitions
    $params = new mosParameters($row->params, $path, 'mambot');
    HTML_modules::editMambot($row, $lists, $params, $option);
}
예제 #11
0
 /**
  * Initializes the global currency converter array
  *
  * @return mixed
  */
 function init()
 {
     global $mosConfig_cachepath, $mosConfig_absolute_path, $vendor_currency, $vmLogger;
     if (!is_array($GLOBALS['converter_array']) && $GLOBALS['converter_array'] !== -1) {
         setlocale(LC_TIME, "en-GB");
         $now = time() + 3600;
         // Time in ECB (Germany) is GMT + 1 hour (3600 seconds)
         if (date("I")) {
             $now += 3600;
             // Adjust for daylight saving time
         }
         $weekday_now_local = gmdate('w', $now);
         // week day, important: week starts with sunday (= 0) !!
         $date_now_local = gmdate('Ymd', $now);
         $time_now_local = gmdate('Hi', $now);
         $time_ecb_update = '1415';
         if (is_writable($mosConfig_cachepath)) {
             $store_path = $mosConfig_cachepath;
         } else {
             $store_path = $mosConfig_absolute_path . "/media";
         }
         $archivefile_name = $store_path . '/daily.xml';
         $ecb_filename = $this->document_address;
         $val = '';
         if (file_exists($archivefile_name) && filesize($archivefile_name) > 0) {
             // timestamp for the Filename
             $file_datestamp = date('Ymd', filemtime($archivefile_name));
             // check if today is a weekday - no updates on weekends
             if (date('w') > 0 && date('w') < 6 && $file_datestamp != $date_now_local && $time_now_local > $time_ecb_update) {
                 $curr_filename = $ecb_filename;
             } else {
                 $curr_filename = $archivefile_name;
                 $this->last_updated = $file_datestamp;
                 $this->archive = false;
             }
         } else {
             $curr_filename = $ecb_filename;
         }
         if (!is_writable($store_path)) {
             $this->archive = false;
             $vmLogger->debug("The file {$archivefile_name} can't be created. The directory {$store_path} is not writable");
         }
         if ($curr_filename == $ecb_filename) {
             // Fetch the file from the internet
             require_once CLASSPATH . 'connectionTools.class.php';
             $contents = vmConnector::handleCommunication($curr_filename);
             $this->last_updated = date('Ymd');
         } else {
             $contents = @file_get_contents($curr_filename);
         }
         if ($contents) {
             // if archivefile does not exist
             if ($this->archive) {
                 // now write new file
                 file_put_contents($archivefile_name, $contents);
             }
             $contents = str_replace("<Cube currency='USD'", " <Cube currency='EUR' rate='1'/> <Cube currency='USD'", $contents);
             /* XML Parsing */
             require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
             $xmlDoc = new DOMIT_Lite_Document();
             if (!$xmlDoc->parseXML($contents, false, true)) {
                 $vmLogger->err('Failed to parse the Currency Converter XML document.');
                 $_SESSION['product_currency'] = $GLOBALS['product_currency'] = $vendor_currency;
                 return false;
             }
             $currency_list = $xmlDoc->getElementsByTagName("Cube");
             // Loop through the Currency List
             for ($i = 0; $i < $currency_list->getLength(); $i++) {
                 $currNode =& $currency_list->item($i);
                 $currency[$currNode->getAttribute("currency")] = $currNode->getAttribute("rate");
                 unset($currNode);
             }
             $GLOBALS['converter_array'] = $currency;
         } else {
             $GLOBALS['converter_array'] = -1;
             $vmLogger->err('Failed to retrieve the Currency Converter XML document.');
             $_SESSION['product_currency'] = $GLOBALS['product_currency'] = $vendor_currency;
             return false;
         }
     }
     return true;
 }
예제 #12
0
function parseXMLFile($id, $xmlfile)
{
    global $_DOCMAN;
    // XML library
    require_once JPATH_LIBRARIES . DS . 'domit' . DS . 'xml_domit_lite_include.php';
    // Read the file to see if it's a valid template XML file
    $xmlDoc = new DOMIT_Lite_Document();
    $xmlDoc->resolveErrors(true);
    if (!$xmlDoc->loadXML($xmlfile, false, true)) {
        return false;
    }
    $element =& $xmlDoc->documentElement;
    if ($element->getTagName() != ('install' || 'mosinstall')) {
        return false;
    }
    if ($element->getAttribute('type') != 'theme') {
        return false;
    }
    $row = new StdClass();
    $row->id = $id;
    $element =& $xmlDoc->getElementsByPath('name', 1);
    $row->name = $element->getText();
    $element =& $xmlDoc->getElementsByPath('creationDate', 1);
    $row->creationdate = $element ? $element->getText() : 'Unknown';
    $element =& $xmlDoc->getElementsByPath('author', 1);
    $row->author = $element ? $element->getText() : 'Unknown';
    $element =& $xmlDoc->getElementsByPath('copyright', 1);
    $row->copyright = $element ? $element->getText() : '';
    $element =& $xmlDoc->getElementsByPath('authorEmail', 1);
    $row->authorEmail = $element ? $element->getText() : '';
    $element =& $xmlDoc->getElementsByPath('authorUrl', 1);
    $row->authorUrl = $element ? $element->getText() : '';
    $element =& $xmlDoc->getElementsByPath('version', 1);
    $row->version = $element ? $element->getText() : '';
    $element =& $xmlDoc->getElementsByPath('description', 1);
    $row->description = $element ? trim($element->getText()) : '';
    $row->mosname = strtolower(str_replace(' ', '_', $row->name));
    // Get info from db
    if ($row->mosname == $_DOCMAN->getCfg('icon_theme')) {
        $row->published = 1;
    } else {
        $row->published = 0;
    }
    $row->checked_out = 0;
    return $row;
}
예제 #13
0
function uploadft($option)
{
    global $mtconf, $mainframe;
    $database =& JFactory::getDBO();
    require_once $mtconf->getjconf('absolute_path') . '/includes/domit/xml_domit_lite_include.php';
    $files = JRequest::get('files');
    $filename = $files['userfile']['tmp_name'];
    if (!empty($filename)) {
        $xmlDoc = new DOMIT_Lite_Document();
        $xmlDoc->resolveErrors(true);
        if (!$xmlDoc->loadXML($filename, true, false)) {
            return null;
        }
        $root =& $xmlDoc->documentElement;
        if ($root->getTagName() != 'fieldtype') {
            return null;
        }
        $useelements = $root->getAttribute('useelements');
        $usesize = $root->getAttribute('usesize');
        $taggable = $root->getAttribute('taggable');
        // $usecolumns = $root->getAttribute( 'usecolumns' );
        $version = $root->getElementsByPath('version', 1);
        $website = $root->getElementsByPath('website', 1);
        $desc = $root->getElementsByPath('description', 1);
        $field_type = $root->getElementsByPath('name', 1);
        $caption = $root->getElementsByPath('caption', 1);
        $class = $root->getElementsByPath('class', 1);
        $version = $version->getText();
        $website = $website->getText();
        $desc = $desc->getText();
        $field_type = $field_type->getText();
        $caption = $caption->getText();
        $class = $class->getText();
        if (empty($useelements)) {
            $useelements = 0;
        }
        if (empty($usesize)) {
            $usesize = 0;
        }
        if (empty($version)) {
            $version = '1.00';
        }
        if (empty($field_type) || empty($caption) || empty($class)) {
            return null;
        }
        $database->setQuery('SELECT ft_id FROM #__mt_fieldtypes WHERE field_type = ' . $database->quote($field_type) . ' LIMIT 1');
        $duplicate_ft_id = $database->loadResult();
        if ($duplicate_ft_id > 0) {
            $ft_id = saveft2($field_type, $caption, $class, $useelements, $usesize, $taggable, $version, $website, $desc, $duplicate_ft_id);
            $database->setQuery("DELETE FROM #__mt_fieldtypes_att WHERE ft_id = " . $ft_id);
            $database->query();
        } else {
            $ft_id = saveft2($field_type, $caption, $class, $useelements, $usesize, $taggable, $version, $website, $desc);
        }
        $attachments =& $root->getElementsByPath('attachments', 1);
        if (!is_null($attachments)) {
            $attachmentsChildNodes = $attachments->childNodes;
            $attachment = new mtFieldTypesAtt($database);
            foreach ($attachmentsChildNodes as $attachmentsChildNode) {
                $filename = $attachmentsChildNode->getElementsByPath('filename', 1);
                $filesize = $attachmentsChildNode->getElementsByPath('filesize', 1);
                $extension = $attachmentsChildNode->getElementsByPath('extension', 1);
                $ordering = $attachmentsChildNode->getElementsByPath('ordering', 1);
                $filedata = $attachmentsChildNode->getElementsByPath('filedata', 1);
                $filename = $filename->getText();
                $filesize = $filesize->getText();
                $extension = $extension->getText();
                $ordering = $ordering->getText();
                $filedata = $filedata->getText();
                $database->setQuery('INSERT INTO #__mt_fieldtypes_att (ft_id, filename, filedata, filesize, extension, ordering) ' . ' VALUES(' . $database->quote($ft_id) . ', ' . $database->quote($filename) . ', ' . $database->quote(base64_decode($filedata)) . ', ' . $database->quote($filesize) . ', ' . $database->quote($extension) . ', ' . '\'9999\')');
                $database->query();
                $attachment->reorder('ft_id=' . $ft_id);
            }
        }
        if (is_null($duplicate_ft_id)) {
            # Create an unpublished custom field for the new field type
            $database->setQuery('INSERT INTO #__mt_customfields (field_type, caption, published, ordering, advanced_search, simple_search, iscore)' . "\n VALUES(" . $database->quote($field_type) . ", " . $database->quote($caption) . ", '0', '99', '0', '0', '0')");
            $database->query();
            $row = new mtCustomFields($database);
            $row->reorder('published >= 0');
            $mainframe->redirect('index2.php?option=com_mtree&task=managefieldtypes', JText::_('Field type installation success'));
        } else {
            $mainframe->redirect('index2.php?option=com_mtree&task=managefieldtypes', JText::_('Field type upgraded successfully'));
        }
    }
}
예제 #14
0
function install_template($option)
{
    global $mtconf, $mainframe;
    $database =& JFactory::getDBO();
    $files = JRequest::get('files');
    $template = $files['template']['tmp_name'];
    require_once $mtconf->getjconf('absolute_path') . '/includes/domit/xml_domit_lite_include.php';
    require_once $mtconf->getjconf('absolute_path') . '/administrator/includes/pcl/pclzip.lib.php';
    require_once $mtconf->getjconf('absolute_path') . '/administrator/includes/pcl/pclerror.lib.php';
    $zipfile = new PclZip($template);
    if (substr(PHP_OS, 0, 3) == 'WIN') {
        define('OS_WINDOWS', 1);
    } else {
        define('OS_WINDOWS', 0);
    }
    $tmp_install = JPath::clean($mtconf->getjconf('absolute_path') . '/media/' . uniqid('minstall_'));
    if (!$zipfile->extract(PCLZIP_OPT_PATH, $tmp_install)) {
        $mainframe->redirect('index2.php?option=com_mtree&task=templates', JText::_('Template installation failed'));
    }
    $tmp_xml = $tmp_install . '/templateDetails.xml';
    if (file_exists($tmp_xml)) {
        $xmlDoc = new DOMIT_Lite_Document();
        $xmlDoc->resolveErrors(true);
        if (!$xmlDoc->loadXML($tmp_xml, true, false)) {
            return false;
        }
        $root =& $xmlDoc->documentElement;
        $template_name = $root->getElementsByPath('name', 1);
        $template_name = $template_name->getText();
        $database->setQuery('INSERT INTO #__mt_templates (tem_name) VALUES(' . $database->quote($template_name) . ')');
        $database->query();
    } else {
        rmdirr($tmp_install);
        $mainframe->redirect('index2.php?option=com_mtree&task=templates', JText::_('Template installation failed'));
    }
    if ($handle = opendir($tmp_install)) {
        $tmp_installdir = JPath::clean($mtconf->getjconf('absolute_path') . '/components/com_mtree/templates/' . $template_name);
        if (file_exists($tmp_installdir)) {
            rmdirr($tmp_install);
            $mainframe->redirect('index2.php?option=com_mtree&task=templates', JText::_('Template installation failed'));
        }
        mkdir($tmp_installdir, 0755);
        while (false !== ($file = readdir($handle))) {
            if ($file != '.' && $file != '..') {
                copy($tmp_install . '/' . $file, $tmp_installdir . '/' . $file);
            }
        }
        closedir($handle);
        rmdirr($tmp_install);
    }
    $mainframe->redirect('index2.php?option=com_mtree&task=templates', JText::_('Template installation success'));
}
예제 #15
0
파일: dhl.php 프로젝트: noikiy/owaspbwa
 function get_signature($order_id, $delivery_date)
 {
     global $vmLogger;
     global $VM_LANG, $mosConfig_absolute_path;
     /* Retrieve waybill information from database */
     $dbl = new ps_DB();
     $q = "SELECT tracking_number, label_is_generated, is_international, ";
     $q .= "have_signature ";
     $q .= "FROM #__{vm}_shipping_label ";
     $q .= "WHERE order_id = '" . $order_id . "'";
     $dbl->query($q);
     if (!$dbl->next_record() || !$dbl->f("label_is_generated")) {
         return "couldn't find label info for order #" . $order_id;
     }
     if ($dbl->f('have_signature')) {
         return true;
     }
     $tracking_number = $dbl->f('tracking_number');
     require_once CLASSPATH . "shipping/" . __CLASS__ . ".cfg.php";
     $dhl_url = "https://eCommerce.airborne.com/";
     if (DHL_TEST_MODE == 'TRUE') {
         $dhl_url .= "ApiLandingTest.asp";
     } else {
         $dhl_url .= "ApiLanding.asp";
     }
     require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
     $xmlReq = new DOMIT_Lite_Document();
     $xmlReq->setXMLDeclaration('<?xml version="1.0"?>');
     $root =& $xmlReq->createElement('eCommerce');
     $root->setAttribute('action', 'Request');
     $root->setAttribute('version', '1.1');
     $xmlReq->setDocumentElement($root);
     $requestor =& $xmlReq->createElement('Requestor');
     $id =& $xmlReq->createElement('ID');
     $id->setText(DHL_ID);
     $requestor->appendChild($id);
     $password =& $xmlReq->createElement('Password');
     $password->setText(DHL_PASSWORD);
     $requestor->appendChild($password);
     $root->appendChild($requestor);
     /* Signature Request */
     $signature =& $xmlReq->createElement('Signature');
     $signature->setAttribute('action', 'Get');
     $signature->setAttribute('version', '1.0');
     $shipment =& $xmlReq->createElement('Shipment');
     $nbr =& $xmlReq->createElement('TrackingNbr');
     $nbr->setText($tracking_number);
     $shipment->appendChild($nbr);
     $delivery =& $xmlReq->createElement('Delivery');
     $date =& $xmlReq->createElement('Date');
     $start =& $xmlReq->createElement('Start');
     $start->setText($delivery_date);
     $date->appendChild($start);
     $end =& $xmlReq->createElement('End');
     $end->setText($delivery_date);
     $date->appendChild($end);
     $delivery->appendChild($date);
     $shipment->appendChild($delivery);
     $signature->appendChild($shipment);
     $root->appendChild($signature);
     //		$vmLogger->err($xmlReq->toNormalizedString());
     if (function_exists("curl_init")) {
         $CR = curl_init();
         curl_setopt($CR, CURLOPT_URL, $dhl_url);
         curl_setopt($CR, CURLOPT_POST, 1);
         curl_setopt($CR, CURLOPT_FAILONERROR, true);
         curl_setopt($CR, CURLOPT_POSTFIELDS, $xmlReq->toString());
         curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1);
         $xmlResult = curl_exec($CR);
         $error = curl_error($CR);
         curl_close($CR);
         if (!empty($error)) {
             return false;
         }
     }
     // XML Parsing
     $xmlResp = new DOMIT_Lite_Document();
     if (!$xmlResp->parseXML($xmlResult, false, true)) {
         return false;
     }
     //		$vmLogger->err($xmlResp->toNormalizedString());
     // Check for success or failure.
     $result_code_list =& $xmlResp->getElementsByPath('//Result/Code');
     $result_code =& $result_code_list->item(0);
     $result_desc_list =& $xmlResp->getElementsByPath('//Result/Desc');
     $result_desc =& $result_desc_list->item(0);
     if ($result_code == NULL) {
         $vmLogger->debug($VM_LANG->_('PHPSHOP_SHIPPING_METHOD_DHL_MISSING_RESULT') . "\n" . $xmlResp->toNormalizedString());
         return false;
     }
     /* 0 is the code for success with viewing a signature. */
     if ($result_code->getText() != 0) {
         $err_msg = '<br /><span class="message">' . $result_desc->getText() . ' [code ' . $result_code->getText() . ']' . '</span>';
         // display an error line for each fault
         $fault_node_list =& $xmlResp->getElementsByPath('//Faults/Fault');
         if ($fault_node_list->getLength() > 0) {
             $err_msg .= '<ul>';
         }
         for ($i = 0; $i < $fault_node_list->getLength(); $i++) {
             $fault_node =& $fault_node_list->item($i);
             $fault_code_node_list =& $fault_node->getElementsByTagName('Code');
             $fault_desc_node_list =& $fault_node->getElementsByTagName('Desc');
             $fault_code_node =& $fault_code_node_list->item(0);
             $fault_desc_node =& $fault_desc_node_list->item(0);
             $err_msg .= '<li>' . $fault_desc_node->getText() . ' [code ' . $fault_code_node->getText() . ']</li>';
         }
         if ($fault_node_list->getLength() > 0) {
             $err_msg .= '</ul>';
         }
         //			echo $err_msg;
         return false;
     }
     $signature_image_node_list =& $xmlResp->getElementsByPath('//Signature/Image');
     $signature_image_node =& $signature_image_node_list->item(0);
     if ($signature_image_node == NULL) {
         return false;
     }
     $signature_image = $signature_image_node->getText();
     /*
      * insert signature image into database and mark that the signature
      * has been retrieved.
      */
     $q = "UPDATE #__{vm}_shipping_label ";
     $q .= "SET ";
     $q .= "have_signature='1', ";
     $q .= "signature_image='" . $signature_image . "' ";
     $q .= "WHERE order_id = '" . $order_id . "'";
     $dbnl = new ps_DB();
     $dbnl->query($q);
     $dbnl->next_record();
     return true;
 }
예제 #16
0
 function getExt()
 {
     return "";
     $dir = JPATH_ROOT . DS . 'components' . DS . 'com_onepage' . DS . 'ext';
     $arr = scandir($dir);
     $ret = array();
     if (!empty($arr)) {
         foreach ($arr as $file) {
             if (is_dir($dir . DS . $file) && $file != '.' && $file != '..') {
                 $arr = array();
                 $arr['path'] = $dir . DS . $file;
                 $arr['enabled'] = file_exists($dir . DS . $file . DS . 'enabled.html');
                 $arr['name'] = $file;
                 // params part here?
                 if (file_exists($dir . DS . $file . DS . 'description.txt')) {
                     $desc = file_get_contents($dir . DS . $file . DS . 'description.txt');
                 } else {
                     $desc = '';
                 }
                 $arr['desc'] = $desc;
                 if (file_exists($dir . DS . $file . DS . 'extension.xml')) {
                     $xmlDoc = new DOMIT_Lite_Document();
                     $xmlDoc->resolveErrors(true);
                     if ($xmlDoc->loadXML($dir . DS . $file . DS . 'extension.xml', false, true)) {
                         $root =& $xmlDoc->documentElement;
                         $tagName = $root->getTagName();
                         $isParamsFile = $tagName == 'mosinstall' || $tagName == 'mosparams';
                         if ($isParamsFile && $root->getAttribute('type') == 'opext') {
                             if ($params =& $root->getElementsByPath('params', 1)) {
                                 $element =& $params;
                             }
                         }
                         $arr['params'] = $params;
                         $desce =& $root->getElementsByPath('description', 1);
                         $desc = $desce->getText();
                         if ($desc) {
                             $arr['desc'] = (string) $desc;
                         }
                         $namee =& $root->getElementsByPath('name', 1);
                         $name = $namee->getText();
                         if ($name) {
                             $arr['nametxt'] = (string) $name;
                         }
                     } else {
                         $app = JFactory::getApplication();
                         $app->enqueueMessage('OPC Extensions XML Error: ' . $xmlDoc->errorString);
                     }
                 }
                 if (empty($arr['nametxt'])) {
                     $arr['nametxt'] = $file;
                 }
                 $ret[] = $arr;
             }
         }
     }
     return $ret;
 }
예제 #17
0
function getXML($xmlfile, $element_name) {
	jimport( 'joomla.factory' );
	jimport('domit.xml_domit_lite_include');
	$xmlDoc = new DOMIT_Lite_Document();
	$xmlDoc->resolveErrors(true);
	if (!@$xmlDoc->loadXML($xmlfile)) {
		return "Could not connect";
	}
	$element = & $xmlDoc->documentElement;
	$element = & $xmlDoc->getElementsByPath($element_name, 1);
	$result = $element ? $element->getText() : '';
	return $result;
} ?>
예제 #18
0
 /**
  * Retrieve joomla standard user parameters so that they can be displayed in user edit mode.
  * @param  int                 $ui        1 for front-end, 2 for back-end
  * @param  moscomprofilerUser  $user      the user being displayed
  * @param  string              $name      Name of variable
  * @return array of user parameter attributes (title,value)
  */
 function _getUserParams($ui, $user, $name = "params")
 {
     global $_CB_framework;
     $result = array();
     // in case not Joomla
     if (class_exists("JUser")) {
         // Joomla 1.5 and 1.6:
         if ($user->id) {
             $juser = JUser::getInstance($user->id);
         } else {
             $juser = JUser::getInstance();
         }
         if (checkJversion() == 2) {
             // Joomla 1.6:
             $result = array();
             jimport('joomla.form.form');
             JForm::addFormPath(JPATH_ADMINISTRATOR . '/components/com_users/models/forms');
             $form = JForm::getInstance('com_users.params', 'user', array('load_data' => true));
             $params = $juser->getParameters(true)->toArray();
             if ($params) {
                 foreach ($params as $k => $v) {
                     $form->setValue($k, 'params', $v);
                 }
             }
             $fields = $form->getFieldset('settings');
             if ($fields) {
                 foreach ($fields as $field) {
                     $admin_field = strpos($field->name, 'admin') || strpos($field->name, 'help');
                     if ($admin_field && ($juser->authorise('canManageUsers') || !$user->id) || !$admin_field) {
                         $result[] = array($field->label, $field->input, $field->description, $field->name);
                     }
                 }
             }
         } else {
             // Joomla 1.5:
             $params =& $juser->getParameters(true);
             // $result = $params->render( 'params' );
             if (is_callable(array($params, "getParams"))) {
                 $result = $params->getParams($name);
                 //BBB new API submited to Jinx 17.4.2006.
             } else {
                 foreach ($params->_xml->param as $param) {
                     //BBB still needs core help... accessing private variable _xml .
                     $result[] = $params->renderParam($param, $name);
                 }
             }
         }
     } else {
         if (file_exists($_CB_framework->getCfg('absolute_path') . '/administrator/components/com_users/users.class.php')) {
             require_once $_CB_framework->getCfg('absolute_path') . '/administrator/components/com_users/users.class.php';
         }
         if (class_exists('mosUserParameters')) {
             // Joomla 1.0 :
             global $mainframe;
             $file = $mainframe->getPath('com_xml', 'com_users');
             $userParams = new mosUserParameters($user->params, $file, 'component');
             if (isset($userParams->_path) && $userParams->_path) {
                 // Joomla 1.0
                 if (!is_object($userParams->_xmlElem)) {
                     require_once $_CB_framework->getCfg('absolute_path') . '/includes/domit/xml_domit_lite_include.php';
                     $xmlDoc = new DOMIT_Lite_Document();
                     $xmlDoc->resolveErrors(true);
                     if ($xmlDoc->loadXML($userParams->_path, false, true)) {
                         $root =& $xmlDoc->documentElement;
                         $tagName = $root->getTagName();
                         $isParamsFile = $tagName == 'mosinstall' || $tagName == 'mosparams';
                         if ($isParamsFile && $root->getAttribute('type') == $userParams->_type) {
                             $params =& $root->getElementsByPath('params', 1);
                             if ($params) {
                                 $userParams->_xmlElem =& $params;
                             }
                         }
                     }
                 }
             }
             $result = array();
             if (isset($userParams->_xmlElem) && is_object($userParams->_xmlElem)) {
                 // Joomla 1.0
                 $element =& $userParams->_xmlElem;
                 //$params = mosParseParams( $row->params );
                 $userParams->_methods = get_class_methods("mosUserParameters");
                 foreach ($element->childNodes as $param) {
                     $result[] = $userParams->renderParam($param, $name);
                 }
             }
         }
     }
     return $result;
 }
 /**
  * @param string The name of the default text area is a setup file is not found
  * @return string HTML
  */
 function render($name = 'params', $method = 'Standard')
 {
     if ($this->_path) {
         if (!is_object($this->_xmlElem)) {
             $xmlDoc = new DOMIT_Lite_Document();
             $xmlDoc->resolveErrors(true);
             if ($xmlDoc->loadXML($this->_path, false, true)) {
                 $element =& $xmlDoc->documentElement;
                 if (($element->getTagName() == 'form' or $element->getTagName() == 'install') && $element->getAttribute("type") == $this->_type) {
                     if ($element =& $xmlDoc->getElementsByPath('params', 1)) {
                         $this->_xmlElem =& $element;
                     }
                 }
             }
         }
     }
     if (is_object($this->_xmlElem)) {
         return call_user_func(array($this, '_render' . $method), $this->_xmlElem, $name);
     } else {
         return "<textarea name=\"" . $name . "\" cols=\"40\" rows=\"10\" class=\"text_area\">" . $this->_raw . "</textarea>";
     }
 }
예제 #20
0
 /**
  * calls the unfuddle api to get the latest svn revision and compares it to the rev
  * listed in this class
  */
 function checkRevision()
 {
     $this->_error = '';
     $this->_msg = '';
     if (!function_exists('curl_init')) {
         $this->_error = JText::_("SORRY YOU NEED CURL INSTALLED TO CHECK REVISION");
         return false;
     }
     $this->config = array('port' => 80, 'version' => 1, 'account' => 'account_identifier', 'response_type' => 'application/xml', 'username' => 'anonymous', 'password' => 'anonymous', 'project' => 17220, 'default_assignee' => 8527, 'default_milestone' => 0);
     $headers = array('Content-Type: application/xml', 'Accept: application/xml');
     $headers = $this->construct_headers('');
     $url = "http://fabrik.unfuddle.com/api/v1/projects/17220/changesets/latest";
     $this->connection = curl_init($url);
     $xml_string = '';
     $curl_options = array(CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => 1, CURLOPT_VERBOSE => 1, CURLOPT_HTTPHEADER => $headers, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_USERPWD => 'anonymous:anonymous');
     foreach ($curl_options as $key => $value) {
         curl_setopt($this->connection, $key, $value);
     }
     $xml = $this->handle_response(curl_exec($this->connection));
     require_once COM_FABRIK_BASE . DS . "includes" . DS . "domit" . DS . "xml_domit_lite_parser.php";
     $xmlDoc = new DOMIT_Lite_Document();
     $ok = $xmlDoc->parseXML($xml);
     if ($ok) {
         $this->_msg .= "<p style='color:green'>Version info obtained from SNV server</p>";
         $rev = $xmlDoc->getElementsByTagName('revision');
         $rev = $rev->item(0);
         $lastestRev = $rev->getText();
         if ($this->SVNREV != $lastestRev) {
             $this->_msg .= "An update is available from the SVN<br>";
             $msg = $xmlDoc->getElementsByTagName('message');
             $msg = $msg->item(0);
             $date = $xmlDoc->getElementsByTagName('created-at');
             $date = $date->item(0);
             $this->_msg .= "<br />message:" . $msg->getText() . "<br>date:" . $date->getText() . "<br><br>";
         } else {
             $this->_msg .= "<p>YOU ARE UP TO DATE!</p>";
         }
         $this->_msg .= "This release versions revision = '{$this->REV}' <br>\n\t\t  This installations current SVN revision = '{$this->SVNREV}' <br>\n\t\t    Latest available SVN rev = '{$lastestRev}'<br />";
     } else {
         $this->_error = JText::_("UNABLE TO PARSE RESPONSE");
     }
 }
예제 #21
0
/**
* @param string The URL option
*/
function showInstalledModules($_option)
{
    global $database, $mosConfig_absolute_path;
    $filter = mosGetParam($_POST, 'filter', '');
    $select[] = mosHTML::makeOption('', 'All');
    $select[] = mosHTML::makeOption('0', 'Site Modules');
    $select[] = mosHTML::makeOption('1', 'Admin Modules');
    $lists['filter'] = mosHTML::selectList($select, 'filter', 'class="inputbox" size="1" onchange="document.adminForm.submit();"', 'value', 'text', $filter);
    if ($filter == NULL) {
        $and = '';
    } else {
        if (!$filter) {
            $and = "\n AND client_id = 0";
        } else {
            if ($filter) {
                $and = "\n AND client_id = 1";
            }
        }
    }
    $query = "SELECT id, module, client_id" . "\n FROM #__modules" . "\n WHERE module LIKE 'mod_%' AND iscore='0'" . $and . "\n GROUP BY module, client_id" . "\n ORDER BY client_id, module";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    $n = count($rows);
    for ($i = 0; $i < $n; $i++) {
        $row =& $rows[$i];
        // path to module directory
        if ($row->client_id == "1") {
            $moduleBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "administrator/modules");
        } else {
            $moduleBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "modules");
        }
        // xml file for module
        $xmlfile = $moduleBaseDir . "/" . $row->module . ".xml";
        if (file_exists($xmlfile)) {
            $xmlDoc = new DOMIT_Lite_Document();
            $xmlDoc->resolveErrors(true);
            if (!$xmlDoc->loadXML($xmlfile, false, true)) {
                continue;
            }
            $root =& $xmlDoc->documentElement;
            if ($root->getTagName() != 'mosinstall') {
                continue;
            }
            if ($root->getAttribute("type") != "module") {
                continue;
            }
            $element =& $root->getElementsByPath('creationDate', 1);
            $row->creationdate = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('author', 1);
            $row->author = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('copyright', 1);
            $row->copyright = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorEmail', 1);
            $row->authorEmail = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorUrl', 1);
            $row->authorUrl = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('version', 1);
            $row->version = $element ? $element->getText() : '';
        }
    }
    HTML_module::showInstalledModules($rows, $_option, $xmlfile, $lists);
}
예제 #22
0
 /**
  * Custom install method
  * @param int The id of the module
  * @param string The URL option
  * @param int The client id
  */
 function uninstall($cid, $option, $client = 0)
 {
     global $database, $mosConfig_absolute_path;
     josSpoofCheck();
     $uninstallret = '';
     $sql = "SELECT *" . "\n FROM #__components" . "\n WHERE id = " . (int) $cid;
     $database->setQuery($sql);
     $row = null;
     if (!$database->loadObject($row)) {
         HTML_installer::showInstallMessage($database->stderr(true), 'Uninstall -  error', $this->returnTo($option, 'component', $client));
         exit;
     }
     if ($row->iscore) {
         HTML_installer::showInstallMessage("Component {$row->name} is a core component, and can not be uninstalled.<br />You need to unpublish it if you don't want to use it", 'Uninstall -  error', $this->returnTo($option, 'component', $client));
         exit;
     }
     // Delete entries in the DB
     $sql = "DELETE FROM #__components" . "\n WHERE parent = " . (int) $row->id;
     $database->setQuery($sql);
     if (!$database->query()) {
         HTML_installer::showInstallMessage($database->stderr(true), 'Uninstall -  error', $this->returnTo($option, 'component', $client));
         exit;
     }
     $sql = "DELETE FROM #__components" . "\n WHERE id = " . (int) $row->id;
     $database->setQuery($sql);
     if (!$database->query()) {
         HTML_installer::showInstallMessage($database->stderr(true), 'Uninstall -  error', $this->returnTo($option, 'component', $client));
         exit;
     }
     // Try to find the uninstall file
     $filesindir = mosReadDirectory($mosConfig_absolute_path . '/administrator/components/' . $row->option, 'uninstall');
     if (count($filesindir) > 0) {
         $uninstall_file = $filesindir[0];
         if (file_exists($mosConfig_absolute_path . '/administrator/components/' . $row->option . '/' . $uninstall_file)) {
             require_once $mosConfig_absolute_path . '/administrator/components/' . $row->option . '/' . $uninstall_file;
             $uninstallret = com_uninstall();
         }
     }
     // Try to find the XML file
     $filesindir = mosReadDirectory(mosPathName($mosConfig_absolute_path . '/administrator/components/' . $row->option), '.xml$');
     if (count($filesindir) > 0) {
         $ismosinstall = false;
         $found = 0;
         foreach ($filesindir as $file) {
             $xmlDoc = new DOMIT_Lite_Document();
             $xmlDoc->resolveErrors(true);
             if (!$xmlDoc->loadXML($mosConfig_absolute_path . "/administrator/components/" . $row->option . "/" . $file, false, true)) {
                 return false;
             }
             $root =& $xmlDoc->documentElement;
             if ($root->getTagName() != 'mosinstall') {
                 continue;
             }
             $found = 1;
             $query_element =& $root->getElementsbyPath('uninstall/queries', 1);
             if (!is_null($query_element)) {
                 $queries = $query_element->childNodes;
                 foreach ($queries as $query) {
                     $database->setQuery($query->getText());
                     if (!$database->query()) {
                         HTML_installer::showInstallMessage($database->stderr(true), 'Uninstall -  error', $this->returnTo($option, 'component', $client));
                         exit;
                     }
                 }
             }
         }
         if (!$found) {
             HTML_installer::showInstallMessage('XML File invalid', 'Uninstall -  error', $this->returnTo($option, 'component', $client));
             exit;
         }
     } else {
         /*
         HTML_installer::showInstallMessage( 'Não foi possível encontrar um arquivo XML de instalação em '.$mosConfig_absolute_path.'/administrator/components/'.$row->option,
         	'Uninstall -  error', $option, 'component' );
         exit();
         */
     }
     // Delete directories
     if (trim($row->option)) {
         $result = 0;
         $path = mosPathName($mosConfig_absolute_path . '/administrator/components/' . $row->option);
         if (is_dir($path)) {
             $result |= deldir($path);
         }
         $path = mosPathName($mosConfig_absolute_path . '/components/' . $row->option);
         if (is_dir($path)) {
             $result |= deldir($path);
         }
         return $result;
     } else {
         HTML_installer::showInstallMessage('Option field empty, cannot remove files', 'Uninstall -  error', $option, 'component');
         exit;
     }
     return $uninstallret;
 }
예제 #23
0
파일: usps.php 프로젝트: noikiy/owaspbwa
 function list_rates(&$d)
 {
     global $VM_LANG, $CURRENCY_DISPLAY, $mosConfig_absolute_path;
     $db = new ps_DB();
     $dbv = new ps_DB();
     $dbc = new ps_DB();
     /** Read current Configuration ***/
     require_once CLASSPATH . "shipping/" . __CLASS__ . ".cfg.php";
     $q = "SELECT * FROM `#__{vm}_user_info`, `#__{vm}_country` WHERE user_info_id='" . $db->getEscaped($d["ship_to_info_id"]) . "' AND ( country=country_2_code OR country=country_3_code)";
     $db->query($q);
     $db->next_record();
     $q = "SELECT * FROM #__{vm}_vendor WHERE vendor_id='" . $_SESSION['ps_vendor_id'] . "'";
     $dbv->query($q);
     $dbv->next_record();
     $order_weight = $d['weight'];
     if ($order_weight > 0) {
         //USPS Username
         $usps_username = USPS_USERNAME;
         //USPS Password
         $usps_password = USPS_PASSWORD;
         //USPS Server
         $usps_server = USPS_SERVER;
         //USPS Path
         $usps_path = USPS_PATH;
         //USPS package size
         $usps_packagesize = USPS_PACKAGESIZE;
         //USPS Package ID
         $usps_packageid = 0;
         //USPS International Per Pound Rate
         $usps_intllbrate = USPS_INTLLBRATE;
         //USPS International handling fee
         $usps_intlhandlingfee = USPS_INTLHANDLINGFEE;
         //Pad the shipping weight to allow weight for shipping materials
         $usps_padding = USPS_PADDING;
         $usps_padding = $usps_padding * 0.01;
         $order_weight = $order_weight * $usps_padding + $order_weight;
         //USPS Machinable for Parcel Post
         $usps_machinable = USPS_MACHINABLE;
         if ($usps_machinable == '1') {
             $usps_machinable = 'TRUE';
         } else {
             $usps_machinable = 'FALSE';
         }
         //USPS Shipping Options to display
         $usps_ship[0] = USPS_SHIP0;
         $usps_ship[1] = USPS_SHIP1;
         $usps_ship[2] = USPS_SHIP2;
         $usps_ship[3] = USPS_SHIP3;
         $usps_ship[4] = USPS_SHIP4;
         $usps_ship[5] = USPS_SHIP5;
         $usps_ship[6] = USPS_SHIP6;
         $usps_ship[7] = USPS_SHIP7;
         $usps_ship[8] = USPS_SHIP8;
         $usps_ship[9] = USPS_SHIP9;
         $usps_ship[10] = USPS_SHIP10;
         foreach ($usps_ship as $key => $value) {
             if ($value == '1') {
                 $usps_ship[$key] = 'TRUE';
             } else {
                 $usps_ship[$key] = 'FALSE';
             }
         }
         $usps_intl[0] = USPS_INTL0;
         $usps_intl[1] = USPS_INTL1;
         $usps_intl[2] = USPS_INTL2;
         $usps_intl[3] = USPS_INTL3;
         $usps_intl[4] = USPS_INTL4;
         $usps_intl[5] = USPS_INTL5;
         $usps_intl[6] = USPS_INTL6;
         $usps_intl[7] = USPS_INTL7;
         $usps_intl[8] = USPS_INTL8;
         // $usps_intl[9] = USPS_INTL9;
         foreach ($usps_intl as $key => $value) {
             if ($value == '1') {
                 $usps_intl[$key] = 'TRUE';
             } else {
                 $usps_intl[$key] = 'FALSE';
             }
         }
         //Title for your request
         $request_title = "Shipping Estimate";
         //The zip that you are shipping from
         $source_zip = substr($dbv->f("vendor_zip"), 0, 5);
         $shpService = 'All';
         //"Priority";
         //The zip that you are shipping to
         $dest_country = $db->f("country_2_code");
         if ($dest_country == "GB") {
             $q = "SELECT state_name FROM #__{vm}_state WHERE state_2_code='" . $db->f("state") . "'";
             $dbc->query($q);
             $dbc->next_record();
             $dest_country_name = $dbc->f("state_name");
         } else {
             $dest_country_name = $db->f("country_name");
         }
         $dest_state = $db->f("state");
         $dest_zip = substr($db->f("zip"), 0, 5);
         //$weight_measure
         if ($order_weight < 1) {
             $shipping_pounds_intl = 0;
         } else {
             $shipping_pounds_intl = ceil($order_weight);
         }
         if ($order_weight < 0.88) {
             $shipping_pounds = 0;
             $shipping_ounces = round(16 * ($order_weight - floor($order_weight)));
         } else {
             $shipping_pounds = ceil($order_weight);
             $shipping_ounces = 0;
         }
         $os = array("Mac", "NT", "Irix", "Linux");
         $states = array("AL", "AK", "AR", "AZ", "CA", "CO", "CT", "DC", "DE", "FL", "GA", "HI", "IA", "ID", "IL", "IN", "KS", "KY", "LA", "MA", "MD", "ME", "MI", "MN", "MO", "MS", "MT", "NC", "ND", "NE", "NH", "NJ", "NM", "NV", "NY", "OH", "OK", "OR", "PA", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VA", "WA", "WI", "WV", "WY");
         //If weight is over 70 pounds, round down to 70 for now.
         //Will update in the future to be able to split the package or something?
         if ($order_weight > 70.0) {
             echo "We are unable to ship USPS as the package weight exceeds the 70 pound limit,<br>please select another shipping method.";
         } else {
             if ($dest_country == "US" && in_array($dest_state, $states)) {
                 /******START OF DOMESTIC RATE******/
                 //the xml that will be posted to usps
                 $xmlPost = 'API=RateV2&XML=<RateV2Request USERID="' . $usps_username . '" PASSWORD="******">';
                 $xmlPost .= '<Package ID="' . $usps_packageid . '">';
                 $xmlPost .= "<Service>" . $shpService . "</Service>";
                 $xmlPost .= "<ZipOrigination>" . $source_zip . "</ZipOrigination>";
                 $xmlPost .= "<ZipDestination>" . $dest_zip . "</ZipDestination>";
                 $xmlPost .= "<Pounds>" . $shipping_pounds . "</Pounds>";
                 $xmlPost .= "<Ounces>" . $shipping_ounces . "</Ounces>";
                 $xmlPost .= "<Size>" . $usps_packagesize . "</Size>";
                 $xmlPost .= "<Machinable>" . $usps_machinable . "</Machinable>";
                 $xmlPost .= "</Package></RateV2Request>";
                 // echo htmlentities( $xmlPost );
                 $host = $usps_server;
                 //$host = "production.shippingapis.com";
                 $path = $usps_path;
                 //"/ups.app/xml/Rate";
                 //$path = "/ShippingAPI.dll";
                 $port = 80;
                 $protocol = "http";
                 $html = "";
                 //echo "<textarea>".$protocol."://".$host.$path."?API=Rate&XML=".$xmlPost."</textarea>";
                 // Using cURL is Up-To-Date and easier!!
                 if (function_exists("curl_init")) {
                     $CR = curl_init();
                     curl_setopt($CR, CURLOPT_URL, $protocol . "://" . $host . $path);
                     //"?API=RateV2&XML=".$xmlPost);
                     curl_setopt($CR, CURLOPT_POST, 1);
                     curl_setopt($CR, CURLOPT_FAILONERROR, true);
                     curl_setopt($CR, CURLOPT_POSTFIELDS, $xmlPost);
                     curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1);
                     $xmlResult = curl_exec($CR);
                     $error = curl_error($CR);
                     if (!empty($error)) {
                         $GLOBALS['vmLogger']->err(curl_error($CR));
                         $html = "<br/><span class=\"message\">" . $VM_LANG->_('PHPSHOP_INTERNAL_ERROR') . " USPS.com</span>";
                         $error = true;
                     } else {
                         /* XML Parsing */
                         require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
                         $xmlDoc = new DOMIT_Lite_Document();
                         $xmlDoc->parseXML($xmlResult, false, true);
                         /* Let's check wether the response from USPS is Success or Failure ! */
                         if (strstr($xmlResult, "Error")) {
                             $error = true;
                             $html = "<span class=\"message\">" . $VM_LANG->_('PHPSHOP_USPS_RESPONSE_ERROR') . "</span><br/>";
                             $error_code = $xmlDoc->getElementsByTagName("Number");
                             $error_code = $error_code->item(0);
                             $error_code = $error_code->getText();
                             $html .= $VM_LANG->_('PHPSHOP_ERROR_CODE') . ": " . $error_code . "<br/>";
                             $error_desc = $xmlDoc->getElementsByTagName("Description");
                             $error_desc = $error_desc->item(0);
                             $error_desc = $error_desc->getText();
                             $html .= $VM_LANG->_('PHPSHOP_ERROR_DESC') . ": " . $error_desc . "<br/>";
                         }
                     }
                     curl_close($CR);
                 } else {
                     $protocol = "http";
                     $fp = fsockopen($protocol . "://" . $host, $errno, $errstr, $timeout = 60);
                     if (!$fp) {
                         $error = true;
                         $html = $VM_LANG->_('PHPSHOP_INTERNAL_ERROR') . ": {$errstr} ({$errno})";
                     } else {
                         //send the server request
                         fputs($fp, "POST {$path} HTTP/1.1\r\n");
                         fputs($fp, "Host: {$host}\r\n");
                         fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
                         fputs($fp, "Content-length: " . strlen($xmlPost) . "\r\n");
                         fputs($fp, "Connection: close\r\n\r\n");
                         fputs($fp, $xmlPost . "\r\n\r\n");
                         $xmlResult = '';
                         while (!feof($fp)) {
                             $xmlResult .= fgets($fp, 4096);
                         }
                         if (stristr($xmlResult, "Success")) {
                             /* XML Parsing */
                             require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
                             $xmlDoc = new DOMIT_Lite_Document();
                             $xmlDoc->parseXML($xmlResult, false, true);
                             $error = false;
                         } else {
                             $html = "Error processing the Request to USPS.com";
                             $error = true;
                         }
                     }
                 }
                 if (DEBUG) {
                     echo "XML Post: <br>";
                     echo "<textarea cols='80'>" . $protocol . "://" . $host . $path . "?" . $xmlPost . "</textarea>";
                     echo "<br>";
                     echo "XML Result: <br>";
                     echo "<textarea cols='80' rows='10'>" . $xmlResult . "</textarea>";
                     echo "<br>";
                     echo "Cart Contents: " . $order_weight . " " . $weight_measure . "<br><br>\n";
                 }
                 if ($error) {
                     // comment out, if you don't want the Errors to be shown!!
                     //$vmLogger->err( $html );
                     // Switch to StandardShipping on Error !!!
                     //require_once( CLASSPATH . 'shipping/standard_shipping.php' );
                     //$shipping = new standard_shipping();
                     //$shipping->list_rates( $d );
                     echo "We are unable to ship USPS as the there was an error,<br> please select another shipping method.";
                     return;
                 }
                 // Domestic shipping - add how long it might take
                 $ship_commit[0] = "1 - 2 Days";
                 $ship_commit[1] = "1 - 2 Days";
                 $ship_commit[2] = "1 - 2 Days";
                 $ship_commit[3] = "1 - 3 Days";
                 $ship_commit[4] = "1 - 3 Days";
                 $ship_commit[5] = "1 - 3 Days";
                 $ship_commit[6] = "2 - 9 Days";
                 $ship_commit[7] = "2 - 9 Days";
                 $ship_commit[8] = "2 - 9 Days";
                 $ship_commit[9] = "2 - 9 Days";
                 $ship_commit[10] = "2 Days or More";
                 // retrieve the service and postage items
                 $i = 0;
                 if ($order_weight > 15) {
                     $count = 8;
                     $usps_ship[6] = $usps_ship[7];
                     $usps_ship[7] = $usps_ship[9];
                     $usps_ship[8] = $usps_ship[10];
                 } else {
                     if ($order_weight >= 0.86) {
                         $count = 9;
                         $usps_ship[6] = $usps_ship[7];
                         $usps_ship[7] = $usps_ship[8];
                         $usps_ship[8] = $usps_ship[9];
                         $usps_ship[9] = $usps_ship[10];
                     } else {
                         $count = 10;
                     }
                 }
                 while ($i <= $count) {
                     if (isset($xmlDoc)) {
                         $ship_service[$i] = $xmlDoc->getElementsByTagName('MailService');
                         $ship_service[$i] = $ship_service[$i]->item($i);
                         $ship_service[$i] = $ship_service[$i]->getText();
                         $ship_postage[$i] = $xmlDoc->getElementsByTagName('Rate');
                         $ship_postage[$i] = $ship_postage[$i]->item($i);
                         $ship_postage[$i] = $ship_postage[$i]->getText();
                         if (preg_match('/%$/', USPS_HANDLINGFEE)) {
                             $ship_postage[$i] = $ship_postage[$i] * (1 + substr(USPS_HANDLINGFEE, 0, -1) / 100);
                         } else {
                             $ship_postage[$i] = $ship_postage[$i] + USPS_HANDLINGFEE;
                         }
                         $i++;
                     }
                 }
                 /******END OF DOMESTIC RATE******/
             } else {
                 /******START INTERNATIONAL RATE******/
                 //the xml that will be posted to usps
                 $xmlPost = 'API=IntlRate&XML=<IntlRateRequest USERID="' . $usps_username . '" PASSWORD="******">';
                 $xmlPost .= '<Package ID="' . $usps_packageid . '">';
                 $xmlPost .= "<Pounds>" . $shipping_pounds_intl . "</Pounds>";
                 $xmlPost .= "<Ounces>" . $shipping_ounces . "</Ounces>";
                 $xmlPost .= "<MailType>Package</MailType>";
                 $xmlPost .= "<Country>" . $dest_country_name . "</Country>";
                 $xmlPost .= "</Package></IntlRateRequest>";
                 // echo htmlentities( $xmlPost );
                 $host = $usps_server;
                 //$host = "production.shippingapis.com";
                 $path = $usps_path;
                 //"/ups.app/xml/Rate";
                 //$path = "/ShippingAPI.dll";
                 $port = 80;
                 $protocol = "http";
                 //echo "<textarea>".$protocol."://".$host.$path."?API=Rate&XML=".$xmlPost."</textarea>";
                 // Using cURL is Up-To-Date and easier!!
                 if (function_exists("curl_init")) {
                     $CR = curl_init();
                     curl_setopt($CR, CURLOPT_URL, $protocol . "://" . $host . $path);
                     //"?API=RateV2&XML=".$xmlPost);
                     curl_setopt($CR, CURLOPT_POST, 1);
                     curl_setopt($CR, CURLOPT_FAILONERROR, true);
                     curl_setopt($CR, CURLOPT_POSTFIELDS, $xmlPost);
                     curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1);
                     $xmlResult = curl_exec($CR);
                     //echo "<textarea>".$xmlResult."</textarea>";
                     $error = curl_error($CR);
                     if (!empty($error)) {
                         $GLOBALS['vmLogger']->err(curl_error($CR));
                         $html = "<br/><span class=\"message\">" . $VM_LANG->_('PHPSHOP_INTERNAL_ERROR') . " USPS.com</span>";
                         $error = true;
                     } else {
                         /* XML Parsing */
                         require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
                         $xmlDoc = new DOMIT_Lite_Document();
                         $xmlDoc->parseXML($xmlResult, false, true);
                         /* Let's check wether the response from USPS is Success or Failure ! */
                         if (strstr($xmlResult, "Error")) {
                             $error = true;
                             $html = "<span class=\"message\">" . $VM_LANG->_('PHPSHOP_USPS_RESPONSE_ERROR') . "</span><br/>";
                             $error_code = $xmlDoc->getElementsByTagName("Number");
                             $error_code = $error_code->item(0);
                             $error_code = $error_code->getText();
                             $html .= $VM_LANG->_('PHPSHOP_ERROR_CODE') . ": " . $error_code . "<br/>";
                             $error_desc = $xmlDoc->getElementsByTagName("Description");
                             $error_desc = $error_desc->item(0);
                             $error_desc = $error_desc->getText();
                             $html .= $VM_LANG->_('PHPSHOP_ERROR_DESC') . ": " . $error_desc . "<br/>";
                         }
                     }
                     curl_close($CR);
                 } else {
                     $protocol = "http";
                     $fp = fsockopen($protocol . "://" . $host, $errno, $errstr, $timeout = 60);
                     if (!$fp) {
                         $error = true;
                         $html = $VM_LANG->_('PHPSHOP_INTERNAL_ERROR') . ": {$errstr} ({$errno})";
                     } else {
                         //send the server request
                         fputs($fp, "POST {$path} HTTP/1.1\r\n");
                         fputs($fp, "Host: {$host}\r\n");
                         fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
                         fputs($fp, "Content-length: " . strlen($xmlPost) . "\r\n");
                         fputs($fp, "Connection: close\r\n\r\n");
                         fputs($fp, $xmlPost . "\r\n\r\n");
                         $xmlResult = '';
                         while (!feof($fp)) {
                             $xmlResult .= fgets($fp, 4096);
                         }
                         if (stristr($xmlResult, "Success")) {
                             /* XML Parsing */
                             require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
                             $xmlDoc = new DOMIT_Lite_Document();
                             $xmlDoc->parseXML($xmlResult, false, true);
                             $error = false;
                         } else {
                             $html = "Error processing the Request to USPS.com";
                             $error = true;
                         }
                     }
                 }
                 if (DEBUG) {
                     echo "XML Post: <br>";
                     echo "<textarea cols='80'>" . $protocol . "://" . $host . $path . "?" . $xmlPost . "</textarea>";
                     echo "<br>";
                     echo "XML Result: <br>";
                     echo "<textarea cols='80' rows='10'>" . $xmlResult . "</textarea>";
                     echo "<br>";
                     echo "Cart Contents: " . $order_weight . " " . $weight_measure . "<br><br>\n";
                 }
                 if ($error) {
                     // comment out, if you don't want the Errors to be shown!!
                     //$vmLogger->err( $html );
                     // Switch to StandardShipping on Error !!!
                     //require_once( CLASSPATH . 'shipping/standard_shipping.php' );
                     //$shipping = new standard_shipping();
                     //$shipping->list_rates( $d );
                     //return;
                     echo "We are unable to ship USPS as there was an error,<br> please select another shipping method.";
                 }
                 // retrieve the service and postage items
                 $i = 0;
                 $numChildren = 0;
                 $numChildren = $xmlDoc->documentElement->firstChild->childCount;
                 $numChildren = $numChildren - 7;
                 // this line removes the preceeding 6 lines of crap not needed plus 1 to make up for the $i starting at 0
                 while ($i <= $numChildren) {
                     if (isset($xmlDoc)) {
                         $ship_service[$i] = $xmlDoc->getElementsByTagName("SvcDescription");
                         $ship_service[$i] = $ship_service[$i]->item($i);
                         $ship_service[$i] = $ship_service[$i]->getText();
                         $ship_weight[$i] = $xmlDoc->getElementsByTagName("MaxWeight");
                         $ship_weight[$i] = $ship_weight[$i]->item($i);
                         $ship_weight[$i] = $ship_weight[$i]->getText($i);
                     }
                     $i++;
                 }
                 // retrieve postage for countries that support all nine shipping methods and weights
                 $ship_weight[8] = $ship_weight[8] / 16;
                 if ($order_weight <= $ship_weight[0] && $ship_weight[1] && $ship_weight[2] && $ship_weight[3] && $ship_weight[4] && $ship_weight[5] && $ship_weight[6] && $ship_weight[7] && $ship_weight[8]) {
                     $count = 8;
                 } elseif ($order_weight <= $ship_weight[0] && $ship_weight[1] && $ship_weight[2] && $ship_weight[3] && $ship_weight[4] && $ship_weight[5] && $ship_weight[6] && $ship_weight[7]) {
                     $count = 7;
                     // $usps_intl[6] = $usps_intl[7];
                 } elseif ($order_weight <= $ship_weight[0] && $ship_weight[1] && $ship_weight[2] && $ship_weight[3] && $ship_weight[4] && $ship_weight[5] && $ship_weight[6]) {
                     $count = 6;
                 } elseif ($order_weight <= $ship_weight[0] && $ship_weight[1] && $ship_weight[2] && $ship_weight[3] && $ship_weight[4] && $ship_weight[5]) {
                     $count = 5;
                 } elseif ($order_weight <= $ship_weight[0] && $ship_weight[1] && $ship_weight[2] && $ship_weight[3] && $ship_weight[4]) {
                     $count = 4;
                 } elseif ($order_weight <= $ship_weight[0] && $ship_weight[1] && $ship_weight[2] && $ship_weight[3]) {
                     $count = 3;
                 } elseif ($order_weight <= $ship_weight[0] && $ship_weight[1] && $ship_weight[2]) {
                     $count = 2;
                 } elseif ($order_weight <= $ship_weight[0] && $ship_weight[1]) {
                     $count = 1;
                 } elseif ($order_weight <= $ship_weight[0]) {
                     $count = 0;
                 } else {
                     echo "We are unable to ship USPS as the package weight exceeds what your<br>country allows, please select another shipping method.";
                 }
                 $i = 0;
                 while ($i <= $numChildren) {
                     if (isset($xmlDoc)) {
                         $ship_service[$i] = $xmlDoc->getElementsByTagName("SvcDescription");
                         $ship_service[$i] = $ship_service[$i]->item($i);
                         $ship_service[$i] = $ship_service[$i]->getText();
                         $ship_commit[$i] = $xmlDoc->getElementsByTagName("SvcCommitments");
                         $ship_commit[$i] = $ship_commit[$i]->item($i);
                         $ship_commit[$i] = $ship_commit[$i]->getText();
                         $ship_postage[$i] = $xmlDoc->getElementsByTagName("Postage");
                         $ship_postage[$i] = $ship_postage[$i]->item($i);
                         $ship_postage[$i] = $ship_postage[$i]->getText($i);
                         $ship_postage[$i] = $ship_postage[$i] + USPS_INTLHANDLINGFEE;
                         $i++;
                     }
                     /******END INTERNATIONAL RATE******/
                 }
             }
             $i = 0;
             while ($i <= $count) {
                 $html = "";
                 // USPS returns Charges in USD.
                 $charge[$i] = $ship_postage[$i];
                 $ship_postage[$i] = $CURRENCY_DISPLAY->getFullValue($charge[$i]);
                 $shipping_rate_id = urlencode(__CLASS__ . "|USPS|" . $ship_service[$i] . "|" . $charge[$i]);
                 //$checked = (@$d["shipping_rate_id"] == $value) ? "checked=\"checked\"" : "";
                 $html .= "\n<input type=\"radio\" name=\"shipping_rate_id\" checked=\"checked\" value=\"{$shipping_rate_id}\" id=\"{$shipping_rate_id}\" />\n";
                 $_SESSION[$shipping_rate_id] = 1;
                 $html .= "<label for=\"{$shipping_rate_id}\">";
                 $html .= "USPS " . $ship_service[$i] . " ";
                 $html .= "<strong>(" . $ship_postage[$i] . ")</strong>";
                 if (USPS_SHOW_DELIVERY_QUOTE == 1) {
                     $html .= "&nbsp;&nbsp;-&nbsp;&nbsp;" . $ship_commit[$i];
                 }
                 $html .= "</label>";
                 $html .= "<br />";
                 if ($dest_country_name == "United States" && $usps_ship[$i] == "TRUE") {
                     echo $html;
                 } else {
                     if ($dest_country_name != "United States" && $usps_intl[$i] == "TRUE") {
                         echo $html;
                     }
                 }
                 $i++;
             }
         }
     }
     return true;
 }
예제 #24
0
/**
* Compiles information to add or edit a module
* @param string The current GET/POST option
* @param integer The unique id of the record to edit
*/
function editModule($option, $uid, $client)
{
    global $database, $my, $mainframe;
    global $mosConfig_absolute_path;
    $lists = array();
    $row = new mosModule($database);
    // load the row from the db table
    $row->load((int) $uid);
    // fail if checked out not by 'me'
    if ($row->isCheckedOut($my->id)) {
        mosErrorAlert("The module " . $row->title . " is currently being edited by another administrator");
    }
    $row->content = htmlspecialchars($row->content);
    if ($uid) {
        $row->checkout($my->id);
    }
    // if a new record we must still prime the mosModule object with a default
    // position and the order; also add an extra item to the order list to
    // place the 'new' record in last position if desired
    if ($uid == 0) {
        $row->position = 'left';
        $row->showtitle = true;
        //$row->ordering = $l;
        $row->published = 1;
    }
    if ($client == 'admin') {
        $where = "client_id = 1";
        $lists['client_id'] = 1;
        $path = 'mod1_xml';
    } else {
        $where = "client_id = 0";
        $lists['client_id'] = 0;
        $path = 'mod0_xml';
    }
    $query = "SELECT position, ordering, showtitle, title" . "\n FROM #__modules" . "\n WHERE {$where}" . "\n ORDER BY ordering";
    $database->setQuery($query);
    if (!($orders = $database->loadObjectList())) {
        echo $database->stderr();
        return false;
    }
    $query = "SELECT position, description" . "\n FROM #__template_positions" . "\n WHERE position != ''" . "\n ORDER BY position";
    $database->setQuery($query);
    // hard code options for now
    $positions = $database->loadObjectList();
    $orders2 = array();
    $pos = array();
    foreach ($positions as $position) {
        $orders2[$position->position] = array();
        $pos[] = mosHTML::makeOption($position->position, $position->description);
    }
    $l = 0;
    $r = 0;
    for ($i = 0, $n = count($orders); $i < $n; $i++) {
        $ord = 0;
        if (array_key_exists($orders[$i]->position, $orders2)) {
            $ord = count(array_keys($orders2[$orders[$i]->position])) + 1;
        }
        $orders2[$orders[$i]->position][] = mosHTML::makeOption($ord, $ord . '::' . addslashes($orders[$i]->title));
    }
    // build the html select list
    $pos_select = 'onchange="changeDynaList(\'ordering\',orders,document.adminForm.position.options[document.adminForm.position.selectedIndex].value, originalPos, originalOrder)"';
    $active = $row->position ? $row->position : 'left';
    $lists['position'] = mosHTML::selectList($pos, 'position', 'class="inputbox" size="1" ' . $pos_select, 'value', 'text', $active);
    // get selected pages for $lists['selections']
    if ($uid) {
        $query = "SELECT menuid AS value" . "\n FROM #__modules_menu" . "\n WHERE moduleid = " . (int) $row->id;
        $database->setQuery($query);
        $lookup = $database->loadObjectList();
    } else {
        $lookup = array(mosHTML::makeOption(0, 'All'));
    }
    if ($row->access == 99 || $row->client_id == 1 || $lists['client_id']) {
        $lists['access'] = 'Administrator<input type="hidden" name="access" value="99" />';
        $lists['showtitle'] = 'N/A <input type="hidden" name="showtitle" value="1" />';
        $lists['selections'] = 'N/A';
    } else {
        if ($client == 'admin') {
            $lists['access'] = 'N/A';
            $lists['selections'] = 'N/A';
        } else {
            $lists['access'] = mosAdminMenus::Access($row);
            $lists['selections'] = mosAdminMenus::MenuLinks($lookup, 1, 1);
        }
        $lists['showtitle'] = mosHTML::yesnoRadioList('showtitle', 'class="inputbox"', $row->showtitle);
    }
    // build the html select list for published
    $lists['published'] = mosAdminMenus::Published($row);
    $row->description = '';
    // XML library
    require_once $mosConfig_absolute_path . '/includes/domit/xml_domit_lite_include.php';
    // xml file for module
    $xmlfile = $mainframe->getPath($path, $row->module);
    $xmlDoc = new DOMIT_Lite_Document();
    $xmlDoc->resolveErrors(true);
    if ($xmlDoc->loadXML($xmlfile, false, true)) {
        $root =& $xmlDoc->documentElement;
        if ($root->getTagName() == 'mosinstall' && $root->getAttribute('type') == 'module') {
            $element =& $root->getElementsByPath('description', 1);
            $row->description = $element ? trim($element->getText()) : '';
        }
    }
    // get params definitions
    $params = new mosParameters($row->params, $xmlfile, 'module');
    HTML_modules::editModule($row, $orders2, $lists, $params, $option);
}
예제 #25
0
/**
* Compiles a list of installed languages
*/
function viewLanguages($option)
{
    global $languages;
    global $mainframe;
    global $mosConfig_lang, $mosConfig_absolute_path, $mosConfig_list_limit;
    $limit = $mainframe->getUserStateFromRequest("viewlistlimit", 'limit', $mosConfig_list_limit);
    $limitstart = $mainframe->getUserStateFromRequest("view{$option}limitstart", 'limitstart', 0);
    // get current languages
    $cur_language = $mosConfig_lang;
    $rows = array();
    // Read the template dir to find templates
    $languageBaseDir = mosPathName(mosPathName($mosConfig_absolute_path) . "language");
    $rowid = 0;
    $xmlFilesInDir = mosReadDirectory($languageBaseDir, '.xml$');
    $dirName = $languageBaseDir;
    foreach ($xmlFilesInDir as $xmlfile) {
        // Read the file to see if it's a valid template XML file
        $xmlDoc = new DOMIT_Lite_Document();
        $xmlDoc->resolveErrors(true);
        if (!$xmlDoc->loadXML($dirName . $xmlfile, false, true)) {
            continue;
        }
        $root =& $xmlDoc->documentElement;
        if ($root->getTagName() != 'mosinstall') {
            continue;
        }
        if ($root->getAttribute("type") != "language") {
            continue;
        }
        $row = new StdClass();
        $row->id = $rowid;
        $row->language = substr($xmlfile, 0, -4);
        $element =& $root->getElementsByPath('name', 1);
        $row->name = $element->getText();
        $element =& $root->getElementsByPath('creationDate', 1);
        $row->creationdate = $element ? $element->getText() : 'Unknown';
        $element =& $root->getElementsByPath('author', 1);
        $row->author = $element ? $element->getText() : 'Unknown';
        $element =& $root->getElementsByPath('copyright', 1);
        $row->copyright = $element ? $element->getText() : '';
        $element =& $root->getElementsByPath('authorEmail', 1);
        $row->authorEmail = $element ? $element->getText() : '';
        $element =& $root->getElementsByPath('authorUrl', 1);
        $row->authorUrl = $element ? $element->getText() : '';
        $element =& $root->getElementsByPath('version', 1);
        $row->version = $element ? $element->getText() : '';
        // if current than set published
        if ($cur_language == $row->language) {
            $row->published = 1;
        } else {
            $row->published = 0;
        }
        $row->checked_out = 0;
        $row->mosname = strtolower(str_replace(" ", "_", $row->name));
        $rows[] = $row;
        $rowid++;
    }
    require_once $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php';
    $pageNav = new mosPageNav(count($rows), $limitstart, $limit);
    $rows = array_slice($rows, $pageNav->limitstart, $pageNav->limit);
    HTML_languages::showLanguages($cur_language, $rows, $pageNav, $option);
}
예제 #26
0
 /**
  * @param string A file path
  * @return object A DOMIT XML document, or null if the file failed to parse
  */
 function isPackageFile($p_file)
 {
     $xmlDoc = new DOMIT_Lite_Document();
     $xmlDoc->resolveErrors(true);
     if (!$xmlDoc->loadXML($p_file, false, true)) {
         return null;
     }
     $root =& $xmlDoc->documentElement;
     if ($root->getTagName() != 'mosinstall') {
         return null;
     }
     // Set the type
     $this->installType($root->getAttribute('type'));
     $this->installFilename($p_file);
     return $xmlDoc;
 }
예제 #27
0
function loadInstalledPlugins(&$rows, &$xmlfile)
{
    $database =& JFactory::getDBO();
    if (!defined('DOMIT_INCLUDE_PATH')) {
        require_once JPATH_SITE . DS . 'libraries' . DS . 'domit' . DS . 'xml_domit_lite_parser.php';
    }
    $query = "SELECT id, extension, published" . "\n FROM #__xmap_ext" . "\n WHERE extension not like '%.bak'" . "\n ORDER BY extension";
    $database->setQuery($query);
    $rows = $database->loadObjectList();
    $n = count($rows);
    for ($i = 0; $i < $n; $i++) {
        $row =& $rows[$i];
        // path to module directory
        $extensionBaseDir = JPATH_COMPONENT_ADMINISTRATOR . DS . 'extensions' . DS;
        // xml file for module
        $xmlfile = $extensionBaseDir . $row->extension . ".xml";
        if (file_exists($xmlfile)) {
            $xmlDoc = new DOMIT_Lite_Document();
            $xmlDoc->resolveErrors(true);
            if (!$xmlDoc->loadXML($xmlfile, false, true)) {
                continue;
            }
            $root =& $xmlDoc->documentElement;
            if ($root->getTagName() != 'install' && $root->getTagName() != 'mosinstall') {
                continue;
            }
            if ($root->getAttribute("type") != "xmap_ext") {
                continue;
            }
            $element =& $root->getElementsByPath('name', 1);
            $row->name = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('creationDate', 1);
            $row->creationdate = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('author', 1);
            $row->author = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('copyright', 1);
            $row->copyright = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorEmail', 1);
            $row->authorEmail = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('authorUrl', 1);
            $row->authorUrl = $element ? $element->getText() : '';
            $element =& $root->getElementsByPath('version', 1);
            $row->version = $element ? $element->getText() : '';
        } else {
            echo "Missing file '{$xmlfile}'";
        }
    }
}
 /**
  * Reads the JoomlaPack version information out of joomlapack.xml and defines two constants 
  *
  */
 function getJoomlaPackVersion()
 {
     require_once JPATH_SITE . DS . 'includes' . DS . 'domit' . DS . 'xml_domit_lite_include.php';
     $xmlDoc = new DOMIT_Lite_Document();
     $xmlDoc->resolveErrors(true);
     if ($xmlDoc->loadXML(JPATH_COMPONENT_ADMINISTRATOR . DS . 'joomlapack.xml', false, true)) {
         $root =& $xmlDoc->documentElement;
         $e =& $root->getElementsByPath('version', 1);
         define("_JP_VERSION", $e->getText());
         $root =& $xmlDoc->documentElement;
         $e =& $root->getElementsByPath('creationDate', 1);
         define("_JP_DATE", $e->getText());
     } else {
         define("_JP_VERSION", "1.2 Series SVN");
         define("_JP_DATE", "");
     }
 }
예제 #29
0
    /**
     * Main upgrade function. Processes XML file
     */
    function doUpgrade()
    {
        require_once KUNENA_ROOT_PATH . DS . 'includes/domit/xml_domit_lite_include.php';
        if (!$this->silent) {
            ?>
			<script language=JavaScript>
			function showDetail(srcElement) {
				var targetID, srcElement, targetElement, imgElementID, imgElement;
				targetID = srcElement.id + "_details";
				imgElementID = srcElement.id + "_img";

				targetElement = document.getElementById(targetID);
				imgElement = document.getElementById(imgElementID);
				if (targetElement.style.display == "none") {
					targetElement.style.display = "";
					imgElement.src = "images/collapseall.png";
				} else {
					targetElement.style.display = "none";
					imgElement.src = "images/expandall.png";
				}
			}
			</script>
			<style>
			.details {
				font-family: courier;
				background-color: #EEEEEE;
				border: 1px dashed #BBBBBB;
				padding-left: 10px;
				margin-left: 20px;
				margin-top: 5px;
			</style>
			<?php 
        }
        $componentBaseDir = KUNENA_ROOT_PATH_ADMIN . DS . 'components/';
        $this->_upgradeDir = $componentBaseDir . $this->component . DS . $this->subdir;
        //get current version, check if version table exists
        $createVersionTable = 1;
        $upgrade = null;
        // Legacy enabler
        // Versions prior to 1.0.5 did not came with a version table inside the database
        // this would make the installer believe this is a fresh install. We need to perform
        // a 'manual' check if this is going to be an upgrade and if so create that table
        // and write a dummy version entry to force an upgrade.
        $kunena_db =& JFactory::getDBO();
        $kunena_db->setQuery("SHOW TABLES LIKE " . $kunena_db->quote($kunena_db->getPrefix() . 'fb_messages'));
        $kunena_db->query();
        check_dberror("Unable to search for messages table.");
        if ($kunena_db->getNumRows()) {
            // fb tables exist, now lets see if we have a version table
            $kunena_db->setQuery("SHOW TABLES LIKE " . $kunena_db->quote($this->versionTable));
            $createVersionTable = $kunena_db->loadResult();
            $createVersionTable = empty($createVersionTable);
            check_dberror("Unable to search for version table.");
            if ($createVersionTable) {
                //version table does not exist - this is a pre 1.0.5 install - lets create
                $this->createVersionTable();
                // insert dummy version entry to force upgrade
                $this->insertDummyVersion();
                $createVersionTable = 0;
            }
        }
        if (!$createVersionTable) {
            // lets see if we need to update the version table layout from it original
            $currentVersion = $this->getLatestVersion($this->versionTable);
            if (!is_object($currentVersion)) {
                // version table exisits, but we cannot retrieve the latest version
                // in this case we assume the table layout might have changed
                // backup old table and create new version table
                $this->backupVersionTable();
                $this->dropVersionTable();
                $this->createVersionTable();
                // insert dummy version info to start with
                $this->insertDummyVersion();
            }
            //check for latest version and date entry
            $currentVersion = $this->getLatestVersion($this->versionTable);
            if (!$currentVersion->version && !$currentVersion->versiondate) {
                //there was an error in retrieving the version and date, goto install mode
                $upgrade = 0;
            } else {
                //OK, no error, there is a version table and it also contains version and date information, switching to upgrade mode
                $upgrade = 1;
            }
        }
        //Create version table
        if ($createVersionTable == 1) {
            if (!$this->createVersionTable()) {
                $this->_error = "DB function failed with error number <b>" . $kunena_db->_errorNum . "</b><br/>";
                $this->_error .= $kunena_db->getErrorMsg();
                $img = "publish_x.png";
                $this->_return = false;
            } else {
                $img = "tick.png";
            }
            if (!$this->silent) {
                ?>
				<table class="adminlist">
				<tr>
					<td>Creating version table</td>
					<td width="20"><a href="#" onMouseOver="return overlib('<?php 
                echo $this->_error;
                ?>
', BELOW, RIGHT,WIDTH,300);" onmouseout="return nd();" ><img src="images/<?php 
                echo $img;
                ?>
" border="0"></a></td>
				</tr>
				</table>
				<?php 
            }
        }
        //initiate XML doc
        $xmlDoc = new DOMIT_Lite_Document();
        $xmlDoc->loadXML($this->_upgradeDir . DS . $this->xmlFileName, false, true);
        //load root element and check XML version (for future use)
        $root =& $xmlDoc->documentElement;
        $comUpgradeVersion = $root->getAttribute("version");
        //here comes the real stuff
        if ($upgrade == 0) {
            $installElement =& $root->firstChild;
            $version = $installElement->getAttribute("version");
            $versiondate = $installElement->getAttribute("versiondate");
            $build = $installElement->getAttribute("build");
            $versionname = $installElement->getAttribute("versionname");
            if (!$this->silent) {
                ?>
				<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
				<script  type="text/javascript" src="<?php 
                echo JURI::root();
                ?>
/includes/js/overlib_mini.js"></script>
				<table class="adminlist">
					<tr>
						<th colspan="2">Installing "<?php 
                echo $this->component;
                ?>
" (Version: <?php 
                echo $version;
                ?>
 / Date: <?php 
                echo $versiondate;
                ?>
 / Build: <?php 
                echo $build;
                ?>
 / VersionName: <?php 
                echo $versionname;
                ?>
 )</th>
					</tr>
				<?php 
            }
            //install mode, run install queries
            $installElement = $root->getElementsByPath('install', 1);
            if (!is_null($installElement)) {
                $this->processNode($installElement, 1);
            }
            if (!$this->silent) {
                ?>
				</table>
				<?php 
            }
            //Store version info and date in database
            $this->insertVersionData($version, $versiondate, $build, $versionname);
        } else {
            if (!$this->silent) {
                ?>
				<div id="overDiv" style="position:absolute; visibility:hidden; z-index:10000;"></div>
				<script  type="text/javascript" src="<?php 
                echo JURI::root();
                ?>
/includes/js/overlib_mini.js"></script>
				<table class="adminlist">
					<tr>
						<th colspan="2">Upgrading "<?php 
                echo $this->component;
                ?>
" (Version: <?php 
                echo @$currentVersion->version;
                ?>
 / Version Date: <?php 
                echo @$currentVersion->versiondate;
                ?>
 / Install Date: <?php 
                echo @$currentVersion->installdate;
                ?>
 / Build: <?php 
                echo @$currentVersion->build;
                ?>
 / Version Name: <?php 
                echo @$currentVersion->versionname;
                ?>
)</th>
					</tr>
				<?php 
            }
            //upgrade mode
            $upgradeElement = $root->getElementsByPath('upgrade', 1);
            if (!is_null($upgradeElement)) {
                //walk through the versions
                $numChildrenMain =& $upgradeElement->childCount;
                $childNodesMain =& $upgradeElement->childNodes;
                for ($k = 0; $k < $numChildrenMain; $k++) {
                    $versionElement =& $childNodesMain[$k];
                    $version = $versionElement->getAttribute("version");
                    $versiondate = $versionElement->getAttribute("versiondate");
                    $build = $versionElement->getAttribute("build");
                    $versionname = $versionElement->getAttribute("versionname");
                    //when legacy version exists, just compare version, if date exists as well, compare date
                    if ($currentVersion->versiondate && $versiondate > $currentVersion->versiondate or version_compare($version, $currentVersion->version, '>') or version_compare($version, $currentVersion->version, '==') && $build > $currentVersion->build) {
                        //these instructions are for a newer version than the currently installed version
                        if (!$this->silent) {
                            ?>
							<tr>
								<td colspan="2">&nbsp;</td>
							</tr>
							<tr>
								<th colspan="2">Version: <?php 
                            echo $version;
                            ?>
 (Version Date: <?php 
                            echo $versiondate;
                            ?>
, Build: <?php 
                            echo $build;
                            ?>
, Version Name: <?php 
                            echo $versionname;
                            ?>
)</th>
							</tr>
							<?php 
                        }
                        //Store version info and date in database
                        $this->insertVersionData($version, $versiondate, $build, $versionname);
                        $added_version = 1;
                        $this->processNode($versionElement, $k);
                    }
                    //end if version newer check
                }
                //end version element loop
                if (!isset($added_version)) {
                    $this->insertVersionData($version, $versiondate, $build, $versionname);
                }
            }
            //end if !is_null($upgradeElement)
            if (!$this->silent) {
                ?>
				</table>
				<?php 
            }
        }
        //end main if upgrade or not
        return $this->_return;
    }
 /**
  * Start parsing an XML document
  *
  * Parses an XML document. The handlers for the configured events are called as many times as necessary.
  *
  * @param  string $data to parse
  */
 function _parse($data = '')
 {
     if ($this->_parser === null) {
         $xml = new DOMIT_Lite_Document();
         $success = $xml->parseXML($data);
         if ($success) {
             //gets a reference to the root element of the cd collection
             $myDocumentElement =& $xml->documentElement;
             $this->_domitParse($myDocumentElement);
             $this->document = $this->document[0];
         }
     } else {
         if (xml_parse($this->_parser, $data)) {
             $this->document = $this->document[0];
         } else {
             //Error handling
             $this->_handleError(xml_get_error_code($this->_parser), xml_get_current_line_number($this->_parser), xml_get_current_column_number($this->_parser));
         }
         xml_parser_free($this->_parser);
     }
 }