示例#1
0
    $xml->setIndent(true);
    $xml->startDocument('1.0', 'UTF-8');
    $xml->startElement('document');
    $xml->writeElement('LimeSurveyDocType', 'Survey');
    $xml->writeElement('DBVersion', $dbversionnumber);
    $xml->startElement('languages');
    $surveylanguages = GetAdditionalLanguagesFromSurveyID($surveyid);
    $surveylanguages[] = GetBaseLanguageFromSurveyID($surveyid);
    foreach ($surveylanguages as $surveylanguage) {
        $xml->writeElement('language', $surveylanguage);
    }
    $xml->endElement();
    getXMLStructure($xml, $exclude);
    $xml->endElement();
    // close columns
    $xml->endDocument();
    return $xml->outputMemory(true);
}
if (!isset($copyfunction)) {
    $fn = "limesurvey_survey_{$surveyid}.lss";
    header("Content-Type: text/xml");
    header("Content-Disposition: attachment; filename={$fn}");
    header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    // Date in the past
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Pragma: public");
    // HTTP/1.0
    echo getXMLData();
    exit;
}
//$url = 'http://mp3.zing.vn/album/Se-Chi-La-Mo-Single-Emily/ZWZBFCAC.html';
$url = 'http://mp3.zing.vn/bai-hat/Khuon-Mat-Dang-Thuong-Son-Tung-M-TP/ZW70UUZF.html';
//$url = 'http://mp3.zing.vn/video-clip/Giay-Phut-Cuoi-Trance-Version-Giang-Hong-Ngoc/ZW7IB6ZO.html';
$type = getLinkType($url);
if (!$type) {
    die('Link is not valid');
}
$content = getPageContent($url);
if (!$content) {
    die('Can not get page content');
}
$xmlLink = getXMLLink($content);
if (!$xmlLink) {
    die('Can not get xml Link');
}
$xmlData = getXMLData($xmlLink);
if (!$xmlData) {
    die('can not get xml data');
}
switch ($type) {
    case 'bai-hat':
    case 'album':
        $items = getAudioItems($xmlData);
        break;
        break;
    case 'video-clip':
        $items = getVideoItems($xmlData);
        break;
}
var_dump($items);
function getLinkType($url)
示例#3
0
    if ($filterxsshtml) {
        $sNewSurveyName = $myFilter->process($sNewSurveyName);
    } else {
        $sNewSurveyName = html_entity_decode($sNewSurveyName, ENT_QUOTES, "UTF-8");
    }
    if (isset($_POST['copysurveyexcludequotas']) && $_POST['copysurveyexcludequotas'] == "on") {
        $exclude['quotas'] = true;
    }
    if (isset($_POST['copysurveyexcludeanswers']) && $_POST['copysurveyexcludeanswers'] == "on") {
        $exclude['answers'] = true;
    }
    if (isset($_POST['copysurveyresetconditions']) && $_POST['copysurveyresetconditions'] == "on") {
        $exclude['conditions'] = true;
    }
    include "export_structure_xml.php";
    $copysurveydata = getXMLData($exclude);
}
// Now, we have the survey : start importing
require_once 'import_functions.php';
if ($action == 'importsurvey' && !$importerror) {
    if (isset($sExtension) && strtolower($sExtension) == 'csv') {
        $aImportResults = CSVImportSurvey($sFullFilepath);
    } elseif (isset($sExtension) && strtolower($sExtension) == 'lss') {
        $aImportResults = XMLImportSurvey($sFullFilepath, null, null, null, isset($_POST['translinksfields']));
    } else {
        $importerror = true;
    }
} elseif ($action == 'copysurvey' && !$importerror) {
    $aImportResults = XMLImportSurvey('', $copysurveydata, $sNewSurveyName);
} else {
    $importerror = true;
示例#4
0
function albumOverride()
{
    if (isset($_POST[descOVERRIDE])) {
        $asin = $_POST[descOVERRIDE];
        $desc_xml = getXMLData(urlencode($asin), true);
    }
    if (isset($_POST[imgOVERRIDE])) {
        $asin = $_POST[imgOVERRIDE];
        $img_xml = getXMLData(urlencode($asin), true);
    }
    if (isset($_POST[descOVERRIDE]) && isset($_POST[imgOVERRIDE])) {
        if (isset($desc_xml->Items->Item->LargeImage) && isset($desc_xml->Items->Item->LargeImage->URL)) {
            $desc_xml->Items->Item->LargeImage->URL = (string) xml_data($img_xml->Items->Item->LargeImage->URL);
        } else {
            $desc_xml->Items->Item->addChild('LargeImage');
            $desc_xml->Items->Item->LargeImage->addChild('URL', $img_xml->Items->Item->LargeImage->URL);
        }
        if (isset($desc_xml->Items->Item->MediumImage) && isset($desc_xml->Items->Item->MediumImage->URL)) {
            $desc_xml->Items->Item->MediumImage->URL = (string) xml_data($img_xml->Items->Item->MediumImage->URL);
        } else {
            $desc_xml->Items->Item->addChild('MediumImage');
            $desc_xml->Items->Item->MediumImage->addChild('URL', $img_xml->Items->Item->MediumImage->URL);
        }
        if (isset($desc_xml->Items->Item->SmallImage) && isset($desc_xml->Items->Item->SmallImage->URL)) {
            $desc_xml->Items->Item->SmallImage->URL = (string) xml_data($img_xml->Items->Item->SmallImage->URL);
        } else {
            $desc_xml->Items->Item->addChild('SmallImage');
            $desc_xml->Items->Item->SmallImage->addChild('URL', $img_xml->Items->Item->SmallImage->URL);
        }
        $item = $desc_xml->Items->Item;
    } elseif (isset($_POST[descOVERRIDE])) {
        $item = $desc_xml->Items->Item;
    } elseif (isset($_POST[imgOVERRIDE])) {
        $item = $img_xml->Items->Item;
    } else {
        return false;
    }
    $display_img = 'style/slick/clear.gif';
    $display_desc = 'Not available';
    if (isset($item->LargeImage->URL) && xml_data($item->LargeImage->URL) != '') {
        $display_img = $item->LargeImage->URL;
    } elseif (isset($item->MediumImage->URL) && xml_data($item->MediumImage->URL) != '') {
        $display_img = $item->MediumImage->URL;
    }
    if (isset($item->EditorialReviews->EditorialReview->Content) && trim(xml_data($item->EditorialReviews->EditorialReview->Content)) != '') {
        $display_desc = $item->EditorialReviews->EditorialReview->Content;
    } else {
        $item->EditorialReviews->EditorialReview->Content = '';
    }
    print '<tr><td><table width="100%" border="1" cellspacing="0" cellpadding="5" id="' . xml_data($item->ASIN) . '">';
    print '<tr><td colspan="3" nowrap="nowrap"><strong>Attempting Override</strong></td>';
    print '<tr><td align="right" width="160px" bgcolor="' . $states['artist'] . '"><b>Artist:</b></td><td width="100%"> ' . xml_data($item->ItemAttributes->Artist) . '</td>';
    print "<td rowspan=\"2\" align=\"right\"><a href=\"{$link_url}" . xml_data($item->ASIN) . "\" target=\"_blank\">View Amazon</a></td></tr>\n";
    print '<tr><td align="right" width="160px" bgcolor="' . $states['album'] . '"><b>Album:</b></td><td width="100%"> ' . xml_data($item->ItemAttributes->Title) . '</td></tr>';
    print '<tr><td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="5"><tr>';
    print '<td width="160px" height="160" align="center" valign="middle" bgcolor="' . $states['image'] . '"><img src="' . $display_img . '" height="150" width="150"><br></td>';
    print '<td valign="top" bgcolor="' . $states['descr'] . '">' . $display_desc . '</td>';
    print '</tr></table></td></tr></table></td></tr>';
    return $item;
}