summaryrefslogtreecommitdiff
path: root/rainloop-fwd.php
blob: d742f446e3173f95fb470d6d761fb22f85c3c6d1 (plain)
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
<?php
# index.php
	define('APP_VERSION', '1.12.1');
	define('APP_VERSION_TYPE', 'community');
	define('APP_INDEX_ROOT_FILE', __FILE__);
	define('APP_INDEX_ROOT_PATH', str_replace('\\', '/', rtrim(dirname(__FILE__), '\\/').'/'));

# rainloop/v/1.12.1/include.php
			define('APP_VERSION_ROOT_PATH', APP_INDEX_ROOT_PATH.'rainloop/v/'.APP_VERSION.'/');
				date_default_timezone_set('UTC');
			define('APP_DEFAULT_PRIVATE_DATA_NAME', '_default_');
			define('APP_DATA_FOLDER_PATH_UNIX', str_replace('\\', '/', APP_DATA_FOLDER_PATH));

      $sPrivateDataFolderInternalName='...';
			$sSalt = @file_get_contents(APP_DATA_FOLDER_PATH.'SALT.php');
			$sData = file_exists(APP_DATA_FOLDER_PATH.'DATA.php') ? @file_get_contents(APP_DATA_FOLDER_PATH.'DATA.php') : '';
			$sInstalled = @file_get_contents(APP_DATA_FOLDER_PATH.'INSTALLED');

			define('APP_SALT', md5($sSalt.APP_PRIVATE_DATA_NAME.$sSalt));
			define('APP_PRIVATE_DATA', APP_DATA_FOLDER_PATH.'_data_'.($sData ? md5($sData) : '').'/'.APP_PRIVATE_DATA_NAME.'/');
			define('APP_PLUGINS_PATH', APP_PRIVATE_DATA.'plugins/');
			unset($sSalt, $sData, $sInstalled, $sPrivateDataFolderInternalName);

# rainloop/v/1.12.1/app/handle.php
  #\define('RAINLOOP_APP_PATH', \rtrim(\realpath(__DIR__), '\\/').'/');
  # include mis a plat donc chemin modifie
	\define('RAINLOOP_APP_PATH', APP_VERSION_ROOT_PATH.'app/');
	\define('RAINLOOP_APP_LIBRARIES_PATH', RAINLOOP_APP_PATH.'libraries/');
	\define('RAINLOOP_MB_SUPPORTED', \function_exists('mb_strtoupper'));

	\define('RAINLOOP_INCLUDE_AS_API_DEF', isset($_ENV['RAINLOOP_INCLUDE_AS_API']) && $_ENV['RAINLOOP_INCLUDE_AS_API']);
		\define('RL_BACKWARD_CAPABILITY', true);
		include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/BackwardCapability/Account.php';


	function rainLoopSplAutoloadNamespaces()
	{
		return RAINLOOP_INCLUDE_AS_API_DEF ? array('RainLoop', 'Predis') :
			array('RainLoop', 'Facebook', 'PHPThumb', 'Predis', 'SabreForRainLoop', 'Imagine', 'Detection');
	}

	function rainLoopSplAutoloadRegisterFunction($sClassName)
	{
		if ($sClassName && '\\' === $sClassName[0])
		{
			$sClassName = \substr($sClassName, 1);
		}

		foreach (rainLoopSplAutoloadNamespaces() as $sNamespaceName)
		{
			if (0 === \strpos($sClassName, $sNamespaceName.'\\'))
			{
				$sPrefix = '';
				if ('Detection' === $sNamespaceName)
				{
					$sPrefix = 'Mobile_Detect/namespaced/';
				}

				if ('SabreForRainLoop' === $sNamespaceName && !RAINLOOP_MB_SUPPORTED && !defined('RL_MB_FIXED'))
				{
					\define('RL_MB_FIXED', true);
					include_once RAINLOOP_APP_LIBRARIES_PATH.'RainLoop/Common/MbStringFix.php';
				}

				error_log("include ".RAINLOOP_APP_LIBRARIES_PATH.$sPrefix.\strtr($sClassName, '\\', '/').'.php');
				return include RAINLOOP_APP_LIBRARIES_PATH.$sPrefix.\strtr($sClassName, '\\', '/').'.php';
			}
		}

    error_log("$sClassName not found");
		return false;
	}

  \spl_autoload_register('rainLoopSplAutoloadRegisterFunction', false);
  include APP_VERSION_ROOT_PATH.'app/libraries/MailSo/MailSo.php';
  \define('APP_API_STARTED', true);

# me and rainloop/v/1.12.1/app/libraries/RainLoop/Providers/Filters/SieveStorage.php
include_once('SieveStorageNoPriv.php');
class SieveDump extends RainLoop\Providers\Filters\SieveStorageNoPriv
{
  public function Dump($aFilters) {
				$sUserFilter = $this->collectionToFileString($aFilters);
        return $sUserFilter;
  }
}

# rainloop/v/1.12.1/app/libraries/RainLoop/Api.php
$oActions = \RainLoop\Actions::NewInstance();
# me
$oSieveDump = new SieveDump($oActions->Plugins(), $oActions->Config());

# rainloop/v/1.12.1/app/libraries/RainLoop/Providers/Filters/Classes/Filter.php
$oFilter = new RainLoop\Providers\Filters\Classes\Filter();

# me
$sMailFwdTo = filter_var($_GET['to'], FILTER_SANITIZE_EMAIL);
$oFilter->FromJSON(array(
  'ID' => '1',
  'Name' => 'Renvoi',
  'ActionType' => \RainLoop\Providers\Filters\Enumerations\ActionType::FORWARD,
  'ActionValue' => $sMailFwdTo,
  'Keep' => 0,
));

header('Content-Type: text/plain');
echo $oSieveDump->Dump(array($oFilter));