コード例 #1
0
ファイル: lists.php プロジェクト: sea75300/affiliat_r
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     if (!is_null($this->getRequestVar('affiliateDelList'))) {
         $affiliateIds = $this->getRequestVar('affiliateDelList');
         foreach ($affiliateIds as $affiliateId) {
             $affiliate = new \model\affiliate($this->getDbconnection(), $this->filterRequest($affiliateId, array(1, 4, 7)));
             $affiliate->delete();
         }
         $this->redirect('affiliate/list', array('affiliatedeleted=yes'));
     }
     $affiliateList = new \model\affiliate_list($this->getDbconnection());
     $affiliateList->setGroupByCategory(true);
     if (!is_null($this->getRequestVar('affiliateadded'))) {
         \messages::registerMessage(\language::returnLanguageConstant('SAVE_SUCCESS_ADDAFFILIATE'));
     }
     if (!is_null($this->getRequestVar('affiliateedited'))) {
         \messages::registerMessage(\language::returnLanguageConstant('SAVE_SUCCESS_EDITAFFILIATE'));
     }
     if (!is_null($this->getRequestVar('affiliatedeleted'))) {
         \messages::registerMessage(\language::returnLanguageConstant('DELETE_SUCCESS_AFFILIATES'));
     }
     $view = new \model\view_acp('affiliate_list');
     $view->assign('theList', $affiliateList->getAffiliates());
     $view->assign('dtMask', $this->getSysconfig()->getDateTimeMask());
     $view->render();
 }
コード例 #2
0
ファイル: dashboard.php プロジェクト: sea75300/affiliat_r
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     $containers = array();
     $containerClassFiles = scandir(\base_config::$baseDir . '/inc/dashcontainers/');
     foreach ($containerClassFiles as $containerClassFile) {
         if (strpos($containerClassFile, '.php') === false) {
             continue;
         }
         $containerClassFile = str_replace('.php', '', $containerClassFile);
         $containerObject = new $containerClassFile($this);
         if (is_a($containerObject, '\\interfaces\\dashcontainer')) {
             $containerPosition = $containerObject->getPosition();
             if (isset($containers[$containerPosition])) {
                 $containerPosition++;
             }
             $containers[$containerPosition] = new \model\dashboard_container($containerObject->getBoxName(), $containerObject->getBoxHeadline(), $containerObject->getBoxContent(), $containerObject->getSize(), $containerObject->getHeight());
         } else {
             $message = \language::replaceLanguageConstant(\language::returnLanguageConstant('DASH_CONTAINER_INSTANCE'), array('{{dashcontainer}}' => $containerClassFile));
             \messages::registerError($message);
         }
     }
     if (count($containers) >= 1) {
         ksort($containers);
     }
     $view = new \model\view_acp('dashboard');
     $view->assign('statsContainers', $containers);
     $view->render();
 }
コード例 #3
0
ファイル: edit.php プロジェクト: sea75300/affiliat_r
 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();
 }
コード例 #4
0
ファイル: add.php プロジェクト: sea75300/affiliat_r
 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();
 }
コード例 #5
0
ファイル: lists.php プロジェクト: sea75300/affiliat_r
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     if (!is_null($this->getRequestVar('submupload'))) {
         $newFile = new \model\file();
         $newFile->uploadFile(\base_config::$bannerDir);
     }
     if (!is_null($this->getRequestVar('fileDelList'))) {
         $deleted = false;
         $files = $this->getRequestVar('fileDelList');
         foreach ($files as $fileName) {
             $file = new \model\file($fileName, \base_config::$bannerDir);
             if ($file->delete()) {
                 $deleted = true;
             }
         }
         if ($deleted) {
             \messages::registerMessage(\language::returnLanguageConstant('DELETE_SUCCESS_FILES'));
         }
     }
     $fileList = new \model\file_list(\base_config::$bannerDir);
     $view = new \model\view_acp('banner_list');
     $view->assign('fileList', $fileList->getFileList());
     $view->assign('dtMask', $this->getSysconfig()->getDateTimeMask());
     $view->render();
 }
コード例 #6
0
ファイル: contact.php プロジェクト: sea75300/affiliat_r
 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();
 }
コード例 #7
0
ファイル: add.php プロジェクト: sea75300/affiliat_r
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     $affiliate = new \model\affiliate($this->getDbconnection());
     if (!is_null($this->getRequestVar('submupload'))) {
         $newFile = new \model\file();
         $pageButton = $newFile->uploadFile();
         $affiliate->setPageButton($pageButton);
     }
     if (!is_null($this->getRequestVar('affiliate'))) {
         $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($data['affiliateIsAccpted']);
         if ($affiliate->save()) {
             $this->redirect('affiliate/list', array('affiliateadded=yes'));
         } else {
             \messages::registerError(\language::returnLanguageConstant('SAVE_FAILED_AFFILIATE'));
         }
     } else {
         $affiliate->setAffiliateIsAccpted(0);
     }
     $categoryList = new \model\category_list($this->getDbconnection());
     $categories = array();
     foreach ($categoryList->getCategories() as $category) {
         $categories[$category->getName() . ' (' . \language::returnLanguageConstant('ID') . ': ' . $category->getId() . ')'] = $category->getId();
     }
     $view = new \model\view_acp('affiliate_editor');
     $view->assign('affiliate', $affiliate);
     $view->assign('categories', $categories);
     $view->assign('editormode', 0);
     $view->assign('headlinetext', \language::returnLanguageConstant('HL_AFFILIATE_ADD'));
     $view->assign('fileList', new \model\file_list());
     $view->render();
 }
コード例 #8
0
ファイル: login.php プロジェクト: sea75300/affiliat_r
 public function process()
 {
     if (!is_null($this->getRequestVar('nologin'))) {
         \messages::registerError(\language::returnLanguageConstant('NO_LOGIN'));
     }
     if (!is_null($this->getRequestVar('nopassreset'))) {
         \messages::registerError(\language::returnLanguageConstant('LOGIN_PASSWORD_RESET_FAILED'));
     }
     if (!is_null($this->getRequestVar('resetpass'))) {
         $newPass = uniqid();
         $mailData = array('mailTo' => $this->getSysconfig()->getAdminMail(), 'mailSubject' => \language::returnLanguageConstant('LOGIN_PASSWORD_RESET'), 'mailText' => $newPass, 'mailFrom' => 'affiliat_r_no_reply@' . $_SERVER['HTTP_HOST']);
         if (\messages::sendEMail($mailData)) {
             $this->getSysconfig()->setLoginPasswort($newPass);
             $this->getSysconfig()->update();
             $this->redirect();
         } else {
             $this->redirect('', array('nopassreset'));
         }
     }
     $sessionCookieValue = $this->getSessionCookieValue();
     if (!is_null($sessionCookieValue)) {
         $session = new \model\session($this->getDbconnection(), $sessionCookieValue);
         if ($session->exists()) {
             $this->redirect('system/dash');
         }
     }
     if (!is_null($this->getRequestVar('passwd', array(1, 4, 7)))) {
         $passwort = \tools::createPasswordHash($this->getRequestVar('passwd'), $this->getSysconfig()->getLoginPasswortSalt());
         if ($passwort == $this->getSysconfig()->getLoginPasswort()) {
             $ip = $_SERVER["REMOTE_ADDR"];
             $sessionId = sha1(uniqid($ip, true));
             $expire = time() + $this->getSysconfig()->getSessionLength();
             $session = new \model\session($this->getDbconnection());
             $session->setLogin(time());
             $session->setLogout(0);
             $session->setSessionId($sessionId);
             $session->setIp($ip);
             $session->save();
             setcookie('afltrsid', $sessionId, $expire, '/', $_SERVER["SERVER_NAME"], false, true);
             $this->redirect('system/dash');
         }
         \messages::registerError(\language::returnLanguageConstant('WRONG_PASSWORD'));
     }
     $view = new \model\view_acp('login');
     $view->assign('defaultPW', '');
     $view->render();
 }
コード例 #9
0
ファイル: edit.php プロジェクト: sea75300/affiliat_r
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     $affiliateId = $this->getRequestVar('affiliateid', array(1, 4, 7));
     if (is_null($affiliateId)) {
         $this->redirect('affiliate/list');
     }
     $affiliate = new \model\affiliate($this->getDbconnection(), $affiliateId);
     if (!is_null($this->getRequestVar('affiliate'))) {
         $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->setAffiliateEditedTime(time());
         $affiliate->setAffiliateIsMarked($data['affiliateIsMarked']);
         $affiliate->setAffiliateIsAccpted($data['affiliateIsAccpted']);
         if ($affiliate->update()) {
             $this->redirect('affiliate/list', array('affiliateedited=yes'));
         } else {
             \messages::registerError(\language::returnLanguageConstant('SAVE_FAILED_AFFILIATE'));
         }
     }
     $categoryList = new \model\category_list($this->getDbconnection());
     $categories = array();
     foreach ($categoryList->getCategories() as $category) {
         $categories[$category->getName() . ' (' . \language::returnLanguageConstant('ID') . ': ' . $category->getId() . ')'] = $category->getId();
     }
     $view = new \model\view_acp('affiliate_editor');
     $view->assign('affiliate', $affiliate);
     $view->assign('categories', $categories);
     $view->assign('editormode', 1);
     $view->assign('headlinetext', \language::returnLanguageConstant('HL_AFFILIATE_EDIT'));
     $view->assign('markedstatus', array(\language::returnLanguageConstant('NO_VALUE') => 0, \language::returnLanguageConstant('YES_VALUE') => 1));
     $view->assign('dtMask', $this->getSysconfig()->getDateTimeMask());
     $view->assign('fileList', new \model\file_list());
     $view->render();
 }
コード例 #10
0
ファイル: options.php プロジェクト: sea75300/affiliat_r
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     if (!is_null($this->getRequestVar('options'))) {
         $data = $this->getRequestVar('options');
         $sysConfigObj = $this->getSysconfig();
         if (!empty($data['loginPasswort']) && !$sysConfigObj->isPasswordSecure($data['loginPasswort'])) {
             \messages::registerError(\language::returnLanguageConstant('SAVE_FAILED_PASSWORD'));
             unset($data['loginPasswort']);
         }
         foreach ($data as $key => $value) {
             if ($value == '') {
                 continue;
             }
             $fn = 'set' . $key;
             $sysConfigObj->{$fn}($this->filterRequest($value, array(1, 4, 7)));
         }
         $sysConfigObj->update();
         \messages::registerMessage(\language::returnLanguageConstant('SAVE_SUCCESS_OPTIONS'));
     }
     $fields = array('adminMail' => $this->getSysconfig()->getAdminMail(), 'iframecss' => $this->getSysconfig()->getIframecss(), 'sessionLength' => $this->getSysconfig()->getSessionLength(), 'timeZone' => $this->getSysconfig()->getTimeZone(), 'dateTimeMask' => $this->getSysconfig()->getDateTimeMask(), 'antispamQuestion' => $this->getSysconfig()->getAntispamQuestion(), 'antispamAnswer' => $this->getSysconfig()->getAntispamAnswer());
     $dtMasksArray = array('d.m.Y', 'd. M Y', 'd.n.Y', 'j.m.Y', 'j. M Y', 'j.n.Y', 'M dS Y', 'm/d/Y', 'n/d/Y');
     $dtMasks = array();
     foreach ($dtMasksArray as $dtMask) {
         $dtMasks[] = array('label' => $dtMask . ' (' . date($dtMask) . ')', 'value' => $dtMask);
     }
     $timeZones = timezone_identifiers_list();
     $timeZones = array_combine(array_values($timeZones), array_values($timeZones));
     unset($timeZones['UTC']);
     $view = new \model\view_acp('options');
     $view->assign('languages', \language::getLanguages());
     $view->assign('modes', array('iframe' => 1, 'phpcinlude' => 2));
     $view->assign('timeZones', array_unique($timeZones));
     $view->assign('syslang', $this->getSysconfig()->getSysLanguage());
     $view->assign('sysmode', $this->getSysconfig()->getSystemMode());
     $view->assign('dtMasks', json_encode($dtMasks));
     $view->assign('fields', $fields);
     $view->render();
 }
コード例 #11
0
ファイル: logs.php プロジェクト: sea75300/affiliat_r
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     $view = new \model\view_acp('logs');
     $errorLogLines = array();
     $systemLogLines = array();
     if (!is_null($this->getRequestVar('submdelete'))) {
         if (file_exists(\base_config::$logfiles['errors'])) {
             @unlink(\base_config::$logfiles['errors']);
         }
         if (file_exists(\base_config::$logfiles['system'])) {
             @unlink(\base_config::$logfiles['system']);
         }
     }
     if (file_exists(\base_config::$logfiles['errors'])) {
         $errorLogs = file(\base_config::$logfiles['errors']);
         foreach ($errorLogs as $errorLine) {
             $errorLine = json_decode(trim($errorLine), true);
             if (empty($errorLine['text'])) {
                 continue;
             }
             $errorLogLines[] = "<p><b>" . date($this->getSysconfig()->getDateTimeMask(), $errorLine['time']) . ":</b> " . $errorLine['text'] . '</p>' . PHP_EOL;
         }
     }
     if (file_exists(\base_config::$logfiles['system'])) {
         $systemLogs = file(\base_config::$logfiles['system']);
         foreach ($systemLogs as $systemLine) {
             $systemLine = json_decode(trim($systemLine), true);
             if (empty($systemLine['text'])) {
                 continue;
             }
             $systemLogLines[] = "<p><b>" . date($this->getSysconfig()->getDateTimeMask(), $systemLine['time']) . ":</b> " . $systemLine['text'] . '</p>' . PHP_EOL;
         }
     }
     $view->assign('errorLogLines', $errorLogLines);
     $view->assign('systemLogLines', $systemLogLines);
     $view->render();
 }