~quam-plures-core/quam-plures/mass_file_upload

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
<?php
/**
 * This is the main public interface file.
 *
 * IF YOU ARE READING THIS IN YOUR WEB BROWSER, IT MEANS THAT PHP IS NOT PROPERLY INSTALLED
 * ON YOUR WEB SERVER. IF YOU DON'T KNOW WHAT THIS MEANS, CONTACT YOUR SERVER ADMINISTRATOR
 * OR YOUR HOSTING COMPANY.
 *
 * This file is NOT mandatory. You can delete it if you want.
 * You can also replace the contents of this file with contents similar to the contents
 * of a_stub.php, a_notemplate.php, multiblogs.php, etc.
 *
 * Quam Plures - {@link http://quamplures.net/}
 * Released under GNU GPL License - {@link http://quamplures.net/license.html}
 * @copyright (c) 2009 - 2011 by the Quam Plures developers - {@link http://quamplures.net/}
 * @copyright (c)2003-2009 by Francois PLANQUE - {@link http://fplanque.net/}
 *
 * {@internal Note: we need at least one file in the main package}}
 *
 * @package pond
 */

/**
 * First thing: Do the minimal initializations required for QP:
 */
require_once dirname(__FILE__).'/qp_config/_config.php';

/**
 * Check this: we are requiring _main.inc.php INSTEAD of _blog_main.inc.php
 * because we are not trying to initialize any particular blog
 */
require_once $inc_path.'_main.inc.php';

// Check if a specific blog has been requested in the URL:
param( 'blog', 'integer', '', true );

if( empty($blog) )
{ // No blog requested by URL param, let's try to match something in the URL
	$Debuglog->add( 'No blog param received, checking extra path...', 'detectblog' );

	$BlogCache = & get_Cache( 'BlogCache' );

	if( preg_match( '#^(.+?)index.php/([^/]+)#', $ReqHost.$ReqPath, $matches ) )
	{ // We have an URL blog name:
		$Debuglog->add( 'Found a potential URL blog name: '.$matches[2], 'detectblog' );
		if( (($Blog = & $BlogCache->get_by_urlname( $matches[2], false )) !== false) )
		{ // We found a matching blog:
			$blog = $Blog->ID;
		}
	}

	if( empty($blog) )
	{ // No blog identified by URL name, let's try to match the absolute URL
		if( preg_match( '#^(.+?)index.php#', $ReqHost.$ReqPath, $matches ) )
		{ // Remove what's not part of the absolute URL
			$ReqAbsUrl = $matches[1];
		}
		else
		{
			$ReqAbsUrl = $ReqHost.$ReqPath;
		}
		$Debuglog->add( 'Looking up absolute url : '.$ReqAbsUrl, 'detectblog' );

		if( (($Blog = & $BlogCache->get_by_url( $ReqAbsUrl, false )) !== false) )
		{ // We found a matching blog:
			$blog = $Blog->ID;
			$Debuglog->add( 'Found matching blog: '.$blog, 'detectblog' );
		}
	}

	if( empty($blog) )
	{ // Still no blog requested, use default
		$blog = $Settings->get('default_blog_ID');
		if( (($Blog = & $BlogCache->get_by_ID( $blog, false, false )) !== false) )
		{ // We found a matching blog:
			$Debuglog->add( 'Using default blog '.$blog, 'detectblog' );
		}
		else
		{
			$blog = NULL;
		}
	}

	if( empty($blog) )
	{ // No specific blog to be displayed, so make something nice then exit
		header_content_type( 'text/html' ); // sets charset
		?>
		<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
		<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php locale_lang() ?>" lang="<?php locale_lang() ?>">
		<head>
		<title><?php echo $app_name; ?> - Default Page</title>
		<meta name="viewport" content="width = 750" />
		<link href="qp_rsc/css/support_install.css" rel="stylesheet" type="text/css" />
		<base href="<?php echo $app_baseurl ?>" />
		</head>
		<body>
		<?php
		// --- --- --- --- --- --- --- --- --- --- ---
		// --- TOOLBAR INCLUDED HERE ---
		require $templates_path.'_toolbar.inc.php';
		echo "\n";
		if( is_logged_in() )
		{
			echo '<div id="template_wrapper" class="template_wrapper_loggedin">';
		}
		else
		{
			echo '<div id="template_wrapper" class="template_wrapper_anonymous">';
		}
		echo "\n";
		?>
		<div class="wrapper1"><div class="wrapper2"><div class="block1"><div class="block2"><div class="block3">
		<h1><?php printf( T_('Welcome to %s'), $app_name ); ?></h1>
		<?php
		// messages generated from actions
		messages( array() );
		$BlogCache = & get_Cache('BlogCache');
		$BlogCache->load_all();
		if( count( $BlogCache->cache ) == 0 )
		{	// There is no blog on this system!
			echo '<p><strong>';
			printf( T_('%s is installed and ready but you haven\'t created any blog on this system yet.'), $app_name );
			echo '</strong></p>';
			echo '<p><a href="'.$admin_url.'?ctrl=collections&amp;action=new">'.T_( 'Create a first blog' ).' &raquo;</a></p>';
		}
		else
		{
			echo '<p><strong>';
			printf( T_('You have successfully installed %s.'), $app_name );
			echo '</strong></p>';
			echo '<p>'.T_('You haven\'t set a default blog yet. Thus, you see this default page.').'</p>';
			?>
			<p><a href="<?php echo $admin_url ?>?ctrl=settings&amp;tab=general"><?php echo T_( 'Set a default blog' ) ?> &raquo;</a></p>
			<?php
		}
		?>
		</div></div></div></div>
		<div class="body_fade_out"><div class="menu_bottom">
		<?php
		echo '<a href="contact.php" title="'.T_('Contact the admin').'">'.T_('Contact the admin').'</a>';
		echo ' &bull; ';
		echo T_('powered by').' <a href="'.$app_homepage.'" title="'.$app_homepage.'">'.$app_name.'</a>';
		?>
		</div></div></div></div></body></html>
		<?php
		exit();
	}
}

// A blog has been requested... Let's set a few default params:

# You could *force* a specific template here with this setting:
# $template = 'basic';

# This setting retricts posts to those published, thus hiding drafts.
# You should not have to change this.
$show_statuses = array();

# Here you can set a limit before which posts will be ignored
# You can use a unix timestamp value or 'now' which will hide all posts in the past
$timestamp_min = '';

# Here you can set a limit after which posts will be ignored
# You can use a unix timestamp value or 'now' which will hide all posts in the future
$timestamp_max = 'now';

# Additionnaly, you can set other values (see URL params in the manual)...
# $order = 'ASC'; // This for example would display the blog in chronological order...

// That's it, now let Quam Plures do the rest! :)
require $inc_path.'_blog_main.inc.php';

?>