Пример #1
0
 function _serialize($arr, $htmlon = 0)
 {
     if (!function_exists('xml_serialize')) {
         include_once DISCUZ_ROOT . './uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlon);
 }
Пример #2
0
 function _serialize($arr, $htmlon = 0)
 {
     if (!function_exists('xml_serialize')) {
         include_once UC_CLIENT_PATH . 'uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlon);
 }
Пример #3
0
 public static function serialize($arr, $htmlon = 0)
 {
     if (!function_exists('xml_serialize')) {
         include API_ROOT . 'uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlon);
 }
Пример #4
0
 function _serialize($arr, $htmlon = 0)
 {
     if (!function_exists('xml_serialize')) {
         include $this->appdir . 'uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlon);
 }
Пример #5
0
function xml_serialize(&$data, $htmlon = 0, $level = 1)
{
    $space = str_repeat("\t", $level);
    $cdatahead = $htmlon ? '<![CDATA[' : '';
    $cdatafoot = $htmlon ? ']]>' : '';
    $s = '';
    if (!empty($data)) {
        foreach ($data as $key => $val) {
            if (!is_array($val)) {
                $val = "{$cdatahead}{$val}{$cdatafoot}";
                if (is_numeric($key)) {
                    $s .= "{$space}<item_{$key}>{$val}</item_{$key}>";
                } elseif ($key === '') {
                    $s .= '';
                } else {
                    $s .= "{$space}<{$key}>{$val}</{$key}>";
                }
            } else {
                if (is_numeric($key)) {
                    $s .= "{$space}<item_{$key}>" . xml_serialize($val, $htmlon, $level + 1) . "{$space}</item_{$key}>";
                } elseif ($key === '') {
                    $s .= '';
                } else {
                    $s .= "{$space}<{$key}>" . xml_serialize($val, $htmlon, $level + 1) . "{$space}</{$key}>";
                }
            }
        }
    }
    $s = preg_replace("/([-\t\v-\f-])+/", ' ', $s);
    return ($level == 1 ? "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><root>" : '') . $s . ($level == 1 ? '</root>' : '');
}
Пример #6
0
function xml_serialize($arr, $htmlon = FALSE, $isnormal = FALSE, $level = 1) {
	$s = $level == 1 ? "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<root>\r\n" : '';
	$space = str_repeat("\t", $level);
	foreach($arr as $k => $v) {
		if(!is_array($v)) {
			$s .= $space."<item id=\"$k\">".($htmlon ? '<![CDATA[' : '').$v.($htmlon ? ']]>' : '')."</item>\r\n";
		} else {
			$s .= $space."<item id=\"$k\">\r\n".xml_serialize($v, $htmlon, $isnormal, $level + 1).$space."</item>\r\n";
		}
	}
	$s = preg_replace("/([\x01-\x09\x0b-\x0c\x0e-\x1f])+/", ' ', $s);
	return $level == 1 ? $s."</root>" : $s;
}
Пример #7
0
 public static function serialize($arr, $htmlon = false, $isnormal = false, $level = 1)
 {
     $s = $level == 1 ? "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\r\n<root>\r\n" : '';
     $space = str_repeat("\t", $level);
     foreach ($arr as $k => $v) {
         if (!is_array($v)) {
             $s .= $space . "<item id=\"{$k}\">" . ($htmlon ? '<![CDATA[' : '') . $v . ($htmlon ? ']]>' : '') . "</item>\r\n";
         } else {
             $s .= $space . "<item id=\"{$k}\">\r\n" . xml_serialize($v, $htmlon, $isnormal, $level + 1) . $space . "</item>\r\n";
         }
     }
     $s = preg_replace("/([-\v-\f-])+/", ' ', $s);
     return $level == 1 ? $s . "</root>" : $s;
 }
Пример #8
0
 public static function serialize($arr, $htmlOn = 0)
 {
     if (!function_exists('xml_serialize')) {
         require APPPATH . '../uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlOn);
 }
Пример #9
0
function uc_serialize($arr, $htmlon = 0)
{
    include_once '../uc_client/lib/xml.class.php';
    return xml_serialize($arr, $htmlon);
}
Пример #10
0
    case 'POST':
        $row = $model->fetchByPK(@$_GET[$model->pkey]);
        if (is_null($row)) {
            header("HTTP/1.0 404 Not Found");
            exit;
        }
        $pkey = $model->update($PAYLOAD, $_GET);
        if (!$pkey) {
            trigger_error("Failed to update");
            exit;
        }
        header("HTTP/1.0 200 OK");
        exit;
    case 'DELETE':
        $row = $model->fetchByPK(@$_GET[$model->pkey]);
        if (is_null($row)) {
            header("HTTP/1.0 404 Not Found");
            exit;
        }
        if (!$model->deleteByPK(@$_GET[$model->pkey])) {
            trigger_error("Failed to delete");
            exit;
        }
        header("Content-Type:text/xml");
        echo "<?xml version='1.0' ?" . ">";
        echo xml_serialize('result', array('status' => "ok"));
        exit;
    default:
        trigger_error("Unrecognized request-method: " . $REQUEST_METHOD);
        exit;
}
Пример #11
0
 function Export()
 {
     $id = jget('id', 'int');
     $plugin_info = jlogic('plugin')->getpluginbyid($id);
     if ($plugin_info) {
         $export_ary = array();
         $export_ary['Title'] = 'JishiGou! Plugin';
         $export_ary['Version'] = SYS_VERSION;
         $export_ary['Time'] = my_date_format(time());
         $export_ary['Data']['plugin']['available'] = 0;
         $export_ary['Data']['plugin']['name'] = $plugin_info['name'];
         $export_ary['Data']['plugin']['identifier'] = $plugin_info['identifier'];
         $export_ary['Data']['plugin']['description'] = $plugin_info['description'];
         $export_ary['Data']['plugin']['directory'] = $plugin_info['directory'];
         $export_ary['Data']['plugin']['copyright'] = $plugin_info['copyright'];
         $export_ary['Data']['plugin']['version'] = $plugin_info['version'];
         $export_ary['Data']['plugin']['__modules'] = unserialize($plugin_info['modules']);
         $plugin_var = jlogic('plugin')->getpluginvarbyid($id);
         foreach ($plugin_var as $temp => $val) {
             $export_ary['Data']['var'][$temp]['displayorder'] = $val['displayorder'];
             $export_ary['Data']['var'][$temp]['title'] = $val['title'];
             $export_ary['Data']['var'][$temp]['description'] = $val['description'];
             $export_ary['Data']['var'][$temp]['variable'] = $val['variable'];
             $export_ary['Data']['var'][$temp]['type'] = $val['type'];
             $export_ary['Data']['var'][$temp]['value'] = $val['value'];
             $export_ary['Data']['var'][$temp]['extra'] = $val['extra'];
         }
         $plugindir = PLUGIN_DIR . '/' . $plugin_info['directory'];
         if (file_exists($plugindir . '/install.php')) {
             $export_ary['installfile'] = 'install.php';
         }
         if (file_exists($plugindir . '/upgrade.php')) {
             $export_ary['upgradefile'] = 'upgrade.php';
         }
         if (file_exists($plugindir . '/uninstall.php')) {
             $export_ary['uninstallfile'] = 'uninstall.php';
         }
         $xml = xml_serialize($export_ary, true);
         $filename = strtolower(str_replace(array('!', ' '), array('', '_'), 'JishiGou! Plugin')) . '_' . $plugin_info['identifier'] . '.xml';
         ob_end_clean();
         header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
         header('Cache-Control: no-cache, must-revalidate');
         header('Pragma: no-cache');
         header('Content-Encoding: none');
         header('Content-Length: ' . strlen($xml));
         header('Content-Disposition: attachment; filename=' . $filename);
         header('Content-Type: text/xml');
         echo $xml;
         exit;
     } else {
         $this->Messager("未找到该插件", 'admin.php?mod=plugin');
     }
 }
Пример #12
0
function &xml_serialize(&$data, $level = 0, $prior_key = NULL)
{
    if ($level == 0) {
        ob_start();
        echo '<?xml version="1.0" ?>', "\n";
    }
    while (list($key, $value) = each($data)) {
        if (!strpos($key, ' attr')) {
            #if it's not an attribute
            #we don't treat attributes by themselves, so for an empty element
            # that has attributes you still need to set the element to NULL
            if (is_array($value) and array_key_exists(0, $value)) {
                xml_serialize($value, $level, $key);
            } else {
                $tag = $prior_key ? $prior_key : $key;
                echo str_repeat("\t", $level), '<', $tag;
                if (array_key_exists("{$key} attr", $data)) {
                    #if there's an attribute for this element
                    while (list($attr_name, $attr_value) = each($data["{$key} attr"])) {
                        echo ' ', $attr_name, '="', htmlspecialchars($attr_value), '"';
                    }
                    reset($data["{$key} attr"]);
                }
                if (is_null($value)) {
                    echo " />\n";
                } elseif (!is_array($value)) {
                    echo '>', htmlspecialchars($value), "</{$tag}>\n";
                } else {
                    echo ">\n", xml_serialize($value, $level + 1), str_repeat("\t", $level), "</{$tag}>\n";
                }
            }
        }
    }
    reset($data);
    if ($level == 0) {
        $str =& ob_get_contents();
        ob_end_clean();
        return $str;
    }
}
Пример #13
0
 function Publish()
 {
     $id = jget('id', 'int');
     $plugin_info = jlogic('plugin')->getpluginbyid($id);
     if (!$plugin_info) {
         $this->Messager("操作失败!");
     }
     $plugindir = PLUGIN_DIR . '/' . $plugin_info['directory'];
     $tempdir = PLUGIN_DIR . '/' . $plugin_info['directory'] . 'template/';
     if (!is_dir($plugindir)) {
         jio()->MakeDir($plugindir);
     }
     if (!is_dir($tempdir)) {
         jio()->MakeDir($tempdir);
     }
     $export_ary = array();
     $export_ary['Title'] = 'JishiGou! Plugin';
     $export_ary['Version'] = SYS_VERSION;
     $export_ary['Time'] = my_date_format(time());
     $export_ary['Data']['plugin']['available'] = 0;
     $export_ary['Data']['plugin']['name'] = $plugin_info['name'];
     $export_ary['Data']['plugin']['identifier'] = $plugin_info['identifier'];
     $export_ary['Data']['plugin']['description'] = $plugin_info['description'];
     $export_ary['Data']['plugin']['directory'] = $plugin_info['directory'];
     $export_ary['Data']['plugin']['copyright'] = $plugin_info['copyright'];
     $export_ary['Data']['plugin']['version'] = $plugin_info['version'];
     $export_ary['Data']['plugin']['__modules'] = unserialize($plugin_info['modules']);
     $plugin_var = jlogic('plugin')->getpluginvarbyid($id);
     if (is_array($plugin_var)) {
         foreach ($plugin_var as $temp => $val) {
             $export_ary['Data']['var'][$temp]['displayorder'] = $val['displayorder'];
             $export_ary['Data']['var'][$temp]['title'] = $val['title'];
             $export_ary['Data']['var'][$temp]['description'] = $val['description'];
             $export_ary['Data']['var'][$temp]['variable'] = $val['variable'];
             $export_ary['Data']['var'][$temp]['type'] = $val['type'];
             $export_ary['Data']['var'][$temp]['value'] = $val['value'];
             $export_ary['Data']['var'][$temp]['extra'] = $val['extra'];
         }
     }
     $export_ary['installfile'] = 'install.php';
     $export_ary['upgradefile'] = 'upgrade.php';
     $export_ary['uninstallfile'] = 'uninstall.php';
     $xmldata = xml_serialize($export_ary, true);
     $filename = $plugindir . 'jishigou_plugin_' . $plugin_info['identifier'] . '.xml';
     $len = jio()->WriteFile($filename, $xmldata);
     if (false === $len) {
         $this->Messager("文件无法写入,请检查是否有可写权限。");
     }
     $data = "<?php\r\nif(!defined('IN_JISHIGOU')) {\r\n    exit('invalid request');\r\n}\r\n?>";
     jio()->WriteFile($plugindir . $export_ary['installfile'], $data);
     jio()->WriteFile($plugindir . $export_ary['upgradefile'], $data);
     jio()->WriteFile($plugindir . $export_ary['uninstallfile'], $data);
     if (is_array($export_ary['Data']['plugin']['__modules'])) {
         foreach ($export_ary['Data']['plugin']['__modules'] as $var) {
             if ($var['modtype'] == 1) {
                 jio()->WriteFile($plugindir . $var['mod_file'] . '.mod.php', $data);
             } elseif ($var['modtype'] == 5) {
                 jio()->WriteFile($plugindir . $var['mod_file'] . '.class.php', $data);
             } else {
                 jio()->WriteFile($plugindir . $var['mod_file'] . '.inc.php', $data);
                 jio()->WriteFile($tempdir . $var['mod_file'] . '.html', '');
             }
         }
     }
     $sql = "DELETE FROM `" . TABLE_PREFIX . "plugin` WHERE `pluginid` =  '{$id}'";
     $result = $this->DatabaseHandler->Query($sql);
     $sql = "DELETE FROM `" . TABLE_PREFIX . "pluginvar` WHERE `pluginid` =  '{$id}'";
     $result = $this->DatabaseHandler->Query($sql);
     $this->Messager("插件发布成功,请进入插件目录<br>" . $plugindir . "<br>编辑相关文件代码,使其具备你所需要的功能!", '', 10);
 }
Пример #14
0
 function uc_serialize($arr, $htmlon = 0)
 {
     return xml_serialize($arr, $htmlon);
 }
Пример #15
0
function error_handler($errno, $errstr, $errfile, $errline)
{
    if (error_reporting() == 0) {
        return;
    }
    $error = array('code' => $errno, 'message' => $errstr, 'file' => $errfile, 'line' => $errline);
    if (@$GLOBALS['debug']) {
        header("Content-Type:text/xml");
        echo "<?xml version='1.0' ?>";
        echo utf8_encode(xml_serialize('error', $error));
    } else {
        error_log(var_export($error, TRUE) . "\n", 3, dirname(__FILE__) . "/errors.log");
        header("HTTP/1.0 500 Internal Error");
    }
    exit;
}
Пример #16
0
Файл: base.php Проект: cwcw/cms
 function serialize($s, $htmlon = 0)
 {
     if (file_exists(UC_ROOT . RELEASE_ROOT . './lib/xml.class.php')) {
         include_once UC_ROOT . RELEASE_ROOT . './lib/xml.class.php';
     } else {
         include_once UC_ROOT . './lib/xml.class.php';
     }
     return xml_serialize($s, $htmlon);
 }
Пример #17
0
 private function hg_serialize($s, $htmlon = 0)
 {
     include_once 'xml.class.php';
     return xml_serialize($s, $htmlon);
 }
Пример #18
0
 public function getcreditsettings(array $get, array $post)
 {
     if (!$this->config['api_getcreditsettings']) {
         return self::API_RETURN_FORBIDDEN;
     }
     $credits = [];
     return xml_serialize($credits);
 }
Пример #19
0
function XMLserialize($s, $htmlon = 0)
{
    include_once UC_PATH . './xml.class.php';
    return xml_serialize($s, $htmlon);
}
Пример #20
0
 function _serialize($arr, $htmlon = 0)
 {
     if (! function_exists('xml_serialize')) {
         include (ROOT_PATH . 'plugins/uc_client/lib/xml.class.php');
     }
     return xml_serialize($arr, $htmlon);
 }
Пример #21
0
<?php

$result = $model->select(@$_REQUEST['orderby'], @$_REQUEST['direction'], @$_REQUEST['limit'], @$_REQUEST['offset']);
header("Content-Type:text/xml");
echo "<?xml version='1.0' ?>";
echo "<result>\n";
foreach ($result as $row) {
    $row['url'] = url(dirname($_SERVER['PHP_SELF']) . "/contact.php", array($model->pkey => $row[$model->pkey]));
    //	$row['pkey'] = json_serialize($row);
    echo xml_serialize('record', $row);
}
echo "</result>\n";
Пример #22
0
 function _serialize($arr, $htmlon = 0)
 {
     if (!function_exists('xml_serialize')) {
         include_once CURR_PLUGIN_DIR . './uc_client/lib/xml.class.php';
     }
     return xml_serialize($arr, $htmlon);
 }
// require 'hkit.class.php';
// require 'lib-xml-serialize.php';

if ( empty( $_GET['url'] ) )
	die( 'Missing required ?url=' );

$ldap = ldap_connect( 'ldap://twitfave.com/' );
if ( $ldap ) {
	$bind = ldap_bind( $ldap, 'cn=admin,dc=nodomain', 'mfslapd%%' );
	if ( !$bind ) {
		echo 'Failed to connect to LDAP server!';
		exit;
	}
	
	$xml = file_get_contents( 'http://microformatique.com/optimus/?format=json&function=&filter=hcard&uri=' . rawurlencode( $_GET['url'] ) );
	$xml = unserialize( xml_serialize( $xml ) );
	
	foreach ( $xml[0]['c'] as $hC ) {
		// Search for something that would identify this card (email, name?)
		// Update if found, or create a new one
		
		$hC = $hC['c'];
		
		$dn = 'uid=' . md5( microtime() ) . ',o=person,dc=nodomain';
	
		$entry = array();
		$entry['objectClass']     = array( 'top', 'person', 'organizationalPerson', 'inetOrgPerson', 'vCardPerson' );

		$entry['cn']              = array( $hC['fn'], /*$hC['nickname']*/ ); // Common Name
//		$entry['personalTitle']   = array( $hC['n']['honorific-prefix'] );
//		$entry['generationQualifier'] = array( $hC['n']['honorific-suffix'] ); // Jr, Sn, III
Пример #24
0
function uc_serialize($arr, $htmlon = 0)
{
    include_once UC_ROOT . './lib/xml.class.php';
    return xml_serialize($arr, $htmlon);
}
Пример #25
0
 private function _serialize($arr, $htmlon = 0)
 {
     if (!function_exists('xml_serialize')) {
         include_once 'xml.class.php';
     }
     echo xml_serialize($arr, $htmlon);
 }