Completed
Branch master (15a86c)
by Michael
06:07
created
class/article.php 1 patch
Indentation   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -48,73 +48,73 @@  discard block
 block discarded – undo
48 48
 
49 49
 class Barticle extends ArtObject
50 50
 {
51
-    /**
52
-     * Constructor
53
-     *
54
-     * @param int $id ID of the article
55
-     */
56
-    function Barticle($id = null)
57
-    {
58
-	    $this->ArtObject();
59
-        $this->table = planet_DB_prefix("article");
60
-        $this->initVar("art_id", XOBJ_DTYPE_INT, null, false);
61
-        $this->initVar("blog_id", XOBJ_DTYPE_INT, 0, true);
51
+	/**
52
+	 * Constructor
53
+	 *
54
+	 * @param int $id ID of the article
55
+	 */
56
+	function Barticle($id = null)
57
+	{
58
+		$this->ArtObject();
59
+		$this->table = planet_DB_prefix("article");
60
+		$this->initVar("art_id", XOBJ_DTYPE_INT, null, false);
61
+		$this->initVar("blog_id", XOBJ_DTYPE_INT, 0, true);
62 62
 
63
-        $this->initVar("art_title", XOBJ_DTYPE_TXTBOX, "");
64
-        $this->initVar("art_content", XOBJ_DTYPE_TXTAREA, "");
65
-        $this->initVar("art_link", XOBJ_DTYPE_TXTBOX, "");
66
-        $this->initVar("art_time", XOBJ_DTYPE_INT, 0);
67
-        $this->initVar("art_author", XOBJ_DTYPE_TXTBOX, "");
63
+		$this->initVar("art_title", XOBJ_DTYPE_TXTBOX, "");
64
+		$this->initVar("art_content", XOBJ_DTYPE_TXTAREA, "");
65
+		$this->initVar("art_link", XOBJ_DTYPE_TXTBOX, "");
66
+		$this->initVar("art_time", XOBJ_DTYPE_INT, 0);
67
+		$this->initVar("art_author", XOBJ_DTYPE_TXTBOX, "");
68 68
 
69
-        $this->initVar("art_views", XOBJ_DTYPE_INT, 0);
70
-        $this->initVar("art_rating", XOBJ_DTYPE_INT, 0);
71
-        $this->initVar("art_rates", XOBJ_DTYPE_INT, 0);
72
-        $this->initVar("art_comments", XOBJ_DTYPE_INT, 0);
69
+		$this->initVar("art_views", XOBJ_DTYPE_INT, 0);
70
+		$this->initVar("art_rating", XOBJ_DTYPE_INT, 0);
71
+		$this->initVar("art_rates", XOBJ_DTYPE_INT, 0);
72
+		$this->initVar("art_comments", XOBJ_DTYPE_INT, 0);
73 73
 
74
-        $this->initVar("dohtml", XOBJ_DTYPE_INT, 1);
75
-        $this->initVar("dosmiley", XOBJ_DTYPE_INT, 1);
76
-        $this->initVar("doxcode", XOBJ_DTYPE_INT, 1);
77
-        $this->initVar("doimage", XOBJ_DTYPE_INT, 1);
78
-        $this->initVar("dobr", XOBJ_DTYPE_INT, 1);
79
-    }
74
+		$this->initVar("dohtml", XOBJ_DTYPE_INT, 1);
75
+		$this->initVar("dosmiley", XOBJ_DTYPE_INT, 1);
76
+		$this->initVar("doxcode", XOBJ_DTYPE_INT, 1);
77
+		$this->initVar("doimage", XOBJ_DTYPE_INT, 1);
78
+		$this->initVar("dobr", XOBJ_DTYPE_INT, 1);
79
+	}
80 80
 
81
-    /**
82
-     * get title of the article
83
-     * 
84
-     * @return string
85
-     */
86
-    function getTitle()
87
-    {
88
-	    $title = $this->getVar("art_title");
81
+	/**
82
+	 * get title of the article
83
+	 * 
84
+	 * @return string
85
+	 */
86
+	function getTitle()
87
+	{
88
+		$title = $this->getVar("art_title");
89 89
 		return $title;
90
-    }
90
+	}
91 91
 
92
-    /**
93
-     * get formatted publish time of the article
94
-     * 
95
- 	 * {@link Config} 
96
- 	 *
97
-     * @param string $format format of time
98
-     * @return string
99
-     */
100
-    function getTime($format = "c")
101
-    {
102
-	    $time = $this->getVar("art_time");
103
-	    if(empty($time)) $time = time();
104
-	    $time = planet_formatTimestamp($time, $format);
92
+	/**
93
+	 * get formatted publish time of the article
94
+	 * 
95
+	 * {@link Config} 
96
+	 *
97
+	 * @param string $format format of time
98
+	 * @return string
99
+	 */
100
+	function getTime($format = "c")
101
+	{
102
+		$time = $this->getVar("art_time");
103
+		if(empty($time)) $time = time();
104
+		$time = planet_formatTimestamp($time, $format);
105 105
 		return $time;
106
-    }
106
+	}
107 107
 
108 108
     
109
-    /**
110
-     * get summary of the article
111
-     * 
112
-     * @param bool 	$actionOnEmpty flag for truncating content if summary is empty
113
-     * @return string
114
-     */
115
-    function &getSummary($length = 0)
116
-    {
117
-	    $content = $this->getVar("art_content");
109
+	/**
110
+	 * get summary of the article
111
+	 * 
112
+	 * @param bool 	$actionOnEmpty flag for truncating content if summary is empty
113
+	 * @return string
114
+	 */
115
+	function &getSummary($length = 0)
116
+	{
117
+		$content = $this->getVar("art_content");
118 118
 		$summary = planet_html2text($content);
119 119
 		if(empty($length)){
120 120
 			$length = $GLOBALS["xoopsModuleConfig"]["display_summary"];
@@ -122,29 +122,29 @@  discard block
 block discarded – undo
122 122
 		if(!empty($length)){
123 123
 			$summary = xoops_substr($summary, 0, $length);
124 124
 		}
125
-	    return $summary;
126
-    }
125
+		return $summary;
126
+	}
127 127
 
128 128
 
129
-    /**
130
-     * get rating average of the article
131
-     * 
132
-     * @param int $decimals decimal length
133
-     * @return numeric
134
-     */
135
-    function getRatingAverage($decimals = 1)
136
-    {
137
-	    $ave=3;
138
-	    if($this->getVar("art_rates")){
139
-	    	$ave = number_format($this->getVar("art_rating")/$this->getVar("art_rates"),$decimals);
140
-    	}
141
-	    return $ave;
142
-    }
129
+	/**
130
+	 * get rating average of the article
131
+	 * 
132
+	 * @param int $decimals decimal length
133
+	 * @return numeric
134
+	 */
135
+	function getRatingAverage($decimals = 1)
136
+	{
137
+		$ave=3;
138
+		if($this->getVar("art_rates")){
139
+			$ave = number_format($this->getVar("art_rating")/$this->getVar("art_rates"),$decimals);
140
+		}
141
+		return $ave;
142
+	}
143 143
 
144
-    function getStar()
145
-    {
146
-	    return $this->getRatingAverage(0);
147
-    }
144
+	function getStar()
145
+	{
146
+		return $this->getRatingAverage(0);
147
+	}
148 148
 }
149 149
 endif;
150 150
 
Please login to merge, or discard this patch.
class/magpie.inc.php 1 patch
Indentation   +468 added lines, -468 removed lines patch added patch discarded remove patch
@@ -32,492 +32,492 @@  discard block
 block discarded – undo
32 32
 *
33 33
 */
34 34
 class MagpieRSS {
35
-    var $parser;
36
-
37
-    var $current_item   = array();  // item currently being parsed
38
-    var $items          = array();  // collection of parsed items
39
-    var $channel        = array();  // hash of channel fields
40
-    var $textinput      = array();
41
-    var $image          = array();
42
-    var $feed_type;
43
-    var $feed_version;
44
-    var $encoding       = '';       // output encoding of parsed rss
45
-
46
-    var $_source_encoding = '';     // only set if we have to parse xml prolog
47
-
48
-    var $ERROR = "";
49
-    var $WARNING = "";
50
-
51
-    // define some constants
52
-
53
-    var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
54
-    var $_KNOWN_ENCODINGS    = array('UTF-8', 'US-ASCII', 'ISO-8859-1');
55
-
56
-    // parser variables, useless if you're not a parser, treat as private
57
-    var $stack              = array(); // parser stack
58
-    var $inchannel          = false;
59
-    var $initem             = false;
60
-    var $incontent          = false; // if in Atom <content mode="xml"> field
61
-    var $intextinput        = false;
62
-    var $inimage            = false;
63
-    var $current_field      = '';
64
-    var $current_namespace  = false;
65
-
66
-
67
-    /**
68
-     *  Set up XML parser, parse source, and return populated RSS object..
69
-     *
70
-     *  @param string $source           string containing the RSS to be parsed
71
-     *
72
-     *  NOTE:  Probably a good idea to leave the encoding options alone unless
73
-     *         you know what you're doing as PHP's character set support is
74
-     *         a little weird.
75
-     *
76
-     *  NOTE:  A lot of this is unnecessary but harmless with PHP5
77
-     *
78
-     *
79
-     *  @param string $output_encoding  output the parsed RSS in this character
80
-     *                                  set defaults to ISO-8859-1 as this is PHP's
81
-     *                                  default.
82
-     *
83
-     *                                  NOTE: might be changed to UTF-8 in future
84
-     *                                  versions.
85
-     *
86
-     *  @param string $input_encoding   the character set of the incoming RSS source.
87
-     *                                  Leave blank and Magpie will try to figure it
88
-     *                                  out.
89
-     *
90
-     *
91
-     *  @param bool   $detect_encoding  if false Magpie won't attempt to detect
92
-     *                                  source encoding. (caveat emptor)
93
-     *
94
-     */
95
-    function MagpieRSS ($source, $output_encoding='ISO-8859-1',
96
-                        $input_encoding=null, $detect_encoding=true)
97
-    {
98
-        # if PHP xml isn't compiled in, die
99
-        #
100
-        if (!function_exists('xml_parser_create')) {
101
-            $this->error( "Failed to load PHP's XML Extension. " .
102
-                          "http://www.php.net/manual/en/ref.xml.php",
103
-                           E_USER_ERROR );
104
-        }
35
+	var $parser;
36
+
37
+	var $current_item   = array();  // item currently being parsed
38
+	var $items          = array();  // collection of parsed items
39
+	var $channel        = array();  // hash of channel fields
40
+	var $textinput      = array();
41
+	var $image          = array();
42
+	var $feed_type;
43
+	var $feed_version;
44
+	var $encoding       = '';       // output encoding of parsed rss
45
+
46
+	var $_source_encoding = '';     // only set if we have to parse xml prolog
47
+
48
+	var $ERROR = "";
49
+	var $WARNING = "";
50
+
51
+	// define some constants
52
+
53
+	var $_CONTENT_CONSTRUCTS = array('content', 'summary', 'info', 'title', 'tagline', 'copyright');
54
+	var $_KNOWN_ENCODINGS    = array('UTF-8', 'US-ASCII', 'ISO-8859-1');
55
+
56
+	// parser variables, useless if you're not a parser, treat as private
57
+	var $stack              = array(); // parser stack
58
+	var $inchannel          = false;
59
+	var $initem             = false;
60
+	var $incontent          = false; // if in Atom <content mode="xml"> field
61
+	var $intextinput        = false;
62
+	var $inimage            = false;
63
+	var $current_field      = '';
64
+	var $current_namespace  = false;
65
+
66
+
67
+	/**
68
+	 *  Set up XML parser, parse source, and return populated RSS object..
69
+	 *
70
+	 *  @param string $source           string containing the RSS to be parsed
71
+	 *
72
+	 *  NOTE:  Probably a good idea to leave the encoding options alone unless
73
+	 *         you know what you're doing as PHP's character set support is
74
+	 *         a little weird.
75
+	 *
76
+	 *  NOTE:  A lot of this is unnecessary but harmless with PHP5
77
+	 *
78
+	 *
79
+	 *  @param string $output_encoding  output the parsed RSS in this character
80
+	 *                                  set defaults to ISO-8859-1 as this is PHP's
81
+	 *                                  default.
82
+	 *
83
+	 *                                  NOTE: might be changed to UTF-8 in future
84
+	 *                                  versions.
85
+	 *
86
+	 *  @param string $input_encoding   the character set of the incoming RSS source.
87
+	 *                                  Leave blank and Magpie will try to figure it
88
+	 *                                  out.
89
+	 *
90
+	 *
91
+	 *  @param bool   $detect_encoding  if false Magpie won't attempt to detect
92
+	 *                                  source encoding. (caveat emptor)
93
+	 *
94
+	 */
95
+	function MagpieRSS ($source, $output_encoding='ISO-8859-1',
96
+						$input_encoding=null, $detect_encoding=true)
97
+	{
98
+		# if PHP xml isn't compiled in, die
99
+		#
100
+		if (!function_exists('xml_parser_create')) {
101
+			$this->error( "Failed to load PHP's XML Extension. " .
102
+						  "http://www.php.net/manual/en/ref.xml.php",
103
+						   E_USER_ERROR );
104
+		}
105 105
 
106
-        list($parser, $source) = $this->create_parser($source,
107
-                $output_encoding, $input_encoding, $detect_encoding);
106
+		list($parser, $source) = $this->create_parser($source,
107
+				$output_encoding, $input_encoding, $detect_encoding);
108 108
 
109 109
 
110
-        if (!is_resource($parser)) {
111
-            $this->error( "Failed to create an instance of PHP's XML parser. " .
112
-                          "http://www.php.net/manual/en/ref.xml.php",
113
-                          E_USER_ERROR );
114
-        }
110
+		if (!is_resource($parser)) {
111
+			$this->error( "Failed to create an instance of PHP's XML parser. " .
112
+						  "http://www.php.net/manual/en/ref.xml.php",
113
+						  E_USER_ERROR );
114
+		}
115 115
 
116 116
 
117
-        $this->parser = $parser;
117
+		$this->parser = $parser;
118 118
 
119
-        # pass in parser, and a reference to this object
120
-        # setup handlers
121
-        #
122
-        xml_set_object( $this->parser, $this );
123
-        xml_set_element_handler($this->parser,
124
-                'feed_start_element', 'feed_end_element' );
119
+		# pass in parser, and a reference to this object
120
+		# setup handlers
121
+		#
122
+		xml_set_object( $this->parser, $this );
123
+		xml_set_element_handler($this->parser,
124
+				'feed_start_element', 'feed_end_element' );
125 125
 
126
-        xml_set_character_data_handler( $this->parser, 'feed_cdata' );
126
+		xml_set_character_data_handler( $this->parser, 'feed_cdata' );
127 127
 
128
-        $status = @xml_parse( $this->parser, $source );
128
+		$status = @xml_parse( $this->parser, $source );
129 129
 
130
-        if (! $status ) {
131
-            $errorcode = xml_get_error_code( $this->parser );
132
-            if ( $errorcode != XML_ERROR_NONE ) {
133
-                $xml_error = xml_error_string( $errorcode );
134
-                $error_line = xml_get_current_line_number($this->parser);
135
-                $error_col = xml_get_current_column_number($this->parser);
136
-                $errormsg = "$xml_error at line $error_line, column $error_col";
130
+		if (! $status ) {
131
+			$errorcode = xml_get_error_code( $this->parser );
132
+			if ( $errorcode != XML_ERROR_NONE ) {
133
+				$xml_error = xml_error_string( $errorcode );
134
+				$error_line = xml_get_current_line_number($this->parser);
135
+				$error_col = xml_get_current_column_number($this->parser);
136
+				$errormsg = "$xml_error at line $error_line, column $error_col";
137 137
 
138
-                $this->error( $errormsg );
139
-            }
140
-        }
138
+				$this->error( $errormsg );
139
+			}
140
+		}
141 141
 
142
-        xml_parser_free( $this->parser );
142
+		xml_parser_free( $this->parser );
143 143
 
144
-        $this->normalize();
144
+		$this->normalize();
145 145
         
146
-    }
146
+	}
147 147
 
148
-    function feed_start_element($p, $element, &$attrs) {
149
-        $el = $element = strtolower($element);
150
-        $attrs = array_change_key_case($attrs, CASE_LOWER);
148
+	function feed_start_element($p, $element, &$attrs) {
149
+		$el = $element = strtolower($element);
150
+		$attrs = array_change_key_case($attrs, CASE_LOWER);
151 151
 
152
-        // check for a namespace, and split if found
153
-        $ns = false;
154
-        if ( strpos( $element, ':' ) ) {
155
-            list($ns, $el) = split( ':', $element, 2);
156
-        }
157
-        if ( $ns and $ns != 'rdf' ) {
158
-            $this->current_namespace = $ns;
159
-        }
152
+		// check for a namespace, and split if found
153
+		$ns = false;
154
+		if ( strpos( $element, ':' ) ) {
155
+			list($ns, $el) = split( ':', $element, 2);
156
+		}
157
+		if ( $ns and $ns != 'rdf' ) {
158
+			$this->current_namespace = $ns;
159
+		}
160 160
 
161
-        # if feed type isn't set, then this is first element of feed
162
-        # identify feed from root element
163
-        #
164
-        if (!isset($this->feed_type) ) {
165
-            if ( $el == 'rdf' ) {
166
-                $this->feed_type = RSS;
167
-                $this->feed_version = '1.0';
168
-            }
169
-            elseif ( $el == 'rss' ) {
170
-                $this->feed_type = RSS;
171
-                $this->feed_version = $attrs['version'];
172
-            }
173
-            elseif ( $el == 'feed' ) {
174
-                $this->feed_type = ATOM;
175
-                $this->feed_version = $attrs['version'];
176
-                $this->inchannel = true;
177
-            }
178
-            return;
179
-        }
161
+		# if feed type isn't set, then this is first element of feed
162
+		# identify feed from root element
163
+		#
164
+		if (!isset($this->feed_type) ) {
165
+			if ( $el == 'rdf' ) {
166
+				$this->feed_type = RSS;
167
+				$this->feed_version = '1.0';
168
+			}
169
+			elseif ( $el == 'rss' ) {
170
+				$this->feed_type = RSS;
171
+				$this->feed_version = $attrs['version'];
172
+			}
173
+			elseif ( $el == 'feed' ) {
174
+				$this->feed_type = ATOM;
175
+				$this->feed_version = $attrs['version'];
176
+				$this->inchannel = true;
177
+			}
178
+			return;
179
+		}
180 180
 
181
-        if ( $el == 'channel' )
182
-        {
183
-            $this->inchannel = true;
184
-        }
185
-        elseif ($el == 'item' or $el == 'entry' )
186
-        {
187
-            $this->initem = true;
188
-            if ( isset($attrs['rdf:about']) ) {
189
-                $this->current_item['about'] = $attrs['rdf:about'];
190
-            }
191
-        }
181
+		if ( $el == 'channel' )
182
+		{
183
+			$this->inchannel = true;
184
+		}
185
+		elseif ($el == 'item' or $el == 'entry' )
186
+		{
187
+			$this->initem = true;
188
+			if ( isset($attrs['rdf:about']) ) {
189
+				$this->current_item['about'] = $attrs['rdf:about'];
190
+			}
191
+		}
192 192
 
193
-        // if we're in the default namespace of an RSS feed,
194
-        //  record textinput or image fields
195
-        elseif (
196
-            $this->feed_type == RSS and
197
-            $this->current_namespace == '' and
198
-            $el == 'textinput' )
199
-        {
200
-            $this->intextinput = true;
201
-        }
193
+		// if we're in the default namespace of an RSS feed,
194
+		//  record textinput or image fields
195
+		elseif (
196
+			$this->feed_type == RSS and
197
+			$this->current_namespace == '' and
198
+			$el == 'textinput' )
199
+		{
200
+			$this->intextinput = true;
201
+		}
202 202
 
203
-        elseif (
204
-            $this->feed_type == RSS and
205
-            $this->current_namespace == '' and
206
-            $el == 'image' )
207
-        {
208
-            $this->inimage = true;
209
-        }
203
+		elseif (
204
+			$this->feed_type == RSS and
205
+			$this->current_namespace == '' and
206
+			$el == 'image' )
207
+		{
208
+			$this->inimage = true;
209
+		}
210 210
 
211
-        # handle atom content constructs
212
-        elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
213
-        {
214
-            // avoid clashing w/ RSS mod_content
215
-            if ($el == 'content' ) {
216
-                $el = 'atom_content';
217
-            }
211
+		# handle atom content constructs
212
+		elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
213
+		{
214
+			// avoid clashing w/ RSS mod_content
215
+			if ($el == 'content' ) {
216
+				$el = 'atom_content';
217
+			}
218 218
 
219
-            $this->incontent = $el;
219
+			$this->incontent = $el;
220 220
 
221 221
 
222
-        }
222
+		}
223 223
 
224
-        // if inside an Atom content construct (e.g. content or summary) field treat tags as text
225
-        elseif ($this->feed_type == ATOM and $this->incontent )
226
-        {
227
-            // if tags are inlined, then flatten
228
-            $attrs_str = join(' ',
229
-                    array_map('map_attrs',
230
-                    array_keys($attrs),
231
-                    array_values($attrs) ) );
224
+		// if inside an Atom content construct (e.g. content or summary) field treat tags as text
225
+		elseif ($this->feed_type == ATOM and $this->incontent )
226
+		{
227
+			// if tags are inlined, then flatten
228
+			$attrs_str = join(' ',
229
+					array_map('map_attrs',
230
+					array_keys($attrs),
231
+					array_values($attrs) ) );
232 232
 
233
-            $this->append_content( "<$element $attrs_str>"  );
233
+			$this->append_content( "<$element $attrs_str>"  );
234 234
 
235
-            array_unshift( $this->stack, $el );
236
-        }
235
+			array_unshift( $this->stack, $el );
236
+		}
237 237
 
238
-        // Atom support many links per containging element.
239
-        // Magpie treats link elements of type rel='alternate'
240
-        // as being equivalent to RSS's simple link element.
241
-        //
242
-        elseif ($this->feed_type == ATOM and $el == 'link' )
243
-        {
244
-            if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
245
-            {
246
-                $link_el = 'link';
247
-            }
248
-            else {
249
-                $link_el = 'link_' . $attrs['rel'];
250
-            }
238
+		// Atom support many links per containging element.
239
+		// Magpie treats link elements of type rel='alternate'
240
+		// as being equivalent to RSS's simple link element.
241
+		//
242
+		elseif ($this->feed_type == ATOM and $el == 'link' )
243
+		{
244
+			if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
245
+			{
246
+				$link_el = 'link';
247
+			}
248
+			else {
249
+				$link_el = 'link_' . $attrs['rel'];
250
+			}
251 251
 
252
-            $this->append($link_el, $attrs['href']);
253
-        }
254
-        // set stack[0] to current element
255
-        else {
256
-            array_unshift($this->stack, $el);
257
-        }
258
-    }
252
+			$this->append($link_el, $attrs['href']);
253
+		}
254
+		// set stack[0] to current element
255
+		else {
256
+			array_unshift($this->stack, $el);
257
+		}
258
+	}
259 259
 
260 260
 
261 261
 
262
-    function feed_cdata ($p, $text) {
262
+	function feed_cdata ($p, $text) {
263 263
 
264
-        if ($this->feed_type == ATOM and $this->incontent)
265
-        {
266
-            $this->append_content( $text );
267
-        }
268
-        else {
269
-            $current_el = join('_', array_reverse($this->stack));
270
-            $this->append($current_el, $text);
271
-        }
272
-    }
264
+		if ($this->feed_type == ATOM and $this->incontent)
265
+		{
266
+			$this->append_content( $text );
267
+		}
268
+		else {
269
+			$current_el = join('_', array_reverse($this->stack));
270
+			$this->append($current_el, $text);
271
+		}
272
+	}
273 273
 
274
-    function feed_end_element ($p, $el) {
275
-        $el = strtolower($el);
274
+	function feed_end_element ($p, $el) {
275
+		$el = strtolower($el);
276 276
 
277
-        if ( $el == 'item' or $el == 'entry' )
278
-        {
279
-            $this->items[] = $this->current_item;
280
-            $this->current_item = array();
281
-            $this->initem = false;
282
-        }
283
-        elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
284
-        {
285
-            $this->intextinput = false;
286
-        }
287
-        elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
288
-        {
289
-            $this->inimage = false;
290
-        }
291
-        elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
292
-        {
293
-            $this->incontent = false;
294
-        }
295
-        elseif ($el == 'channel' or $el == 'feed' )
296
-        {
297
-            $this->inchannel = false;
298
-        }
299
-        elseif ($this->feed_type == ATOM and $this->incontent  ) {
300
-            // balance tags properly
301
-            // note:  i don't think this is actually neccessary
302
-            if ( $this->stack[0] == $el )
303
-            {
304
-                $this->append_content("</$el>");
305
-            }
306
-            else {
307
-                $this->append_content("<$el />");
308
-            }
277
+		if ( $el == 'item' or $el == 'entry' )
278
+		{
279
+			$this->items[] = $this->current_item;
280
+			$this->current_item = array();
281
+			$this->initem = false;
282
+		}
283
+		elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
284
+		{
285
+			$this->intextinput = false;
286
+		}
287
+		elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
288
+		{
289
+			$this->inimage = false;
290
+		}
291
+		elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
292
+		{
293
+			$this->incontent = false;
294
+		}
295
+		elseif ($el == 'channel' or $el == 'feed' )
296
+		{
297
+			$this->inchannel = false;
298
+		}
299
+		elseif ($this->feed_type == ATOM and $this->incontent  ) {
300
+			// balance tags properly
301
+			// note:  i don't think this is actually neccessary
302
+			if ( $this->stack[0] == $el )
303
+			{
304
+				$this->append_content("</$el>");
305
+			}
306
+			else {
307
+				$this->append_content("<$el />");
308
+			}
309 309
 
310
-            array_shift( $this->stack );
311
-        }
312
-        else {
313
-            array_shift( $this->stack );
314
-        }
310
+			array_shift( $this->stack );
311
+		}
312
+		else {
313
+			array_shift( $this->stack );
314
+		}
315 315
 
316
-        $this->current_namespace = false;
317
-    }
316
+		$this->current_namespace = false;
317
+	}
318 318
 
319
-    function concat (&$str1, $str2="") {
320
-        if (!isset($str1) ) {
321
-            $str1="";
322
-        }
323
-        $str1 .= $str2;
324
-    }
319
+	function concat (&$str1, $str2="") {
320
+		if (!isset($str1) ) {
321
+			$str1="";
322
+		}
323
+		$str1 .= $str2;
324
+	}
325 325
 
326 326
 
327 327
 
328
-    function append_content($text) {
329
-        if ( $this->initem ) {
330
-            $this->concat( $this->current_item[ $this->incontent ], $text );
331
-        }
332
-        elseif ( $this->inchannel ) {
333
-            $this->concat( $this->channel[ $this->incontent ], $text );
334
-        }
335
-    }
328
+	function append_content($text) {
329
+		if ( $this->initem ) {
330
+			$this->concat( $this->current_item[ $this->incontent ], $text );
331
+		}
332
+		elseif ( $this->inchannel ) {
333
+			$this->concat( $this->channel[ $this->incontent ], $text );
334
+		}
335
+	}
336 336
 
337
-    // smart append - field and namespace aware
338
-    function append($el, $text) {
339
-        if (!$el) {
340
-            return;
341
-        }
342
-        if ( $this->current_namespace )
343
-        {
344
-            if ( $this->initem ) {
345
-                $this->concat(
346
-                    $this->current_item[ $this->current_namespace ][ $el ], $text);
347
-            }
348
-            elseif ($this->inchannel) {
349
-                $this->concat(
350
-                    $this->channel[ $this->current_namespace][ $el ], $text );
351
-            }
352
-            elseif ($this->intextinput) {
353
-                $this->concat(
354
-                    $this->textinput[ $this->current_namespace][ $el ], $text );
355
-            }
356
-            elseif ($this->inimage) {
357
-                $this->concat(
358
-                    $this->image[ $this->current_namespace ][ $el ], $text );
359
-            }
360
-        }
361
-        else {
362
-            if ( $this->initem ) {
363
-                $this->concat(
364
-                    $this->current_item[ $el ], $text);
365
-            }
366
-            elseif ($this->intextinput) {
367
-                $this->concat(
368
-                    $this->textinput[ $el ], $text );
369
-            }
370
-            elseif ($this->inimage) {
371
-                $this->concat(
372
-                    $this->image[ $el ], $text );
373
-            }
374
-            elseif ($this->inchannel) {
375
-                $this->concat(
376
-                    $this->channel[ $el ], $text );
377
-            }
337
+	// smart append - field and namespace aware
338
+	function append($el, $text) {
339
+		if (!$el) {
340
+			return;
341
+		}
342
+		if ( $this->current_namespace )
343
+		{
344
+			if ( $this->initem ) {
345
+				$this->concat(
346
+					$this->current_item[ $this->current_namespace ][ $el ], $text);
347
+			}
348
+			elseif ($this->inchannel) {
349
+				$this->concat(
350
+					$this->channel[ $this->current_namespace][ $el ], $text );
351
+			}
352
+			elseif ($this->intextinput) {
353
+				$this->concat(
354
+					$this->textinput[ $this->current_namespace][ $el ], $text );
355
+			}
356
+			elseif ($this->inimage) {
357
+				$this->concat(
358
+					$this->image[ $this->current_namespace ][ $el ], $text );
359
+			}
360
+		}
361
+		else {
362
+			if ( $this->initem ) {
363
+				$this->concat(
364
+					$this->current_item[ $el ], $text);
365
+			}
366
+			elseif ($this->intextinput) {
367
+				$this->concat(
368
+					$this->textinput[ $el ], $text );
369
+			}
370
+			elseif ($this->inimage) {
371
+				$this->concat(
372
+					$this->image[ $el ], $text );
373
+			}
374
+			elseif ($this->inchannel) {
375
+				$this->concat(
376
+					$this->channel[ $el ], $text );
377
+			}
378 378
 
379
-        }
380
-    }
381
-
382
-    function normalize () {
383
-        // if atom populate rss fields
384
-        if ( $this->is_atom() ) {
385
-            $this->channel['description'] = $this->channel['tagline'];
386
-            for ( $i = 0; $i < count($this->items); $i++) {
387
-                $item = $this->items[$i];
388
-                if ( isset($item['summary']) )
389
-                    $item['description'] = $item['summary'];
390
-                if ( isset($item['atom_content']))
391
-                    $item['content']['encoded'] = $item['atom_content'];
392
-
393
-                $atom_date = (isset($item['issued']) ) ? $item['issued'] : @$item['modified'];
394
-                if ( $atom_date ) {
395
-                    $epoch = @parse_w3cdtf($atom_date);
396
-                    if ($epoch and $epoch > 0) {
397
-                        $item['date_timestamp'] = $epoch;
398
-                    }
399
-                }
400
-
401
-                $this->items[$i] = $item;
402
-            }
403
-        }
404
-        elseif ( $this->is_rss() ) {
405
-            $this->channel['tagline'] = $this->channel['description'];
406
-            for ( $i = 0; $i < count($this->items); $i++) {
407
-                $item = $this->items[$i];
408
-                if ( isset($item['description']))
409
-                    $item['summary'] = $item['description'];
410
-                if ( isset($item['content']['encoded'] ) )
411
-                    $item['atom_content'] = $item['content']['encoded'];
412
-
413
-                if ( $this->is_rss() == '1.0' and isset($item['dc']['date']) ) {
414
-                    $epoch = @parse_w3cdtf($item['dc']['date']);
415
-                    if ($epoch and $epoch > 0) {
416
-                        $item['date_timestamp'] = $epoch;
417
-                    }
418
-                }
419
-                elseif ( isset($item['pubdate']) ) {
420
-                    $epoch = @strtotime($item['pubdate']);
421
-                    if ($epoch > 0) {
422
-                        $item['date_timestamp'] = $epoch;
423
-                    }
424
-                }
425
-
426
-                $this->items[$i] = $item;
427
-            }
428
-        }
429
-    }
379
+		}
380
+	}
430 381
 
382
+	function normalize () {
383
+		// if atom populate rss fields
384
+		if ( $this->is_atom() ) {
385
+			$this->channel['description'] = $this->channel['tagline'];
386
+			for ( $i = 0; $i < count($this->items); $i++) {
387
+				$item = $this->items[$i];
388
+				if ( isset($item['summary']) )
389
+					$item['description'] = $item['summary'];
390
+				if ( isset($item['atom_content']))
391
+					$item['content']['encoded'] = $item['atom_content'];
392
+
393
+				$atom_date = (isset($item['issued']) ) ? $item['issued'] : @$item['modified'];
394
+				if ( $atom_date ) {
395
+					$epoch = @parse_w3cdtf($atom_date);
396
+					if ($epoch and $epoch > 0) {
397
+						$item['date_timestamp'] = $epoch;
398
+					}
399
+				}
400
+
401
+				$this->items[$i] = $item;
402
+			}
403
+		}
404
+		elseif ( $this->is_rss() ) {
405
+			$this->channel['tagline'] = $this->channel['description'];
406
+			for ( $i = 0; $i < count($this->items); $i++) {
407
+				$item = $this->items[$i];
408
+				if ( isset($item['description']))
409
+					$item['summary'] = $item['description'];
410
+				if ( isset($item['content']['encoded'] ) )
411
+					$item['atom_content'] = $item['content']['encoded'];
412
+
413
+				if ( $this->is_rss() == '1.0' and isset($item['dc']['date']) ) {
414
+					$epoch = @parse_w3cdtf($item['dc']['date']);
415
+					if ($epoch and $epoch > 0) {
416
+						$item['date_timestamp'] = $epoch;
417
+					}
418
+				}
419
+				elseif ( isset($item['pubdate']) ) {
420
+					$epoch = @strtotime($item['pubdate']);
421
+					if ($epoch > 0) {
422
+						$item['date_timestamp'] = $epoch;
423
+					}
424
+				}
425
+
426
+				$this->items[$i] = $item;
427
+			}
428
+		}
429
+	}
431 430
 
432
-    function is_rss () {
433
-        if ( $this->feed_type == RSS ) {
434
-            return $this->feed_version;
435
-        }
436
-        else {
437
-            return false;
438
-        }
439
-    }
440 431
 
441
-    function is_atom() {
442
-        if ( $this->feed_type == ATOM ) {
443
-            return $this->feed_version;
444
-        }
445
-        else {
446
-            return false;
447
-        }
448
-    }
449
-
450
-    /**
451
-    * return XML parser, and possibly re-encoded source
452
-    *
453
-    */
454
-    function create_parser($source, $out_enc, $in_enc, $detect) {
455
-        if ( substr(phpversion(),0,1) == 5) {
456
-            $parser = $this->php5_create_parser($in_enc, $detect);
457
-        }
458
-        else {
459
-            list($parser, $source) = $this->php4_create_parser($source, $in_enc, $detect);
460
-        }
461
-        if ($out_enc) {
462
-            $this->encoding = $out_enc;
463
-            xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $out_enc);
464
-        }
432
+	function is_rss () {
433
+		if ( $this->feed_type == RSS ) {
434
+			return $this->feed_version;
435
+		}
436
+		else {
437
+			return false;
438
+		}
439
+	}
465 440
 
466
-        return array($parser, $source);
467
-    }
468
-
469
-    /**
470
-    * Instantiate an XML parser under PHP5
471
-    *
472
-    * PHP5 will do a fine job of detecting input encoding
473
-    * if passed an empty string as the encoding.
474
-    *
475
-    * All hail libxml2!
476
-    *
477
-    */
478
-    function php5_create_parser($in_enc, $detect) {
479
-        // by default php5 does a fine job of detecting input encodings
480
-        if(!$detect && $in_enc) {
481
-            return xml_parser_create($in_enc);
482
-        }
483
-        else {
484
-            return xml_parser_create('');
485
-        }
486
-    }
487
-
488
-    /**
489
-    * Instaniate an XML parser under PHP4
490
-    *
491
-    * Unfortunately PHP4's support for character encodings
492
-    * and especially XML and character encodings sucks.  As
493
-    * long as the documents you parse only contain characters
494
-    * from the ISO-8859-1 character set (a superset of ASCII,
495
-    * and a subset of UTF-8) you're fine.  However once you
496
-    * step out of that comfy little world things get mad, bad,
497
-    * and dangerous to know.
498
-    *
499
-    * The following code is based on SJM's work with FoF
500
-    * @see http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
501
-    *
502
-    */
503
-    function php4_create_parser($source, $in_enc, $detect) {
504
-        if ( !$detect ) {
505
-            return array(xml_parser_create($in_enc), $source);
506
-        }
441
+	function is_atom() {
442
+		if ( $this->feed_type == ATOM ) {
443
+			return $this->feed_version;
444
+		}
445
+		else {
446
+			return false;
447
+		}
448
+	}
507 449
 
508
-        if (!$in_enc) {
509
-            if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) {
510
-                $in_enc = strtoupper($m[1]);
511
-                $this->source_encoding = $in_enc;
512
-            }
513
-            else {
514
-                $in_enc = 'UTF-8';
515
-            }
516
-        }
450
+	/**
451
+	 * return XML parser, and possibly re-encoded source
452
+	 *
453
+	 */
454
+	function create_parser($source, $out_enc, $in_enc, $detect) {
455
+		if ( substr(phpversion(),0,1) == 5) {
456
+			$parser = $this->php5_create_parser($in_enc, $detect);
457
+		}
458
+		else {
459
+			list($parser, $source) = $this->php4_create_parser($source, $in_enc, $detect);
460
+		}
461
+		if ($out_enc) {
462
+			$this->encoding = $out_enc;
463
+			xml_parser_set_option($parser, XML_OPTION_TARGET_ENCODING, $out_enc);
464
+		}
517 465
 
518
-        if ($this->known_encoding($in_enc)) {
519
-            return array(xml_parser_create($in_enc), $source);
520
-        }
466
+		return array($parser, $source);
467
+	}
468
+
469
+	/**
470
+	 * Instantiate an XML parser under PHP5
471
+	 *
472
+	 * PHP5 will do a fine job of detecting input encoding
473
+	 * if passed an empty string as the encoding.
474
+	 *
475
+	 * All hail libxml2!
476
+	 *
477
+	 */
478
+	function php5_create_parser($in_enc, $detect) {
479
+		// by default php5 does a fine job of detecting input encodings
480
+		if(!$detect && $in_enc) {
481
+			return xml_parser_create($in_enc);
482
+		}
483
+		else {
484
+			return xml_parser_create('');
485
+		}
486
+	}
487
+
488
+	/**
489
+	 * Instaniate an XML parser under PHP4
490
+	 *
491
+	 * Unfortunately PHP4's support for character encodings
492
+	 * and especially XML and character encodings sucks.  As
493
+	 * long as the documents you parse only contain characters
494
+	 * from the ISO-8859-1 character set (a superset of ASCII,
495
+	 * and a subset of UTF-8) you're fine.  However once you
496
+	 * step out of that comfy little world things get mad, bad,
497
+	 * and dangerous to know.
498
+	 *
499
+	 * The following code is based on SJM's work with FoF
500
+	 * @see http://minutillo.com/steve/weblog/2004/6/17/php-xml-and-character-encodings-a-tale-of-sadness-rage-and-data-loss
501
+	 *
502
+	 */
503
+	function php4_create_parser($source, $in_enc, $detect) {
504
+		if ( !$detect ) {
505
+			return array(xml_parser_create($in_enc), $source);
506
+		}
507
+
508
+		if (!$in_enc) {
509
+			if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/m', $source, $m)) {
510
+				$in_enc = strtoupper($m[1]);
511
+				$this->source_encoding = $in_enc;
512
+			}
513
+			else {
514
+				$in_enc = 'UTF-8';
515
+			}
516
+		}
517
+
518
+		if ($this->known_encoding($in_enc)) {
519
+			return array(xml_parser_create($in_enc), $source);
520
+		}
521 521
 
522 522
 		/*
523 523
         // the dectected encoding is not one of the simple encodings PHP knows
@@ -548,44 +548,44 @@  discard block
 block discarded – undo
548 548
                      E_USER_NOTICE);
549 549
 		*/
550 550
 
551
-        return array(xml_parser_create(), $source);
552
-    }
551
+		return array(xml_parser_create(), $source);
552
+	}
553 553
 
554
-    function known_encoding($enc) {
555
-        $enc = strtoupper($enc);
556
-        if ( in_array($enc, $this->_KNOWN_ENCODINGS) ) {
557
-            return $enc;
558
-        }
559
-        else {
560
-            return false;
561
-        }
562
-    }
554
+	function known_encoding($enc) {
555
+		$enc = strtoupper($enc);
556
+		if ( in_array($enc, $this->_KNOWN_ENCODINGS) ) {
557
+			return $enc;
558
+		}
559
+		else {
560
+			return false;
561
+		}
562
+	}
563 563
 
564
-    function error ($errormsg, $lvl=E_USER_WARNING) {
565
-        // append PHP's error message if track_errors enabled
566
-        if ( !empty($php_errormsg) ) {
567
-            $errormsg .= " ($php_errormsg)";
568
-        }
569
-        if ( MAGPIE_DEBUG ) {
570
-            trigger_error( $errormsg, $lvl);
571
-        }
572
-        else {
573
-            error_log( $errormsg, 0);
574
-        }
564
+	function error ($errormsg, $lvl=E_USER_WARNING) {
565
+		// append PHP's error message if track_errors enabled
566
+		if ( !empty($php_errormsg) ) {
567
+			$errormsg .= " ($php_errormsg)";
568
+		}
569
+		if ( MAGPIE_DEBUG ) {
570
+			trigger_error( $errormsg, $lvl);
571
+		}
572
+		else {
573
+			error_log( $errormsg, 0);
574
+		}
575 575
 
576
-        $notices = E_USER_NOTICE|E_NOTICE;
577
-        if ( $lvl&$notices ) {
578
-            $this->WARNING = $errormsg;
579
-        } else {
580
-            $this->ERROR = $errormsg;
581
-        }
582
-    }
576
+		$notices = E_USER_NOTICE|E_NOTICE;
577
+		if ( $lvl&$notices ) {
578
+			$this->WARNING = $errormsg;
579
+		} else {
580
+			$this->ERROR = $errormsg;
581
+		}
582
+	}
583 583
 
584 584
 
585 585
 } // end class RSS
586 586
 
587 587
 function map_attrs($k, $v) {
588
-    return "$k=\"$v\"";
588
+	return "$k=\"$v\"";
589 589
 }
590 590
 
591 591
 
Please login to merge, or discard this patch.
class/blog.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -48,25 +48,25 @@  discard block
 block discarded – undo
48 48
 
49 49
 class Bblog extends ArtObject
50 50
 {
51
-    /**
52
-     * Constructor
53
-     */
54
-    function Bblog()
55
-    {
56
-	    $this->ArtObject();
57
-        $this->table = planet_DB_prefix("blog");
58
-        $this->initVar("blog_id", XOBJ_DTYPE_INT, null, false);
59
-        $this->initVar("blog_title", XOBJ_DTYPE_TXTBOX, null, true);
60
-        $this->initVar("blog_desc", XOBJ_DTYPE_TXTBOX, null);
61
-        /* rss URI */
62
-        $this->initVar("blog_feed", XOBJ_DTYPE_TXTBOX, null, true);
63
-        $this->initVar("blog_language", XOBJ_DTYPE_TXTBOX, null);
64
-        $this->initVar("blog_charset", XOBJ_DTYPE_TXTBOX, null);
65
-        /* blog website */
66
-        $this->initVar("blog_link", XOBJ_DTYPE_TXTBOX, null);
67
-        $this->initVar("blog_image", XOBJ_DTYPE_TXTBOX, null);
51
+	/**
52
+	 * Constructor
53
+	 */
54
+	function Bblog()
55
+	{
56
+		$this->ArtObject();
57
+		$this->table = planet_DB_prefix("blog");
58
+		$this->initVar("blog_id", XOBJ_DTYPE_INT, null, false);
59
+		$this->initVar("blog_title", XOBJ_DTYPE_TXTBOX, null, true);
60
+		$this->initVar("blog_desc", XOBJ_DTYPE_TXTBOX, null);
61
+		/* rss URI */
62
+		$this->initVar("blog_feed", XOBJ_DTYPE_TXTBOX, null, true);
63
+		$this->initVar("blog_language", XOBJ_DTYPE_TXTBOX, null);
64
+		$this->initVar("blog_charset", XOBJ_DTYPE_TXTBOX, null);
65
+		/* blog website */
66
+		$this->initVar("blog_link", XOBJ_DTYPE_TXTBOX, null);
67
+		$this->initVar("blog_image", XOBJ_DTYPE_TXTBOX, null);
68 68
         
69
-        /* regexp for blog article trackback
69
+		/* regexp for blog article trackback
70 70
          * From article url to article trackback URI
71 71
          *
72 72
          * For example: http://www.example.com/blog/111.html => http://www.example.com/blog/trackback/111.html
@@ -77,68 +77,68 @@  discard block
 block discarded – undo
77 77
          * The input shall be: pattern[SPACE]replacement
78 78
          *                     (.*wordpress/)(index.php)?(\?p.*) $1wp-trackback/$3      
79 79
          */
80
-        $this->initVar("blog_trackback", XOBJ_DTYPE_TXTBOX, "");
80
+		$this->initVar("blog_trackback", XOBJ_DTYPE_TXTBOX, "");
81 81
         
82
-        /* blog submitter: is_numeric - uid; is_string - IP */
83
-        $this->initVar("blog_submitter", XOBJ_DTYPE_TXTBOX, "");
82
+		/* blog submitter: is_numeric - uid; is_string - IP */
83
+		$this->initVar("blog_submitter", XOBJ_DTYPE_TXTBOX, "");
84 84
         
85
-        /* blog status: 0 - pending; 1 - active; 2 - featured */ 
86
-        $this->initVar("blog_status", XOBJ_DTYPE_INT, 1);
85
+		/* blog status: 0 - pending; 1 - active; 2 - featured */ 
86
+		$this->initVar("blog_status", XOBJ_DTYPE_INT, 1);
87 87
         
88
-        /* key for blog content */
89
-        $this->initVar("blog_key", XOBJ_DTYPE_TXTBOX, "");
88
+		/* key for blog content */
89
+		$this->initVar("blog_key", XOBJ_DTYPE_TXTBOX, "");
90 90
         
91
-        $this->initVar("blog_time", XOBJ_DTYPE_INT, 0);
92
-        $this->initVar("blog_rating", XOBJ_DTYPE_INT, 0);
93
-        $this->initVar("blog_rates", XOBJ_DTYPE_INT, 0);
94
-        /* bookmark times */
95
-        $this->initVar("blog_marks", XOBJ_DTYPE_INT, 0);
96
-    }
91
+		$this->initVar("blog_time", XOBJ_DTYPE_INT, 0);
92
+		$this->initVar("blog_rating", XOBJ_DTYPE_INT, 0);
93
+		$this->initVar("blog_rates", XOBJ_DTYPE_INT, 0);
94
+		/* bookmark times */
95
+		$this->initVar("blog_marks", XOBJ_DTYPE_INT, 0);
96
+	}
97 97
 
98
-    /**
99
-     * get formatted publish time of the article
100
-     * 
101
- 	 * {@link Config} 
102
- 	 *
103
-     * @param string $format format of time
104
-     * @return string
105
-     */
106
-    function getTime($format ="")
107
-    {
108
-	    $time = planet_formatTimestamp($this->getVar("blog_time"), $format);
98
+	/**
99
+	 * get formatted publish time of the article
100
+	 * 
101
+	 * {@link Config} 
102
+	 *
103
+	 * @param string $format format of time
104
+	 * @return string
105
+	 */
106
+	function getTime($format ="")
107
+	{
108
+		$time = planet_formatTimestamp($this->getVar("blog_time"), $format);
109 109
 		return $time;
110
-    }
110
+	}
111 111
     
112
-    /**
113
-     * get verified image url of the category
114
-     * 
115
-     * @return 	string
116
-     */
117
-    function getImage()
118
-    {
112
+	/**
113
+	 * get verified image url of the category
114
+	 * 
115
+	 * @return 	string
116
+	 */
117
+	function getImage()
118
+	{
119 119
 		$image = $this->getVar("blog_image");
120 120
 		return $image;
121
-    }
121
+	}
122 122
     
123
-    /**
124
-     * get rating average of the article
125
-     * 
126
-     * @param int $decimals decimal length
127
-     * @return numeric
128
-     */
129
-    function getRatingAverage($decimals = 1)
130
-    {
131
-	    $ave=3;
132
-	    if($this->getVar("blog_rates")){
133
-	    	$ave = number_format($this->getVar("blog_rating")/$this->getVar("blog_rates"),$decimals);
134
-    	}
135
-	    return $ave;
136
-    }
123
+	/**
124
+	 * get rating average of the article
125
+	 * 
126
+	 * @param int $decimals decimal length
127
+	 * @return numeric
128
+	 */
129
+	function getRatingAverage($decimals = 1)
130
+	{
131
+		$ave=3;
132
+		if($this->getVar("blog_rates")){
133
+			$ave = number_format($this->getVar("blog_rating")/$this->getVar("blog_rates"),$decimals);
134
+		}
135
+		return $ave;
136
+	}
137 137
 
138
-    function getStar()
139
-    {
140
-	    return $this->getRatingAverage(0);
141
-    }
138
+	function getStar()
139
+	{
140
+		return $this->getRatingAverage(0);
141
+	}
142 142
 }
143 143
 endif;
144 144
 /**
Please login to merge, or discard this patch.
class/rate.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -34,17 +34,17 @@
 block discarded – undo
34 34
 if(!class_exists("Brate")):
35 35
 class Brate extends ArtObject
36 36
 {
37
-    function Brate($id = null)
38
-    {
39
-	    $this->ArtObject();
40
-        $this->table = planet_DB_prefix("rate");
41
-        $this->initVar("rate_id", XOBJ_DTYPE_INT, null, false);
42
-        $this->initVar("art_id", XOBJ_DTYPE_INT, 0, true);
43
-        $this->initVar("rate_uid", XOBJ_DTYPE_INT, 0);
44
-        $this->initVar("rate_ip", XOBJ_DTYPE_INT, 0);
45
-        $this->initVar("rate_rating", XOBJ_DTYPE_INT, 0, true);
46
-        $this->initVar("rate_time", XOBJ_DTYPE_INT, 0, true);
47
-    }
37
+	function Brate($id = null)
38
+	{
39
+		$this->ArtObject();
40
+		$this->table = planet_DB_prefix("rate");
41
+		$this->initVar("rate_id", XOBJ_DTYPE_INT, null, false);
42
+		$this->initVar("art_id", XOBJ_DTYPE_INT, 0, true);
43
+		$this->initVar("rate_uid", XOBJ_DTYPE_INT, 0);
44
+		$this->initVar("rate_ip", XOBJ_DTYPE_INT, 0);
45
+		$this->initVar("rate_rating", XOBJ_DTYPE_INT, 0, true);
46
+		$this->initVar("rate_time", XOBJ_DTYPE_INT, 0, true);
47
+	}
48 48
 }
49 49
 endif;
50 50
 
Please login to merge, or discard this patch.
class/xml.php 1 patch
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -84,63 +84,63 @@
 block discarded – undo
84 84
 if(!class_exists("Xmlfeed")){
85 85
 class Bxmlfeed extends UniversalFeedCreator
86 86
 {
87
-    var $version;
88
-    var $filename= "";
89
-
90
-    function Bxmlfeed($version)
91
-    {
92
-    	$this->filename= XOOPS_CACHE_PATH."/feed.xml";
93
-        $this->version = $version;
94
-    }
95
-
96
-    function setVar($var, $val, $encoding = false)
97
-    {
98
-	    if(!empty($encoding)) $val = $this->convert_encoding($val);
99
-        $this->$var = $val;
100
-    }
87
+	var $version;
88
+	var $filename= "";
89
+
90
+	function Bxmlfeed($version)
91
+	{
92
+		$this->filename= XOOPS_CACHE_PATH."/feed.xml";
93
+		$this->version = $version;
94
+	}
95
+
96
+	function setVar($var, $val, $encoding = false)
97
+	{
98
+		if(!empty($encoding)) $val = $this->convert_encoding($val);
99
+		$this->$var = $val;
100
+	}
101 101
     
102
-    function convert_encoding($val)    
103
-    {
104
-	    if(is_array($val)){
105
-		    foreach(array_keys($val) as $key){
106
-			    $val[$key] = $this->convert_encoding($val[$key]);
107
-		    }
108
-	    }else{
109
-		    $val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET);
110
-	    }
111
-	    return $val;
112
-    }
113
-
114
-    function getVar($var)
115
-    {
116
-        return $this->$var;
117
-    }
118
-
119
-    function setImage(&$img)
120
-    {
121
-	    $image = new FeedImage();
122
-	    foreach($img as $key=>$val){
123
-		    $image->$key = $this->convert_encoding($val);
124
-	    }
125
-	    $this->setVar("image", $image);
126
-    }
127
-
128
-    function _addItem(&$itm)
129
-    {
130
-    	$item = new FeedItem();
131
-	    foreach($itm as $key=>$val){
132
-		    $item->$key = $this->convert_encoding($val);
133
-	    }
134
-	    $this->addItem($item);
135
-    }
136
-
137
-    function addItems(&$items)
138
-    {
139
-	    if(!is_array($items) || count($items)==0) return;
140
-	    foreach($items as $item){
141
-		    $this->_addItem($item);
142
-	    }
143
-    }
102
+	function convert_encoding($val)    
103
+	{
104
+		if(is_array($val)){
105
+			foreach(array_keys($val) as $key){
106
+				$val[$key] = $this->convert_encoding($val[$key]);
107
+			}
108
+		}else{
109
+			$val = XoopsLocal::convert_encoding($val, $this->encoding, _CHARSET);
110
+		}
111
+		return $val;
112
+	}
113
+
114
+	function getVar($var)
115
+	{
116
+		return $this->$var;
117
+	}
118
+
119
+	function setImage(&$img)
120
+	{
121
+		$image = new FeedImage();
122
+		foreach($img as $key=>$val){
123
+			$image->$key = $this->convert_encoding($val);
124
+		}
125
+		$this->setVar("image", $image);
126
+	}
127
+
128
+	function _addItem(&$itm)
129
+	{
130
+		$item = new FeedItem();
131
+		foreach($itm as $key=>$val){
132
+			$item->$key = $this->convert_encoding($val);
133
+		}
134
+		$this->addItem($item);
135
+	}
136
+
137
+	function addItems(&$items)
138
+	{
139
+		if(!is_array($items) || count($items)==0) return;
140
+		foreach($items as $item){
141
+			$this->_addItem($item);
142
+		}
143
+	}
144 144
 }
145 145
 }
146 146
 
Please login to merge, or discard this patch.
class/category.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -48,17 +48,17 @@
 block discarded – undo
48 48
 
49 49
 class Bcategory extends ArtObject
50 50
 {
51
-    /**
52
-     * Constructor
53
-     */
54
-    function Bcategory()
55
-    {
56
-	    $this->ArtObject();
57
-        $this->table = planet_DB_prefix("category");
58
-        $this->initVar("cat_id", XOBJ_DTYPE_INT, null, false);
59
-        $this->initVar("cat_title", XOBJ_DTYPE_TXTBOX, "", true);
60
-        $this->initVar("cat_order", XOBJ_DTYPE_INT, 1, false);
61
-    }
51
+	/**
52
+	 * Constructor
53
+	 */
54
+	function Bcategory()
55
+	{
56
+		$this->ArtObject();
57
+		$this->table = planet_DB_prefix("category");
58
+		$this->initVar("cat_id", XOBJ_DTYPE_INT, null, false);
59
+		$this->initVar("cat_title", XOBJ_DTYPE_TXTBOX, "", true);
60
+		$this->initVar("cat_order", XOBJ_DTYPE_INT, 1, false);
61
+	}
62 62
 }
63 63
 
64 64
 endif;
Please login to merge, or discard this patch.
class/class-IXR.php 1 patch
Indentation   +734 added lines, -734 removed lines patch added patch discarded remove patch
@@ -11,305 +11,305 @@  discard block
 block discarded – undo
11 11
 
12 12
 
13 13
 class IXR_Value {
14
-    var $data;
15
-    var $type;
16
-    function IXR_Value ($data, $type = false) {
17
-        $this->data = $data;
18
-        if (!$type) {
19
-            $type = $this->calculateType();
20
-        }
21
-        $this->type = $type;
22
-        if ($type == 'struct') {
23
-            /* Turn all the values in the array in to new IXR_Value objects */
24
-            foreach ($this->data as $key => $value) {
25
-                $this->data[$key] = new IXR_Value($value);
26
-            }
27
-        }
28
-        if ($type == 'array') {
29
-            for ($i = 0, $j = count($this->data); $i < $j; $i++) {
30
-                $this->data[$i] = new IXR_Value($this->data[$i]);
31
-            }
32
-        }
33
-    }
34
-    function calculateType() {
35
-        if ($this->data === true || $this->data === false) {
36
-            return 'boolean';
37
-        }
38
-        if (is_integer($this->data)) {
39
-            return 'int';
40
-        }
41
-        if (is_double($this->data)) {
42
-            return 'double';
43
-        }
44
-        // Deal with IXR object types base64 and date
45
-        if (is_object($this->data) && is_a($this->data, 'IXR_Date')) {
46
-            return 'date';
47
-        }
48
-        if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) {
49
-            return 'base64';
50
-        }
51
-        // If it is a normal PHP object convert it in to a struct
52
-        if (is_object($this->data)) {
14
+	var $data;
15
+	var $type;
16
+	function IXR_Value ($data, $type = false) {
17
+		$this->data = $data;
18
+		if (!$type) {
19
+			$type = $this->calculateType();
20
+		}
21
+		$this->type = $type;
22
+		if ($type == 'struct') {
23
+			/* Turn all the values in the array in to new IXR_Value objects */
24
+			foreach ($this->data as $key => $value) {
25
+				$this->data[$key] = new IXR_Value($value);
26
+			}
27
+		}
28
+		if ($type == 'array') {
29
+			for ($i = 0, $j = count($this->data); $i < $j; $i++) {
30
+				$this->data[$i] = new IXR_Value($this->data[$i]);
31
+			}
32
+		}
33
+	}
34
+	function calculateType() {
35
+		if ($this->data === true || $this->data === false) {
36
+			return 'boolean';
37
+		}
38
+		if (is_integer($this->data)) {
39
+			return 'int';
40
+		}
41
+		if (is_double($this->data)) {
42
+			return 'double';
43
+		}
44
+		// Deal with IXR object types base64 and date
45
+		if (is_object($this->data) && is_a($this->data, 'IXR_Date')) {
46
+			return 'date';
47
+		}
48
+		if (is_object($this->data) && is_a($this->data, 'IXR_Base64')) {
49
+			return 'base64';
50
+		}
51
+		// If it is a normal PHP object convert it in to a struct
52
+		if (is_object($this->data)) {
53 53
             
54
-            $this->data = get_object_vars($this->data);
55
-            return 'struct';
56
-        }
57
-        if (!is_array($this->data)) {
58
-            return 'string';
59
-        }
60
-        /* We have an array - is it an array or a struct ? */
61
-        if ($this->isStruct($this->data)) {
62
-            return 'struct';
63
-        } else {
64
-            return 'array';
65
-        }
66
-    }
67
-    function getXml() {
68
-        /* Return XML for this value */
69
-        switch ($this->type) {
70
-            case 'boolean':
71
-                return '<boolean>'.(($this->data) ? '1' : '0').'</boolean>';
72
-                break;
73
-            case 'int':
74
-                return '<int>'.$this->data.'</int>';
75
-                break;
76
-            case 'double':
77
-                return '<double>'.$this->data.'</double>';
78
-                break;
79
-            case 'string':
80
-                return '<string>'.htmlspecialchars($this->data).'</string>';
81
-                break;
82
-            case 'array':
83
-                $return = '<array><data>'."\n";
84
-                foreach ($this->data as $item) {
85
-                    $return .= '  <value>'.$item->getXml()."</value>\n";
86
-                }
87
-                $return .= '</data></array>';
88
-                return $return;
89
-                break;
90
-            case 'struct':
91
-                $return = '<struct>'."\n";
92
-                foreach ($this->data as $name => $value) {
93
-                    $return .= "  <member><name>$name</name><value>";
94
-                    $return .= $value->getXml()."</value></member>\n";
95
-                }
96
-                $return .= '</struct>';
97
-                return $return;
98
-                break;
99
-            case 'date':
100
-            case 'base64':
101
-                return $this->data->getXml();
102
-                break;
103
-        }
104
-        return false;
105
-    }
106
-    function isStruct($array) {
107
-        /* Nasty function to check if an array is a struct or not */
108
-        $expected = 0;
109
-        foreach ($array as $key => $value) {
110
-            if ((string)$key != (string)$expected) {
111
-                return true;
112
-            }
113
-            $expected++;
114
-        }
115
-        return false;
116
-    }
54
+			$this->data = get_object_vars($this->data);
55
+			return 'struct';
56
+		}
57
+		if (!is_array($this->data)) {
58
+			return 'string';
59
+		}
60
+		/* We have an array - is it an array or a struct ? */
61
+		if ($this->isStruct($this->data)) {
62
+			return 'struct';
63
+		} else {
64
+			return 'array';
65
+		}
66
+	}
67
+	function getXml() {
68
+		/* Return XML for this value */
69
+		switch ($this->type) {
70
+			case 'boolean':
71
+				return '<boolean>'.(($this->data) ? '1' : '0').'</boolean>';
72
+				break;
73
+			case 'int':
74
+				return '<int>'.$this->data.'</int>';
75
+				break;
76
+			case 'double':
77
+				return '<double>'.$this->data.'</double>';
78
+				break;
79
+			case 'string':
80
+				return '<string>'.htmlspecialchars($this->data).'</string>';
81
+				break;
82
+			case 'array':
83
+				$return = '<array><data>'."\n";
84
+				foreach ($this->data as $item) {
85
+					$return .= '  <value>'.$item->getXml()."</value>\n";
86
+				}
87
+				$return .= '</data></array>';
88
+				return $return;
89
+				break;
90
+			case 'struct':
91
+				$return = '<struct>'."\n";
92
+				foreach ($this->data as $name => $value) {
93
+					$return .= "  <member><name>$name</name><value>";
94
+					$return .= $value->getXml()."</value></member>\n";
95
+				}
96
+				$return .= '</struct>';
97
+				return $return;
98
+				break;
99
+			case 'date':
100
+			case 'base64':
101
+				return $this->data->getXml();
102
+				break;
103
+		}
104
+		return false;
105
+	}
106
+	function isStruct($array) {
107
+		/* Nasty function to check if an array is a struct or not */
108
+		$expected = 0;
109
+		foreach ($array as $key => $value) {
110
+			if ((string)$key != (string)$expected) {
111
+				return true;
112
+			}
113
+			$expected++;
114
+		}
115
+		return false;
116
+	}
117 117
 }
118 118
 
119 119
 
120 120
 class IXR_Message {
121
-    var $message;
122
-    var $messageType;  // methodCall / methodResponse / fault
123
-    var $faultCode;
124
-    var $faultString;
125
-    var $methodName;
126
-    var $params;
127
-    // Current variable stacks
128
-    var $_arraystructs = array();   // The stack used to keep track of the current array/struct
129
-    var $_arraystructstypes = array(); // Stack keeping track of if things are structs or array
130
-    var $_currentStructName = array();  // A stack as well
131
-    var $_param;
132
-    var $_value;
133
-    var $_currentTag;
134
-    var $_currentTagContents;
135
-    // The XML parser
136
-    var $_parser;
137
-    function IXR_Message ($message) {
138
-        $this->message = $message;
139
-    }
140
-    function parse() {
141
-        // first remove the XML declaration
142
-        $this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message);
143
-        if (trim($this->message) == '') {
144
-            return false;
145
-        }
146
-        $this->_parser = xml_parser_create();
147
-        // Set XML parser to take the case of tags in to account
148
-        xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false);
149
-        // Set XML parser callback functions
150
-        xml_set_object($this->_parser, $this);
151
-        xml_set_element_handler($this->_parser, 'tag_open', 'tag_close');
152
-        xml_set_character_data_handler($this->_parser, 'cdata');
153
-        if (!xml_parse($this->_parser, $this->message)) {
154
-            /* die(sprintf('XML error: %s at line %d',
121
+	var $message;
122
+	var $messageType;  // methodCall / methodResponse / fault
123
+	var $faultCode;
124
+	var $faultString;
125
+	var $methodName;
126
+	var $params;
127
+	// Current variable stacks
128
+	var $_arraystructs = array();   // The stack used to keep track of the current array/struct
129
+	var $_arraystructstypes = array(); // Stack keeping track of if things are structs or array
130
+	var $_currentStructName = array();  // A stack as well
131
+	var $_param;
132
+	var $_value;
133
+	var $_currentTag;
134
+	var $_currentTagContents;
135
+	// The XML parser
136
+	var $_parser;
137
+	function IXR_Message ($message) {
138
+		$this->message = $message;
139
+	}
140
+	function parse() {
141
+		// first remove the XML declaration
142
+		$this->message = preg_replace('/<\?xml(.*)?\?'.'>/', '', $this->message);
143
+		if (trim($this->message) == '') {
144
+			return false;
145
+		}
146
+		$this->_parser = xml_parser_create();
147
+		// Set XML parser to take the case of tags in to account
148
+		xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false);
149
+		// Set XML parser callback functions
150
+		xml_set_object($this->_parser, $this);
151
+		xml_set_element_handler($this->_parser, 'tag_open', 'tag_close');
152
+		xml_set_character_data_handler($this->_parser, 'cdata');
153
+		if (!xml_parse($this->_parser, $this->message)) {
154
+			/* die(sprintf('XML error: %s at line %d',
155 155
                 xml_error_string(xml_get_error_code($this->_parser)),
156 156
                 xml_get_current_line_number($this->_parser))); */
157
-            return false;
158
-        }
159
-        xml_parser_free($this->_parser);
160
-        // Grab the error messages, if any
161
-        if ($this->messageType == 'fault') {
162
-            $this->faultCode = $this->params[0]['faultCode'];
163
-            $this->faultString = $this->params[0]['faultString'];
164
-        }
165
-        return true;
166
-    }
167
-    function tag_open($parser, $tag, $attr) {
168
-        $this->currentTag = $tag;
169
-        switch($tag) {
170
-            case 'methodCall':
171
-            case 'methodResponse':
172
-            case 'fault':
173
-                $this->messageType = $tag;
174
-                break;
175
-            /* Deal with stacks of arrays and structs */
176
-            case 'data':    // data is to all intents and puposes more interesting than array
177
-                $this->_arraystructstypes[] = 'array';
178
-                $this->_arraystructs[] = array();
179
-                break;
180
-            case 'struct':
181
-                $this->_arraystructstypes[] = 'struct';
182
-                $this->_arraystructs[] = array();
183
-                break;
184
-        }
185
-    }
186
-    function cdata($parser, $cdata) {
187
-        $this->_currentTagContents .= $cdata;
188
-    }
189
-    function tag_close($parser, $tag) {
190
-        $valueFlag = false;
191
-        switch($tag) {
192
-            case 'int':
193
-            case 'i4':
194
-                $value = (int)trim($this->_currentTagContents);
195
-                $this->_currentTagContents = '';
196
-                $valueFlag = true;
197
-                break;
198
-            case 'double':
199
-                $value = (double)trim($this->_currentTagContents);
200
-                $this->_currentTagContents = '';
201
-                $valueFlag = true;
202
-                break;
203
-            case 'string':
204
-                $value = (string)trim($this->_currentTagContents);
205
-                $this->_currentTagContents = '';
206
-                $valueFlag = true;
207
-                break;
208
-            case 'dateTime.iso8601':
209
-                $value = new IXR_Date(trim($this->_currentTagContents));
210
-                // $value = $iso->getTimestamp();
211
-                $this->_currentTagContents = '';
212
-                $valueFlag = true;
213
-                break;
214
-            case 'value':
215
-                // "If no type is indicated, the type is string."
216
-                if (trim($this->_currentTagContents) != '') {
217
-                    $value = (string)$this->_currentTagContents;
218
-                    $this->_currentTagContents = '';
219
-                    $valueFlag = true;
220
-                }
221
-                break;
222
-            case 'boolean':
223
-                $value = (boolean)trim($this->_currentTagContents);
224
-                $this->_currentTagContents = '';
225
-                $valueFlag = true;
226
-                break;
227
-            case 'base64':
228
-                $value = base64_decode( trim($this->_currentTagContents) );
229
-                $this->_currentTagContents = '';
230
-                $valueFlag = true;
231
-                break;
232
-            /* Deal with stacks of arrays and structs */
233
-            case 'data':
234
-            case 'struct':
235
-                $value = array_pop($this->_arraystructs);
236
-                array_pop($this->_arraystructstypes);
237
-                $valueFlag = true;
238
-                break;
239
-            case 'member':
240
-                array_pop($this->_currentStructName);
241
-                break;
242
-            case 'name':
243
-                $this->_currentStructName[] = trim($this->_currentTagContents);
244
-                $this->_currentTagContents = '';
245
-                break;
246
-            case 'methodName':
247
-                $this->methodName = trim($this->_currentTagContents);
248
-                $this->_currentTagContents = '';
249
-                break;
250
-        }
251
-        if ($valueFlag) {
252
-            /*
157
+			return false;
158
+		}
159
+		xml_parser_free($this->_parser);
160
+		// Grab the error messages, if any
161
+		if ($this->messageType == 'fault') {
162
+			$this->faultCode = $this->params[0]['faultCode'];
163
+			$this->faultString = $this->params[0]['faultString'];
164
+		}
165
+		return true;
166
+	}
167
+	function tag_open($parser, $tag, $attr) {
168
+		$this->currentTag = $tag;
169
+		switch($tag) {
170
+			case 'methodCall':
171
+			case 'methodResponse':
172
+			case 'fault':
173
+				$this->messageType = $tag;
174
+				break;
175
+			/* Deal with stacks of arrays and structs */
176
+			case 'data':    // data is to all intents and puposes more interesting than array
177
+				$this->_arraystructstypes[] = 'array';
178
+				$this->_arraystructs[] = array();
179
+				break;
180
+			case 'struct':
181
+				$this->_arraystructstypes[] = 'struct';
182
+				$this->_arraystructs[] = array();
183
+				break;
184
+		}
185
+	}
186
+	function cdata($parser, $cdata) {
187
+		$this->_currentTagContents .= $cdata;
188
+	}
189
+	function tag_close($parser, $tag) {
190
+		$valueFlag = false;
191
+		switch($tag) {
192
+			case 'int':
193
+			case 'i4':
194
+				$value = (int)trim($this->_currentTagContents);
195
+				$this->_currentTagContents = '';
196
+				$valueFlag = true;
197
+				break;
198
+			case 'double':
199
+				$value = (double)trim($this->_currentTagContents);
200
+				$this->_currentTagContents = '';
201
+				$valueFlag = true;
202
+				break;
203
+			case 'string':
204
+				$value = (string)trim($this->_currentTagContents);
205
+				$this->_currentTagContents = '';
206
+				$valueFlag = true;
207
+				break;
208
+			case 'dateTime.iso8601':
209
+				$value = new IXR_Date(trim($this->_currentTagContents));
210
+				// $value = $iso->getTimestamp();
211
+				$this->_currentTagContents = '';
212
+				$valueFlag = true;
213
+				break;
214
+			case 'value':
215
+				// "If no type is indicated, the type is string."
216
+				if (trim($this->_currentTagContents) != '') {
217
+					$value = (string)$this->_currentTagContents;
218
+					$this->_currentTagContents = '';
219
+					$valueFlag = true;
220
+				}
221
+				break;
222
+			case 'boolean':
223
+				$value = (boolean)trim($this->_currentTagContents);
224
+				$this->_currentTagContents = '';
225
+				$valueFlag = true;
226
+				break;
227
+			case 'base64':
228
+				$value = base64_decode( trim($this->_currentTagContents) );
229
+				$this->_currentTagContents = '';
230
+				$valueFlag = true;
231
+				break;
232
+			/* Deal with stacks of arrays and structs */
233
+			case 'data':
234
+			case 'struct':
235
+				$value = array_pop($this->_arraystructs);
236
+				array_pop($this->_arraystructstypes);
237
+				$valueFlag = true;
238
+				break;
239
+			case 'member':
240
+				array_pop($this->_currentStructName);
241
+				break;
242
+			case 'name':
243
+				$this->_currentStructName[] = trim($this->_currentTagContents);
244
+				$this->_currentTagContents = '';
245
+				break;
246
+			case 'methodName':
247
+				$this->methodName = trim($this->_currentTagContents);
248
+				$this->_currentTagContents = '';
249
+				break;
250
+		}
251
+		if ($valueFlag) {
252
+			/*
253 253
             if (!is_array($value) && !is_object($value)) {
254 254
                 $value = trim($value);
255 255
             }
256 256
             */
257
-            if (count($this->_arraystructs) > 0) {
258
-                // Add value to struct or array
259
-                if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') {
260
-                    // Add to struct
261
-                    $this->_arraystructs[count($this->_arraystructs)-1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value;
262
-                } else {
263
-                    // Add to array
264
-                    $this->_arraystructs[count($this->_arraystructs)-1][] = $value;
265
-                }
266
-            } else {
267
-                // Just add as a paramater
268
-                $this->params[] = $value;
269
-            }
270
-        }
271
-    }       
257
+			if (count($this->_arraystructs) > 0) {
258
+				// Add value to struct or array
259
+				if ($this->_arraystructstypes[count($this->_arraystructstypes)-1] == 'struct') {
260
+					// Add to struct
261
+					$this->_arraystructs[count($this->_arraystructs)-1][$this->_currentStructName[count($this->_currentStructName)-1]] = $value;
262
+				} else {
263
+					// Add to array
264
+					$this->_arraystructs[count($this->_arraystructs)-1][] = $value;
265
+				}
266
+			} else {
267
+				// Just add as a paramater
268
+				$this->params[] = $value;
269
+			}
270
+		}
271
+	}       
272 272
 }
273 273
 
274 274
 
275 275
 class IXR_Server {
276
-    var $data;
277
-    var $callbacks = array();
278
-    var $message;
279
-    var $capabilities;
280
-    function IXR_Server($callbacks = false, $data = false) {
281
-        $this->setCapabilities();
282
-        if ($callbacks) {
283
-            $this->callbacks = $callbacks;
284
-        }
285
-        $this->setCallbacks();
286
-        $this->serve($data);
287
-    }
288
-    function serve($data = false) {
289
-        if (!$data) {
290
-            global $HTTP_RAW_POST_DATA;
291
-            if (!$HTTP_RAW_POST_DATA) {
292
-               die('XML-RPC server accepts POST requests only.');
293
-            }
294
-            $data = $HTTP_RAW_POST_DATA;
295
-        }
296
-        $this->message = new IXR_Message($data);
297
-        if (!$this->message->parse()) {
298
-            $this->error(-32700, 'parse error. not well formed');
299
-        }
300
-        if ($this->message->messageType != 'methodCall') {
301
-            $this->error(-32600, 'server error. invalid xml-rpc. not conforming to spec. Request must be a methodCall');
302
-        }
303
-        $result = $this->call($this->message->methodName, $this->message->params);
304
-        // Is the result an error?
305
-        if (is_a($result, 'IXR_Error')) {
306
-            $this->error($result);
307
-        }
308
-        // Encode the result
309
-        $r = new IXR_Value($result);
310
-        $resultxml = $r->getXml();
311
-        // Create the XML
312
-        $xml = <<<EOD
276
+	var $data;
277
+	var $callbacks = array();
278
+	var $message;
279
+	var $capabilities;
280
+	function IXR_Server($callbacks = false, $data = false) {
281
+		$this->setCapabilities();
282
+		if ($callbacks) {
283
+			$this->callbacks = $callbacks;
284
+		}
285
+		$this->setCallbacks();
286
+		$this->serve($data);
287
+	}
288
+	function serve($data = false) {
289
+		if (!$data) {
290
+			global $HTTP_RAW_POST_DATA;
291
+			if (!$HTTP_RAW_POST_DATA) {
292
+			   die('XML-RPC server accepts POST requests only.');
293
+			}
294
+			$data = $HTTP_RAW_POST_DATA;
295
+		}
296
+		$this->message = new IXR_Message($data);
297
+		if (!$this->message->parse()) {
298
+			$this->error(-32700, 'parse error. not well formed');
299
+		}
300
+		if ($this->message->messageType != 'methodCall') {
301
+			$this->error(-32600, 'server error. invalid xml-rpc. not conforming to spec. Request must be a methodCall');
302
+		}
303
+		$result = $this->call($this->message->methodName, $this->message->params);
304
+		// Is the result an error?
305
+		if (is_a($result, 'IXR_Error')) {
306
+			$this->error($result);
307
+		}
308
+		// Encode the result
309
+		$r = new IXR_Value($result);
310
+		$resultxml = $r->getXml();
311
+		// Create the XML
312
+		$xml = <<<EOD
313 313
 <methodResponse>
314 314
   <params>
315 315
     <param>
@@ -321,265 +321,265 @@  discard block
 block discarded – undo
321 321
 </methodResponse>
322 322
 
323 323
 EOD;
324
-        // Send it
325
-        $this->output($xml);
326
-    }
327
-    function call($methodname, $args) {
328
-        if (!$this->hasMethod($methodname)) {
329
-            return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.');
330
-        }
331
-        $method = $this->callbacks[$methodname];
332
-        // Perform the callback and send the response
333
-        if (count($args) == 1) {
334
-            // If only one paramater just send that instead of the whole array
335
-            $args = $args[0];
336
-        }
337
-        // Are we dealing with a function or a method?
338
-        if (substr($method, 0, 5) == 'this:') {
339
-            // It's a class method - check it exists
340
-            $method = substr($method, 5);
341
-            if (!method_exists($this, $method)) {
342
-                return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.');
343
-            }
344
-            // Call the method
345
-            $result = $this->$method($args);
346
-        } else {
347
-            // It's a function - does it exist?
348
-            if (is_array($method)) {
349
-            	if (!method_exists($method[0], $method[1])) {
350
-                return new IXR_Error(-32601, 'server error. requested object method "'.$method[1].'" does not exist.');
351
-            	}
352
-            } else if (!function_exists($method)) {
353
-                return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.');
354
-            }
355
-            // Call the function
356
-            $result = call_user_func($method, $args);
357
-        }
358
-        return $result;
359
-    }
324
+		// Send it
325
+		$this->output($xml);
326
+	}
327
+	function call($methodname, $args) {
328
+		if (!$this->hasMethod($methodname)) {
329
+			return new IXR_Error(-32601, 'server error. requested method '.$methodname.' does not exist.');
330
+		}
331
+		$method = $this->callbacks[$methodname];
332
+		// Perform the callback and send the response
333
+		if (count($args) == 1) {
334
+			// If only one paramater just send that instead of the whole array
335
+			$args = $args[0];
336
+		}
337
+		// Are we dealing with a function or a method?
338
+		if (substr($method, 0, 5) == 'this:') {
339
+			// It's a class method - check it exists
340
+			$method = substr($method, 5);
341
+			if (!method_exists($this, $method)) {
342
+				return new IXR_Error(-32601, 'server error. requested class method "'.$method.'" does not exist.');
343
+			}
344
+			// Call the method
345
+			$result = $this->$method($args);
346
+		} else {
347
+			// It's a function - does it exist?
348
+			if (is_array($method)) {
349
+				if (!method_exists($method[0], $method[1])) {
350
+				return new IXR_Error(-32601, 'server error. requested object method "'.$method[1].'" does not exist.');
351
+				}
352
+			} else if (!function_exists($method)) {
353
+				return new IXR_Error(-32601, 'server error. requested function "'.$method.'" does not exist.');
354
+			}
355
+			// Call the function
356
+			$result = call_user_func($method, $args);
357
+		}
358
+		return $result;
359
+	}
360 360
 
361
-    function error($error, $message = false) {
362
-        // Accepts either an error object or an error code and message
363
-        if ($message && !is_object($error)) {
364
-            $error = new IXR_Error($error, $message);
365
-        }
366
-        $this->output($error->getXml());
367
-    }
368
-    function output($xml) {
369
-        $xml = '<?xml version="1.0"?>'."\n".$xml;
370
-        $length = strlen($xml);
371
-        header('Connection: close');
372
-        header('Content-Length: '.$length);
373
-        header('Content-Type: text/xml');
374
-        header('Date: '.date('r'));
375
-        echo $xml;
376
-        exit;
377
-    }
378
-    function hasMethod($method) {
379
-        return in_array($method, array_keys($this->callbacks));
380
-    }
381
-    function setCapabilities() {
382
-        // Initialises capabilities array
383
-        $this->capabilities = array(
384
-            'xmlrpc' => array(
385
-                'specUrl' => 'http://www.xmlrpc.com/spec',
386
-                'specVersion' => 1
387
-            ),
388
-            'faults_interop' => array(
389
-                'specUrl' => 'http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php',
390
-                'specVersion' => 20010516
391
-            ),
392
-            'system.multicall' => array(
393
-                'specUrl' => 'http://www.xmlrpc.com/discuss/msgReader$1208',
394
-                'specVersion' => 1
395
-            ),
396
-        );   
397
-    }
398
-    function getCapabilities($args) {
399
-        return $this->capabilities;
400
-    }
401
-    function setCallbacks() {
402
-        $this->callbacks['system.getCapabilities'] = 'this:getCapabilities';
403
-        $this->callbacks['system.listMethods'] = 'this:listMethods';
404
-        $this->callbacks['system.multicall'] = 'this:multiCall';
405
-    }
406
-    function listMethods($args) {
407
-        // Returns a list of methods - uses array_reverse to ensure user defined
408
-        // methods are listed before server defined methods
409
-        return array_reverse(array_keys($this->callbacks));
410
-    }
411
-    function multiCall($methodcalls) {
412
-        // See http://www.xmlrpc.com/discuss/msgReader$1208
413
-        $return = array();
414
-        foreach ($methodcalls as $call) {
415
-            $method = $call['methodName'];
416
-            $params = $call['params'];
417
-            if ($method == 'system.multicall') {
418
-                $result = new IXR_Error(-32600, 'Recursive calls to system.multicall are forbidden');
419
-            } else {
420
-                $result = $this->call($method, $params);
421
-            }
422
-            if (is_a($result, 'IXR_Error')) {
423
-                $return[] = array(
424
-                    'faultCode' => $result->code,
425
-                    'faultString' => $result->message
426
-                );
427
-            } else {
428
-                $return[] = array($result);
429
-            }
430
-        }
431
-        return $return;
432
-    }
361
+	function error($error, $message = false) {
362
+		// Accepts either an error object or an error code and message
363
+		if ($message && !is_object($error)) {
364
+			$error = new IXR_Error($error, $message);
365
+		}
366
+		$this->output($error->getXml());
367
+	}
368
+	function output($xml) {
369
+		$xml = '<?xml version="1.0"?>'."\n".$xml;
370
+		$length = strlen($xml);
371
+		header('Connection: close');
372
+		header('Content-Length: '.$length);
373
+		header('Content-Type: text/xml');
374
+		header('Date: '.date('r'));
375
+		echo $xml;
376
+		exit;
377
+	}
378
+	function hasMethod($method) {
379
+		return in_array($method, array_keys($this->callbacks));
380
+	}
381
+	function setCapabilities() {
382
+		// Initialises capabilities array
383
+		$this->capabilities = array(
384
+			'xmlrpc' => array(
385
+				'specUrl' => 'http://www.xmlrpc.com/spec',
386
+				'specVersion' => 1
387
+			),
388
+			'faults_interop' => array(
389
+				'specUrl' => 'http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php',
390
+				'specVersion' => 20010516
391
+			),
392
+			'system.multicall' => array(
393
+				'specUrl' => 'http://www.xmlrpc.com/discuss/msgReader$1208',
394
+				'specVersion' => 1
395
+			),
396
+		);   
397
+	}
398
+	function getCapabilities($args) {
399
+		return $this->capabilities;
400
+	}
401
+	function setCallbacks() {
402
+		$this->callbacks['system.getCapabilities'] = 'this:getCapabilities';
403
+		$this->callbacks['system.listMethods'] = 'this:listMethods';
404
+		$this->callbacks['system.multicall'] = 'this:multiCall';
405
+	}
406
+	function listMethods($args) {
407
+		// Returns a list of methods - uses array_reverse to ensure user defined
408
+		// methods are listed before server defined methods
409
+		return array_reverse(array_keys($this->callbacks));
410
+	}
411
+	function multiCall($methodcalls) {
412
+		// See http://www.xmlrpc.com/discuss/msgReader$1208
413
+		$return = array();
414
+		foreach ($methodcalls as $call) {
415
+			$method = $call['methodName'];
416
+			$params = $call['params'];
417
+			if ($method == 'system.multicall') {
418
+				$result = new IXR_Error(-32600, 'Recursive calls to system.multicall are forbidden');
419
+			} else {
420
+				$result = $this->call($method, $params);
421
+			}
422
+			if (is_a($result, 'IXR_Error')) {
423
+				$return[] = array(
424
+					'faultCode' => $result->code,
425
+					'faultString' => $result->message
426
+				);
427
+			} else {
428
+				$return[] = array($result);
429
+			}
430
+		}
431
+		return $return;
432
+	}
433 433
 }
434 434
 
435 435
 class IXR_Request {
436
-    var $method;
437
-    var $args;
438
-    var $xml;
439
-    function IXR_Request($method, $args) {
440
-        $this->method = $method;
441
-        $this->args = $args;
442
-        $this->xml = <<<EOD
436
+	var $method;
437
+	var $args;
438
+	var $xml;
439
+	function IXR_Request($method, $args) {
440
+		$this->method = $method;
441
+		$this->args = $args;
442
+		$this->xml = <<<EOD
443 443
 <?xml version="1.0"?>
444 444
 <methodCall>
445 445
 <methodName>{$this->method}</methodName>
446 446
 <params>
447 447
 
448 448
 EOD;
449
-        foreach ($this->args as $arg) {
450
-            $this->xml .= '<param><value>';
451
-            $v = new IXR_Value($arg);
452
-            $this->xml .= $v->getXml();
453
-            $this->xml .= "</value></param>\n";
454
-        }
455
-        $this->xml .= '</params></methodCall>';
456
-    }
457
-    function getLength() {
458
-        return strlen($this->xml);
459
-    }
460
-    function getXml() {
461
-        return $this->xml;
462
-    }
449
+		foreach ($this->args as $arg) {
450
+			$this->xml .= '<param><value>';
451
+			$v = new IXR_Value($arg);
452
+			$this->xml .= $v->getXml();
453
+			$this->xml .= "</value></param>\n";
454
+		}
455
+		$this->xml .= '</params></methodCall>';
456
+	}
457
+	function getLength() {
458
+		return strlen($this->xml);
459
+	}
460
+	function getXml() {
461
+		return $this->xml;
462
+	}
463 463
 }
464 464
 
465 465
 
466 466
 class IXR_Client {
467
-    var $server;
468
-    var $port;
469
-    var $path;
470
-    var $useragent;
471
-    var $response;
472
-    var $timeout;
473
-    var $vendor = '';
474
-    var $message = false;
475
-    var $debug = false;
476
-    // Storage place for an error message
477
-    var $error = false;
478
-    function IXR_Client($server, $path = false, $port = 80, $timeout = 30, $vendor = '') {
479
-        if (!$path) {
480
-            // Assume we have been given a URL instead
481
-            $bits = parse_url($server);
482
-            $this->server = $bits['host'];
483
-            $this->port = isset($bits['port']) ? $bits['port'] : 80;
484
-            $this->path = isset($bits['path']) ? $bits['path'] : '/';
485
-            // Make absolutely sure we have a path
486
-            if (!$this->path) {
487
-                $this->path = '/';
488
-            }
489
-        } else {
490
-            $this->server = $server;
491
-            $this->path = $path;
492
-            $this->port = $port;
493
-            $this->timeout = $timeout;
494
-        }
495
-        $this->useragent = 'The Incutio XML-RPC PHP Library';
496
-    }
497
-    function query() {
498
-        $args = func_get_args();
499
-        $method = array_shift($args);
500
-        $request = new IXR_Request($method, $args);
501
-        $length = $request->getLength();
502
-        $xml = $request->getXml();
503
-        $r = "\r\n";
504
-        $request  = "POST {$this->path} HTTP/1.0$r";
505
-        $request .= "Host: {$this->server}$r";
506
-        $request .= "Content-Type: text/xml$r";
507
-        $request .= "User-Agent: {$this->useragent}$r";
508
-        $request .= "Content-length: {$length}$r$r";
509
-        $request .= $xml;
510
-        // Now send the request
511
-        if ($this->debug) {
512
-            echo '<pre>'.htmlspecialchars($request)."\n</pre>\n\n";
513
-        }
514
-        $fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout);
515
-        if (!$fp) {
516
-            $this->error = new IXR_Error(-32300, 'transport error - could not open socket');
517
-            return false;
518
-        }
519
-        fputs($fp, $request);
520
-        $contents = '';
521
-        $gotFirstLine = false;
522
-        $gettingHeaders = true;
523
-        while (!feof($fp)) {
524
-            $line = fgets($fp, 4096);
525
-            if (!$gotFirstLine) {
526
-                // Check line for '200'
527
-                if (strstr($line, '200') === false) {
528
-                    $this->error = new IXR_Error(-32300, 'transport error - HTTP status code was not 200');
529
-                    return false;
530
-                }
531
-                $gotFirstLine = true;
532
-            }
533
-            if (trim($line) == '') {
534
-                $gettingHeaders = false;
535
-            }
536
-            if (!$gettingHeaders) {
537
-                $contents .= trim($line)."\n";
538
-            }
539
-        }
540
-        if ($this->debug) {
541
-            echo '<pre>'.htmlspecialchars($contents)."\n</pre>\n\n";
542
-        }
543
-        // Now parse what we've got back
544
-        $this->message = new IXR_Message($contents);
545
-        if (!$this->message->parse()) {
546
-            // XML error
547
-            $this->error = new IXR_Error(-32700, 'parse error. not well formed');
548
-            return false;
549
-        }
550
-        // Is the message a fault?
551
-        if ($this->message->messageType == 'fault') {
552
-            $this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
553
-            return false;
554
-        }
555
-        // Message must be OK
556
-        return true;
557
-    }
558
-    function getResponse() {
559
-        // methodResponses can only have one param - return that
560
-        return $this->message->params[0];
561
-    }
562
-    function isError() {
563
-        return (is_object($this->error));
564
-    }
565
-    function getErrorCode() {
566
-        return $this->error->code;
567
-    }
568
-    function getErrorMessage() {
569
-        return $this->error->message;
570
-    }
467
+	var $server;
468
+	var $port;
469
+	var $path;
470
+	var $useragent;
471
+	var $response;
472
+	var $timeout;
473
+	var $vendor = '';
474
+	var $message = false;
475
+	var $debug = false;
476
+	// Storage place for an error message
477
+	var $error = false;
478
+	function IXR_Client($server, $path = false, $port = 80, $timeout = 30, $vendor = '') {
479
+		if (!$path) {
480
+			// Assume we have been given a URL instead
481
+			$bits = parse_url($server);
482
+			$this->server = $bits['host'];
483
+			$this->port = isset($bits['port']) ? $bits['port'] : 80;
484
+			$this->path = isset($bits['path']) ? $bits['path'] : '/';
485
+			// Make absolutely sure we have a path
486
+			if (!$this->path) {
487
+				$this->path = '/';
488
+			}
489
+		} else {
490
+			$this->server = $server;
491
+			$this->path = $path;
492
+			$this->port = $port;
493
+			$this->timeout = $timeout;
494
+		}
495
+		$this->useragent = 'The Incutio XML-RPC PHP Library';
496
+	}
497
+	function query() {
498
+		$args = func_get_args();
499
+		$method = array_shift($args);
500
+		$request = new IXR_Request($method, $args);
501
+		$length = $request->getLength();
502
+		$xml = $request->getXml();
503
+		$r = "\r\n";
504
+		$request  = "POST {$this->path} HTTP/1.0$r";
505
+		$request .= "Host: {$this->server}$r";
506
+		$request .= "Content-Type: text/xml$r";
507
+		$request .= "User-Agent: {$this->useragent}$r";
508
+		$request .= "Content-length: {$length}$r$r";
509
+		$request .= $xml;
510
+		// Now send the request
511
+		if ($this->debug) {
512
+			echo '<pre>'.htmlspecialchars($request)."\n</pre>\n\n";
513
+		}
514
+		$fp = @fsockopen($this->server, $this->port, $errno, $errstr, $this->timeout);
515
+		if (!$fp) {
516
+			$this->error = new IXR_Error(-32300, 'transport error - could not open socket');
517
+			return false;
518
+		}
519
+		fputs($fp, $request);
520
+		$contents = '';
521
+		$gotFirstLine = false;
522
+		$gettingHeaders = true;
523
+		while (!feof($fp)) {
524
+			$line = fgets($fp, 4096);
525
+			if (!$gotFirstLine) {
526
+				// Check line for '200'
527
+				if (strstr($line, '200') === false) {
528
+					$this->error = new IXR_Error(-32300, 'transport error - HTTP status code was not 200');
529
+					return false;
530
+				}
531
+				$gotFirstLine = true;
532
+			}
533
+			if (trim($line) == '') {
534
+				$gettingHeaders = false;
535
+			}
536
+			if (!$gettingHeaders) {
537
+				$contents .= trim($line)."\n";
538
+			}
539
+		}
540
+		if ($this->debug) {
541
+			echo '<pre>'.htmlspecialchars($contents)."\n</pre>\n\n";
542
+		}
543
+		// Now parse what we've got back
544
+		$this->message = new IXR_Message($contents);
545
+		if (!$this->message->parse()) {
546
+			// XML error
547
+			$this->error = new IXR_Error(-32700, 'parse error. not well formed');
548
+			return false;
549
+		}
550
+		// Is the message a fault?
551
+		if ($this->message->messageType == 'fault') {
552
+			$this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
553
+			return false;
554
+		}
555
+		// Message must be OK
556
+		return true;
557
+	}
558
+	function getResponse() {
559
+		// methodResponses can only have one param - return that
560
+		return $this->message->params[0];
561
+	}
562
+	function isError() {
563
+		return (is_object($this->error));
564
+	}
565
+	function getErrorCode() {
566
+		return $this->error->code;
567
+	}
568
+	function getErrorMessage() {
569
+		return $this->error->message;
570
+	}
571 571
 }
572 572
 
573 573
 
574 574
 class IXR_Error {
575
-    var $code;
576
-    var $message;
577
-    function IXR_Error($code, $message) {
578
-        $this->code = $code;
579
-        $this->message = $message;
580
-    }
581
-    function getXml() {
582
-        $xml = <<<EOD
575
+	var $code;
576
+	var $message;
577
+	function IXR_Error($code, $message) {
578
+		$this->code = $code;
579
+		$this->message = $message;
580
+	}
581
+	function getXml() {
582
+		$xml = <<<EOD
583 583
 <methodResponse>
584 584
   <fault>
585 585
     <value>
@@ -598,231 +598,231 @@  discard block
 block discarded – undo
598 598
 </methodResponse> 
599 599
 
600 600
 EOD;
601
-        return $xml;
602
-    }
601
+		return $xml;
602
+	}
603 603
 }
604 604
 
605 605
 
606 606
 class IXR_Date {
607
-    var $year;
608
-    var $month;
609
-    var $day;
610
-    var $hour;
611
-    var $minute;
612
-    var $second;
613
-    var $timezone;
614
-    function IXR_Date($time) {
615
-        // $time can be a PHP timestamp or an ISO one
616
-        if (is_numeric($time)) {
617
-            $this->parseTimestamp($time);
618
-        } else {
619
-            $this->parseIso($time);
620
-        }
621
-    }
622
-    function parseTimestamp($timestamp) {
623
-        $this->year = date('Y', $timestamp);
624
-        $this->month = date('Y', $timestamp);
625
-        $this->day = date('Y', $timestamp);
626
-        $this->hour = date('H', $timestamp);
627
-        $this->minute = date('i', $timestamp);
628
-        $this->second = date('s', $timestamp);
629
-    }
630
-    function parseIso($iso) {
631
-        $this->year = substr($iso, 0, 4);
632
-        $this->month = substr($iso, 4, 2);
633
-        $this->day = substr($iso, 6, 2);
634
-        $this->hour = substr($iso, 9, 2);
635
-        $this->minute = substr($iso, 12, 2);
636
-        $this->second = substr($iso, 15, 2);
637
-        $this->timezone = substr($iso, 17);
638
-    }
639
-    function getIso() {
640
-        return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone;
641
-    }
642
-    function getXml() {
643
-        return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>';
644
-    }
645
-    function getTimestamp() {
646
-        return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);
647
-    }
607
+	var $year;
608
+	var $month;
609
+	var $day;
610
+	var $hour;
611
+	var $minute;
612
+	var $second;
613
+	var $timezone;
614
+	function IXR_Date($time) {
615
+		// $time can be a PHP timestamp or an ISO one
616
+		if (is_numeric($time)) {
617
+			$this->parseTimestamp($time);
618
+		} else {
619
+			$this->parseIso($time);
620
+		}
621
+	}
622
+	function parseTimestamp($timestamp) {
623
+		$this->year = date('Y', $timestamp);
624
+		$this->month = date('Y', $timestamp);
625
+		$this->day = date('Y', $timestamp);
626
+		$this->hour = date('H', $timestamp);
627
+		$this->minute = date('i', $timestamp);
628
+		$this->second = date('s', $timestamp);
629
+	}
630
+	function parseIso($iso) {
631
+		$this->year = substr($iso, 0, 4);
632
+		$this->month = substr($iso, 4, 2);
633
+		$this->day = substr($iso, 6, 2);
634
+		$this->hour = substr($iso, 9, 2);
635
+		$this->minute = substr($iso, 12, 2);
636
+		$this->second = substr($iso, 15, 2);
637
+		$this->timezone = substr($iso, 17);
638
+	}
639
+	function getIso() {
640
+		return $this->year.$this->month.$this->day.'T'.$this->hour.':'.$this->minute.':'.$this->second.$this->timezone;
641
+	}
642
+	function getXml() {
643
+		return '<dateTime.iso8601>'.$this->getIso().'</dateTime.iso8601>';
644
+	}
645
+	function getTimestamp() {
646
+		return mktime($this->hour, $this->minute, $this->second, $this->month, $this->day, $this->year);
647
+	}
648 648
 }
649 649
 
650 650
 
651 651
 class IXR_Base64 {
652
-    var $data;
653
-    function IXR_Base64($data) {
654
-        $this->data = $data;
655
-    }
656
-    function getXml() {
657
-        return '<base64>'.base64_encode($this->data).'</base64>';
658
-    }
652
+	var $data;
653
+	function IXR_Base64($data) {
654
+		$this->data = $data;
655
+	}
656
+	function getXml() {
657
+		return '<base64>'.base64_encode($this->data).'</base64>';
658
+	}
659 659
 }
660 660
 
661 661
 
662 662
 class IXR_IntrospectionServer extends IXR_Server {
663
-    var $signatures;
664
-    var $help;
665
-    function IXR_IntrospectionServer() {
666
-        $this->setCallbacks();
667
-        $this->setCapabilities();
668
-        $this->capabilities['introspection'] = array(
669
-            'specUrl' => 'http://xmlrpc.usefulinc.com/doc/reserved.html',
670
-            'specVersion' => 1
671
-        );
672
-        $this->addCallback(
673
-            'system.methodSignature', 
674
-            'this:methodSignature', 
675
-            array('array', 'string'), 
676
-            'Returns an array describing the return type and required parameters of a method'
677
-        );
678
-        $this->addCallback(
679
-            'system.getCapabilities', 
680
-            'this:getCapabilities', 
681
-            array('struct'), 
682
-            'Returns a struct describing the XML-RPC specifications supported by this server'
683
-        );
684
-        $this->addCallback(
685
-            'system.listMethods', 
686
-            'this:listMethods', 
687
-            array('array'), 
688
-            'Returns an array of available methods on this server'
689
-        );
690
-        $this->addCallback(
691
-            'system.methodHelp', 
692
-            'this:methodHelp', 
693
-            array('string', 'string'), 
694
-            'Returns a documentation string for the specified method'
695
-        );
696
-    }
697
-    function addCallback($method, $callback, $args, $help) {
698
-        $this->callbacks[$method] = $callback;
699
-        $this->signatures[$method] = $args;
700
-        $this->help[$method] = $help;
701
-    }
702
-    function call($methodname, $args) {
703
-        // Make sure it's in an array
704
-        if ($args && !is_array($args)) {
705
-            $args = array($args);
706
-        }
707
-        // Over-rides default call method, adds signature check
708
-        if (!$this->hasMethod($methodname)) {
709
-            return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.');
710
-        }
711
-        $method = $this->callbacks[$methodname];
712
-        $signature = $this->signatures[$methodname];
713
-        $returnType = array_shift($signature);
714
-        // Check the number of arguments
715
-        if (count($args) != count($signature)) {
716
-            // print 'Num of args: '.count($args).' Num in signature: '.count($signature);
717
-            return new IXR_Error(-32602, 'server error. wrong number of method parameters');
718
-        }
719
-        // Check the argument types
720
-        $ok = true;
721
-        $argsbackup = $args;
722
-        for ($i = 0, $j = count($args); $i < $j; $i++) {
723
-            $arg = array_shift($args);
724
-            $type = array_shift($signature);
725
-            switch ($type) {
726
-                case 'int':
727
-                case 'i4':
728
-                    if (is_array($arg) || !is_int($arg)) {
729
-                        $ok = false;
730
-                    }
731
-                    break;
732
-                case 'base64':
733
-                case 'string':
734
-                    if (!is_string($arg)) {
735
-                        $ok = false;
736
-                    }
737
-                    break;
738
-                case 'boolean':
739
-                    if ($arg !== false && $arg !== true) {
740
-                        $ok = false;
741
-                    }
742
-                    break;
743
-                case 'float':
744
-                case 'double':
745
-                    if (!is_float($arg)) {
746
-                        $ok = false;
747
-                    }
748
-                    break;
749
-                case 'date':
750
-                case 'dateTime.iso8601':
751
-                    if (!is_a($arg, 'IXR_Date')) {
752
-                        $ok = false;
753
-                    }
754
-                    break;
755
-            }
756
-            if (!$ok) {
757
-                return new IXR_Error(-32602, 'server error. invalid method parameters');
758
-            }
759
-        }
760
-        // It passed the test - run the "real" method call
761
-        return parent::call($methodname, $argsbackup);
762
-    }
763
-    function methodSignature($method) {
764
-        if (!$this->hasMethod($method)) {
765
-            return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.');
766
-        }
767
-        // We should be returning an array of types
768
-        $types = $this->signatures[$method];
769
-        $return = array();
770
-        foreach ($types as $type) {
771
-            switch ($type) {
772
-                case 'string':
773
-                    $return[] = 'string';
774
-                    break;
775
-                case 'int':
776
-                case 'i4':
777
-                    $return[] = 42;
778
-                    break;
779
-                case 'double':
780
-                    $return[] = 3.1415;
781
-                    break;
782
-                case 'dateTime.iso8601':
783
-                    $return[] = new IXR_Date(time());
784
-                    break;
785
-                case 'boolean':
786
-                    $return[] = true;
787
-                    break;
788
-                case 'base64':
789
-                    $return[] = new IXR_Base64('base64');
790
-                    break;
791
-                case 'array':
792
-                    $return[] = array('array');
793
-                    break;
794
-                case 'struct':
795
-                    $return[] = array('struct' => 'struct');
796
-                    break;
797
-            }
798
-        }
799
-        return $return;
800
-    }
801
-    function methodHelp($method) {
802
-        return $this->help[$method];
803
-    }
663
+	var $signatures;
664
+	var $help;
665
+	function IXR_IntrospectionServer() {
666
+		$this->setCallbacks();
667
+		$this->setCapabilities();
668
+		$this->capabilities['introspection'] = array(
669
+			'specUrl' => 'http://xmlrpc.usefulinc.com/doc/reserved.html',
670
+			'specVersion' => 1
671
+		);
672
+		$this->addCallback(
673
+			'system.methodSignature', 
674
+			'this:methodSignature', 
675
+			array('array', 'string'), 
676
+			'Returns an array describing the return type and required parameters of a method'
677
+		);
678
+		$this->addCallback(
679
+			'system.getCapabilities', 
680
+			'this:getCapabilities', 
681
+			array('struct'), 
682
+			'Returns a struct describing the XML-RPC specifications supported by this server'
683
+		);
684
+		$this->addCallback(
685
+			'system.listMethods', 
686
+			'this:listMethods', 
687
+			array('array'), 
688
+			'Returns an array of available methods on this server'
689
+		);
690
+		$this->addCallback(
691
+			'system.methodHelp', 
692
+			'this:methodHelp', 
693
+			array('string', 'string'), 
694
+			'Returns a documentation string for the specified method'
695
+		);
696
+	}
697
+	function addCallback($method, $callback, $args, $help) {
698
+		$this->callbacks[$method] = $callback;
699
+		$this->signatures[$method] = $args;
700
+		$this->help[$method] = $help;
701
+	}
702
+	function call($methodname, $args) {
703
+		// Make sure it's in an array
704
+		if ($args && !is_array($args)) {
705
+			$args = array($args);
706
+		}
707
+		// Over-rides default call method, adds signature check
708
+		if (!$this->hasMethod($methodname)) {
709
+			return new IXR_Error(-32601, 'server error. requested method "'.$this->message->methodName.'" not specified.');
710
+		}
711
+		$method = $this->callbacks[$methodname];
712
+		$signature = $this->signatures[$methodname];
713
+		$returnType = array_shift($signature);
714
+		// Check the number of arguments
715
+		if (count($args) != count($signature)) {
716
+			// print 'Num of args: '.count($args).' Num in signature: '.count($signature);
717
+			return new IXR_Error(-32602, 'server error. wrong number of method parameters');
718
+		}
719
+		// Check the argument types
720
+		$ok = true;
721
+		$argsbackup = $args;
722
+		for ($i = 0, $j = count($args); $i < $j; $i++) {
723
+			$arg = array_shift($args);
724
+			$type = array_shift($signature);
725
+			switch ($type) {
726
+				case 'int':
727
+				case 'i4':
728
+					if (is_array($arg) || !is_int($arg)) {
729
+						$ok = false;
730
+					}
731
+					break;
732
+				case 'base64':
733
+				case 'string':
734
+					if (!is_string($arg)) {
735
+						$ok = false;
736
+					}
737
+					break;
738
+				case 'boolean':
739
+					if ($arg !== false && $arg !== true) {
740
+						$ok = false;
741
+					}
742
+					break;
743
+				case 'float':
744
+				case 'double':
745
+					if (!is_float($arg)) {
746
+						$ok = false;
747
+					}
748
+					break;
749
+				case 'date':
750
+				case 'dateTime.iso8601':
751
+					if (!is_a($arg, 'IXR_Date')) {
752
+						$ok = false;
753
+					}
754
+					break;
755
+			}
756
+			if (!$ok) {
757
+				return new IXR_Error(-32602, 'server error. invalid method parameters');
758
+			}
759
+		}
760
+		// It passed the test - run the "real" method call
761
+		return parent::call($methodname, $argsbackup);
762
+	}
763
+	function methodSignature($method) {
764
+		if (!$this->hasMethod($method)) {
765
+			return new IXR_Error(-32601, 'server error. requested method "'.$method.'" not specified.');
766
+		}
767
+		// We should be returning an array of types
768
+		$types = $this->signatures[$method];
769
+		$return = array();
770
+		foreach ($types as $type) {
771
+			switch ($type) {
772
+				case 'string':
773
+					$return[] = 'string';
774
+					break;
775
+				case 'int':
776
+				case 'i4':
777
+					$return[] = 42;
778
+					break;
779
+				case 'double':
780
+					$return[] = 3.1415;
781
+					break;
782
+				case 'dateTime.iso8601':
783
+					$return[] = new IXR_Date(time());
784
+					break;
785
+				case 'boolean':
786
+					$return[] = true;
787
+					break;
788
+				case 'base64':
789
+					$return[] = new IXR_Base64('base64');
790
+					break;
791
+				case 'array':
792
+					$return[] = array('array');
793
+					break;
794
+				case 'struct':
795
+					$return[] = array('struct' => 'struct');
796
+					break;
797
+			}
798
+		}
799
+		return $return;
800
+	}
801
+	function methodHelp($method) {
802
+		return $this->help[$method];
803
+	}
804 804
 }
805 805
 
806 806
 
807 807
 class IXR_ClientMulticall extends IXR_Client {
808
-    var $calls = array();
809
-    function IXR_ClientMulticall($server, $path = false, $port = 80) {
810
-        parent::IXR_Client($server, $path, $port);
811
-        $this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)';
812
-    }
813
-    function addCall() {
814
-        $args = func_get_args();
815
-        $methodName = array_shift($args);
816
-        $struct = array(
817
-            'methodName' => $methodName,
818
-            'params' => $args
819
-        );
820
-        $this->calls[] = $struct;
821
-    }
822
-    function query() {
823
-        // Prepare multicall, then call the parent::query() method
824
-        return parent::query('system.multicall', $this->calls);
825
-    }
808
+	var $calls = array();
809
+	function IXR_ClientMulticall($server, $path = false, $port = 80) {
810
+		parent::IXR_Client($server, $path, $port);
811
+		$this->useragent = 'The Incutio XML-RPC PHP Library (multicall client)';
812
+	}
813
+	function addCall() {
814
+		$args = func_get_args();
815
+		$methodName = array_shift($args);
816
+		$struct = array(
817
+			'methodName' => $methodName,
818
+			'params' => $args
819
+		);
820
+		$this->calls[] = $struct;
821
+	}
822
+	function query() {
823
+		// Prepare multicall, then call the parent::query() method
824
+		return parent::query('system.multicall', $this->calls);
825
+	}
826 826
 }
827 827
 
828 828
 ?>
829 829
\ No newline at end of file
Please login to merge, or discard this patch.
class/xmlparser.php 1 patch
Indentation   +106 added lines, -106 removed lines patch added patch discarded remove patch
@@ -47,23 +47,23 @@  discard block
 block discarded – undo
47 47
 	var $charset_in;
48 48
 	var $charset_out;
49 49
 	
50
-    /**
51
-     *  Set up XML parser, parse source, and return populated RSS object..
52
-     *
53
-     *  @param string $content           string containing the RSS to be parsed
54
-     *
55
-     *
56
-     *  @param string $output_encoding  output the parsed RSS in this character
57
-     *                                  set defaults to ISO-8859-1 as this is PHP's
58
-     *                                  default.
59
-     *
60
-     *  @param string $input_encoding   the character set of the incoming RSS source.
61
-     *                                  Leave blank and Magpie will try to figure it
62
-     *                                  out.
63
-     *
64
-     */
65
-    function XmlParser ($content, $input_charset, $output_charset = _CHARSET, $tags = array())
66
-    {
50
+	/**
51
+	 *  Set up XML parser, parse source, and return populated RSS object..
52
+	 *
53
+	 *  @param string $content           string containing the RSS to be parsed
54
+	 *
55
+	 *
56
+	 *  @param string $output_encoding  output the parsed RSS in this character
57
+	 *                                  set defaults to ISO-8859-1 as this is PHP's
58
+	 *                                  default.
59
+	 *
60
+	 *  @param string $input_encoding   the character set of the incoming RSS source.
61
+	 *                                  Leave blank and Magpie will try to figure it
62
+	 *                                  out.
63
+	 *
64
+	 */
65
+	function XmlParser ($content, $input_charset, $output_charset = _CHARSET, $tags = array())
66
+	{
67 67
 		if(!in_array(strtoupper($input_charset), array("UTF-8", "US-ASCII", "ISO-8859-1"))) {
68 68
 			$content = XoopsLocal::convert_encoding($content, "UTF-8", $input_charset);
69 69
 			$content = preg_replace('/(<\?xml.*encoding=[\'"])(.*?)([\'"].*\?>)/m', '$1UTF-8$3', $content);
@@ -79,109 +79,109 @@  discard block
 block discarded – undo
79 79
 		//xoops_message($this);
80 80
 		unset($this->content);
81 81
 		$this->encoding_convert($tags);
82
-    }
82
+	}
83 83
 
84
-    function is_atom() {
85
-        if ( $this->feed_type == ATOM ) {
86
-	        $this->feed_version = empty($this->feed_version)?"0.3":$this->feed_version;
87
-            return $this->feed_version;
88
-        }
89
-        else {
90
-            return false;
91
-        }
92
-    }
84
+	function is_atom() {
85
+		if ( $this->feed_type == ATOM ) {
86
+			$this->feed_version = empty($this->feed_version)?"0.3":$this->feed_version;
87
+			return $this->feed_version;
88
+		}
89
+		else {
90
+			return false;
91
+		}
92
+	}
93 93
     
94
-    function normalize () {
95
-        if ( $this->is_atom() ):
96
-	    if(empty($this->channel["tagline"])){
97
-		    /* ATOM */
98
-		    $this->channel["tagline"] = @$this->channel["subtitle"];
99
-		    unset($this->channel["subtitle"]);
100
-    	}
101
-        for ( $i = 0; $i < count($this->items); $i++) {
102
-	        // ATOM time
103
-	        if($date = @$this->items[$i]['modified']) continue;
104
-	        if(empty($date)){
105
-                $date = @$this->items[$i]['updated'];
106
-        	}
107
-	        if(empty($date)){
108
-                $date = @$this->items[$i]['issued'];
109
-        	}
110
-	        if(empty($date)){
111
-                $date = @$this->items[$i]['created'];
112
-        	}
113
-	        if(empty($date)){
114
-                $date = @$this->items[$i]['created'];
115
-        	}
116
-	        $this->items[$i]['modified'] = $date;
117
-        }
118
-        elseif($this->is_rss() != '1.0'):
119
-        for ( $i = 0; $i < count($this->items); $i++) {
120
-	        if($date = @$this->items[$i]['pubdate']) continue;
121
-	        $this->items[$i]['pubdate'] = @$this->items[$i]['dc']['date'];
122
-        }
123
-        endif;
124
-	    parent::normalize();	    
125
-    	/* ATOM */
126
-	    if(empty($this->channel["language"]) && !empty($this->channel["dc"]["language"]) )  {
94
+	function normalize () {
95
+		if ( $this->is_atom() ):
96
+		if(empty($this->channel["tagline"])){
97
+			/* ATOM */
98
+			$this->channel["tagline"] = @$this->channel["subtitle"];
99
+			unset($this->channel["subtitle"]);
100
+		}
101
+		for ( $i = 0; $i < count($this->items); $i++) {
102
+			// ATOM time
103
+			if($date = @$this->items[$i]['modified']) continue;
104
+			if(empty($date)){
105
+				$date = @$this->items[$i]['updated'];
106
+			}
107
+			if(empty($date)){
108
+				$date = @$this->items[$i]['issued'];
109
+			}
110
+			if(empty($date)){
111
+				$date = @$this->items[$i]['created'];
112
+			}
113
+			if(empty($date)){
114
+				$date = @$this->items[$i]['created'];
115
+			}
116
+			$this->items[$i]['modified'] = $date;
117
+		}
118
+		elseif($this->is_rss() != '1.0'):
119
+		for ( $i = 0; $i < count($this->items); $i++) {
120
+			if($date = @$this->items[$i]['pubdate']) continue;
121
+			$this->items[$i]['pubdate'] = @$this->items[$i]['dc']['date'];
122
+		}
123
+		endif;
124
+		parent::normalize();	    
125
+		/* ATOM */
126
+		if(empty($this->channel["language"]) && !empty($this->channel["dc"]["language"]) )  {
127 127
 			$this->channel["language"] = $this->channel["dc"]["language"];
128 128
 			unset($this->channel["dc"]["language"]);
129 129
 		}
130
-	    if(empty($this->channel["language"]) && preg_match('/<link.*hreflang=[\'"](.*?)[\'"].*?>/m', $this->content, $match) )  {
130
+		if(empty($this->channel["language"]) && preg_match('/<link.*hreflang=[\'"](.*?)[\'"].*?>/m', $this->content, $match) )  {
131 131
 			$this->channel["language"] = $match[1];
132 132
 		}
133
-	    if(empty($this->channel["language"]) && preg_match('/<feed.*xml:lang=[\'"](.*?)[\'"].*?>/m', $this->content, $match) )  {
133
+		if(empty($this->channel["language"]) && preg_match('/<feed.*xml:lang=[\'"](.*?)[\'"].*?>/m', $this->content, $match) )  {
134 134
 			$this->channel["language"] = $match[1];
135 135
 		}
136 136
 		/* remove to avoid redundant encoding conversion */
137
-	    if(!empty($this->channel["tagline"])){
138
-		    unset($this->channel["tagline"]);
139
-	    }
137
+		if(!empty($this->channel["tagline"])){
138
+			unset($this->channel["tagline"]);
139
+		}
140 140
 		
141
-        for ( $i = 0; $i < count($this->items); $i++) {
142
-	        if($date_timestamp = @$this->items[$i]['date_timestamp']) continue;
143
-	        if($date_timestamp = @$this->items[$i]['pubdate']){
144
-                $this->items[$i]['date_timestamp'] = $date_timestamp;
145
-            }elseif($date_timestamp = @$this->items[$i]['dc']['date']){
146
-                $this->items[$i]['date_timestamp'] = $date_timestamp;
147
-        	}else{
148
-	        	$this->items[$i]['date_timestamp'] = time();
149
-        	}
150
-	        if(!is_numeric($this->items[$i]['date_timestamp'])){
151
-		        if($date = parse_w3cdtf($this->items[$i]['date_timestamp'])) {
152
-		        	$this->items[$i]['date_timestamp'] = $date;
153
-	        	}elseif($date = strtotime($this->items[$i]['date_timestamp'])) {
154
-		        	$this->items[$i]['date_timestamp'] = $date;
155
-	        	}
156
-	        }
141
+		for ( $i = 0; $i < count($this->items); $i++) {
142
+			if($date_timestamp = @$this->items[$i]['date_timestamp']) continue;
143
+			if($date_timestamp = @$this->items[$i]['pubdate']){
144
+				$this->items[$i]['date_timestamp'] = $date_timestamp;
145
+			}elseif($date_timestamp = @$this->items[$i]['dc']['date']){
146
+				$this->items[$i]['date_timestamp'] = $date_timestamp;
147
+			}else{
148
+				$this->items[$i]['date_timestamp'] = time();
149
+			}
150
+			if(!is_numeric($this->items[$i]['date_timestamp'])){
151
+				if($date = parse_w3cdtf($this->items[$i]['date_timestamp'])) {
152
+					$this->items[$i]['date_timestamp'] = $date;
153
+				}elseif($date = strtotime($this->items[$i]['date_timestamp'])) {
154
+					$this->items[$i]['date_timestamp'] = $date;
155
+				}
156
+			}
157 157
 
158 158
 			/* remove to avoid redundant encoding conversion */
159
-            if ( isset($this->items[$i]['summary']) )
160
-                unset($this->items[$i]['summary']);
161
-            if ( isset($this->items[$i]['atom_content']))
162
-                unset($this->items[$i]['atom_content']);
163
-        }
164
-	    return;
165
-    }
159
+			if ( isset($this->items[$i]['summary']) )
160
+				unset($this->items[$i]['summary']);
161
+			if ( isset($this->items[$i]['atom_content']))
162
+				unset($this->items[$i]['atom_content']);
163
+		}
164
+		return;
165
+	}
166 166
     
167
-    function encoding_convert($tags = array()){
168
-	    if(empty($tags) || in_array("channel", $tags)){
169
-	    	$this->channel = $this->_encoding($this->channel);
170
-    	}
171
-	    if(empty($tags) || in_array("items", $tags)){
172
-	    	$this->items = $this->_encoding($this->items);
173
-    	}
174
-    }
167
+	function encoding_convert($tags = array()){
168
+		if(empty($tags) || in_array("channel", $tags)){
169
+			$this->channel = $this->_encoding($this->channel);
170
+		}
171
+		if(empty($tags) || in_array("items", $tags)){
172
+			$this->items = $this->_encoding($this->items);
173
+		}
174
+	}
175 175
     
176
-    function _encoding($val){
177
-	    if(is_array($val)){
178
-		    foreach(array_keys($val) as $key){
179
-			    $val[$key] = $this->_encoding($val[$key]);
180
-		    }
181
-	    }else{
182
-		    $val = XoopsLocal::convert_encoding($val, $this->charset_out, $this->charset_in);
183
-	    }
184
-	    return $val;
185
-    }
176
+	function _encoding($val){
177
+		if(is_array($val)){
178
+			foreach(array_keys($val) as $key){
179
+				$val[$key] = $this->_encoding($val[$key]);
180
+			}
181
+		}else{
182
+			$val = XoopsLocal::convert_encoding($val, $this->charset_out, $this->charset_in);
183
+		}
184
+		return $val;
185
+	}
186 186
 }
187 187
 ?>
188 188
\ No newline at end of file
Please login to merge, or discard this patch.
class/xmlpc.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -32,24 +32,24 @@  discard block
 block discarded – undo
32 32
 if(!class_exists("Xmlrpc_client")){
33 33
 class Xmlrpc_client
34 34
 {
35
-    function Xmlrpc_client()
36
-    {
37
-    }
35
+	function Xmlrpc_client()
36
+	{
37
+	}
38 38
 
39
-    function setObject(&$article)
40
-    {
41
-        $this->$var = $val;
42
-    }
39
+	function setObject(&$article)
40
+	{
41
+		$this->$var = $val;
42
+	}
43 43
 
44
-    function setVar($var, $val)
45
-    {
46
-        $this->$var = $val;
47
-    }
44
+	function setVar($var, $val)
45
+	{
46
+		$this->$var = $val;
47
+	}
48 48
 
49
-    function getVar($var)
50
-    {
51
-        return $this->$var;
52
-    }
49
+	function getVar($var)
50
+	{
51
+		return $this->$var;
52
+	}
53 53
 }
54 54
 }
55 55
 
@@ -58,19 +58,19 @@  discard block
 block discarded – undo
58 58
 class Xmlrpc_server
59 59
 {
60 60
 
61
-    function Xmlrpc_server()
62
-    {
63
-    }
61
+	function Xmlrpc_server()
62
+	{
63
+	}
64 64
 
65
-    function setVar($var, $val)
66
-    {
67
-        $this->$var = $val;
68
-    }
65
+	function setVar($var, $val)
66
+	{
67
+		$this->$var = $val;
68
+	}
69 69
 
70
-    function getVar($var)
71
-    {
72
-        return $this->$var;
73
-    }
70
+	function getVar($var)
71
+	{
72
+		return $this->$var;
73
+	}
74 74
 }
75 75
 }
76 76
 
Please login to merge, or discard this patch.