forked from NorHei/multilingual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.php
44 lines (36 loc) · 1.41 KB
/
install.php
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
<?php
//no direct file access
if (count(get_included_files()) ==1) {
$z="HTTP/1.0 404 Not Found";
header($z);
die($z);
}
// include_once('../../config.php');
$mod_path = dirname(__FILE__);
$mod_rel = str_replace($_SERVER['DOCUMENT_ROOT'], '', str_replace('\\', '/', $mod_path));
$mod_name = basename($mod_path);
include('lang.functions.php');
include(get_module_language_file($mod_name));
// this function checks the basic configurations of an existing WB intallation
function status_msg($message, $class='check', $element='span')
{
// returns a status message
print '<'.$element .' class="' .$class .'">' .$message .'</' .$element.'>';
}
/**********************************************************
* - Add field "page_code" to table "pages"
*/
print '<h3>Step 1: Updating database pages entrie</h3>';
$database->field_add(TABLE_PREFIX.'pages', 'page_code', 'INT(11) NOT NULL AFTER `modified_by`');
print '<h3>Step 2: Updating field page_code with page_id by default language</h3>';
$lang_array = get_page_languages(); // check for page languages
if (count($lang_array)) {
$entries = array();
$entries = get_page_list(0);
// fill page_code with $page_id for default_language
foreach ($entries as $page_id => $val) {
if ($val['language'] == DEFAULT_LANGUAGE) {
db_update_field_entry($page_id, 'pages', (int)$page_id);
}
}
}