Example #1
0
 protected static function loginPost()
 {
     $email = type::post('email', 'string');
     $password = type::post('password', 'string');
     $remember = type::post('remember', 'int');
     if (is_null($email) || is_null($password) || $email == '' || $password == '') {
         echo message::info(lang::get('fill_out_both'));
         return;
     }
     $sql = new sql();
     $sql->query('SELECT password, salt, id FROM ' . sql::table('user') . ' WHERE `email` = "' . $sql->escape($email) . '"');
     if (!$sql->num()) {
         echo message::danger(sprintf(lang::get('email_not_found'), htmlspecialchars($email)), true);
         $shake = 1;
         return;
     }
     $sql->result();
     if (!self::checkPassword($password, $sql->get('salt'), $sql->get('password'))) {
         echo message::danger(lang::get('wrong_pw'));
         $shake = 1;
         return;
     }
     self::loginSession();
     self::$userID = $sql->get('id');
     $_SESSION['login'] = $sql->get('id');
     if ($remember) {
         setcookie("remember", $sql->get('id'), time() + 3600 * 24 * 7);
     }
 }
Example #2
0
 public function __construct($host, $user, $pass)
 {
     $this->sftp = new Net_SFTP($host);
     if (!$this->sftp->login($user, $pass)) {
         echo message::danger(lang::get('sftp_login_failed'), false);
     }
 }
Example #3
0
 protected static function loginPost()
 {
     $email = type::post('email', 'string');
     $password = type::post('password', 'string');
     // Formular ganz abgesendet?
     if (is_null($email) || is_null($password) || $email == '' || $password == '') {
         echo message::info(lang::get('login_form_notfull'), true);
         return;
     }
     $sql = sql::factory();
     $sql->query('SELECT password, id FROM ' . sql::table('user') . ' WHERE `email` = "' . $sql->escape($email) . '"');
     // Username mit E-Mail vorhanden?
     if (!$sql->num()) {
         echo message::danger(sprintf(lang::get('login_no_user'), $email), true);
         return;
     }
     $sql->result();
     // Password nicht gleich?
     if (!self::checkPassword($password, $sql->get('password'))) {
         echo message::danger(lang::get('login_pwd_false'), true);
         return;
     }
     self::loginSession();
     self::$userID = $sql->get('id');
     $_SESSION['login'] = $sql->get('id') . '||' . self::hash($password);
 }
Example #4
0
 public function __construct($host, $user, $pass)
 {
     $this->host = $host;
     $this->user = $user;
     $this->password = $pass;
     $this->ssh = new Net_SSH2($host);
     if (!$this->ssh->login($user, $pass)) {
         echo message::danger(lang::get('ssh_login_failed'), false);
         return false;
     }
     return $this->ssh;
 }
Example #5
0
 public function result($query = false, $type = MYSQL_ASSOC)
 {
     try {
         if ($query) {
             $this->query($query);
         }
         if (!in_array($type, self::$QUERY_TYPE)) {
             throw new Exception(sprintf(lang::get('sql_result_invalid_type'), __CLASS__));
         }
         $this->result = $this->query->fetch_array($type);
     } catch (Exception $e) {
         echo message::danger($e->getMessage());
     }
     return $this;
 }
Example #6
0
 public function checkNeed()
 {
     $errors = [];
     foreach ($this->get('need', []) as $key => $value) {
         $check = addonNeed::check($key, $value);
         if ($check !== true) {
             $errors[] = $check;
         }
     }
     if (!empty($errors)) {
         echo message::danger(implode('<br />', $errors));
         return false;
     }
     return true;
 }
Example #7
0
 public function checkNeed()
 {
     $errors = [];
     foreach ($this->get('need', []) as $key => $value) {
         $check = templateNeed::check($key, $value);
         // Typcheck, because $check can be a string
         if ($check !== true) {
             $errors[] = $check;
         }
     }
     if (!empty($errors)) {
         echo message::danger(implode('<br />', $errors));
         return false;
     }
     return true;
 }
Example #8
0
 /**
  * Fügt eine Erweiterung hinzu
  *
  * @param	string	$name			Der Name der Erweiterung
  * @param	string	$function		Die Funktion die auf die Erweiterung zugreift
  * @param	int		$position		Die Position wann die Funktion aufgerufen werden soll
  *
  */
 public static function add($name, $function, $position = -1)
 {
     try {
         if (!is_callable($function)) {
             throw new Exception(sprintf(lang::get('extension_callable_func'), _CLASS__));
             return false;
         }
         self::$extensions[$name] = [];
         if ($position < 0) {
             $position = count(self::$extensions[$name]);
         }
         // Funktion hinzufügen zum $name mit der Position $position
         array_splice(self::$extensions[$name], $position, 0, $function);
         return true;
     } catch (Exception $e) {
         echo message::danger($e->getMessage());
     }
 }
Example #9
0
 public function result($query = false, $type = MYSQL_ASSOC)
 {
     try {
         if ($query) {
             $this->query($query);
         }
         if (!in_array($type, [MYSQLI_NUM, MYSQLI_ASSOC, MYSQLI_BOTH])) {
             throw new Exception(sprintf(lang::get('sql_result_invalid_type'), __CLASS__));
         }
         if (!$this->query) {
             throw new Exception(lang::get('sql_result_error'));
         } else {
             $this->result = $this->query->fetch_array($type);
         }
         return $this;
     } catch (Exception $e) {
         echo message::danger($e->getMessage());
     }
 }
Example #10
0
 public static function exportTables()
 {
     if (!isset($_POST["export"])) {
         echo message::danger(lang::get('exportSelect'), true);
     } else {
         $result = '';
         foreach ($_POST["export"] as $table => $status) {
             $DB = dyn::get('DB');
             $prefix = strlen($DB['prefix']);
             $result .= 'DROP TABLE IF EXISTS `dynaoimportexporttoll' . $table . '`;';
             $sql = sql::factory();
             $sql->query('SHOW CREATE TABLE ' . $DB['prefix'] . $table)->result();
             $creatTable = "\n\n" . str_replace("CREATE TABLE `" . $DB['prefix'], "CREATE TABLE IF NOT EXISTS `dynaoimportexporttoll", $sql->get("Create Table")) . ";\n\n";
             $result .= preg_replace("/(`.*` int.* DEFAULT) '(.*)'/", '${1} ${2}', $creatTable);
             $sql->query("SELECT * FROM " . $DB['prefix'] . $table)->result();
             while ($sql->isNext()) {
                 $result .= 'INSERT INTO `dynaoimportexporttoll' . $table . '` VALUES(';
                 $i = 1;
                 foreach ($sql->result as $row) {
                     $result .= "'" . $sql->escape(str_replace(";", "`#semikolon#`", $row)) . "'";
                     if (count($sql->result) > $i) {
                         $result .= ",";
                     }
                     $i++;
                 }
                 $result .= ");\n";
                 $sql->next();
             }
         }
         $length = strlen($result);
         header('Content-Description: File Transfer');
         header('Content-Type: application/sql');
         header('Content-Disposition: attachment; filename=backup.sql');
         header('Content-Transfer-Encoding: binary');
         header('Content-Length: ' . $length);
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Expires: 0');
         header('Pragma: public');
         echo $result;
         exit;
     }
 }
Example #11
0
 protected static function loginPost()
 {
     $email = type::post('email', 'string');
     $password = type::post('password', 'string');
     // Formular ganz abgesendet?
     if (is_null($email) || is_null($password) || $email == '' || $password == '') {
         echo message::info(lang::get('login_form_notfull'), true);
         return;
     }
     $sql = sql::factory();
     $sql->query('SELECT password, salt, id FROM ' . sql::table('user') . ' WHERE `email` = "' . $sql->escape($email) . '"');
     // Username mit E-Mail vorhanden?
     if (!$sql->num()) {
         echo message::danger(sprintf(lang::get('login_no_user'), htmlspecialchars($email)), true);
         return;
     }
     $sql->result();
     // Password nicht gleich?
     if (!self::checkPassword($password, $sql->get('salt'), $sql->get('password'))) {
         echo message::danger(lang::get('login_pwd_false'), true);
         return;
     }
     self::loginSession();
     self::$userID = $sql->get('id');
     $_SESSION['login'] = $sql->get('id');
     // Falls alte Methode (sha1) neuen Salt generieren und salt updaten
     // sha1 deprecated 0.2 Beta
     $salt = $sql->get('salt');
     if (empty($salt)) {
         $salt = self::generateSalt();
         $sql->setTable('user');
         $sql->setWhere('`email` = "' . $email . '"');
         $sql->addPost('salt', $salt);
         $sql->addPost('password', self::hash($password, $salt));
         $sql->update();
     }
 }
Example #12
0
 public static function checkLogin()
 {
     $username = type::post('username', 'string', '');
     $password = type::post('password', 'string', '');
     if ($username == '' || $password == '') {
         echo message::info(lang::get('login_form_notfull'), true);
         return;
     }
     $sql = sql::factory();
     $sql->query('SELECT password, salt, id FROM ' . sql::table('community_user') . ' WHERE `username` = "' . $sql->escape($username) . '"');
     if (!$sql->num()) {
         echo message::danger(sprintf(lang::get('login_no_user'), $email), true);
         return;
     }
     $sql->result();
     if (!userLogin::checkPassword($password, $sql->get('salt'), $sql->get('password'))) {
         echo message::danger(lang::get('login_pwd_false'), true);
         return;
     }
     $_SESSION['community-login'] = $sql->get('id');
     self::checkSession();
     // Für spätere Foren-Bridges
     extension::get('COMMUNITY_USER_LOGIN', $password);
 }
Example #13
0
$field->addValidator('notEmpty', lang::get('validator_not_empty'));
$field->fieldName(lang::get('password'));
if ($form->isSubmit()) {
    $sql = sql::connect($form->get('db_host'), $form->get('db_user'), $form->get('db_password'), $form->get('db_database'));
    if (is_null($sql)) {
        $DB = ['host' => $form->get('db_host'), 'user' => $form->get('db_user'), 'password' => $form->get('db_password'), 'database' => $form->get('db_database'), 'prefix' => $form->get('db_prefix')];
        dyn::add('DB', $DB, true);
        dyn::add('setup', false, true);
        dyn::save();
        install::newInstall();
        install::insertDemoContent();
        $template = new template(dyn::get('template'));
        if ($template->install() !== true) {
            $form->setSuccessMessage(null);
            $error = true;
        }
        $form->addParam('page', 'finish');
    } else {
        echo message::danger($sql);
    }
}
echo $form->show();
?>
                
                </div>
        
        </div>
    
    </div>
    
</div>
Example #14
0
    echo message::success($success);
}
layout::addNav(lang::get('dashboard'), 'dashboard', 'home', ['refresh'], true);
layout::addNav(lang::get('settings'), 'settings', 'settings', [], false);
layout::addNav(lang::get('server'), 'server', 'list', ['add'], true);
layout::addNav(lang::get('addons'), 'addons', 'alt', [], true);
layout::addNav(lang::get('user'), 'user', 'users', ['add'], true);
foreach (addonConfig::includeAllConfig() as $file) {
    include $file;
}
if (userLogin::isLogged()) {
    $path = 'pages/' . $page . '.php';
    $path = extension::get('PAGE_PATH', $path);
    if (file_exists($path)) {
        include $path;
    } else {
        echo message::danger(lang::get('page_not_found'), false);
    }
}
$content = ob_get_contents();
ob_end_clean();
rp::add('content', $content);
if (ajax::is()) {
    echo ajax::getReturn();
    die;
}
if (userLogin::isLogged()) {
    include dir::layout('index.php', rp::get('layout'));
} else {
    include dir::layout('login.php', rp::get('layout'));
}
Example #15
0
 public static function getNaviInclude($addon = false)
 {
     self::setCurrents();
     if (isset(self::$navi[self::getPageName()])) {
         $current = self::$navi[self::getPageName()];
     } else {
         $current = self::$addonNavi[self::getPageName()];
     }
     // isset gibt bei null false aus
     if (isset($current['callback']) && is_callable($current['callback'])) {
         return $current['callback']();
     }
     $page = self::$getVars[0];
     if (!$addon) {
         if (file_exists(dir::page($page . '.php'))) {
             return dir::page($page . '.php');
         }
     } else {
         if (file_exists(dir::addon($addon, 'page' . DIRECTORY_SEPARATOR . $page . '.php'))) {
             return dir::addon($addon, 'page' . DIRECTORY_SEPARATOR . $page . '.php');
         }
     }
     echo message::danger(lang::get('page_not_found'));
     return false;
 }
Example #16
0
<?php

if (!dyn::get('user')->hasPerm('admin[user]')) {
    echo message::danger(lang::get('access_denied'));
    return;
}
$action = type::super('action', 'string');
$id = type::super('id', 'int', 0);
backend::addSubnavi(lang::get('overview'), url::backend('user', ['subpage' => 'overview']));
include_once backend::getSubnaviInclude();
Example #17
0
 public static function getEval($content)
 {
     ob_start();
     ob_implicit_flush(0);
     // PHP-Startzeichen  im Code verwenden können
     $content = eval(' ?>' . $content . ' <?php ');
     // Falls irgendein Fehler gekommen ist
     if (false === $content) {
         echo message::danger(lang::get('modul_php_error'));
     }
     $output = ob_get_contents();
     ob_end_clean();
     return $output;
 }
Example #18
0
<?php

if ($action == 'delete') {
    if (dyn::get('user')->get('id') == $id) {
        echo message::danger(lang::get('user_self_deleted'));
    } else {
        $sql = sql::factory();
        $sql->setTable('user');
        $sql->setWhere('id=' . $id);
        $sql->delete();
        echo message::success(lang::get('user_deleted'));
    }
    $action = '';
}
if ($action == 'add' || $action == 'edit') {
    layout::addJsCode("\n\tvar page_admin_button = \$('#pageadmin-button');\n\tvar page_admin_content = \$('#pageadmin-content');\n\t\n\tpage_admin_button.change(function() {\n\t\t\tif(page_admin_button.is(':checked')) {\n\t\t\t\tpage_admin_content.stop().slideUp(300);\n\t\t\t} else {\n\t\t\t\tpage_admin_content.stop().slideDown(300);\n\t\t\t}\n\t});");
    $form = form::factory('user', 'id=' . $id, 'index.php');
    $field = $form->addTextField('firstname', $form->get('firstname'));
    $field->fieldName(lang::get('firstname'));
    $field->autofocus();
    $field = $form->addTextField('name', $form->get('name'));
    $field->fieldName(lang::get('name'));
    $field = $form->addTextField('email', $form->get('email'));
    $field->fieldName(lang::get('email_adress'));
    $field->addValidator('notEmpty', lang::get('user_email_empty'));
    $field->addValidator('email', lang::get('user_wrong_email'));
    if ($form->get('password') != $form->sql->getValue('password')) {
        $password = userLogin::hash($form->get('password'), $form->get('salt'));
    } else {
        $password = $form->sql->getValue('password');
    }
Example #19
0
 /**
  * Fügt das Formular zusammen und speichert es, falls nötig
  *
  * @return	string
  *
  */
 public function show()
 {
     extension::get('FORM_BEFORE_ACTION', $this);
     foreach ($this->getParams() as $key => $value) {
         $param = $this->addHiddenField($key, $value);
         $param->setSave(false);
     }
     if ($this->isSubmit(true)) {
         $this->saveForm();
         if (!$this->isSaveEdit() && is_null($this->errorMessage)) {
             $this->redirect();
         }
         if (!is_null($this->errorMessage)) {
             echo message::danger($this->errorMessage);
         } elseif (!is_null($this->successMessage)) {
             echo message::success($this->successMessage);
         }
     }
     $return = [];
     $buttons = [];
     $hidden = [];
     $x = 1;
     $return[] = '<form' . html_convertAttribute($this->formAttributes) . '>' . PHP_EOL;
     foreach ($this->return as $ausgabe) {
         if ($ausgabe->getAttribute('type') == 'hidden') {
             $hidden[] = $ausgabe->get();
             continue;
         }
         if (!$ausgabe->hasAttribute('id')) {
             $ausgabe->addAttribute('id', 'form_' . $x);
         }
         $return[] = '<div class="form-group">';
         $return[] = '<label for="' . $ausgabe->getAttribute('id') . '">' . $ausgabe->fieldName . '</label>';
         $return[] = '<div class="form-wrap-input">' . $ausgabe->prefix . $ausgabe->get() . $ausgabe->suffix . '</div>';
         $return[] = '</div>';
         $x++;
     }
     foreach ($this->buttons as $button) {
         $buttons[] = $button->get();
     }
     $return[] = implode(PHP_EOL, $hidden);
     $return[] = '<div class="form-group">';
     $return[] = '<div class="form-submit-area col-sm-10 btn-group">' . implode(PHP_EOL, $buttons) . '</div>';
     $return[] = '</div>';
     $return[] = '</form>';
     $return = extension::get('FORM_BEFORE_SHOW', implode(PHP_EOL, $return));
     return $return;
 }
Example #20
0
<?php

if ($action == 'deleteCache') {
    cache::clear();
    pageCache::clearAll();
    extension::get('SETTINGS_DELETE_CACHE');
    echo message::success(lang::get('delete_cache_success'), true);
}
if ($action == 'loadTemplate') {
    $template = new template(dyn::get('template'));
    if ($template->install(true) !== true) {
        echo message::danger(lang::get('load_template_failed'), true);
    } else {
        echo message::success(lang::get('load_template_success'), true);
    }
}
?>
<div class="row">	
    <div class="col-lg-8">
        <div class="panel panel-default">
            <div class="panel-heading">
            	<h3 class="panel-title pull-left"><?php 
echo lang::get('general');
?>
</h3>
                <div class="pull-right">
                	<a href="<?php 
echo url::backend('settings', ['subpage' => 'main', 'action' => 'deleteCache']);
?>
" class="btn btn-sm btn-default"><?php 
echo lang::get('delete_cache');
Example #21
0
<?php

if (!dyn::get('user')->hasPerm('page[module]')) {
    echo message::danger(lang::get('access_denied'));
    return;
}
if ($action == 'delete') {
    $sql = sql::factory();
    $num = $sql->num('SELECT id FROM ' . sql::table('structure_area') . ' WHERE modul = ' . $id);
    if ($num) {
        echo message::danger(lang::get('module_in_use'));
    } else {
        $sql->setTable('module');
        $sql->setWhere('id=' . $id);
        $sql->delete();
        echo message::success(lang::get('module_deleted'));
    }
    $action = '';
}
if ($action == 'export') {
    module::sendExport($id);
    echo message::success(lang::get('module_export'));
    $action = '';
}
if ($action == 'import') {
    $content = (array) apiserver::getModuleFile();
    if ($id && isset($content[$id])) {
        $sql = sql::factory();
        $sql->setTable('module');
        $sql->addPost('name', $content[$id]['name']);
        $sql->addPost('input', $content[$id]['install']['input']);
Example #22
0
        $sql = sql::factory();
        $sql->setTable('addons');
        $sql->setWhere('`name` = "' . $addon . '"');
        $sql->addPost('install', $install);
        if (!$install) {
            $sql->addPost('active', 0);
        }
        $sql->update();
        echo message::success(lang::get('addon_save_success'));
    }
}
if ($action == 'active') {
    $addonClass = new addon($addon, false);
    $active = $addonClass->isActive() ? 0 : 1;
    if (!$addonClass->isInstall()) {
        echo message::danger(sprintf(lang::get('addon_install_first'), $addon));
    } else {
        $sql = sql::factory();
        $sql->setTable('addons');
        $sql->setWhere('`name` = "' . $addon . '"');
        $sql->addPost('active', $active);
        $sql->update();
        echo message::success(lang::get('addon_save_success'));
    }
}
if ($action == 'help') {
    $curAddon = new addon($addon);
    ?>
	<div class="row">
		<div class="col-lg-12">
			<div class="panel panel-default">
        if ($mail) {
            ajax::addReturn(message::success(lang::get('idea_send')));
        } else {
            ajax::addReturn(message::danger(lang::get('idea_error')));
        }
    } else {
        ajax::addReturn(message::danger(lang::get('idea_empty')));
    }
}
$versionCheck = dyn::checkDynVersion();
if ($versionCheck === lang::get('version_fail_connect')) {
    $message = lang::get('version_fail_connect');
    $message .= '<br /><a href="' . url::backend('dashboard', ['subpage' => 'overview', 'checkversion' => 1]) . '">' . lang::get('try_again') . '</a>';
    echo message::danger($message, true);
} elseif ($versionCheck) {
    echo message::danger($versionCheck, true);
}
$stats = [];
$sql = sql::factory();
$numPages = $sql->num('SELECT * FROM ' . sql::table('structure'));
$sql = sql::factory();
$numModule = $sql->num('SELECT * FROM ' . sql::table('module'));
$sql = sql::factory();
$numBlocks = $sql->num('SELECT * FROM ' . sql::table('blocks'));
$sql = sql::factory();
$numAddons = $sql->num('SELECT * FROM ' . sql::table('addons'));
$stats[] = ['num' => $numPages, 'text' => lang::get('numpages'), 'btn' => ['text' => lang::get('page_add'), 'url' => url::backend('structure', ['subpage' => 'pages', 'action' => 'add'])]];
$stats[] = ['num' => $numAddons, 'text' => lang::get('numaddons'), 'btn' => ''];
$stats[] = ['num' => $numModule, 'text' => lang::get('nummodule'), 'btn' => ['text' => lang::get('module_add'), 'url' => url::backend('structure', ['subpage' => 'module', 'action' => 'add'])]];
$stats[] = ['num' => $numBlocks, 'text' => lang::get('numblocks'), 'btn' => ['text' => lang::get('block_add'), 'url' => url::backend('structure', ['subpage' => 'blocks', 'action' => 'add'])]];
$stats = extension::get('DASHBOARD_STATS', $stats);
Example #24
0
    <div class="col-lg-12">
    
        <div class="panel panel-default">
        
                <div class="panel-heading">
                    <h3 class="panel-title"><?php 
echo lang::get('db_connect');
?>
</h3>
                </div>
                <div class="panel-body">

                   		<?php 
if (type::get('error')) {
    echo message::danger(type::get('error'));
}
$form = form_install::factory('', '', 'index.php');
$DB = dyn::get('DB');
$field = $form->addRawField('<h4>' . lang::get('db_database') . '</h4>');
$field = $form->addTextField('db_host', $DB['host']);
$field->setRequired(true);
$field->fieldName(lang::get('db_host'));
$field = $form->addTextField('db_user', $DB['user']);
$field->setRequired(true);
$field->fieldName(lang::get('db_user'));
$field = $form->addPasswordField('db_password', $DB['password']);
$field->setRequired(true);
$field->fieldName(lang::get('db_password'));
$field = $form->addTextField('db_database', $DB['database']);
$field->setRequired(true);
Example #25
0
?>
</h1>
            
            <?php 
if (isset($_POST['check'])) {
    $host = type::post('host');
    $user = type::post('user');
    $password = type::post('password');
    $database = type::post('database');
    $prefix = type::post('prefix');
    ob_start();
    $sqlCheck = sql::connect($host, $user, $password, $database);
    $error = ob_get_contents();
    ob_end_clean();
    if ($sqlCheck) {
        echo message::danger(lang::get('db_not_correct') . ' - <small>' . lang::get('show_errors') . '</small>', false);
    } else {
        $DB = ['host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix];
        rp::add('DB', $DB, true);
        rp::save();
        $DB = rp::get('DB');
        sql::connect($DB['host'], $DB['user'], $DB['password'], $DB['database']);
        unset($DB);
        $sql = new sql();
        $sql->query('DROP TABLE IF EXISTS `' . sql::table('addons') . '`');
        $sql->query('CREATE TABLE `' . sql::table("addons") . '` (
							`id` int(11) unsigned NOT NULL,
							`name` varchar(255) NOT NULL,
							`active` int(1) NOT NULL,
							`install` int(1) NOT NULL
							) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;');
Example #26
0
foreach (addonConfig::includeAllConfig() as $file) {
    if (file_exists($file)) {
        require_once $file;
    } else {
        $failed_plugins++;
    }
}
if ($failed_plugins > 0) {
    echo message::warning(lang::get('failed_plugins_load'));
}
$page = type::super('page', 'string', 'dashboard');
$subpage = type::super('subpage', 'string');
$successMsg = type::get('success_msg', 'string');
$errorMsg = type::get('error_msg', 'string');
if (!is_null($errorMsg)) {
    echo message::danger($errorMsg);
} elseif (!is_null($successMsg)) {
    echo message::success($successMsg);
}
if (userLogin::isLogged()) {
    if ($file = backend::getNaviInclude()) {
        include $file;
    }
}
$content = ob_get_contents();
ob_end_clean();
$content = extension::get('BACKEND_OUTPUT', $content);
dyn::add('content', $content);
if (ajax::is()) {
    $deleteAction = type::get('deleteAction', 'bool', false);
    if ($deleteAction) {
Example #27
0
}
$breadcrumb[] = '<li><a href="' . url::backend('media', ['subpage' => 'category']) . '">' . lang::get('start') . '</a></li>';
echo '<ul class="breadcrumb">' . implode('', array_reverse($breadcrumb)) . '</ul>';
if ($action == 'delete' && dyn::get('user')->hasPerm('media[category][delete]')) {
    $error = [];
    $sql = sql::factory();
    $sql->query('SELECT id FROM ' . sql::table('media_cat') . ' WHERE `pid` = ' . $id)->result();
    if ($sql->num()) {
        $error[] = lang::get('media_underfile_exist');
    }
    $sql->query('SELECT id FROM ' . sql::table('media') . ' WHERE `category` = ' . $id)->result();
    if ($sql->num()) {
        $error[] = lang::get('media_underfile_exist2');
    }
    if (count($error)) {
        echo message::danger(implode('<br />', $error));
    } else {
        $sql = sql::factory();
        $sql->query('SELECT `sort`, `pid` FROM ' . sql::table('media_cat') . ' WHERE id=' . $id)->result();
        $delete = sql::factory();
        $delete->setTable('media_cat');
        $delete->setWhere('id=' . $id);
        $delete->delete();
        sql::sortTable('media_cat', 0, '`pid` = ' . $sql->get('pid'));
        echo message::success(lang::get('file_deleted'));
    }
}
if (in_array($action, ['save-add', 'save-edit']) && dyn::get('user')->hasPerm('media[category][edit]')) {
    $sql = sql::factory();
    $sql->setTable('media_cat');
    $sql->setWhere('id=' . $id);
Example #28
0
    if (isset($_POST['delete'])) {
        $ids = type::post('ids');
        if (is_array($ids) && count($ids) >= 1) {
            if (in_array(rp::get('user')->get('id'), $ids)) {
                echo message::danger(lang::get('user_delete_own'));
            } else {
                foreach ($ids as $var) {
                    $sql = new sql();
                    $sql->setTable('user');
                    $sql->setWhere("id=" . $var);
                    $sql->delete();
                }
                echo message::success(lang::get('user_deleted'));
            }
        } else {
            echo message::danger(lang::get('choose_user'));
        }
    }
    $table = new table();
    $table->addCollsLayout('25, 30%, *, 140, 100');
    $table->addRow()->addCell("\n\t\t\t<input type='checkbox' id='all'>\n\t\t\t<label for='all'></label>\n\t\t", ['class' => 'checkbox'])->addCell(lang::get('name'))->addCell(lang::get('email'))->addCell(lang::get('username'))->addCell("");
    $table->addSection('tbody');
    $table->setSql('SELECT * FROM ' . sql::table('user'));
    while ($table->isNext()) {
        $id = $table->get('id');
        $edit = '<a class="btn" href="?page=user&action=edit&id=' . $id . '">' . layout::svg('edit') . '</a>';
        $table->addRow()->addCell("\n\t\t\t\t<input type='checkbox' name='ids[]' value='" . $id . "' id='id" . $id . "'>\n\t\t\t\t<label for='id" . $id . "'></label>\n\t\t\t", ['class' => 'checkbox'])->addCell($table->get('firstname') . " " . $table->get('name'))->addCell($table->get('email'))->addCell($table->get('username'))->addCell($edit);
        $table->next();
    }
    ?>
Example #29
0
        continue;
    }
    $field->add($file, $file);
}
if ($form->isSubmit()) {
    $url = 'http://' . str_replace('http://', '', $form->get('hp_url'));
    $endSlash = substr($url, -1, 1);
    if ($endSlash != '/') {
        $url .= '/';
    }
    dyn::add('hp_name', $form->get('hp_name'), true);
    dyn::add('hp_url', $url, true);
    dyn::add('lang', $form->get('lang'), true);
    dyn::save();
    if ($error) {
        echo message::danger('error');
    } else {
        $form->addParam('page', 'database');
    }
}
echo $form->show();
?>
                
                </div>        
        </div>    
    </div>	
    <div class="col-lg-4">    
        <div class="panel panel-default">        
                <div class="panel-heading">
                    <h3 class="panel-title"><?php 
echo lang::get('settings');
Example #30
0
if ($action == 'deleteCache') {
    cache::clear();
    echo message::success(lang::get('delete_cache_success'));
}
if ($action == 'generateCSS') {
    $less = new lessc();
    $error = false;
    $newCSS = '';
    try {
        $newCSS = $less->compileFile(dir::layout('less/style.less', rp::get('layout')));
        $fp = fopen(dir::layout('css/style.css', rp::get('layout')), "wb");
        fwrite($fp, $newCSS);
        fclose($fp);
    } catch (exception $e) {
        echo message::danger($e->getMessage());
        $error = true;
    }
    if (!$error) {
        echo message::success(lang::get('generate_css_success'));
    }
}
if (isset($_POST['send'])) {
    rp::add('lang', type::post('lang', 'string'), true);
    rp::add('logs', type::post('logs', 'int'), true);
    rp::add('ip', type::post('ip', 'string'), true);
    rp::add('email', type::post('email', 'string'), true);
    rp::add('emailNot', type::post('emailNot', 'int'), true);
    rp::save();
    echo message::success(lang::get('settings_edited'));
}