'doNew', 'preview' => 'doPreview', 'list' => 'doList', 'cancel' => 'doBack', 'insert' => 'doInsert', 'edit' => 'doEdit', 'update' => 'doUpdate', 'save_company_template' => 'doSaveLocationTemplate', 'save_as_company_template' => 'doSaveAsLocationTemplate', 'load_company_template' => 'doLoadLocationTemplate', 'del_company_template' => 'doDeleteLocationTemplate', 'test' => 'doTest', 'choose_recipients' => 'doChooseRecipients', 'save_recipients' => 'doSaveRecipients', 'send' => 'doSend', 'done' => 'doDone', 'show_legal_agreement' => 'doShowLegalAgreement', 'start_send' => 'doStartSend', 'get_report' => 'doGetReport', 'get_img_size' => 'doGetImageSize' ); var $moneyFields = array('property_size'=>'Size'); var $adminEnd = false; var $sendServerPort = BROADCAST_SERVER_PORT; var $sendServerIp = '127.0.0.1'; function initAction() { // Check For Legal Agreement //if ($this->DBObj->memberData['is_accepted_broadcast_legal_agreement'] == 'n') { // $this->action = 'show_legal_agreement'; //} // END Check For Legal Agreement if (empty($this->action)) { if (isset($_REQUEST['action']) && !empty($_REQUEST['action'])) { $this->action= $_REQUEST['action']; } else { $this->action = $this->defaultAction; } } if (key_exists($this->action, $this->actions)){ $this->actionMethod = $this->actions[$this->action]; } else { $this->action = key($this->actions); $this->actionMethod = current($this->actions); } if ($this->isXmlHttpRequest()) { $this->actionMethod .= 'Ajax'; } } function exec(&$Doc) { $this->Doc = &$Doc; $this->DBObj = SiteMap::getObj('BroadcastEmail/BroadcastEmail.php', $_REQUEST['id']); $this->DBObj->memberData = $this->Doc->MemberAuth->getData(); $this->initAction(); if (in_array($this->action, array('choose_recipients', 'save_recipients', 'send', 'done', 'start_send')) && !$this->hasAccess2ChooseRecipients() ) { $this->Doc->showMessageAccessDeny(); return false; } if (method_exists($this, $this->actionMethod)) { $function = $this->actionMethod; $this->$function(); } else { exit; } } function _getBaseForm($method = 'post') { require_once 'class/Form/Form.class.php'; $form = new Form($this->Doc, 'form_'.strtolower(get_class($this->DBObj)), $method, '', '_self', array('class'=>'form form_'.strtolower(get_class($this->DBObj)))); return $form; } function _bindFormFields($form) { $form->setAttribute('onsubmit', 'try { var myValidator = validate_broadcast_form; } catch(e) { return true; } return myValidator(this);'); $elList = $this->formCreateRadioboxList($form, 'id_type', $this->DBObj->getDEmailType4Select()); $form->addGroup($elList, 'broadcast_type', '', '', false); /*$specialtyList = $this->DBObj->getDSpecialty4Select('sorter', "profile = 'y'"); $elList = $this->formCreateRadioboxList($form, 'id_specialty', $specialtyList); $form->addGroup($elList, 'subjectRadiogroup2', '', '
', false);*/ $types = $this->DBObj->getDEmailSubType4Select(); $elList = $this->formCreateRadioboxList($form, 'listing_type', $types); $form->addGroup($elList, 'listing_type', '', '', false); $form->addElement('advcheckbox', 'listing_investment', '', 'Check here to list this as an investment opportunity in the archive', array(), array('n', 'y')); $elList = $this->formCreateCheckboxList($form, 'requirements_type', $types); $form->addGroup($elList, 'requirements_type', '', '', false); $form->addElement('advcheckbox', 'requirements_investment', '', 'Check here to list this as an investment opportunity in the archive', array(), array('n', 'y')); $groups = $this->DBObj->getDEmailGroupType4Select(); $elList = $this->formCreateCheckboxList($form, 'group_type', array_slice($groups, 0, 4, true)); $form->addGroup($elList, 'group_type_1', '', '', false); $elList = $this->formCreateCheckboxList($form, 'group_type', array_slice($groups, 4, 4, true)); $form->addGroup($elList, 'group_type_2', '', '', false); $elList = $this->formCreateCheckboxList($form, 'group_type', array_slice($groups, 8, null, true)); $form->addGroup($elList, 'group_type_3', '', '', false); $locations = $this->DBObj->getDPropertyLocation4Select(); $elList = $this->formCreateRadioboxList($form, 'location_id', array_slice($locations, 0, 7, true)); $form->addGroup($elList, 'location_1', '', '', false); $elList = $this->formCreateRadioboxList($form, 'location_id', array_slice($locations, 7, null, true)); $form->addGroup($elList, 'location_2', '', '', false); $primaryUse = $this->DBObj->db->queryAll("SELECT id, title, `type` as class FROM mn_DPrimaryUse ORDER BY sorter"); $elList = $this->formCreateRadioboxList($form, 'primary_use_id', array_slice($primaryUse, 0, 5, true)); $form->addGroup($elList, 'primary_use_1', '', '', false); $elList = $this->formCreateRadioboxList($form, 'primary_use_id', array_slice($primaryUse, 5, null, true)); $form->addGroup($elList, 'primary_use_2', '', '', false); $form->addElement('radio', 'market_group', '', 'Twin Cities Market', 'twin_cities'); $form->addElement('radio', 'market_group', '', 'Out of Metro Markets', 'out_of_metro'); $form->addElement('select', 'market_subgroup', '', array(''=>'Choose An Intended Use') + (array)$this->DBObj->getDSpecialty4Select('sorter', "is_subcategory = 'y'")); $form->addElement('text', 'property_size_min', 'Size', array('style'=>'width:129px;')); $form->addElement('text', 'property_size_max', 'Size', array('style'=>'width:129px; margin:0 0 0 1px')); $form->addElement('advcheckbox', 'use_range', '', 'Check this box to enter a size range', array('id'=>'use_range'), array('n', 'y')); $elList = $this->formCreateRadioboxList($form, 'property_unit', array('sf'=>'square feet', 'acres'=>'acres')); $form->addGroup($elList, 'gPropertyUnit', '', '', false); $form->addElement('text', 'additional_text', 'Additional Text', array('style'=>'width:500px;')); $form->addElement('text', 'subject', 'Subject', array('readonly'=>'readonly', 'class'=>'subject inp_width', 'style'=>'width:500px', 'size'=>'155')); $form->addElement('file_db', 'attachment', 'Attachment'); if ($this->adminEnd) { $FCKFilesPath = $this->DBObj->getEmailFckFilesPath($this->DBObj->id); } else { $FCKFilesPath = $this->DBObj->getIndividualFckFilesPath(); } $body = &$form->createElement('html_editor_basic_img', 'body', 'Message Body', null, null, $FCKFilesPath); $body->width = ($this->Doc->content['DOC']['handler'] == 'SiteDoc')?880:615; $body->height = 550; $form->addElement($body); $tplList = $this->DBObj->getLocationTemplate4Select('title', 'id_parent='.intval($this->DBObj->memberData['id_location'])); if ($this->DBObj->isAccess4TemplateManagment($this->DBObj->memberData['id']) || !empty($tplList)) { $form->addElement('select', 'id_location_msg_template', '', array(''=>'Use a broker template > Choose One') + $tplList); } $form->addElement('advcheckbox', 'signature_info_enabled', '', 'Include Following Signature Information', null, array('n','y')); $form->addElement('textarea', 'signature_info', null, array('rows'=>5, 'style'=>'width:100%;')); $this->Doc->addItemProp('JSs', 'js/broadcast_email_form.js'); $this->Doc->addItemProp('initFuncsEx', array('name'=>'initBroadcastEmailFormStep1', 'params'=>array( $form->_attributes['id'], ))); $form->addFormRule(array($this, 'validForm')); return $form; } function validForm($data) { $this->fixMoneyFields($data); $err = array(); if (empty($data['subject'])) { $err['subject'] = 'Subject is required'; } if ($data['id_type'] != 3 && empty($data['property_size_min'])) { $err['property_size_min'] = 'Size is required'; } if (empty($data['body'])) { $err['body'] = 'Message Body is required'; } $regex_numeric = "/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/"; foreach ($this->moneyFields as $name=>$title) { if (!empty($data[$name]) && !preg_match($regex_numeric, $data[$name])) { $err[$name] = $title.' is in wrong format'; } } if (is_uploaded_file($_FILES['attachment']['tmp_name']['file']) && intval($_FILES['attachment']['size']['file']) > 1572864) { $err['attachment'] = 'File is too large'; } $this->DBObj->initMarketsFromArray($data); if ($data['id_type'] == 1 && $data['market_group'] == 'twin_cities') { $markets = current($data['id_area']); if (empty($markets)) { $err['market_group'] = 'Please check at least one of the checkboxes for Twin Cities Market'; } } return (empty($err)) ? true : $err; } function doNew() { $form = $this->_getNewForm(); $areaListByType = $this->DBObj->getDAreaByType(); $data = array( 'id_type'=>'1', 'location_id'=>0, 'primary_use_id'=>0, 'listing_type'=>0, 'requirements_type' => array(), 'group_type' => array(), 'property_unit' => 'sf', 'listing_investment' => 'n', 'signature_info_enabled' => 'y', 'signature_info' => $this->DBObj->memberData['email_signature'], 'market_group' => 'twin_cities', 'id_area' => array(4=>key($areaListByType[4]['items'])), ); /* $areaListByType = $this->DBObj->getDAreaByType(); foreach ($areaListByType as $id_type => $type) { foreach ($type['items'] as $id_area => $title) { $data['id_area'][$id_type][$id_area] = $id_area; } }*/ $this->DBObj->deleteNotCompletedEmails(); $data['id_individual'] = $this->DBObj->memberData['id']; $id = $this->DBObj->insert($data); require_once('class/HTTP.php'); skHTTP::redirect(BASE_URL.'/'.CURR_PAGE_FULL.'?action=edit&id='.$id); //$form->setDefaults($data); //$this->renderForm($form); } function checkAccess() { $err = array(); if (!$this->DBObj->isEmailOwner()) { $err[] = 'Invalid email identifier'; } if (empty($err)) { return true; } $this->Doc->addContent(array('tpl'=>'msg_error.tpl', 'text'=>implode('
', $err))); return false; } function doEdit() { $this->DBObj->initFromDB(); if(!$this->DBObj->isCompleted()) { if (!$this->checkAccess()) { return false; } $form = $this->_getEditForm(); $form->setDefaults($this->DBObj->getData()); $this->renderForm($form); } else { require_once('class/HTTP.php'); skHTTP::redirect(BASE_URL.'/'.CURR_PAGE_FULL); } } function doInsert() { $form = $this->_getNewForm(); if ($form->validate()){ $this->DBObj->initFromForm($form ); $this->fixMoneyFields($this->DBObj->_data); $id = $this->DBObj->insert(); require_once('class/HTTP.php'); skHTTP::redirect(BASE_URL.'/'.CURR_PAGE_FULL.'?action=preview&id='.$id); }else { $this->renderForm($form); } return true; } function doUpdate() { $form = $this->_getEditForm(); if ($form->validate()){ $this->DBObj->initFromForm($form); $this->fixMoneyFields($this->DBObj->_data); $this->DBObj->update(); require_once('class/HTTP.php'); skHTTP::redirect(BASE_URL.'/'.CURR_PAGE_FULL.'?action=preview&id='.$this->DBObj->id); }else { $this->renderForm($form); } return true; } function renderForm($form) { $form->setTpl(SiteMap::getPath('BroadcastEmail/tpl/form_step1.tpl')); $form->setRendType(FORM_RENDERER_ARRAY_SMARTY); $form->return_form_arr = true; $item = $form->exec(); $item['tabs'] = $this->getTabMenu(); $item['allow_manage_template'] = $this->DBObj->isAccess4TemplateManagment($this->DBObj->memberData['id']); //vdie($item); $this->Doc->addContent($item); } function formCreateRadioboxList(&$form, $name, $list) { if (!is_array($list) || empty($list)) { return false; } $elList = array(); foreach ($list as $id => $title) { $elList[$id.'_open'] = $form->createElement('static', $name . '_open', '', '
'); if (is_array($title)) { $elList[$title['id']] = $form->createElement('radio', $name, '', $title['title'], $title['id'], array('class'=>$title['class'], 'id'=>'qfr_'.substr(md5($name), 0, 5).rand(0, 100))); } else { $elList[$id] = $form->createElement('radio', $name, '', $title, $id, array('id'=>'qfr_'.substr(md5($name), 0, 5).rand(0, 100))); } $elList[$id.'_close'] = $form->createElement('static', $name . '_close', '', '
'); } return $elList; } function formCreateTableOfCheckboxes(&$form, $elName, $list, $cntCol) { require_once('app/Member/Grid/Grid.php'); return MemberGrid::formCreateTableOfCheckboxes($form, $elName, null, $list, $cntCol); } function formCreateTableOfRadioboxes(&$form, $elName, $list, $cntCol) { $elList = array(); $separators = array(); $elList[] = $form->createElement('static', 'static_'.$elName, '', '
' ); $separators[] = ''; $elList = array_merge($elList, $this->formCreateRadioboxList($form, $elName, $list)); $separators = array_merge($separators, $this->getSeparators4Table($list, $cntCol)); $separators[] = ''; $elList[] = $form->createElement('static', 'static_'.$elName, '', '
'); $form->addGroup($elList, 'g'.$elName, '', $separators, false); } function formCreateAdvcheckboxList(&$form, $name, $list) { require_once('app/Member/Grid/Grid.php'); return MemberGrid::formCreateAdvcheckboxList($form, $name, $list); } function formCreateCheckboxList(&$form, $name, $list) { if (!is_array($list) || empty($list)) { return false; } $elList = array(); foreach ($list as $id => $title) { $elList[$id.'_open'] = $form->createElement('static', $name . $id . '_open', '', '
'); $elList[$id] = $form->createElement('checkbox', $name.'['.$id.']', '', $title); $elList[$id.'_close'] = $form->createElement('static', $name . $id . '_close', '', '
'); } return $elList; } function getSeparators4Table($list, $cntCol = 3) { require_once('app/Member/Grid/Grid.php'); return MemberGrid::getSeparators4Table($list, $cntCol); } function doSaveLocationTemplateAjax() { if (!$this->DBObj->isAccess4TemplateManagment($this->DBObj->memberData['id'])) { $this->displayJSON(array('error'=>'You have not access to manage templates')); } $data = array('body'=>strval($_REQUEST['body'])); $this->initRequestData($data); $id_location = intval($this->DBObj->memberData['id_location']); if (!$id_location) { $this->displayJSON(array('error'=>'no company')); } $data['id_parent'] = $id_location; $res = $this->DBObj->updateLocationTemplate($data, $_REQUEST['id']); $this->displayJSON($res); } function initRequestData(&$data) { function my_stripslashes(&$item) { $item = stripslashes($item); } if (1 == get_magic_quotes_gpc()) { array_walk($data, 'my_stripslashes'); } } function doSaveAsLocationTemplateAjax() { if (!$this->DBObj->isAccess4TemplateManagment($this->DBObj->memberData['id'])) { $this->displayJSON(array('error'=>'You have not access to manage templates')); } $data = array('title'=>$_REQUEST['title'], 'body'=>$_REQUEST['body']); $this->initRequestData($data); $id_location = intval($this->DBObj->memberData['id_location']); if (!$id_location) { $this->displayJSON(array('error'=>'no company')); } $data['id_parent'] = $id_location; $res = $this->DBObj->insertLocationTemplate($data); $this->displayJSON($res); } function doLoadLocationTemplateAjax() { $data = $this->DBObj->getLocationTemplate(intval($_REQUEST['id'])); die($data['body']); } function doDeleteLocationTemplateAjax() { if (!$this->DBObj->isAccess4TemplateManagment($this->DBObj->memberData['id'])) { $this->displayJSON(array('error'=>'You have not access to manage templates')); } $id_location = intval($this->DBObj->memberData['id_location']); if (!$id_location) { $this->displayJSON(array('error'=>'no company')); } $res = $this->DBObj->deleteLocationTemplate(intval($_REQUEST['id']), $id_location); $this->displayJSON($res); } function hasAccess2ChooseRecipients() { return !in_array($this->Doc->MemberAuth->getData('id_mcpe_access_type'), array(2, 4)); // ADN, Support } function doPreview() { $this->DBObj->initFromDB(); if(!$this->DBObj->isCompleted()) { if (!$this->checkAccess()) { return false; } $item = $this->DBObj->getData(); $item['tpl'] = SiteMap::getPath('BroadcastEmail/tpl/preview.tpl'); $item['back_url'] = $this->getBackUrl(); $item['enableButtonChooseRecipients'] = $this->hasAccess2ChooseRecipients(); $item['mode'] = 'preview'; $item['tabs'] = $this->getTabMenu(); $this->Doc->addContent($item); $this->Doc->addItemProp('JSs', 'js/broadcast_email_form.js'); } else { require_once('class/HTTP.php'); skHTTP::redirect(BASE_URL.'/'.CURR_PAGE_FULL); } } function doTestAjax() { $this->DBObj->initFromDB(); $ret = $this->DBObj->sendMail($_REQUEST['email'], $this->DBObj->getData(), $this->Doc); if (empty($ret)) { $ret = array('success'=>1); } else { $ret = array('success'=>0, 'errors'=>$ret); } $this->displayJSON($ret); } function doChooseRecipients() { $this->DBObj->initFromDB(); if(!$this->DBObj->isCompleted()) { $item = $this->DBObj->getData(); $item['tpl'] = SiteMap::getPath('BroadcastEmail/tpl/choose_recipients.tpl'); $item['tabs'] = $this->getTabMenu(); $this->Doc->addContent($item); $this->Doc->addItemProp('JSs', 'js/broadcast_email_form.js'); $this->Doc->addItemProp('initFuncsEx', array('name'=>'initBroadcastEmailChooseRecipients', 'params'=>array($this->DBObj->id))); $this->Doc->addItemProp('JSs','js/jquery.cluetip.js'); $this->Doc->addItemProp('CSSs','css/jquery.cluetip.css'); $this->Doc->addItemProp('JSs','js/jquery.dimensions-1.2.js'); } else { require_once('class/HTTP.php'); skHTTP::redirect(BASE_URL.'/'.CURR_PAGE_FULL); } } function doChooseRecipientsAjax() { $this->DBObj->initFromDB(); $item = $this->DBObj->getData(); $item['recipients'] = $this->DBObj->getRecipients(); $item['tpl'] = SiteMap::getPath('BroadcastEmail/tpl/recipients_by_individual.tpl'); $this->Doc->setMainTpl($item['tpl']); $this->Doc->assign('item', $item); require_once('class/Const.php'); Constant::set('DEBUG', false); echo $this->Doc->fetch(); exit; } function doSaveRecipientsAjax() { $ids_individual = (array)$_REQUEST['id_individual']; $ids_individual = array_filter($ids_individual, 'intval'); $this->DBObj->saveRecipients($ids_individual); $this->displayJSON(array('success'=>1)); } function doSend() { $ids_individual = (array)$_REQUEST['id_individual']; $ids_individual = array_filter($ids_individual, 'intval'); $this->DBObj->initFromDB(); $this->DBObj->markCompleted(); $this->DBObj->saveRecipients($ids_individual); $this->DBObj->saveEmailSignature($this->DBObj->memberData['id'], $this->DBObj->getData('signature_info')); $this->DBObj->copyEmailFiles(); require_once('class/HTTP.php'); skHTTP::redirect(BASE_URL.'/'.CURR_PAGE_FULL.'?action=start_send&id='.$this->DBObj->id); } function doStartSend() { $this->startSend(); require_once('class/HTTP.php'); skHTTP::redirect(BASE_URL . '/' . CURR_PAGE_FULL . '?action=done&id=' . $this->DBObj->id); } function startSend() { $errno = ''; $errstr = ''; $fp = fsockopen('tcp://' . $this->sendServerIp, $this->sendServerPort, $errno, $errstr, 2); if (!$fp) { return 'Connection failed: ' . 'tcp://' . $this->sendServerIp . ':' . $this->sendServerPort; } $ret = fwrite($fp, 'START ' . BASE_URL . '/_quick_send'); fclose($fp); return true; } function doDone() { $aMenu = $this->getTabMenu(); $item = array( 'id' => $this->DBObj->id, 'recipients' => $this->DBObj->getRecipients('individual', true), 'tabs' => $aMenu, 'create_new_link' => array('alias' => CURR_PAGE_FULL, 'title' => 'Create New Message'), 'tpl' => SiteMap::getPath('BroadcastEmail/tpl/done.tpl') ); $item['recipientsCount'] = $recipientsCount = count($item['recipients']); $item['sentSuccessfullyCount'] = 0; $item['sentErrorCount'] = 0; $report = $this->DBObj->getReport(); $item['progressValue'] = floor(($recipientsCount - $report['waitingCount']) / $recipientsCount * 100); if (!$report['waitingCount']) { foreach ($item['recipients'] as &$v) { if ($v['error'] == 'y') { $item['sentErrorCount']++; } if ($v['error'] == 'n') { $item['sentSuccessfullyCount']++; } } } $this->Doc->addContent($item); $this->Doc->addItemProp('JSs','js/jquery.cluetip.js'); $this->Doc->addItemProp('JSs','js/broadcast_email_form.js'); $this->Doc->addItemProp('CSSs','css/jquery.cluetip.css'); $this->Doc->addItemProp('JSs','js/jquery.dimensions-1.2.js'); /*if ($report['waitingCount']) { $this->Doc->addItemProp('initFuncsEx', array('name' => 'bmInitReport', 'params' => array( $this->DBObj->id, $item['recipientsCount'], 0, 0))); }*/ $this->Doc->addItemProp('initFuncs','addtooltips'); } function getRecipientsMapByMatches($list) { $ret = array(); foreach ($list['one'] as $id => $v){ $ret[1][] = 'chk_1_'.$id; if (array_key_exists($id, $list['one_or_more'])) { $ret[1][] = 'chk_2_'.$id; } } foreach ($list['one_or_more'] as $id => $v){ $ret[2][] = 'chk_2_'.$id; if (array_key_exists($id, $list['one'])) { $ret[2][] = 'chk_1_'.$id; } } return $ret; } function getRecipientsMapByMarkets($list) { $ret = array(); foreach ($list as $id_area => $area){ foreach ($area['items'] as $id_individual => $data){ $ret[$id_area][] = 'chk_'.$id_area.'_'.$id_individual; foreach ($list as $id_area2 => $area2){ if ($id_area2 == $id_area) { continue; } if (array_key_exists($id_individual, $list[$id_area2]['items'])) { $ret[$id_area][] = 'chk_'.$id_area2.'_'.$id_individual; } } } } return $ret; } function getTabMenu() { $menu = array( 'new_edit'=>array('index'=>1, 'alias'=>CURR_PAGE_FULL.'?action=edit&id='.$this->DBObj->id, 'title'=>'Create Your Message'), 'preview'=>array('index'=>2, 'alias'=>CURR_PAGE_FULL.'?action=preview&id='.$this->DBObj->id, 'title'=>'Preview Your Message'), 'choose_recipients'=>array('index'=>3, 'alias'=>CURR_PAGE_FULL.'?action=choose_recipients&id='.$this->DBObj->id, 'title'=>'Choose Your Recipients'), 'confirm'=>array('index'=>4, 'title'=>'Confirmation'), ); return $menu; } function fixMoneyFields(&$data) { foreach ($this->moneyFields as $name=>$title) { if (!empty($data[$name])) { $data[$name] = str_replace(array(',', ' '), '', $data[$name]); } } } function doShowLegalAgreement() { require_once('app/Settings/Settings.php'); $form = $this->_getBaseForm(); $form->addElement('radio', 'agree', null, 'I agree', 'y'); $form->addElement('radio', 'agree', null, 'I do not agree', 'n'); $form->addFormRule(array($this, 'validLegalAgreementForm')); if (isset($_POST['agree']) && $form->validate()) { require_once('class/DB/DBTable.php'); $Member = new DBTable('Member'); $Member->update(array('is_accepted_broadcast_legal_agreement'=>'y'), 'id='.intval($this->DBObj->memberData['id'])); $this->doBack(); } $url = BASE_URL.'/'.CURR_PAGE_FULL; if (!empty($_SERVER['QUERY_STRING'])) { $url .= '?'.$_SERVER['QUERY_STRING']; } $form->setAttribute('action', $url); if (!empty($_SERVER['QUERY_STRING'])) { $url .= '&legal_agreement=accepted'; } else { $url .= '?legal_agreement=accepted'; } $this->setBackUrl($url); $form->setSubmitTitle('Continue'); $form->setCancelType(''); $form->setTpl(BASE_PATH.'/tpl/BroadcastEmail/legal_agreement.tpl'); $form->setRendType(FORM_RENDERER_ARRAY_SMARTY); $form->return_form_arr = true; $item = $form->exec(); $item['legal_agreement'] = Settings::get('legal_agreement_broadcast'); $this->Doc->addContent($item); } function validLegalAgreementForm($data) { $err = array(); if ($data['agree'] != 'y') { $err['agree'] = 'You must agree to the terms in the user agreement to use the Broadast Email feature.'; } return (empty($err))?true:$err; } function doGetReportAjax() { $result = $this->DBObj->getReport(intval($_REQUEST['sorter'])); $this->displayJSON($result); } function doGetImageSizeAjax() { $result = array(); $result['size'] = strlen(file_get_contents($_REQUEST['img_src'])); $result['img_src'] = $_REQUEST['img_src']; $aFile = file($_REQUEST['img_src']); $result['lines'] = count($aFile); $this->displayJSON($result); } }