Filter:   InfoImg
download pages.inc
Language: NonCode
LOC: 0
Project Info
HPE
Server: SourceForge
Type: cvs
[Show Code]






[Show Code]
...ceForge\h\hpe\hpe\hpe1\HPE\
   .cvsignore
   clickerr.inc
   config.inc
   Config_File.class.php
   database.inc
   database.mysql.inc
   database.pear.inc
   FormChek.js
   HPE.inc
   HPEbase.inc
   HPEUsers.default.xml
   HPEUsers.guest.xml
   layout.js
   local.inc
   modules.inc
   ...andlers.addChannel.ftsc
   navcond.js
   newsaccess.inc
   newssource.inc
   newstools.js
   overlib.js
   overlib_mini.js
   pagemaker.inc
   pages.inc
   PHPClientSniffer.inc
   phpodp.inc
   publisher.inc
   services.inc
   sitelister.inc
   Smarty.addons.php
   Smarty.class.php
   Smarty_Compiler.class.php
   sourcetools.js
   thememaker.inc
   toparser.inc
   user.edit.inc
   user.inc
   xmlrpc.inc
   xmlrpcs.inc
   xmltree.inc

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
<?
/*

HPE - News Portal Engine
Copyright (C) 2000-2001 Mike Krus

This program is free software; it is distributed in the hope 
that it will be useful, but WITHOUT ANY WARRANTY; without 
even the implied warranty of MERCHANTABILITY or FITNESS 
FOR A PARTICULAR PURPOSE.

READ LICENSE.TXT IN THE BASE DIRECTORY FOR INFORMATION 
ABOUT REDISTRIBUTING THIS SOURCE CODE

*/


class HPEPage
{

	var $url;		//! The base url for the page
	var $name;		//! The name of this type
	var $desc;		//! Short Description of this type
	var $flags;		//! Flags controlling the behavior

	var $showpath;	//! Path the display sub page
	var $editpath;	//! Path the display sub page

	function HPEPage() 
	{
		$this->url = "";
		$this->name = "";
		$this->desc = "";
		$this->flags = 0;
		$this->showpath = "";
		$this->editpath = "";
	}


	function AcceptsModule($type)
	{
		return false;
	}

};




class HPEPageBoxes extends HPEPage
{

	var $basepath;

	function HPEPageBoxes()
	{
		$this->HPEPage();
		$this->Reset();
	}


	function Reset()
	{
		$this->type = "newsbox";
		$this->url = "";
		$this->name = "Module Boxes";
		$this->desc = "Arrange your choice of modules in 3 columns";
		$this->flags = (HPEPageEditable | HPEPageExternEdit | HPEPageMailable);
		$this->editpath = $GLOBALS["HPEinc"] . "/plugins/page.newsboxes.edit.inc";
	}


	function UnSerializeFromXML(&$XMLtree, $path, &$pgdata)
	{
		global $HPEtheConfig;

		for($j=1, $k=0; $j<=3; $j++, $k++) 
		{
			$pgdata["column$k"] = array();
			$n = $XMLtree->getAttribute("$path/column($j)", "numelts");
			for($i=1; $i<=$n; $i++)
			{
				$srctype = $XMLtree->getAttribute("$path/column($j)/module($i)", "type");
				$srcdata = array( "type" => $srctype );
				if(isset($HPEtheConfig->modhandlers[$srctype]))
				{
					$HPEtheConfig->modhandlers[$srctype]["control"]->UnSerializeFromXML($XMLtree,
						"$path/column($j)/module($i)", $srcdata);
	
					$pgdata["column" . ($j - 1)][$i-1] = $srcdata;
				} 
				else
				{
					global $HPEtheUser;
					HPEWatchdog("user", "User $HPEtheUser->userid : Module type $srctype unknown");
				}
			}
		}
	}


	function SerializeToXML(&$pgdata)
	{
		global $HPEtheConfig;

		$data = "\t\t<PAGE type=\"$this->type\" id=\"" . $pgdata["id"] .
				"\" title=\"" . HPEXMLString($pgdata["title"]) . "\">\n";
		for($i=0; $i<3; $i++) 
		{
			$n = count($pgdata["column$i"]);
			if($n == 0) 
			{
				$data .= "\t\t\t<COLUMN numelts=\"0\"/>\n";
				continue;
			}
			$data .= "\t\t\t<COLUMN numelts=\"$n\">\n";
			for($j=0; $j<$n; $j++) 
			{
				$srctype = $pgdata["column$i"][$j]["type"];
				$data .= $HPEtheConfig->modhandlers[$srctype]["control"]->SerializeToXML($pgdata["column$i"][$j]);
			}
			$data .= "\t\t\t</COLUMN>\n";
		}
		$data .= "\t\t</PAGE>\n";
		return $data;
	}


	function Create($param)
	{
		$data = array();
		$data["column0"] = array();
		$data["column1"] = array();
		$data["column2"] = array();
		return $data;
	}


	function AcceptsModule($type)
	{
		return ($type == 0 || $type == 1 || $type == 4);
	}


	function AddModule(&$pgdata, &$moddata)
	{
		$c = 0;
		if(count($pgdata["column1"]) < count($pgdata["column$c"])) $c = 1;
		if(count($pgdata["column2"]) < count($pgdata["column$c"])) $c = 2;

		$pgdata["column$c"][] = $moddata;
	}


	function &GetModule(&$pgdata, $modid)
	{
		$t = 0;
		for($i=0; $i<3; $i++) 
		{
			$n = count($pgdata["column$i"]);
			$l = $t + $n - 1;
			if($modid <= $l) 
			{
				$nc = array();
				for($j=0; $j<$n; $j++) 
					if(($j + $t) == $modid) return $pgdata["column$i"][$j];
			}
			$t += $n;
		}
		return "";
	}


	function RemoveModule(&$pgdata, $modid)
	{
		$t = 0;
		for($i=0; $i<3; $i++) 
		{
			$n = count($pgdata["column$i"]);
			$l = $t + $n - 1;
			if($modid <= $l) 
			{
				$nc = array();
				for($j=0, $k=0; $j<$n; $j++) 
				{
					if(($j + $t) == $modid) continue;
					$nc[$k] = $pgdata["column$i"][$j];
					$k++;
				}
				$pgdata["column$i"] = $nc;
				return "";
			}
			$t += $n;
		}
		return "Module not found";
	}


	function Show()
	{
		global $HPEtheUser;
		global $HPEtheThemeMaker;
		global $page;

		echo $HPEtheThemeMaker->TPLRun("page.newsboxes", $this->GetData($HPEtheUser->pages[$page]));
	}


	function GetData(&$pagedata)
	{
		global $HPEtheConfig;

		$n = 0;
		$data = array ( "title" => $pagedata["title"] );

		for($i=0;$i<3; $i++)
		{
			$ln = count($pagedata["column$i"]);
			$data["COL"][$i] = array( );

			for($j=0; $j<$ln; $j++) 
			{
				if(isset($pagedata["column$i"][$j]))
				{
					$t = $pagedata["column$i"][$j]["type"];
					if(isset($HPEtheConfig->modhandlers[$t])) 
						$data["COL"][$i][$j] = $HPEtheConfig->modhandlers[$t]["control"]->show($pagedata["column$i"][$j], $n);
				}
				else $data["COL"][$i][$j] = "";
				$n++;
			}
		}

		return $data;
	}

};


class HPEPageNewsLog extends HPEPage
{


	function HPEPageNewsLog()
	{
		$this->HPEPage();
		$this->Reset();
	}


	function Reset()
	{
		$this->type = "newslog";
		$this->url = "";
		$this->name = "Multisource headlines in a flat list";
		$this->desc = "Arrange your choice of modules in a flat list";
		$this->flags = (HPEPageEditable | HPEPageExternEdit | HPEPageMailable);
		$this->editpath = $GLOBALS["HPEinc"] . "/plugins/page.newslog.edit.inc";
	}


	function UnSerializeFromXML(&$XMLtree, $path, &$pgdata)
	{
		global $HPEtheConfig;

		$pgdata["mode"] = $XMLtree->getAttribute($path, "mode");
		$pgdata["outdate"] = $XMLtree->getAttribute($path, "outdate");
		if(empty($pgdata["outdate"]))
			$pgdata["outdate"] = 0;

		$pgdata["sources"] = array();
		$i = 1;
		while(1)
		{
			$type = $XMLtree->getAttribute("$path/module($i)", "type");
			if($type == "") break;

			$srcdata = array( "type" => $type );
			if(isset($HPEtheConfig->modhandlers[$type]))
			{
				$HPEtheConfig->modhandlers[$type]["control"]->UnSerializeFromXML($XMLtree, "$path/module($i)", $srcdata);
				$pgdata["sources"][] = $srcdata;
			}
			$i++;
		}
	}


	function SerializeToXML(&$pgdata)
	{
		global $HPEtheConfig;

		if(!isset($pgdata["outdate"]))
			$pgdata["outdate"] = 0;

		$data = "\t\t<PAGE type=\"" . $pgdata["type"] . "\" id=\"" . $pgdata["id"] .
				"\" title=\"" . HPEXMLString($pgdata["title"]) . "\" mode=\"" . $pgdata["mode"] . "\" " .
				"outdate=\"" . $pgdata["outdate"] . "\">\n";

		$n = count($pgdata["sources"]);
		for($i=0; $i<$n; $i++)
			if(isset($HPEtheConfig->modhandlers[$pgdata["sources"][$i]["type"]]) && $pgdata["sources"][$i]["type"] == 0)
				$data .= $HPEtheConfig->modhandlers[$pgdata["sources"][$i]["type"]]["control"]->SerializeToXML($pgdata["sources"][$i]);

		$data .= "\t\t</PAGE>\n";
		return $data;
	}


	function Create($param)
	{
		$data = array();
		$data["sources"] = array( );
		$data["mode"] = "flat";
		return $data;
	}


	function AcceptsModule($type)
	{
		return ($type == 0  || $type == 4);
	}


	function AddModule(&$pgdata, &$moddata)
	{
		if($moddata["type"] == 0 || $moddate["type"] == 4)
			$pgdata["sources"][] = $moddata;
	}


	function &GetModule(&$pgdata, $modid)
	{
		if(isset($pgdata["sources"][$modid]))
			return $pgdata["sources"][$modid];
		return "";
	}


	function RemoveModule(&$pgdata, $modid)
	{
		$n = count($pgdata["sources"]);
		$ns = array();
		for($j=0, $k=0; $j<$n; $j++) 
		{
			if($j == $modid) continue;
			$ns[$k] = $pgdata["sources"][$j];
			$k++;
		}
		if(count($ns) == $n - 1)
		{
			$pgdata["sources"] = $ns;
			return "";
		}
		return "Module not found";
	}

	
	function Show()
	{
		global $HPEtheUser;
		global $HPEtheThemeMaker;
		global $page;

		echo $HPEtheThemeMaker->TPLRun("page.newslog", $this->GetData($HPEtheUser->pages[$page]));
	}


	function GetData(&$pagedata)
	{
		global $HPEinc;
		global $page;
		global $HPEtheConfig;
		global $HPEtheUser;

		$data = array();
		$data["items"] = array();

		$nitems = 0;
		$n = count($pagedata["sources"]);
		if($n)
		{
			$srcids = array();
			$modids = array();
			for($i=0; $i<$n; $i++)
			{
				$srcids[] = $pagedata["sources"][$i]["source"];
				$modids[$pagedata["sources"][$i]["source"]] = $i;
			}

			$nitems = HPELoadMultiNews($data, $srcids, 0, $sort = ($pagedata["mode"] == "flat" ? 0 : 1), $HPEtheUser->level);

			reset($data["items"]);
			$outdate = $pagedata["outdate"] * 3600 * 24;
			while(list($key, $val) = each($data["items"]))
			{
				if($outdate && $data["items"][$key]["date"] < time() - $outdate)
				{
					unset($data["items"][$key]);
					continue;
				}
				$data["items"][$key]["link"] = $HPEtheConfig->siteroot . "click/" . $data["items"][$key]["id"] . "/";
				$data["items"][$key]["elink"] = "";
				$data["items"][$key]["ulink"] = "";
			}
		}

		$data["title"] = $pagedata["title"];
		return $data;
	}

};


class HPEPageRandSources extends HPEPage
{

	function HPEPageRandSources() {
		$this->HPEPage();
		$this->Reset();
	}


	function Reset() {
		$this->type = "newsrandsrc";
		$this->url = "";
		$this->name = "Random News";
		$this->desc = "Show 9 randomly selected news boxes";
		$this->flags = (HPEPageHasDefValues);
	}


	function UnSerializeFromXML(&$XMLtree, $path, &$data)
	{
	}


	function SerializeToXML(&$pgdata)
	{
		$data = "\t\t<PAGE type=\"" . $pgdata["type"] . "\" id=\"" . $pgdata["id"] .
				"\" title=\"" . HPEXMLString($pgdata["title"]) . "\" />\n";
		return $data;
	}


	function Create($param)
	{
		$data = array();
		return $data;
	}


	function Show()
	{
		global $HPEtheConfig;
		global $HPEtheDB;
		global $HPEtheThemeMaker;
		global $page;

		$HPEtheNEWSmodule = &$HPEtheConfig->modhandlers[0]["control"];
		
		$data = array();
		$data["title"] = ($page == -1 ? $this->name : "");
		
		$query = "SELECT count(*) FROM $HPEtheDB->dbtnewssites;";
		$numsites = $HPEtheDB->one_data($query);
		if($numsites) 
		{
			mt_srand((double)microtime() * 1000000);
		
			$data["COL"] = array( );
		
			for($i=0; $i<3; $i++) 
			{
				$data["COL"][$i] = array( );
				for($j=0; $j<3; $j++) 
				{
					$k = 0;
					$id = 0;
					while($k < 10) 
					{
						$t = mt_rand(1, $numsites);
						HPELoadSingleNews($srcdata, $t);
						if(count($srcdata) && !($srcdata["flags"] & HPENewsDisable))
						{
							$data["COL"][$i][$j] = $HPEtheNEWSmodule->showChannel( $t, 5 );
							break;
						}
					}
				}
			}		
		}
		echo $HPEtheThemeMaker->TPLRun("page.newsboxes", $data);
	}

};


class HPEPageRecentSources extends HPEPage
{

	function HPEPageRecentSources() 
	{
		$this->HPEPage();
		$this->Reset();
	}


	function Reset() 
	{
		$this->type = "newsrecentsrc";
		$this->url = "";
		$this->name = "Recent News Sources";
		$this->desc = "Show news boxes for 9 most recent sources";
		$this->flags = (HPEPageHasDefValues);
	}


	function UnSerializeFromXML(&$XMLtree, $path, &$data)
	{
	}


	function SerializeToXML(&$pgdata)
	{
		$data = "\t\t<PAGE type=\"" . $pgdata["type"] . "\" id=\"" . $pgdata["id"] .
				"\" title=\"" . HPEXMLString($pgdata["title"]) . "\" />\n";
		return $data;
	}


	function Create($param)
	{
		$data = array();
		return $data;
	}


	function Show()
	{
		global $HPEtheConfig;
		global $HPEtheDB;
		global $HPEtheThemeMaker;
		global $page;

		$HPEtheNEWSmodule = &$HPEtheConfig->modhandlers[0]["control"];

		$data = array( );
		$data["title"] = ($page == -1 ? $this->name : "");

		$result = $HPEtheDB->query("SELECT siteid FROM $HPEtheDB->dbtnewssites WHERE !(flags & " . HPENewsDisable . ") ORDER BY siteid DESC LIMIT 9");
		if(!$HPEtheDB->iserror($result)) 
		{
			$k=0;
			$data["COL"] = array( );
			for($i=0; $i<3; $i++) 
			{
				$data["COL"][$i] = array( );
				for($j=0; $j<3; $j++) 
				{
					$row = $HPEtheDB->getrow($result);
					if(!$row) 
						break;
					$data["COL"][$i][$j] = $HPEtheNEWSmodule->showChannel( $row["siteid"], 5 );
				}
			}
		}
		echo $HPEtheThemeMaker->TPLRun("sources.recent", $data);
	}


};


class HPEPageNewsNavigator extends HPEPage 
{

	function HPEPageNewsNavigator() 
	{
		$this->HPEPage();
		$this->Reset();
	}


	function Reset() 
	{
		$this->type = "newscat";
		$this->url = "";
		$this->name = "News Navigator";
		$this->desc = "Browse News Items by Category";
		$this->flags = (HPEPageHasDefValues | HPEPageEditable);
		$this->showpath = $GLOBALS["HPEinc"] . "/plugins/page.newsnav.show.inc";
	}


	function UnSerializeFromXML(&$XMLtree, $path, &$data)
	{
		$data["cat"] = $XMLtree->getAttribute($path, "cat");
		$data["excludes"] = $XMLtree->getAttribute($path, "excludes");
	}


	function SerializeToXML(&$pgdata)
	{
		$data = "\t\t<PAGE type=\"" . $pgdata["type"] . "\" id=\"" . $pgdata["id"] .
				"\" title=\"" . HPEXMLString($pgdata["title"]) . "\" cat=\"" . $pgdata["cat"] . "\" " .
				" excludes=\"" . $pgdata["excludes"] . "\" />\n";
		return $data;
	}


	function Create($param)
	{
		$data = array();
		if($param == "") {
			$data["cat"] = 0;
			$data["excludes"] = "";
		} else {
			$data["cat"] = $param["cat"];
			$data["excludes"] = $param["excludes"];
		}
		return $data;
	}


};


class HPEPageTeaser extends HPEPage 
{

	function HPEPageTeaser() 
	{
		$this->HPEPage();
		$this->Reset();
	}


	function Reset() 
	{
		$this->type = "teaser";
		$this->url = "";
		$this->name = "Teaser";
		$this->desc = "Main Page for guest users";
		$this->flags = (HPEPageHidden);
	}


	function UnSerializeFromXML(&$XMLtree, $path, &$data)
	{
	}


	function SerializeToXML(&$pgdata)
	{
		$data = "\t\t<PAGE type=\"" . $pgdata["type"] . "\" id=\"" . $pgdata["id"] .
				"\" title=\"" . HPEXMLString($pgdata["title"]) . "\" />\n";
		return $data;
	}


	function Create($param)
	{
		die("Can't create a page of type '$this->type'");
	}


	function Show()
	{
		global $HPEtheThemeMaker;
		global $HPEtheDB;
		global $HPEtheUser;

		$data = array(
				"numsites" => $HPEtheDB->one_data("SELECT count(*) FROM $HPEtheDB->dbtnewssites")
			   );
		echo $HPEtheThemeMaker->TPLRun("teaser", $data);
	}


};

?>