예제 #1
0
function getXMLString($name = false, $data, $ret = false, $debug = false)
{
    // given string $data, will return the text string content of the $name attribute content of a given valid xml document.
    if ($debug) {
        ezDebug::writeNotice($name, 'getXMLString:name');
    }
    // get information out of eZXML
    $xml = new eZXML();
    $xmlDoc = $data;
    if ($debug) {
        ezDebug::writeNotice($data, 'getXMLString:data');
    }
    // continue only with content
    if ($xmlDoc != null and $name != null) {
        $dom = $xml->domTree($xmlDoc);
        $element = $dom->elementsByName("{$name}");
        if (is_object($element[0])) {
            $string = $element[0]->textContent();
            $ret = $string;
        } else {
            eZDebug::writeNotice('Key "' . $name . '" does not exist.', 'wrap_operator');
        }
    }
    if ($debug) {
        ezDebug::writeNotice($ret, 'getXMLString:ret');
    }
    return $ret;
}
예제 #2
0
function tidy($input, $debug = true, $ret = false)
{
    /*
    if ( $debug )
        ezDebug::writeNotice( 'call', 'getCountryList:fetch' );
    */
    /*
    $PHP_COMMAND='/usr/local/php4.4.4/bin/php -d memory_limit=456M';
    $exec = $PHP_COMMAND . ' update/common/scripts/updatesearchindex2_sub.php ' . $optionString . $objectID;
    */
    // okay - we have valid key.  Let's encrypt the contents now.
    // $call = "$input | /usr/bin/tidy --show-body-only";
    $call = "/usr/bin/tidy --show-body-only";
    // $call .= $this->gpg_decrypt_cmd_parm;
    // $call .= " 3<<< '$key' <<< '$data' ";
    $call .= " <<< '{$input}' ";
    if ($debug) {
        // ezDebug::writeNotice( $call, 'tidy:call' );
        // $last_line = system( $gpg_call, $decrypted );
        // $decrypted = passthru( $gpg_call, $retcode );
        // $decrypted = passthru( $gpg_call, $retcode );
        /* Add redirection so we can get stderr.
           $handle = popen( $call, 'rw' );
           $contents = fread( $handle, 2096 );
           */
        // @exec( $call.' "'..'"', $contents);
        @exec($call, $contents);
    }
    // $contents = shell_exec( $call );
    // $contents = 0;
    if ($debug) {
        ezDebug::writeNotice($contents, 'tidy:ret');
    }
    // $PHP_COMMAND='/usr/local/php4.4.4/bin/php -d memory_limit=456M';
    // $exec="$input|tidy --show-body-only"; // . $optionString . $objectID";
    /*
    $retval='';
    echo "Executing $exec\n";
    $result = passthru( $exec, $retval );
    $ret = $retval;
    */
    $ret = $contents;
    /*
    include_once( 'extension/ezdbug/autoloads/ezdbug.php' );
    $d = new eZDBugOperators();
    $d->ezdbugDump( $contents );
    */
    // echo('<hr />');
    //     die("$call <hr />");
    /*
    if ( $debug )
        ezDebug::writeNotice( $ret, 'getXMLString:ret' );
    */
    return $ret;
}
예제 #3
0
function getCountryList($ret = false, $debug = false)
{
    /*
    if ( $debug )
        ezDebug::writeNotice( 'call', 'getCountryList:fetch' );
    */
    $countryType = new eZCountryType();
    $countries = $countryType->fetchCountryList();
    /*
    include_once( 'extension/ezdbug/autoloads/ezdbug.php' );
    $d = new eZDBugOperators();
    $d->ezdbugDump( $countries );
    */
    $ret =& $countries;
    if ($debug) {
        ezDebug::writeNotice($ret, 'getXMLString:ret');
    }
    return $ret;
}
예제 #4
0
 function getClassAttributes($attribute_names = array())
 {
     $debug = false;
     $db = eZDb::instance();
     $ret = array();
     $result = array();
     $result2 = array();
     if (count($attribute_names) > 1) {
         foreach ($attribute_names as $key => $attribute_name) {
             $sql = "SELECT tmp.id, tmp.identifier from (select ezcontentclass.id, ezcontentclass.identifier from ezcontentclass,ezcontentclass_attribute where (ezcontentclass.id=ezcontentclass_attribute.contentclass_id AND ezcontentclass_attribute.identifier='servizio')) as tmp, ezcontentclass_attribute where tmp.id=ezcontentclass_attribute.contentclass_id AND ezcontentclass_attribute.identifier='argomento'";
             $ret[] = $db->arrayQuery($sql);
         }
     } else {
         foreach ($attribute_names as $key => $attribute_name) {
             $sql = "SELECT ezcontentclass.id, ezcontentclass.identifier \n                FROM ezcontentclass_attribute, ezcontentclass \n                WHERE ezcontentclass.id=ezcontentclass_attribute.contentclass_id \n                AND ezcontentclass_attribute.identifier='" . $attribute_name . "'";
             $ret[] = $db->arrayQuery($sql);
         }
     }
     if ($debug) {
         ezDebug::writeNotice($ret[0], 'getClassAttributes: risultato per ' . implode(',', $attribute_names));
     }
     return $ret[0];
 }