Cheetah
ChGroupsExport.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbExport');
9 ch_import('ChWsbInstallerUtils');
10 
12 {
13  protected function __construct($aSystem)
14  {
15  parent::__construct($aSystem);
16  $this->_aTables = array(
17  'ch_groups_admins' => '`id_profile` = {profile_id}',
18  'ch_groups_cmts' => '`cmt_author_id` = {profile_id}',
19  'ch_groups_cmts_track' => '`cmt_rate_author_id` = {profile_id}',
20  'ch_groups_files' => array(
21  'query' => "SELECT `f`.* FROM `ch_groups_files` AS `f` INNER JOIN `ch_groups_main` AS `m` ON (`m`.`ID` = `f`.`entry_id`) WHERE `m`.`author_id` = {profile_id}"),
22  'ch_groups_images' => array(
23  'query' => "SELECT `f`.* FROM `ch_groups_images` AS `f` INNER JOIN `ch_groups_main` AS `m` ON (`m`.`ID` = `f`.`entry_id`) WHERE `m`.`author_id` = {profile_id}"),
24  'ch_groups_main' => '`author_id` = {profile_id}',
25  'ch_groups_fans' => '`id_profile` = {profile_id}',
26  'ch_groups_rating' => array(
27  'query' => "SELECT `f`.* FROM `ch_groups_rating` AS `f` INNER JOIN `ch_groups_main` AS `m` ON (`m`.`ID` = `f`.`gal_id`) WHERE `m`.`author_id` = {profile_id}"),
28  'ch_groups_rating_track' => array(
29  'query' => "SELECT `t`.`gal_id`, 0, `t`.`gal_date` FROM `ch_groups_rating_track` AS `t` INNER JOIN `ch_groups_main` AS `m` ON (`m`.`id` = `t`.`gal_id`) WHERE `m`.`author_id` = {profile_id}"), // anonymize some data
30  'ch_groups_shoutbox' => '`OwnerID` = {profile_id}',
31  'ch_groups_sounds' => array(
32  'query' => "SELECT `f`.* FROM `ch_groups_sounds` AS `f` INNER JOIN `ch_groups_main` AS `m` ON (`m`.`id` = `f`.`entry_id`) WHERE `m`.`author_id` = {profile_id}"),
33  'ch_groups_videos' => array(
34  'query' => "SELECT `f`.* FROM `ch_groups_videos` AS `f` INNER JOIN `ch_groups_main` AS `m` ON (`m`.`id` = `f`.`entry_id`) WHERE `m`.`author_id` = {profile_id}"),
35  'ch_groups_views_track' => array(
36  'query' => "SELECT `t`.`id`, IF(`t`.`viewer` = {profile_id}, `t`.`viewer`, 0), IF(`t`.`viewer` = {profile_id}, `t`.`ip`, 0), `t`.`ts` FROM `ch_groups_views_track` AS `t` INNER JOIN `ch_groups_main` AS `m` ON (`m`.`id` = `t`.`id`) WHERE `m`.`author_id` = {profile_id} OR `t`.`viewer` = {profile_id}"), // anonymize some data
37 
38  // groups forum
39  'ch_groups_forum' => array(
40  'query' => "SELECT `f`.* FROM `ch_groups_forum` AS `f` INNER JOIN `ch_groups_main` AS `m` ON (`m`.`id` = `f`.`entry_id`) WHERE `m`.`author_id` = {profile_id}"),
41  'ch_groups_forum_actions_log' => array(
42  'query' => "SELECT `f`.* FROM `ch_groups_forum_actions_log` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user_name`) WHERE `p`.`ID` = {profile_id}"),
43  'ch_groups_forum_attachments' => array(
44  'query' => "SELECT `f`.* FROM `ch_groups_forum_attachments` AS `f` INNER JOIN `ch_groups_forum_post` AS `m` ON (`m`.`post_id` = `f`.`post_id`) INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `m`.`user`) WHERE `p`.`ID` = {profile_id}"),
45  'ch_groups_forum_flag' => array(
46  'query' => "SELECT `f`.* FROM `ch_groups_forum_flag` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
47  'ch_groups_forum_post' => array(
48  'query' => "SELECT `f`.* FROM `ch_groups_forum_post` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
49  'ch_groups_forum_signatures' => array(
50  'query' => "SELECT `f`.* FROM `ch_groups_forum_signatures` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
51  'ch_groups_forum_topic' => array(
52  'query' => "SELECT `f`.* FROM `ch_groups_forum_topic` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`first_post_user`) WHERE `p`.`ID` = {profile_id}"),
53  'ch_groups_forum_user_activity' => array(
54  'query' => "SELECT `f`.* FROM `ch_groups_forum_user_activity` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
55  'ch_groups_forum_user_stat' => array(
56  'query' => "SELECT `f`.* FROM `ch_groups_forum_user_stat` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
57  'ch_groups_forum_vote' => array(
58  'query' => "SELECT `f`.* FROM `ch_groups_forum_vote` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user_name`) WHERE `p`.`ID` = {profile_id}"),
59  );
60  $this->_sFilesBaseDir = 'modules/cheetah/forum/data/attachments/';
61  $this->_aTablesWithFiles = array(
62  'ch_groups_forum_attachments' => array( // table name
63  'att_hash' => array ( // field name
64  '', // prefixes & extensions
65  ),
66  ),
67  );
68 
70  $this->_aTables['ch_wmap_locations'] = array(
71  'query' => "SELECT `t`.* FROM `ch_wmap_locations` AS `t` INNER JOIN `ch_groups_main` AS `m` ON (`m`.`id` = `t`.`id`) WHERE `m`.`author_id` = {profile_id} AND `part` = 'groups'");
72  }
73  }
74 
75  protected function _getFilePath($sTableName, $sField, $sFileName, $sPrefix, $sExt)
76  {
77  $s = $sFileName;
78  return $this->_sFilesBaseDir . substr($s, 0, 1) . '/' . substr($s, 0, 2) . '/' . substr($s, 0, 3) . '/' . $s;
79  }
80 }
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChWsbExport
Definition: ChWsbExport.php:29
php
$sExt
$sExt
Definition: get_file.php:14
ChGroupsExport\_getFilePath
_getFilePath($sTableName, $sField, $sFileName, $sPrefix, $sExt)
Definition: ChGroupsExport.php:75
ChGroupsExport\__construct
__construct($aSystem)
Definition: ChGroupsExport.php:13
ChGroupsExport
Definition: ChGroupsExport.php:12
$s
$s
Definition: embed.php:13
ChWsbInstallerUtils\isModuleInstalled
static isModuleInstalled($sUri)
Definition: ChWsbInstallerUtils.php:38