XOOPS  2.6.0
install.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
31 {
32  /* This is all upgrade related, not install.
33  TODO: Add to upgrade script and remove from here
34 
35  global $xoopsDB;
36  // delete avatar_allow_upload, avatar_width, avatar_height, avatar_maxsize and avatar_minposts
37  $xoops = Xoops::getInstance();
38  $sql = "DELETE FROM " . $xoopsDB->prefix("config") . " WHERE `conf_name` IN "
39  . " ('avatar_allow_upload', 'avatar_width', 'avatar_height', 'avatar_maxsize', 'avatar_minposts') ";
40  $xoopsDB->queryF($sql);
41 
42  $dbManager = new XoopsDatabaseManager();
43  $map = array(
44  'avatar_id' => 'avatar_id',
45  'avatar_file' => 'avatar_file',
46  'avatar_name' => 'avatar_name',
47  'avatar_mimetype' => 'avatar_mimetype',
48  'avatar_created' => 'avatar_created',
49  'avatar_display' => 'avatar_display',
50  'avatar_weight' => 'avatar_weight',
51  'avatar_type' => 'avatar_type',
52  );
53  $dbManager->copyFields($map, 'avatar', 'avatars_avatar', false);
54 
55  $map = array(
56  'avatar_id' => 'avatar_id',
57  'user_id' => 'user_id',
58  );
59  $dbManager->copyFields($map, 'avatar_user_link', 'avatars_user_link', false);
60  */
61 
63 
64  // create folder "avatars"
65  $dir = $xoops_root_path . "/uploads/avatars";
66  if (!is_dir($dir)) {
67  mkdir($dir, 0777);
68  chmod($dir, 0777);
69  }
70  //Copy index.html
71  $file = $xoops_root_path . "/uploads/avatars/index.html";
72  if (!is_file($file)) {
73  copy($xoops_root_path . "/modules/avatars/images/index.html", $file);
74  }
75  //Copy blank.gif
76  $file = $xoops_root_path . "/uploads/avatars/blank.gif";
77  if (!is_file($file)) {
78  copy($xoops_root_path . "/modules/avatars/images/blank.gif", $file);
79  }
80  //Copy .htaccess
81  $file = $xoops_root_path . "/uploads/avatars/.htaccess";
82  if (!is_file($file)) {
83  copy($xoops_root_path . "/uploads/.htaccess", $file);
84  }
85  return true;
86 }
if(!isset($xoops->paths[$path_type])) if($path_type== 'var') $file
Definition: browse.php:55
if(DIRECTORY_SEPARATOR!="/") $xoops_root_path
Definition: config.php:7
static get($name)
$module
Definition: main.php:52
xoops_module_install_avatars(&$module)
Definition: install.php:30
$dir
Definition: browse.php:56