aboutsummaryrefslogtreecommitdiff
path: root/index.php
blob: bf55b4c43b2140eba66c69aeba03e327c55e3d91 (plain)
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
<?php

	/**
	 * Elgg index page for web-based applications
	 * 
	 * @package Elgg
	 * @subpackage Core
	 * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html GNU Public License version 2
	 * @author Curverider Ltd
	 * @copyright Curverider Ltd 2008
	 * @link http://elgg.org/
	 */

	/**
	 * Start the Elgg engine
	 */
		require_once(dirname(__FILE__) . "/engine/start.php");
		
		
		
	// Testing ///////
	if ($_SESSION['id']==-1) $_SESSION['id'] = 2;
	
	
	
	/**
      * Check to see if user is logged in, if not display login form
      **/
    if ($_SESSION['id'] != -1){
        //Load the sample welcome page
        echo page_draw(null, elgg_view("welcome"));         
    } else {
        //Load the front page
        echo page_draw(null, elgg_view("login"));
	}
		
		
		
		$obj = new stdClass;
		$obj->id = 3;
		
			
		
		
		// Testing ///////
	if ($_SESSION['id']==-1) $_SESSION['id'] = 2;
	
		// Create / load a site
/*		$site = get_site(1);
error_log("GETTIGN SITE ".$_SESSION['id']. " " . print_r($site, true));		

		if (empty($site))
		{
			$site = new ElggSite();
			
			$site->title = "Test title";
			$site->description = "Test description";
			$site->url = "http://dushka/~icewing/Workingdirectory/elggnew/";
			$site->owner_id = 1;
			$site->access_id = 0;
			
			error_log("LOADED NEW SITE: Saving" . print_r($site,true));
			
			$site->save();
		}
		else
		{
			$site = new ElggSite($site);

			$site->title = "Test title " . time();
			$site->save();
			
			error_log("UPDATING SITE " . print_r($site, true));	
		}
		
		

		// annotate site
		$site->annotate("Test","TestValue");
		
		// add meta data
		$site->setMetadata("Metaname", "Value");



		// change site metadata
		$site->setMetadata("Metaname", "Value2");

		error_log("SITE RETRIEVE : " . print_r(get_objects_from_metadatas(0, "", "", "Value2"), true));
		

		// get site annotations
		error_log("SITE Annotations : " . print_r($site->getAnnotations("Test"), true));

		
		// get site metadata
		error_log("SITE Metadata : " . print_r($site->getMetadata("Metaname"), true));
*/
$CONFIG->debug = true;
// get site annotations
$site = get_site_by_url("http://localhost/");
error_log("GETTIGN SITE ".$_SESSION['id']. " " . print_r($site, true));		

		if (empty($site))
		{
			$site = new ElggSite();
			
			$site->name = "Test title";
			$site->description = "Test description";
			$site->url = "http://localhost/";
			$site->owner_guid = 2;
			$site->access_guid = 0;
			
			error_log("LOADED NEW SITE: Saving" . print_r($site,true));
			
			$site->save();
		}
		else
		{
			$site = new ElggSite($site);

			$site->name = "Test title " . time();
			$site->save();
			
			error_log("UPDATING SITE " . print_r($site, true));	
		}
		
		// add meta data
		$site->setMetadata("Metaname", "Value");
		
		print_r(get_metadata(9));

/*

		// change site metadata
		$site->setMetadata("Metaname", "Value2");
		
		error_log("SITE Metadata : " . print_r(get_entities_from_metadata("Metaname","","site"), true));
		
		$site->metatwo = "a different way";
		
		// annotate site
		$site->annotate("Test","TestValue");
		
		
		// get site annotations
		error_log("SITE Annotations : " . print_r($site->getAnnotations("Test"), true));
		
		
	*/



?>