Esempio n. 1
0
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     $affiliateIds = array($this->getRequestVar('affiliateid', array(1, 4, 7)));
     $data = array('emailText' => '', 'mailSubject' => '');
     if (is_null($affiliateIds[0])) {
         $this->redirect('affiliate/list');
     }
     if (!is_null($this->getRequestVar('mailData'))) {
         $data = array_merge($data, $this->getRequestVar('mailData'));
         if (strpos($data['mailRecipients'], PHP_EOL) == false) {
             str_replace(PHP_EOL, ';', $data['mailRecipients']);
         }
         $recipients = explode(';', $data['mailRecipients']);
         $sendRecipients = array();
         $affiliateList = new \model\affiliate_list($this->dbconnection);
         foreach ($affiliateList->getAffiliateIdsByEmail($recipients) as $affiliateIdArr) {
             $affiliate = new \model\affiliate($this->getDbconnection(), $affiliateIdArr['id']);
             $category = new \model\category($this->getDbconnection(), $affiliate->getAffiliateCategory());
             $replacers = array('pagename' => $affiliate->getPageName(), 'pageurl' => $affiliate->getPageUrl(), 'adminname' => $affiliate->getPageAdminName(), 'adminmail' => $affiliate->getPageAdminEmail(), 'category' => $category->getName());
             $mailtext = $data['emailText'];
             foreach ($replacers as $key => $value) {
                 $mailtext = str_replace('{{' . $key . '}}', $value, $mailtext);
             }
             $mailData = array('mailTo' => $affiliate->getPageAdminEmail(), 'mailSubject' => $this->filterRequest($data['mailSubject'], array(1, 4, 7, 2)), 'mailText' => $this->filterRequest($mailtext, array(1, 4, 7, 2)), 'mailFrom' => 'affiliat_r_no_reply@' . $_SERVER['HTTP_HOST']);
             \messages::sendEMail($mailData);
             $sendRecipients[] = $affiliate->getPageAdminEmail();
         }
         $mailtext = $data['emailText'];
         foreach ($replacers as $key => $value) {
             $mailtext = str_replace('{{' . $key . '}}', '', $mailtext);
         }
         foreach ($recipients as $recipient) {
             if (in_array($recipient, $sendRecipients)) {
                 continue;
             }
             $mailData = array('mailTo' => $recipient, 'mailSubject' => $this->filterRequest($data['mailSubject'], array(1, 4, 7, 2)), 'mailText' => $this->filterRequest($mailtext, array(1, 4, 7, 2)), 'mailFrom' => 'affiliat_r_no_reply@' . $_SERVER['HTTP_HOST']);
             \messages::sendEMail($mailData);
         }
         $this->redirect('affiliate/list');
     } else {
         $affiliate = new \model\affiliate($this->getDbconnection(), $affiliateIds[0]);
         $recipients = array($affiliate->getPageAdminEmail());
     }
     $data['recipients'] = implode(';', $recipients);
     $view = new \model\view_acp('contact');
     foreach ($data as $key => $value) {
         $view->assign($key, $value);
     }
     $view->render();
 }
Esempio n. 2
0
 public function process()
 {
     $affiliate = new \model\affiliate($this->getDbconnection());
     if (!is_null($this->getRequestVar('submsave')) && !is_null($this->getRequestVar('antiSpamAnswer'))) {
         if ($this->getRequestVar('antiSpamAnswer') === $this->getSysconfig()->getAntispamAnswer()) {
             $data = $this->getRequestVar('affiliate');
             foreach ($data as $key => $value) {
                 $data[$key] = $this->filterRequest($value, array(1, 4, 7));
             }
             $affiliate->setPageName($data['pageName']);
             $affiliate->setPageUrl($data['pageUrl']);
             $affiliate->setPageAdminName($data['pageAdminName']);
             $affiliate->setPageAdminEmail($data['pageAdminEmail']);
             $affiliate->setPageButton($data['pageButton']);
             $affiliate->setAffiliateCategory($data['affiliateCategory']);
             $affiliate->setAffiliateAddedTime(time());
             $affiliate->setAffiliateEditedTime(0);
             $affiliate->setAffiliateIsMarked(0);
             $affiliate->setAffiliateIsAccpted(0);
             if ($affiliate->save()) {
                 \messages::registerNotice(\language::returnLanguageConstant('APPLY_OK'));
                 $catgory = new \model\category($this->dbconnection, $affiliate->getAffiliateCategory());
                 $mailData = array('mailTo' => $this->getSysconfig()->getAdminMail(), 'mailSubject' => \language::replaceLanguageConstant(\language::returnLanguageConstant('APPLY_MAIL_SUBJECT'), array('{{affiliateKategory}}' => $catgory->getName())), 'mailText' => \language::replaceLanguageConstant(\language::returnLanguageConstant('APPLY_MAIL_TEXT'), array('{{name}}' => $affiliate->getPageAdminName(), '{{page}}' => $affiliate->getPageUrl(), '{{affiliateKategory}}' => $catgory->getName(), '{{acpLink}}' => \base_config::$rootPath)), 'mailFrom' => $affiliate->getPageAdminEmail());
                 \messages::sendEMail($mailData);
             } else {
                 \messages::registerError(\language::returnLanguageConstant('APPLY_FAILED'));
             }
             $affiliate = new \model\affiliate($this->getDbconnection());
         } else {
             \messages::registerError(\language::returnLanguageConstant('APPLY_FAILED_SPAM'));
         }
     }
     $categoryList = new \model\category_list($this->getDbconnection(), false);
     $categories = array();
     foreach ($categoryList->getCategories() as $category) {
         $categories[$category->getName()] = $category->getId();
     }
     $view = new \model\view_public('apply_form');
     $view->assign('affiliate', $affiliate);
     $view->assign('categories', $categories);
     $view->assign('antiSpamQuestion', $this->getSysconfig()->getAntispamQuestion());
     $view->assign('isNotUtf8', $this->isNotUtf8);
     $view->assign('systemVersion', $this->getSysconfig()->getSysVersion());
     $view->setReturnRender($this->returnRender);
     if ($this->returnRender) {
         $data = $view->render();
         return $data;
     }
     $view->render();
 }
Esempio n. 3
0
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     $category = new \model\category($this->getDbconnection());
     if (!is_null($this->getRequestVar('submupload'))) {
         $newFile = new \model\file();
         $icon = $newFile->uploadFile();
         $category->setIconPath($icon);
     }
     if (!is_null($this->getRequestVar('category'))) {
         $data = $this->getRequestVar('category');
         foreach ($data as $key => $value) {
             $data[$key] = $this->filterRequest($value, array(1, 4, 7));
         }
         $category->setName($data['name']);
         $category->setIconPath($data['iconPath']);
         $category->setIsPrivate($data['isPrivate']);
         if ($category->save()) {
             $this->redirect('category/list', array('categoryadded=yes'));
         } else {
             \messages::registerError(\language::returnLanguageConstant('SAVE_FAILED_CATEGORY'));
         }
     } else {
         $category->setIsPrivate(0);
     }
     $view = new \model\view_acp('category_editor');
     $view->assign('category', $category);
     $view->assign('editormode', 0);
     $view->assign('headlinetext', \language::returnLanguageConstant('HL_CATEGORIES_ADD'));
     $view->render();
 }
Esempio n. 4
0
 /**
  * Ließt Daten ein
  * @return void
  */
 private function loadData()
 {
     $where = $this->showPrivate ? 'isPrivate = 0 OR isPrivate = 1' : 'isPrivate = 0';
     $categories = $this->dbconnection->select($this->categoryTab, 'id, name, iconPath, isPrivate', $where);
     if ($categories === false) {
         return;
     }
     foreach ($categories as $categoryData) {
         $category = new \model\category($this->dbconnection);
         $category->setId($categoryData['id']);
         $category->setName($categoryData['name']);
         $category->setIconPath($categoryData['iconPath']);
         $category->setIsPrivate($categoryData['isPrivate']);
         $this->categories[$categoryData['id']] = $category;
     }
 }
Esempio n. 5
0
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     $categoryId = $this->getRequestVar('categoryid', array(1, 4, 7));
     if (is_null($categoryId)) {
         $this->redirect('category/list');
     }
     $category = new \model\category($this->getDbconnection(), $categoryId);
     if (!is_null($this->getRequestVar('category'))) {
         $data = $this->getRequestVar('category');
         foreach ($data as $key => $value) {
             $data[$key] = $this->filterRequest($value, array(1, 4, 7));
         }
         $category->setName($data['name']);
         $category->setIconPath($data['iconPath']);
         $category->setIsPrivate($data['isPrivate']);
         if ($category->update()) {
             $this->redirect('category/list', array('categoryedited=yes'));
         } else {
             \messages::registerError(\language::returnLanguageConstant('SAVE_FAILED_CATEGORY'));
         }
     }
     $view = new \model\view_acp('category_editor');
     $view->assign('category', $category);
     $view->assign('editormode', 1);
     $view->assign('systemmode', $this->getSysconfig()->getSystemMode());
     $view->assign('headlinetext', \language::returnLanguageConstant('HL_CATEGORIES_EDIT'));
     $view->assign('dtMask', $this->getSysconfig()->getDateTimeMask());
     $view->render();
 }
Esempio n. 6
0
 public function process()
 {
     $affiliates = new \model\affiliate_list($this->getDbconnection(), $this->categoryId, $this->acceptedOnly, $this->textOnly);
     $view = new \model\view_public($this->viewName);
     if (count($affiliates->getAffiliates()) > 0) {
         $view->assign('affiliates', $affiliates->getAffiliates());
     } else {
         $view->assign('notaffiliates', true);
     }
     $category = new \model\category($this->getDbconnection(), $this->categoryId);
     $value = $this->openBlank ? 'target="_blank"' : '';
     $categoryName = $this->textOnly == 2 ? $category->getName() . '-text' : $category->getName();
     $view->assign('linkTarget', $value);
     $view->assign('categoryNameClass', strtolower($categoryName));
     $view->assign('showastext', $this->textOnly);
     $view->assign('isNotUtf8', $this->isNotUtf8);
     $view->assign('systemVersion', $this->getSysconfig()->getSysVersion());
     $view->setReturnRender($this->returnRender);
     if ($this->returnRender) {
         $data = $view->render();
         return $data;
     }
     $view->render();
 }
Esempio n. 7
0
 public function createStdCategory()
 {
     $category = new \model\category($this->dbconnection);
     $category->setName('Links');
     $category->save();
 }
Esempio n. 8
0
 /**
  * Ließt Daten ein
  * @return void
  */
 private function loadData()
 {
     if ($this->groupByCategory) {
         $this->affiliates = array();
         $categoryList = new category_list($this->dbconnection);
         $categoryList = $categoryList->getCategories();
         foreach ($categoryList as $category) {
             $affiliates = new affiliate_list($this->dbconnection, $category->getId());
             $this->affiliates[$category->getName()] = $affiliates->getAffiliates();
         }
     } else {
         $where = !is_null($this->categoryId) ? "affiliateCategory = {$this->categoryId} ORDER BY id ASC" : null;
         $affiliateIds = $this->dbconnection->select($this->affiliateTab, 'id', $where);
         if ($affiliateIds === false) {
             return;
         }
         foreach ($affiliateIds as $affiliateId) {
             $affiliateId = $affiliateId['id'];
             $affiliate = new \model\affiliate($this->dbconnection, $affiliateId);
             $category = new \model\category($this->dbconnection, $affiliate->getAffiliateCategory());
             $affiliate->setAffiliateCategory($category->getName());
             if ($this->exclude($affiliate)) {
                 continue;
             }
             $this->affiliates[$affiliateId] = $affiliate;
         }
     }
 }