added files yo
[civicrm-lp.git] / CRM / Lp / Page / Namer.php
1 <?php
2
3 require_once 'CRM/Core/Page.php';
4
5 define('DIR_SPOOL', '/var/www/html/sites/default/files/civicrm/lp/spool');
6 define('DIR_STORE', '/var/www/html/sites/default/files/civicrm/lp/store');
7 define('DIR_TEMP', '/var/www/html/sites/default/files/civicrm/lp/tmp');
8
9 class CRM_Lp_Page_Namer extends CRM_Core_Page {
10 function run() {
11
12 if(isset($_POST)) {
13 if(array_key_exists('batchname', $_POST)) {
14 $file = '/tmp/'.$_POST['file'];
15
16
17 $ph = popen('/usr/local/bin/splitletters.sh '.$file.' '.$_POST['batchname'].' '.$_POST['batchsize'], 'r');
18 echo fgets($ph);
19 echo $file;
20 pclose($ph);
21
22 unlink($file);
23
24
25 header('Location: /civicrm/lp-admin');
26 exit;
27 }
28 }
29
30 if(isset($_GET)) {
31 if(!array_key_exists('file', $_GET)) {
32 header('Location: /civicrm/lp-admin');
33 exit;
34 }
35 }
36
37
38
39 $this->assign('file',$_GET['file']);
40 // Example: Set the page-title dynamically; alternatively, declare a static title in xml/Menu/*.xml
41 CRM_Utils_System::setTitle(ts('CiviCRM LPAdmin'));
42
43
44
45 // Example: Assign a variable for use in a template
46
47 parent::run();
48 }
49 }