forked from blak3r/email-to-sugar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
email_to_sugar_exporter.php
59 lines (37 loc) · 994 Bytes
/
email_to_sugar_exporter.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
/**
* Simple script to export email_to_sugar
*/
$OUTPUT_FILE = "C:/sugarcrm/htdocs/email_to_sugar-release.php";
$handle = fopen($OUTPUT_FILE, 'w');
$lines = file("C:/sugarcrm/htdocs/email_to_sugar.php");
$mode = "";
foreach($lines as $line)
{
$skipLine = false;
//echo($line);
// Check for start of skip condition
if( preg_match("/.*RELEASE EXCLUDE START.*/i", $line, $matches) ) {
$mode = "skip";
$skipLine = true;
echo ( "skipping begins on : $line\n");
}
else if( $mode == "skip" && preg_match("/.*RELEASE EXCLUDE END.*/i", $line, $matches) ) {
$mode = "";
$skipLine = true;
echo ( "skipping ends on : $line\n");
}
else if( preg_match("/.*RELEASE INCLUDE START.*/i", $line, $matches ) ) {
$skipLine = true;
$mode = "";
}
else if( preg_match("/.*RELEASE INCLUDE END.*/i", $line, $matches ) ) {
$skipLine = true;
$mode = "";
}
if( $mode != "skip" && !$skipLine ) {
fwrite($handle, $line );
}
}
fclose($handle);
?>