Cheetah
All Classes Namespaces Files Functions Variables Pages
ChStoreExport.php
Go to the documentation of this file.
1 <?php
2 
8 ch_import('ChWsbExport');
9 
11 {
12  protected function __construct($aSystem)
13  {
14  parent::__construct($aSystem);
15  $this->_aTables = array(
16  'ch_store_cmts' => '`cmt_author_id` = {profile_id}',
17  'ch_store_cmts_track' => '`cmt_rate_author_id` = {profile_id}',
18  'ch_store_customers' => '`client_id` = {profile_id}',
19  'ch_store_products' => '`author_id` = {profile_id}',
20  'ch_store_product_files' => array(
21  'query' => "SELECT `f`.* FROM `ch_store_product_files` AS `f` INNER JOIN `ch_store_products` AS `m` ON (`m`.`id` = `f`.`entry_id`) WHERE `m`.`author_id` = {profile_id}"),
22  'ch_store_product_images' => array(
23  'query' => "SELECT `f`.* FROM `ch_store_product_images` AS `f` INNER JOIN `ch_store_products` AS `m` ON (`m`.`id` = `f`.`entry_id`) WHERE `m`.`author_id` = {profile_id}"),
24  'ch_store_product_videos' => array(
25  'query' => "SELECT `f`.* FROM `ch_store_product_videos` AS `f` INNER JOIN `ch_store_products` AS `m` ON (`m`.`id` = `f`.`entry_id`) WHERE `m`.`author_id` = {profile_id}"),
26  'ch_store_rating' => array(
27  'query' => "SELECT `f`.* FROM `ch_store_rating` AS `f` INNER JOIN `ch_store_products` AS `m` ON (`m`.`id` = `f`.`gal_id`) WHERE `m`.`author_id` = {profile_id}"),
28  'ch_store_rating_track' => array(
29  'query' => "SELECT `t`.`gal_id`, 0, `t`.`gal_date` FROM `ch_store_rating_track` AS `t` INNER JOIN `ch_store_products` AS `m` ON (`m`.`id` = `t`.`gal_id`) WHERE `m`.`author_id` = {profile_id}"), // anonymize some data
30  'ch_store_views_track' => array(
31  'query' => "SELECT `t`.`id`, IF(`t`.`viewer` = {profile_id}, `t`.`viewer`, 0), IF(`t`.`viewer` = {profile_id}, `t`.`ip`, 0), `t`.`ts` FROM `ch_store_views_track` AS `t` INNER JOIN `ch_store_products` AS `m` ON (`m`.`id` = `t`.`id`) WHERE `m`.`author_id` = {profile_id} OR `t`.`viewer` = {profile_id}"), // anonymize some data
32 
33  // events forum
34  'ch_store_forum' => array(
35  'query' => "SELECT `f`.* FROM `ch_store_forum` AS `f` INNER JOIN `ch_store_products` AS `m` ON (`m`.`id` = `f`.`entry_id`) WHERE `m`.`author_id` = {profile_id}"),
36  'ch_store_forum_actions_log' => array(
37  'query' => "SELECT `f`.* FROM `ch_store_forum_actions_log` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user_name`) WHERE `p`.`ID` = {profile_id}"),
38  'ch_store_forum_attachments' => array(
39  'query' => "SELECT `f`.* FROM `ch_store_forum_attachments` AS `f` INNER JOIN `ch_store_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}"),
40  'ch_store_forum_flag' => array(
41  'query' => "SELECT `f`.* FROM `ch_store_forum_flag` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
42  'ch_store_forum_post' => array(
43  'query' => "SELECT `f`.* FROM `ch_store_forum_post` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
44  'ch_store_forum_signatures' => array(
45  'query' => "SELECT `f`.* FROM `ch_store_forum_signatures` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
46  'ch_store_forum_topic' => array(
47  'query' => "SELECT `f`.* FROM `ch_store_forum_topic` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`first_post_user`) WHERE `p`.`ID` = {profile_id}"),
48  'ch_store_forum_user_activity' => array(
49  'query' => "SELECT `f`.* FROM `ch_store_forum_user_activity` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
50  'ch_store_forum_user_stat' => array(
51  'query' => "SELECT `f`.* FROM `ch_store_forum_user_stat` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user`) WHERE `p`.`ID` = {profile_id}"),
52  'ch_store_forum_vote' => array(
53  'query' => "SELECT `f`.* FROM `ch_store_forum_vote` AS `f` INNER JOIN `Profiles` AS `p` ON (`p`.`NickName` = `f`.`user_name`) WHERE `p`.`ID` = {profile_id}"),
54  );
55  $this->_sFilesBaseDir = 'modules/cheetah/forum/data/attachments/';
56  $this->_aTablesWithFiles = array(
57  'ch_store_forum_attachments' => array( // table name
58  'att_hash' => array ( // field name
59  '', // prefixes & extensions
60  ),
61  ),
62  );
63  }
64 
65  protected function _getFilePath($sTableName, $sField, $sFileName, $sPrefix, $sExt)
66  {
67  $s = $sFileName;
68  return $this->_sFilesBaseDir . substr($s, 0, 1) . '/' . substr($s, 0, 2) . '/' . substr($s, 0, 3) . '/' . $s;
69  }
70 }
ChStoreExport\__construct
__construct($aSystem)
Definition: ChStoreExport.php:12
ChStoreExport
Definition: ChStoreExport.php:11
ch_import
ch_import($sClassName, $aModule=array())
Definition: utils.inc.php:1218
ChWsbExport
Definition: ChWsbExport.php:29
php
ChStoreExport\_getFilePath
_getFilePath($sTableName, $sField, $sFileName, $sPrefix, $sExt)
Definition: ChStoreExport.php:65
$sExt
$sExt
Definition: get_file.php:14
$s
$s
Definition: embed.php:13