Esempio n. 1
0
function login()
{
    $msg = new messages();
    $fun = new funciones();
    if (!$fun->isAjax()) {
        header("Location: login.php");
    }
    $con = new con();
    $con->connect();
    $response = new StdClass();
    $usu = $_POST['usr'];
    $pass = $_POST['psw'];
    $pass = sha1(md5($pass));
    /*Consulta a la Bd*/
    $selectSQL = "SELECT * FROM `tbl_users` WHERE `us_usuario` = '{$usu}' AND `us_clave` = '{$pass}' AND us_estado = 1";
    $row_cons = mysql_query($selectSQL);
    $existe = mysql_fetch_assoc($row_cons);
    /*Termina Consulta*/
    /*Existe*/
    //$existe = 1;
    if ($existe) {
        $res = true;
        $mes = "panel.html";
        $_SESSION["ses_id"] = $existe['us_id'];
        //$menu = 1;
    } else {
        $res = false;
        $mes = $msg->get_msg("e002");
    }
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
    $con->disconnect();
}
 public function test_get_current_message()
 {
     $m = new messages();
     //No message has been set
     $this->assertEquals('', $m->get_current_message());
     //Set a message and check if it's ok
     $m->set_message('general-ok-0');
     $this->assertEquals('Command OK', $m->get_current_message());
 }
Esempio n. 3
0
 function action_index()
 {
     $data = new messages();
     if (isset($_POST['send'])) {
         if ($_POST["id"]) {
             $data->sendMessage($_POST["id"], $_POST["message"]);
         }
     }
     $messages = $data->getMessages();
     $data = array(array($messages, 'messages'));
     $this->view->generate('messages.tpl', $data);
 }
Esempio n. 4
0
function add_persona()
{
    $fun = new funciones();
    $msg = new messages();
    $response = new StdClass();
    /*recibimos variables*/
    $tipo = $_POST['tipo'];
    $nombre = $_POST['nombre'];
    $ced = $_POST['ced'];
    $lic = $_POST['lic'];
    $lic_v = $_POST['lic_v'];
    $dir = $_POST['dir'];
    $tel = $_POST['tel'];
    $cel = $_POST['cel'];
    $f1 = $_POST['f1'];
    $f2 = $_POST['f2'];
    $placa = $_POST['placa'];
    if ($tipo == 1) {
        $placa = "0";
    }
    if ($nombre == "") {
        $res = false;
        $mes = $msg->get_msg("e005");
    } else {
        $con = new con();
        $con->connect();
        /* verificamos que no esté registrado en la tabla de personas*/
        $res_existe = $fun->existe("personas", "pe_cedula", $ced);
        if (!$res_existe) {
            /* ingresamos datos de la persona */
            $qry = "INSERT INTO tbl_personas \n\t\t\t\t(pe_nombre, pe_tel, pe_cedula, pe_licencia, pe_licencia_vigencia, pe_dir, pe_cel, pe_tipo, pe_created, pe_estado, pe_f1, pe_f2, pe_ve_id) \n\t\t\t\tVALUES \n\t\t\t\t('" . $nombre . "', '" . $tel . "', '" . $ced . "', '" . $lic . "', '" . $lic_v . "', '" . $dir . "', '" . $cel . "', '" . $tipo . "', " . $_SESSION["ses_id"] . ", 1 , '" . $f1 . "', '" . $f2 . "', " . $placa . ");";
            //echo "QUERY: ".$qry;
            $resp = mysql_query($qry);
            if (!$resp) {
                $res = false;
                $mes = $msg->get_msg("e003");
            } else {
                $res = true;
                $mes = $msg->get_msg("e004");
            }
        } else {
            $res = false;
            $mes = $msg->get_msg("e003-1", "El usuario ya existe");
        }
    }
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
    $con->disconnect();
}
Esempio n. 5
0
 /**
  * Файлы переписки в ЛС доступны участникам и админу.
  * 
  * @param type $params
  * @param CFile $file
  *
  * @return type
  */
 protected function _contacts($params, CFile $file)
 {
     //нет необходимости так как в общей таблице
     //$tableName = $file->getTableName();
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/messages.php';
     $allow_download = false;
     $users = new users();
     $from_uid = $users->GetUid($error, $params['login']);
     if ($from_uid > 0) {
         $msgObj = new messages();
         $allow_download = $msgObj->isFileExist($from_uid, $this->uid, $file->id);
     }
     return $allow_download;
 }
Esempio n. 6
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. 7
0
 public function __construct()
 {
     //SINGLETON------------------------------------
     $this->msgs = messages::getInstance();
     //---------------------------------------------
     $this->connectDB();
 }
Esempio n. 8
0
 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();
 }
Esempio n. 9
0
 public function runUpdate($fileList = array())
 {
     $view = new \model\view_installer('updater');
     $view->assign('version', $this->sysconfig->getSysVersion());
     include \base_config::$baseDir . '/version.php';
     $this->updateConfigKey('sysVersion', $afltrVersion);
     if (file_exists(\base_config::$updateCache)) {
         @unlink(\base_config::$updateCache);
     }
     $fileDeleteList = array('/inc/model/model_base.php', '/inc/model/dashcontainerbox.php', '/inc/lib/jquery/jquery-1.10.2.min.js');
     foreach ($fileDeleteList as $fileDelete) {
         if (file_exists(\base_config::$baseDir . $fileDelete)) {
             @unlink(\base_config::$baseDir . $fileDelete);
         }
     }
     $file = new \model\file();
     if (is_dir(base_config::$baseDir . '/inc/lib/lightbox')) {
         $file->deleteRecursive(base_config::$baseDir . '/inc/lib/lightbox');
     }
     if (is_dir(base_config::$baseDir . '/inc/lib/jquery_ui')) {
         $file->deleteRecursive(base_config::$baseDir . '/inc/lib/jquery_ui');
     }
     if (!file_exists(base_config::$uploadDir . '/banners')) {
         mkdir(base_config::$uploadDir . '/banners');
     }
     $this->createConfigKey('timeZone', 'Europe/Berlin');
     $newVersion = $this->dbconnection->select("config", "config_value", "config_key LIKE 'sysVersion'");
     \messages::registerMessage(\language::returnLanguageConstant('UPDATE_SUCCESS'), true);
     $view->assign('newVersion', $newVersion[0]['config_value']);
     $view->assign('fileList', $fileList);
     $view->render();
 }
Esempio n. 10
0
 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();
 }
Esempio n. 11
0
 public function __construct()
 {
     //SINGLETON------------------------------------
     $this->msgs = messages::getInstance();
     $this->db = Database::getInstance();
     //---------------------------------------------
 }
Esempio n. 12
0
 public static function getInstance()
 {
     if (self::$instance == null) {
         self::$instance = new messages();
     }
     return self::$instance;
 }
Esempio n. 13
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. 14
0
 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();
 }
Esempio n. 15
0
function remove_user()
{
    $fun = new funciones();
    $msg = new messages();
    $response = new StdClass();
    /*recibimos variables*/
    $user = $_POST["user"];
    $res = $fun->borrar("vehiculos", "ve_id", $user);
    if ($res) {
        $res = true;
        $mes = $msg->get_msg("e004");
    } else {
        $res = false;
        $mes = $msg->get_msg("e022");
    }
    $response->res = $res;
    $response->mes = $mes;
    echo json_encode($response);
}
Esempio n. 16
0
 public static function add_content($content_id, $content_name)
 {
     ob_start();
     if (file_exists(config::get_config('tpl_config')['bloks_folder'] . '/' . $content_name . '.php')) {
         require config::get_config('tpl_config')['bloks_folder'] . '/' . $content_name . '.php';
     } else {
         messages::set_message('20', 'alert-danger');
     }
     self::$content[$content_id] = ob_get_contents();
     ob_end_clean();
 }
Esempio n. 17
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. 18
0
 public function run()
 {
     $login = new login(session::getSID());
     if ($login->logged_in() === true) {
         $tpl = new template();
         //Messages
         $message = new messages();
         $messages = $message->getInbox($_SESSION['userdata']['id'], 5, 0);
         $messageCount = count($messages);
         if ($messageCount) {
             $mailOptions = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'href' => '#');
         } else {
             $mailOptions = array('class' => 'dropdown-toggle');
         }
         $tpl->assign("mailOptions", $mailOptions);
         $tpl->assign("messagecount", $messageCount);
         $tpl->assign("messages", $messages);
         $tpl->assign("helper", new helper());
         //Tickets
         $tickets = new tickets();
         $newTickets = $tickets->getUnreadTickets($_SESSION['userdata']['id']);
         $ticketCount = count($newTickets);
         if (count($newTickets)) {
             $ticketOptions = array('class' => 'dropdown-toggle', 'data-toggle' => 'dropdown', 'data-target' => '#');
         } else {
             $ticketOptions = array('class' => 'dropdown-toggle');
         }
         if (is_array($newTickets) === true) {
             $limitedTicketItems = array_slice($newTickets, 0, 5);
         } else {
             $limitedTicketItems = array();
         }
         $tpl->assign("tickeOptions", $ticketOptions);
         $tpl->assign("ticketCount", $ticketCount);
         $tpl->assign("newTickets", $limitedTicketItems);
         $tpl->display("general.headMenu");
     }
 }
Esempio n. 19
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. 20
0
 /**
  * Gibt Inhalt von Language-String zurück
  * @param string $constName
  * @param array $replaceArray
  * @return string
  */
 public static function returnLanguageConstant($constName, $replaceArray = null, $isNotUtf8 = false)
 {
     if (!isset(self::$languageData[$constName])) {
         self::$languageData[$constName] = "{$constName} NOTFOUND!";
         messages::logSystem("language const {$constName} not found!");
     }
     $constText = self::$languageData[$constName];
     if (!is_null($replaceArray)) {
         $constText = self::replaceLanguageConstant($constText, $replaceArray);
     }
     if ($isNotUtf8) {
         $constText = utf8_decode($constText);
     }
     return $constText;
 }
Esempio n. 21
0
 public function process()
 {
     if (!parent::process()) {
         $this->redirectNoSession();
     }
     $file = new \model\file();
     if (!unlink(\base_config::$updateCache)) {
         \messages::logSystem('Unable to clear cache!');
         \messages::registerError(\language::returnLanguageConstant('CACHE_CLEARED_FAILED'));
     } else {
         \messages::registerMessage(\language::returnLanguageConstant('CACHE_CLEARED_OK'));
     }
     \messages::showMessages();
     die;
 }
Esempio n. 22
0
 function process()
 {
     if (!is_null($this->getRequestVar('nologin'))) {
         \messages::registerError(\language::returnLanguageConstant('NO_LOGIN'));
     }
     $sessionCookieValue = $this->getSessionCookieValue();
     if (!is_null($sessionCookieValue)) {
         $session = new \model\session($this->getDbconnection(), $sessionCookieValue);
         if ($session->exists()) {
             $session->setLogout(time());
             $session->update();
             setcookie('afltrsid', '', 0, '/', $_SERVER["SERVER_NAME"], false, true);
             header('Location: index.php');
         }
     }
 }
Esempio n. 23
0
 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();
 }
Esempio n. 24
0
 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();
 }
Esempio n. 25
0
 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();
 }
Esempio n. 26
0
 public function set($params, $options = null)
 {
     //var_dump($params);
     $last_id = 0;
     if ($options != null) {
         $this->options = $options;
     }
     $this->prepared = $this->pdo->prepare($this->query_builder->get_query(), $this->options);
     $this->pdo->beginTransaction();
     var_dump($this->prepared);
     if (!$this->prepared) {
         $this->pdo->rollBack();
         messages::set_message('30', 'alert-danger');
         return $last_id;
     }
     $this->prepared->execute($params);
     $last_id = $this->pdo->lastInsertId();
     $this->pdo->commit();
     return $last_id;
 }
Esempio n. 27
0
 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();
 }
Esempio n. 28
0
 public static function call($route, $params = null)
 {
     self::$route = $route;
     self::$params = $params;
     if (!class_exists(self::$route[0] . '_controller')) {
         self::$route[0] = config::get_config('app_config')['default_controller'] . '_controller';
         messages::set_message('00', 'alert-danger');
     } else {
         self::$route[0] = self::$route[0] . '_controller';
     }
     if (!isset(self::$route[1])) {
         self::$route[1] = config::get_config('app_config')['default_action'];
     }
     if (method_exists(self::$route[0], self::$route[1])) {
         self::$route[1] = self::$route[1];
     } else {
         self::$route[1] = config::get_config('app_config')['default_action'];
         messages::set_message('01', 'alert-danger');
     }
     call_user_func_array(self::$route, self::$params);
 }
Esempio n. 29
0
 /**
  * Lädt Datei, fügt View-Element, Header & Footer zusammen und erstellt Variablen für View
  * @see view
  * @return void
  */
 public function render()
 {
     $this->setViewFile($this->getViewPath() . $this->getViewName());
     $this->setDefaultCssFiles();
     $this->setDefaultJsFiles();
     if (!file_exists($this->getViewFile())) {
         $notFoundMessage = str_replace('{{viewname}}', $this->viewName, \language::returnLanguageConstant('VIEW_NOT_FOUND'));
         \messages::logError($notFoundMessage);
         die($notFoundMessage);
         return;
     }
     include \base_config::$baseDir . '/version.php';
     $systemVersion = $afltrVersion;
     $relroot = defined('INSTALL_MODE') ? str_replace('install', '', \base_config::$rootPath) : '';
     $title = defined('INSTALL_MODE') ? \language::returnLanguageConstant('INSTALLER') : \language::returnLanguageConstant('UPDATER');
     include_once \base_config::$baseDir . '/style/header.php';
     foreach ($this->getViewVars() as $key => $value) {
         ${$key} = $value;
     }
     include_once $this->getViewFile();
     include_once \base_config::$baseDir . '/style/footer.php';
 }
 /**
  * Receive Action: receives a HTTP Post request, in JSON, checks to ensure the client is authenticated
  * and then responds with an array of JSON objects for each message that has not yet been downloaded from the
  * server
  */
 public function receiveAction()
 {
     $this->view->setRenderLevel(\Phalcon\Mvc\View::LEVEL_NO_RENDER);
     $request = new \Phalcon\Http\Request();
     if ($request->isPost()) {
         //The request is post, therefore it is receiving data
         //Data is in JSON format
         $data = json_decode(file_get_contents('php://input'), true);
         //print_r($data);
         $user = users::findFirst(array("conditions" => 'id = :idVal: and apiKey = :keyVal:', 'bind' => array('idVal' => $data['userid'], 'keyVal' => $data['user_api_key'])));
         if ($user) {
             $messages = messages::find(array("conditions" => "receiver = :idVal: or sender = :idVal:", "bind" => array("idVal" => $user->id)));
             $array = array();
             $i = 1;
             foreach ($messages as $message) {
                 $downloaded = downloadedmessages::findFirst(array("conditions" => "userID = :idVal: and messageID = :msgVal:", "bind" => array("idVal" => $user->id, "msgVal" => $message->id)));
                 //var_dump($downloaded);
                 if (!$downloaded) {
                     //If the message has not been downloaded
                     $data = array();
                     $data['id'] = $message->id;
                     $data['sender'] = $message->sender;
                     $data['receiver'] = $message->receiver;
                     $data['content'] = $message->content;
                     $data['timestamp'] = $message->timestamp;
                     $array[$i] = $data;
                     $downloadedMsg = new downloadedmessages();
                     $downloadedMsg->messageID = $message->id;
                     $downloadedMsg->userID = $user->id;
                     $downloadedMsg->save();
                     $i++;
                 }
             }
             echo json_encode($array);
         }
     }
 }