Beispiel #1
0
 public function sendUsageStat()
 {
     $res = new responseGmp();
     $this->getModel()->sendUsageStat();
     $res->addMessage(langGmp::_('Information was saved. Thank you for your support!'));
     return $res->ajaxExec();
 }
Beispiel #2
0
 public function saveGroup()
 {
     $res = new responseGmp();
     if ($this->getModel()->saveGroup(reqGmp::get('post'))) {
         $res->addMessage(__('Done', GMP_LANG_CODE));
     } else {
         $res->pushError($this->getModel('options')->getErrors());
     }
     return $res->ajaxExec();
 }
Beispiel #3
0
 public function remove()
 {
     $res = new responseGmp();
     if ($this->getModel()->remove(reqGmp::getVar('id', 'post'))) {
         $res->addMessage(__('Done', GMP_LANG_CODE));
     } else {
         $res->pushError($this->getModel()->getErrors());
     }
     $res->ajaxExec();
 }
Beispiel #4
0
 public function activateUpdate()
 {
     $res = new responseGmp();
     if ($this->getModel('modules')->activateUpdate(reqGmp::get('post'))) {
         $res->addMessage(langGmp::_('Very good! Now plugin will be updated.'));
     } else {
         $res->pushError($this->getModel('modules')->getErrors());
     }
     return $res->ajaxExec();
 }
Beispiel #5
0
 public function welcomePageSaveInfo()
 {
     $res = new responseGmp();
     installerGmp::setUsed();
     if ($this->getModel()->welcomePageSaveInfo(reqGmp::get('get'))) {
         $res->addMessage(__('Information was saved. Thank you!', GMP_LANG_CODE));
     } else {
         $res->pushError($this->getModel()->getErrors());
     }
     $originalPage = reqGmp::getVar('original_page');
     $http = isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
     if (strpos($originalPage, $http . $_SERVER['HTTP_HOST']) !== 0) {
         $originalPage = '';
     }
     redirectGmp($originalPage);
 }
Beispiel #6
0
 public function removeGroup()
 {
     $params = reqGmp::get('post');
     $res = new responseGmp();
     if (!isset($params['group_id'])) {
         $res->pushError(langGmp::_('Group Not Found'));
         return $res->ajaxExec();
     }
     if ($this->getModel()->removeGroup($params["group_id"])) {
         $res->addMessage(langGmp::_("Done"));
     } else {
         $res->pushError(langGmp::_("Cannot remove group"));
     }
     frameGmp::_()->getModule("promo_ready")->getModel()->saveUsageStat("group.delete");
     return $res->ajaxExec();
 }
Beispiel #7
0
 public function sendMailToDevelopers()
 {
     $res = new responseGmp();
     $data = reqGmp::get('post');
     $fields = array('name' => new fieldGmpGmp('name', langGmp::_('Your name field is required.'), '', '', 'Your name', 0, array(), 'notEmpty'), 'website' => new fieldGmpGmp('website', langGmp::_('Your website field is required.'), '', '', 'Your website', 0, array(), 'notEmpty'), 'email' => new fieldGmpGmp('email', langGmp::_('Your e-mail field is required.'), '', '', 'Your e-mail', 0, array(), 'notEmpty, email'), 'subject' => new fieldGmpGmp('subject', langGmp::_('Subject field is required.'), '', '', 'Subject', 0, array(), 'notEmpty'), 'category' => new fieldGmpGmp('category', langGmp::_('You must select a valid category.'), '', '', 'Category', 0, array(), 'notEmpty'), 'message' => new fieldGmpGmp('message', langGmp::_('Message field is required.'), '', '', 'Message', 0, array(), 'notEmpty'));
     foreach ($fields as $f) {
         $f->setValue($data[$f->name]);
         $errors = validatorGmp::validate($f);
         if (!empty($errors)) {
             $res->addError($errors);
         }
     }
     if (!$res->error) {
         $msg = 'Message from: ' . get_bloginfo('name') . ', Host: ' . $_SERVER['HTTP_HOST'] . '<br />';
         foreach ($fields as $f) {
             $msg .= '<b>' . $f->label . '</b>: ' . nl2br($f->value) . '<br />';
         }
         $headers[] = 'From: ' . $fields['name']->value . ' <' . $fields['email']->value . '>';
         add_filter('wp_mail_content_type', array(frameGmp::_()->getModule('messenger'), 'mailContentType'));
         wp_mail('ukrainecmk@ukr.net, simon@readyshoppingcart.com, support@readyecommerce.zendesk.com', 'Ready Ecommerce Contact Dev', $msg, $headers);
         $res->addMessage(langGmp::_('Done'));
     }
     $res->ajaxExec();
 }
Beispiel #8
0
 public function getListForTable()
 {
     $res = new responseGmp();
     $res->ignoreShellData();
     $count = $this->getModel()->getCount();
     $listReqData = array('limitFrom' => reqGmp::getVar('iDisplayStart'), 'limitTo' => reqGmp::getVar('iDisplayLength'));
     $displayColumns = $this->getView()->getDisplayColumns();
     $displayColumnsKeys = array_keys($displayColumns);
     $iSortCol = reqGmp::getVar('iSortCol_0');
     if (!is_null($iSortCol) && is_numeric($iSortCol)) {
         $listReqData['orderBy'] = $displayColumns[$displayColumnsKeys[$iSortCol]]['db'];
         $iSortDir = reqGmp::getVar('sSortDir_0');
         if (!is_null($iSortDir)) {
             $listReqData['orderBy'] .= ' ' . strtoupper($iSortDir);
         }
     }
     $search = reqGmp::getVar('sSearch');
     if (!is_null($search) && !empty($search)) {
         $dbSearch = dbGmp::escape($search);
         $listReqData['additionalCondition'] = 'title LIKE "%' . $dbSearch . '%" OR description LIKE "%' . $dbSearch . '%"';
     }
     $list = $this->getModel()->getAllMarkers($listReqData, true);
     $res->addData('aaData', $this->_convertDataForDatatable($list));
     $res->addData('iTotalRecords', $count);
     $res->addData('iTotalDisplayRecords', $count);
     $res->addData('sEcho', reqGmp::getVar('sEcho'));
     $res->addMessage(__('Done'));
     return $res->ajaxExec();
 }
Beispiel #9
0
 public function clear()
 {
     $res = new responseGmp();
     if ($this->getModel()->clear()) {
         $res->addMessage(__('Done', GMP_LANG_CODE));
     } else {
         $res->pushError($this->getModel()->getErrors());
     }
     $res->ajaxExec();
 }
Beispiel #10
0
 public function import()
 {
     @ini_set('auto_detect_line_endings', true);
     $res = new responseGmp();
     $this->_connectCsvLib();
     $csvGenerator = toeCreateObjGmp('csvgeneratorGmp', array($fileName));
     $file = reqGmp::getVar('csv_import_file', 'file');
     if (empty($file) || empty($file['size'])) {
         $res->pushError(langGmp::_('Missing File'));
     }
     if (!empty($file['error'])) {
         $res->pushError(langGmp::_(array('File uploaded with error code', $file['error'])));
     }
     if (!$res->error()) {
         $fileArray = array();
         $handle = fopen($file['tmp_name'], 'r');
         $csvParams['delimiter'] = $csvGenerator->getDelimiter();
         $csvParams['enclosure'] = $csvGenerator->getEnclosure();
         $csvParams['escape'] = $csvGenerator->getEscape();
         //if(version_compare( phpversion(), '5.3.0' ) == -1) //for PHP lower than 5.3.0 third parameter - escape - is not implemented
         while ($row = @fgetcsv($handle, 0, $csvParams['delimiter'], '"')) {
             $fileArray[] = $row;
         }
         /*else
         		while($row = @fgetcsv( $handle, 0, $csvParams['delimiter'], $csvParams['enclosure'], $csvParams['escape'] )) $fileArray[] = $row;*/
         /*var_dump($fileArray);
         		exit();*/
         if (!empty($fileArray)) {
             if (count($fileArray) > 1) {
                 $overwriteSameNames = (int) reqGmp::getVar('overwrite_same_names');
                 $importRes = $this->getModel()->import($fileArray, $overwriteSameNames);
                 if ($importRes) {
                     if ($importRes['map']['added']) {
                         $res->addMessage(langGmp::_(array('Added', $importRes['map']['added'], 'maps')));
                     }
                     if ($importRes['map']['updated']) {
                         $res->addMessage(langGmp::_(array('Updated', $importRes['map']['updated'], 'maps')));
                     }
                     if ($importRes['marker']['added']) {
                         $res->addMessage(langGmp::_(array('Added', $importRes['marker']['added'], 'markers')));
                     }
                     if ($importRes['marker']['updated']) {
                         $res->addMessage(langGmp::_(array('Updated', $importRes['marker']['updated'], 'markers')));
                     }
                 } else {
                     $res->pushError($this->getModel()->getErrors());
                 }
             } else {
                 $res->pushError(langGmp::_('File should contain more then 1 row, at least 1 row should be for headers'));
             }
         } else {
             $res->pushError(langGmp::_('Empty data in file'));
         }
     }
     frameGmp::_()->getModule('promo_ready')->getModel()->saveUsageStat('csv.import');
     $res->ajaxExec();
 }