Exemple #1
0
/**
 * db backup render start
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 */
function db_backup_render_start()
{
    if (LOGGED_IN == TOKEN && FIRST_PARAMETER == 'admin' && SECOND_PARAMETER == 'db-backup') {
        define('TITLE', l('database_backup', 'db_backup'));
        /* registry object */
        $registry = Redaxscript\Registry::getInstance();
        $registry->set('title', l('database_backup', 'db_backup'));
        /* config object */
        $config = Redaxscript\Config::getInstance();
        /* download database backup */
        if (THIRD_PARAMETER == 'download') {
            define('RENDER_BREAK', 1);
            db_backup($config::get('name'), 0);
        }
        /* send database backup */
        if (THIRD_PARAMETER == 'send') {
            define('CENTER_BREAK', 1);
            /* prepare body parts */
            $urlLink = anchor_element('external', '', '', ROOT, ROOT);
            $fileName = $config::get('name') . '-' . db_backup_clean_date(NOW) . '.sql';
            /* prepare mail inputs */
            $toArray = $fromArray = array(s('author') => s('email'));
            $subject = l('database_backup', 'db_backup');
            $bodyArray = array('<strong>' . l('url') . l('colon') . '</strong> ' . $urlLink, '<strong>' . l('database') . l('colon') . '</strong> ' . $config::get('name'), '<br />', '<strong>' . l('message') . l('colon') . '</strong> ' . l('save_attachment', 'db_backup') . l('point'));
            $attachmentArray = array($fileName => db_backup($config::get('name'), 1));
            /* mail object */
            $mail = new Redaxscript\Mailer($toArray, $fromArray, $subject, $bodyArray, $attachmentArray);
            $mail->send();
        }
    }
}
Exemple #2
0
/**
 * fb group render start
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 */
function fb_group_render_start()
{
    if (FIRST_PARAMETER == 'fb-group' && SECOND_PARAMETER == 'get-contents' && (THIRD_PARAMETER == 'members' || THIRD_PARAMETER == 'feed')) {
        Redaxscript\Registry::set('renderBreak', true);
        fb_group_get_contents(THIRD_PARAMETER);
    }
}
Exemple #3
0
/**
 * github tracker render start
 *
 * @since 2.1.0
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 */
function github_tracker_render_start()
{
    if (FIRST_PARAMETER == 'github-tracker' && SECOND_PARAMETER == 'get-contents' && (THIRD_PARAMETER == 'milestones' || THIRD_PARAMETER == 'issues')) {
        Redaxscript\Registry::set('renderBreak', true);
        github_tracker_get_contents(THIRD_PARAMETER);
    }
}
Exemple #4
0
/**
 * file manager render start
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 */
function file_manager_render_start()
{
    if (LOGGED_IN == TOKEN && FIRST_PARAMETER == 'admin' && SECOND_PARAMETER == 'file-manager') {
        Redaxscript\Registry::set('title', l('file_manager', '_file_manager'));
        Redaxscript\Registry::set('centerBreak', true);
    }
}
Exemple #5
0
/**
 * file manager render start
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 */
function file_manager_render_start()
{
    if (LOGGED_IN == TOKEN && FIRST_PARAMETER == 'admin' && SECOND_PARAMETER == 'file-manager') {
        define('CENTER_BREAK', 1);
        define('TITLE', l('file_manager', 'file_manager'));
        /* registry object */
        $registry = Redaxscript\Registry::getInstance();
        $registry->set('title', l('file_manager', 'file_manager'));
    }
}
Exemple #6
0
/**
 * qunit render start
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 */
function qunit_render_start()
{
    if (FIRST_PARAMETER == 'qunit') {
        define('CENTER_BREAK', 1);
        define('TITLE', l('qunit', 'qunit'));
        define('DESCRIPTION', l('description', 'qunit'));
        /* registry object */
        $registry = Redaxscript\Registry::getInstance();
        $registry->set('title', l('qunit', 'qunit'));
    }
}
Exemple #7
0
/**
 * center
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Center
 * @author Henry Ruhs
 */
function center()
{
    Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    /* center break */
    if (CENTER_BREAK == 1 || Redaxscript\Registry::get('centerBreak') == 1) {
        return;
    } else {
        routing();
    }
    Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
}
/**
 * search post
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Search
 * @author Henry Ruhs
 */
function search_post()
{
    /* clean post */
    if (ATTACK_BLOCKED < 10) {
        $search_terms = clean($_POST['search_terms'], 5);
        $table = clean($_POST['table']);
    }
    /* validate post */
    if (strlen($search_terms) < 3 || $search_terms == l('search_terms')) {
        $error = l('input_incorrect');
    } else {
        /* fetch result */
        $result = Redaxscript\Db::forTablePrefix($table)->where('status', 1)->whereIn('language', array(Redaxscript\Registry::get('language'), ''))->whereLikeMany(array('title', 'description', 'keywords', 'text'), array('%' . $search_terms . '%', '%' . $search_terms . '%', '%' . $search_terms . '%', '%' . $search_terms . '%'))->orderByDesc('date')->findArray();
        /* process result */
        $num_rows = count($result);
        if (!$result) {
            $error = l('search_no');
        } else {
            if ($result) {
                $accessValidator = new Redaxscript\Validator\Access();
                $output = '<h2 class="title_content title_search_result">' . l('search') . '</h2>';
                $output .= form_element('fieldset', '', 'set_search_result', '', '', '') . '<ol class="list_search_result">';
                foreach ($result as $r) {
                    $access = $r['access'];
                    /* access granted */
                    if ($accessValidator->validate($access, MY_GROUPS) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                        if ($r) {
                            foreach ($r as $key => $value) {
                                ${$key} = stripslashes($value);
                            }
                        }
                        /* prepare metadata */
                        if ($description == '') {
                            $description = $title;
                        }
                        $date = date(s('date'), strtotime($date));
                        /* build route */
                        if ($table == 'categories' && $parent == 0 || $table == 'articles' && $category == 0) {
                            $route = $alias;
                        } else {
                            $route = build_route($table, $id);
                        }
                        /* collect item output */
                        $output .= '<li class="item_search_result">' . anchor_element('internal', '', 'link_search_result', $title, $route, $description) . '<span class="date_search_result">' . $date . '</span></li>';
                    } else {
                        $counter++;
                    }
                }
                $output .= '</ol></fieldset>';
                /* handle access */
                if ($num_rows == $counter) {
                    $error = l('access_no');
                }
            }
        }
    }
    /* handle error */
    if ($error) {
        notification(l('something_wrong'), $error);
    } else {
        echo $output;
    }
}
/**
 * migrate constants
 *
 * @since 2.1.0
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Migrate
 * @author Henry Ruhs
 * @author Gary Aylward
 *
 * @return array
 */
function migrate_constants()
{
    /* get user constants */
    $constants = get_defined_constants(true);
    $constants_user = $constants['user'];
    /* process constants user */
    foreach ($constants_user as $key => $value) {
        /* transform to camelcase */
        $key = mb_convert_case($key, MB_CASE_TITLE);
        $key[0] = strtolower($key[0]);
        /* remove underline */
        $key = str_replace('_', '', $key);
        /* store in array */
        $output[$key] = $value;
    }
    $output = array_merge($output, Redaxscript\Registry::get());
    return $output;
}
Exemple #10
0
/**
 * startup
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Startup
 * @author Henry Ruhs
 */
function startup()
{
    /* ini set */
    if (function_exists('ini_set')) {
        if (error_reporting() == 0) {
            ini_set('display_startup_errors', 0);
            ini_set('display_errors', 0);
        }
        ini_set('session.use_trans_sid', 0);
        ini_set('url_rewriter.tags', 0);
        ini_set('mbstring.substitute_character', 0);
    }
    /* define general */
    $request = Redaxscript\Request::getInstance();
    $file = new Redaxscript\Server\File($request);
    $root = new Redaxscript\Server\Root($request);
    define('FILE', $file->getOutput());
    define('ROOT', $root->getOutput());
    /* session start */
    session_start();
    /* prevent session hijacking */
    if (!$_SESSION[ROOT . '/regenerate_id']) {
        session_regenerate_id();
        $_SESSION[ROOT . '/regenerate_id'] = 1;
    }
    /* database status */
    Redaxscript\Registry::set('dbStatus', Redaxscript\Db::getStatus());
    /* define token */
    $token = new Redaxscript\Server\Token($request);
    define('TOKEN', $token->getOutput());
    /* prefix and salt */
    define('PREFIX', Redaxscript\Config::get('dbPrefix'));
    define('SALT', Redaxscript\Config::get('dbSalt'));
    /* define session */
    define('LOGGED_IN', $_SESSION[ROOT . '/logged_in']);
    define('ATTACK_BLOCKED', $_SESSION[ROOT . '/attack_blocked']);
    /* setup charset */
    if (function_exists('ini_set') && Redaxscript\Registry::get('dbStatus') === 2) {
        ini_set('default_charset', s('charset'));
    }
    /* define parameter */
    $parameter = new Redaxscript\Parameter($request);
    $parameter->init();
    define('FIRST_PARAMETER', $parameter->getFirst());
    define('FIRST_SUB_PARAMETER', $parameter->getSub());
    define('SECOND_PARAMETER', $parameter->getSecond());
    define('SECOND_SUB_PARAMETER', $parameter->getSub());
    define('THIRD_PARAMETER', $parameter->getThird());
    define('THIRD_SUB_PARAMETER', $parameter->getSub());
    if (LOGGED_IN == TOKEN && FIRST_PARAMETER == 'admin') {
        define('ADMIN_PARAMETER', $parameter->getAdmin());
        define('TABLE_PARAMETER', $parameter->getTable());
        define('ID_PARAMETER', $parameter->getId());
        define('ALIAS_PARAMETER', $parameter->getAlias());
    } else {
        undefine(array('ADMIN_PARAMETER', 'TABLE_PARAMETER', 'ID_PARAMETER', 'ALIAS_PARAMETER'));
    }
    define('LAST_PARAMETER', $parameter->getLast());
    define('LAST_SUB_PARAMETER', $parameter->getSub());
    define('TOKEN_PARAMETER', $parameter->getToken());
    /* define routes */
    $router = new Redaxscript\Router($request);
    $router->init();
    define('LITE_ROUTE', $router->getLite());
    define('FULL_ROUTE', $router->getFull());
    if (function_exists('apache_get_modules') && in_array('mod_rewrite', apache_get_modules()) == '' || file_exists('.htaccess') == '' || FILE == 'install.php') {
        define('REWRITE_ROUTE', '?p=');
        define('LANGUAGE_ROUTE', '&amp;l=');
        define('TEMPLATE_ROUTE', '&amp;t=');
    } else {
        define('REWRITE_ROUTE', '');
        define('LANGUAGE_ROUTE', '.');
        define('TEMPLATE_ROUTE', '.');
    }
    /* define tables */
    if (Redaxscript\Registry::get('dbStatus') === 2) {
        if (FULL_ROUTE == '' || FIRST_PARAMETER == 'admin' && SECOND_PARAMETER == '') {
            /* check for homepage */
            if (s('homepage') > 0) {
                $table = 'articles';
                $id = s('homepage');
            } else {
                $table = 'categories';
                $id = 0;
                /* check order */
                if (s('order') == 'asc') {
                    $rank = Redaxscript\Db::forTablePrefix($table)->min('rank');
                } else {
                    if (s('order') == 'desc') {
                        $rank = Redaxscript\Db::forTablePrefix($table)->max('rank');
                    }
                }
                /* if category is published */
                if ($rank) {
                    $status = Redaxscript\Db::forTablePrefix($table)->where('rank', $rank)->findOne()->status;
                    if ($status == 1) {
                        $id = Redaxscript\Db::forTablePrefix($table)->where('rank', $rank)->findOne()->id;
                    }
                }
            }
            define('FIRST_TABLE', $table);
            define('SECOND_TABLE', '');
            define('THIRD_TABLE', '');
            define('LAST_TABLE', $table);
        } else {
            if (FIRST_PARAMETER) {
                define('FIRST_TABLE', query_table(FIRST_PARAMETER));
            } else {
                define('FIRST_TABLE', '');
            }
            if (FIRST_TABLE) {
                define('SECOND_TABLE', query_table(SECOND_PARAMETER));
            } else {
                define('SECOND_TABLE', '');
            }
            if (SECOND_TABLE) {
                define('THIRD_TABLE', query_table(THIRD_PARAMETER));
            } else {
                define('THIRD_TABLE', '');
            }
            if (LAST_PARAMETER) {
                define('LAST_TABLE', query_table(LAST_PARAMETER));
            } else {
                define('LAST_TABLE', '');
            }
            if (LAST_TABLE) {
                $id = Redaxscript\Db::forTablePrefix(LAST_TABLE)->where('alias', LAST_PARAMETER)->findOne()->id;
            }
        }
    } else {
        undefine(array('FIRST_TABLE', 'SECOND_TABLE', 'THIRD_TABLE', 'LAST_TABLE'));
    }
    /* define ids */
    if (LAST_TABLE == 'categories') {
        define('CATEGORY', $id);
        define('ARTICLE', '');
        define('LAST_ID', $id);
    } else {
        if (LAST_TABLE == 'articles') {
            define('CATEGORY', '');
            define('ARTICLE', $id);
            define('LAST_ID', $id);
        } else {
            undefine(array('CATEGORY', 'ARTICLE', 'LAST_ID'));
        }
    }
    /* define content error */
    $aliasValidator = new Redaxscript\Validator\Alias();
    if (LAST_ID == '' && $aliasValidator->validate(FIRST_PARAMETER, Redaxscript\Validator\Alias::MODE_DEFAULT) == Redaxscript\Validator\ValidatorInterface::FAILED) {
        define('CONTENT_ERROR', 1);
    } else {
        define('CONTENT_ERROR', 0);
    }
    /* define user */
    $browser = new Redaxscript\Client\Browser($request);
    $version = new Redaxscript\Client\Version($request);
    $engine = new Redaxscript\Client\Engine($request);
    $mobile = new Redaxscript\Client\Mobile($request);
    $tablet = new Redaxscript\Client\Tablet($request);
    define('MY_BROWSER', $browser->getOutput());
    define('MY_BROWSER_VERSION', $version->getOutput());
    define('MY_ENGINE', $engine->getOutput());
    define('MY_MOBILE', $mobile->getOutput());
    define('MY_TABLET', $tablet->getOutput());
    /* if mobile or tablet */
    if (MY_MOBILE || MY_TABLET) {
        define('MY_DESKTOP', '');
    } else {
        $desktop = new Redaxscript\Client\Desktop($request);
        define('MY_DESKTOP', $desktop->getOutput());
    }
    /* if logged in */
    if (LOGGED_IN == TOKEN) {
        define('MY_ID', $_SESSION[ROOT . '/my_id']);
        define('MY_NAME', $_SESSION[ROOT . '/my_name']);
        define('MY_USER', $_SESSION[ROOT . '/my_user']);
        define('MY_EMAIL', $_SESSION[ROOT . '/my_email']);
        define('MY_GROUPS', $_SESSION[ROOT . '/my_groups']);
        /* define access */
        $access_array = array('categories', 'articles', 'extras', 'comments', 'groups', 'users');
        foreach ($access_array as $value) {
            define(strtoupper($value) . '_NEW', $_SESSION[ROOT . '/' . $value . '_new']);
            define(strtoupper($value) . '_EDIT', $_SESSION[ROOT . '/' . $value . '_edit']);
            define(strtoupper($value) . '_DELETE', $_SESSION[ROOT . '/' . $value . '_delete']);
            if (TABLE_PARAMETER == 'users' && ID_PARAMETER == MY_ID && $value == 'users') {
                define('USERS_EXCEPTION', 1);
            } else {
                if ($value == 'users') {
                    define('USERS_EXCEPTION', 0);
                }
            }
        }
        define('MODULES_INSTALL', $_SESSION[ROOT . '/modules_install']);
        define('MODULES_EDIT', $_SESSION[ROOT . '/modules_edit']);
        define('MODULES_UNINSTALL', $_SESSION[ROOT . '/modules_uninstall']);
        define('SETTINGS_EDIT', $_SESSION[ROOT . '/settings_edit']);
        define('FILTER', $_SESSION[ROOT . '/filter']);
    } else {
        define('FILTER', 1);
    }
    /* define table access */
    define('TABLE_NEW', constant(strtoupper(TABLE_PARAMETER) . '_NEW'));
    define('TABLE_INSTALL', constant(strtoupper(TABLE_PARAMETER) . '_INSTALL'));
    define('TABLE_EDIT', constant(strtoupper(TABLE_PARAMETER) . '_EDIT'));
    define('TABLE_DELETE', constant(strtoupper(TABLE_PARAMETER) . '_DELETE'));
    define('TABLE_UNINSTALL', constant(strtoupper(TABLE_PARAMETER) . '_UNINSTALL'));
    /* define time */
    define('GMDATE', gmdate('D, d M Y H:i:s') . ' GMT');
    define('GMDATE_PLUS_WEEK', gmdate('D, d M Y H:i:s', strtotime('+1 week')) . ' GMT');
    define('GMDATE_PLUS_YEAR', gmdate('D, d M Y H:i:s', strtotime('+1 year')) . ' GMT');
    define('NOW', date('Y-m-d H:i:s'));
    Redaxscript\Registry::set('now', NOW);
    define('DELAY', date('Y-m-d H:i:s', strtotime('+1 minute')));
    define('TODAY', date('Y-m-d'));
    /* future update */
    define('UPDATE', $_SESSION[ROOT . '/update']);
    if (UPDATE == '' && Redaxscript\Registry::get('dbStatus') === 2) {
        future_update('articles');
        future_update('comments');
        future_update('extras');
        $_SESSION[ROOT . '/update'] = DELAY;
    } else {
        if (UPDATE < NOW) {
            $_SESSION[ROOT . '/update'] = '';
        }
    }
}
/**
 * admin control
 *
 * @since 2.0.0
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Admin
 * @author Henry Ruhs
 *
 * @param string $type
 * @param string $table
 * @param integer $id
 * @param string $alias
 * @param integer $status
 * @param string $new
 * @param string $edit
 * @param string $delete
 * @return string
 */
function admin_control($type, $table, $id, $alias, $status, $new, $edit, $delete)
{
    $output = Redaxscript\Hook::trigger('adminControlStart');
    /* define access variables */
    if ($type == 'access' && $id == 1) {
        $delete = 0;
    }
    if ($type == 'modules_not_installed') {
        $edit = $delete = 0;
    }
    /* collect modules output */
    if ($new == 1 && $type == 'modules_not_installed') {
        $output .= '<li class="rs-admin-item-control rs-admin-item-install"><a href="' . Redaxscript\Registry::get('parameterRoute') . 'admin/install/' . $table . '/' . $alias . '/' . Redaxscript\Registry::get('token') . '">' . Redaxscript\Language::get('install') . '</a></li>';
    }
    /* collect contents output */
    if ($type == 'contents') {
        if ($status == 2) {
            $output .= '<li class="rs-admin-item-control rs-admin-item-future-posting"><span>' . Redaxscript\Language::get('future_posting') . '</span></li>';
        }
        if ($edit == 1) {
            if ($status == 1) {
                $output .= '<li class="rs-admin-item-control rs-admin-item-unpublish"><a href="' . Redaxscript\Registry::get('parameterRoute') . 'admin/unpublish/' . $table . '/' . $id . '/' . Redaxscript\Registry::get('token') . '">' . Redaxscript\Language::get('unpublish') . '</a></li>';
            } else {
                if ($status == 0) {
                    $output .= '<li class="rs-admin-item-control rs-admin-item-publish"><a href="' . Redaxscript\Registry::get('parameterRoute') . 'admin/publish/' . $table . '/' . $id . '/' . Redaxscript\Registry::get('token') . '">' . Redaxscript\Language::get('publish') . '</a></li>';
                }
            }
        }
    }
    /* collect access and system output */
    if ($edit == 1 && ($type == 'access' && $id > 1 || $type == 'modules_installed')) {
        if ($status == 1) {
            $output .= '<li class="rs-admin-item-control rs-admin-item-disable"><a href="' . Redaxscript\Registry::get('parameterRoute') . 'admin/disable/' . $table . '/' . $id . '/' . Redaxscript\Registry::get('token') . '">' . Redaxscript\Language::get('disable') . '</a></li>';
        } else {
            if ($status == 0) {
                $output .= '<li class="rs-admin-item-control rs-admin-item-enable"><a href="' . Redaxscript\Registry::get('parameterRoute') . 'admin/enable/' . $table . '/' . $id . '/' . Redaxscript\Registry::get('token') . '">' . Redaxscript\Language::get('enable') . '</a></li>';
            }
        }
    }
    /* collect general edit and delete output */
    if ($edit == 1) {
        $output .= '<li class="rs-admin-item-control rs-admin-item-edit"><a href="' . Redaxscript\Registry::get('parameterRoute') . 'admin/edit/' . $table . '/' . $id . '">' . Redaxscript\Language::get('edit') . '</a></li>';
    }
    if ($delete == 1) {
        if ($type == 'modules_installed') {
            $output .= '<li class="rs-admin-item-control rs-admin-item-uninstall"><a href="' . Redaxscript\Registry::get('parameterRoute') . 'admin/uninstall/' . $table . '/' . $alias . '/' . Redaxscript\Registry::get('token') . '" class="rs-admin-js-confirm">' . Redaxscript\Language::get('uninstall') . '</a></li>';
        } else {
            $output .= '<li class="rs-admin-item-control rs-admin-item-delete"><a href="' . Redaxscript\Registry::get('parameterRoute') . 'admin/delete/' . $table . '/' . $id . '/' . Redaxscript\Registry::get('token') . '" class="rs-admin-js-confirm">' . Redaxscript\Language::get('delete') . '</a></li>';
        }
    }
    /* collect list output */
    if ($output) {
        $output = '<ul class="rs-admin-list-control">' . $output . '</ul>';
    }
    $output .= Redaxscript\Hook::trigger('adminControlEnd');
    return $output;
}
/**
 * comments
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Comments
 * @author Henry Ruhs
 *
 * @param integer $article
 * @param string $route
 */
function comments($article = '', $route = '')
{
    $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    /* query comments */
    $comments = Redaxscript\Db::forTablePrefix('comments')->where(array('status' => 1, 'article' => $article))->whereIn('language', array(Redaxscript\Registry::get('language'), ''))->orderGlobal('rank');
    /* query result */
    $result = $comments->findArray();
    if ($result) {
        $num_rows = count($result);
        $sub_maximum = ceil($num_rows / s('limit'));
        $sub_active = LAST_SUB_PARAMETER;
        /* sub parameter */
        if (LAST_SUB_PARAMETER > $sub_maximum || LAST_SUB_PARAMETER == '') {
            $sub_active = 1;
        } else {
            $offset_string = ($sub_active - 1) * s('limit') . ', ';
        }
    }
    $comments->limit($offset_string . s('limit'));
    /* query result */
    $result = $comments->findArray();
    $num_rows_active = count($result);
    /* handle error */
    if ($result == '' || $num_rows == '') {
        $error = l('comment_no');
    } else {
        if ($result) {
            $accessValidator = new Redaxscript\Validator\Access();
            $output .= '<div class="box_line"></div>';
            foreach ($result as $r) {
                $access = $r['access'];
                /* access granted */
                if ($accessValidator->validate($access, MY_GROUPS) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                    if ($r) {
                        foreach ($r as $key => $value) {
                            ${$key} = stripslashes($value);
                        }
                    }
                    /* collect headline output */
                    $output .= Redaxscript\Hook::trigger('comment_start', $r) . '<h3 id="comment-' . $id . '" class="title_comment">';
                    if ($url) {
                        $output .= anchor_element('external', '', '', $author, $url, '', 'rel="nofollow"');
                    } else {
                        $output .= $author;
                    }
                    $output .= '</h3>';
                    /* collect box output */
                    $output .= infoline('comments', $id, $author, $date);
                    $output .= '<div class="box_comment">' . $text . '</div>' . Redaxscript\Hook::trigger('comment_end', $r);
                    /* admin dock */
                    if (LOGGED_IN == TOKEN && FIRST_PARAMETER != 'logout') {
                        $output .= admin_dock('comments', $id);
                    }
                } else {
                    $counter++;
                }
            }
            /* handle access */
            if ($num_rows_active == $counter) {
                $error = l('access_no');
            }
        }
    }
    /* handle error */
    if ($error) {
        $output = '<div class="box_comment_error">' . $error . l('point') . '</div>';
    }
    $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    echo $output;
    /* call pagination as needed */
    if ($sub_maximum > 1 && s('pagination') == 1) {
        pagination($sub_active, $sub_maximum, $route);
    }
}
Exemple #13
0
/**
 * router
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Center
 * @author Henry Ruhs
 */
function router()
{
    $firstParameter = Redaxscript\Registry::get('firstParameter');
    $secondParameter = Redaxscript\Registry::get('secondParameter');
    $thirdParameter = Redaxscript\Registry::get('thirdParameter');
    $thirdSubParameter = Redaxscript\Registry::get('thirdSubParameter');
    $config = Redaxscript\Config::getInstance();
    Redaxscript\Hook::trigger('routerStart');
    if (Redaxscript\Registry::get('routerBreak')) {
        return;
    }
    /* check token */
    $messenger = new Redaxscript\Messenger(Redaxscript\Registry::getInstance());
    if ($_POST && $_POST['token'] != Redaxscript\Registry::get('token')) {
        echo $messenger->setRoute(Redaxscript\Language::get('home'), Redaxscript\Registry::get('root'))->error(Redaxscript\Language::get('token_incorrect'), Redaxscript\Language::get('error_occurred'));
        return;
    }
    /* install routing */
    if (Redaxscript\Registry::get('file') === 'install.php' && $config->get('env') !== 'production') {
        if (Redaxscript\Request::getPost('Redaxscript\\View\\InstallForm')) {
            $installController = new Redaxscript\Controller\Install(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance(), Redaxscript\Request::getInstance(), Redaxscript\Config::getInstance());
            echo $installController->process();
            return;
        } else {
            $systemStatus = new Redaxscript\View\SystemStatus(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
            $installForm = new Redaxscript\View\InstallForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
            echo $systemStatus->render() . $installForm->render();
            return;
        }
    }
    /* general routing */
    $post_list = ['Redaxscript\\View\\LoginForm' => 'Redaxscript\\Controller\\Login', 'Redaxscript\\View\\RegisterForm' => 'Redaxscript\\Controller\\Register', 'Redaxscript\\View\\ResetForm' => 'Redaxscript\\Controller\\Reset', 'Redaxscript\\View\\RecoverForm' => 'Redaxscript\\Controller\\Recover', 'Redaxscript\\View\\CommentForm' => 'Redaxscript\\Controller\\Comment'];
    foreach ($post_list as $key => $value) {
        if (Redaxscript\Request::getPost($key)) {
            if (class_exists($value)) {
                $controller = new $value(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance(), Redaxscript\Request::getInstance());
                echo $controller->process();
            }
            return;
        }
    }
    /* search routing */
    if (Redaxscript\Request::getPost('Redaxscript\\View\\SearchForm')) {
        $messenger = new Redaxscript\Messenger(Redaxscript\Registry::getInstance());
        $table = Redaxscript\Request::getPost('table');
        if ($table) {
            $table = '/' . $table;
        }
        echo $messenger->setRoute(Redaxscript\Language::get('continue'), 'search' . $table . '/' . Redaxscript\Request::getPost('search'))->doRedirect(0)->success(Redaxscript\Language::get('search'));
    }
    /* parameter routing */
    switch ($firstParameter) {
        case 'admin':
            if (Redaxscript\Registry::get('loggedIn') == Redaxscript\Registry::get('token')) {
                admin_router();
            } else {
                echo $messenger->setRoute(Language::get('login'), 'login')->error(Language::get('access_no'), Language::get('error_occurred'));
            }
            return;
        case 'login':
            switch ($secondParameter) {
                case 'recover':
                    if (Redaxscript\Db::getSetting('recovery') == 1) {
                        $recoverForm = new Redaxscript\View\RecoverForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
                        echo $recoverForm->render();
                        return;
                    }
                case 'reset':
                    if (Redaxscript\Db::getSetting('recovery') == 1 && $thirdParameter && $thirdSubParameter) {
                        $resetForm = new Redaxscript\View\ResetForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
                        echo $resetForm->render();
                        return;
                    }
                    /* show error */
                    echo $messenger->setRoute(Language::get('login'), 'login')->error(Language::get('access_no'), Language::get('error_occurred'));
                    return;
                default:
                    $loginForm = new Redaxscript\View\LoginForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
                    echo $loginForm->render();
                    return;
            }
        case 'logout':
            if (Redaxscript\Registry::get('loggedIn') == Redaxscript\Registry::get('token')) {
                $logoutController = new Redaxscript\Controller\Logout(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance(), Redaxscript\Request::getInstance());
                echo $logoutController->process();
                return;
            }
            /* show error */
            echo $messenger->setRoute(Language::get('login'), 'login')->error(Language::get('access_no'), Language::get('error_occurred'));
            return;
        case 'register':
            if (Redaxscript\Db::getSetting('registration')) {
                $registerForm = new Redaxscript\View\RegisterForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
                echo $registerForm->render();
                return;
            }
            /* show error */
            echo $messenger->setRoute(Language::get('home'), Redaxscript\Registry::get('root'))->error(Language::get('access_no'), Language::get('error_occurred'));
            return;
        case 'search':
            $searchController = new Redaxscript\Controller\Search(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance(), Redaxscript\Request::getInstance());
            echo $searchController->process();
            return;
        default:
            contents();
            return;
    }
    Redaxscript\Hook::trigger('routerEnd');
}
/**
 * registration post
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Registration
 * @author Henry Ruhs
 */
function registration_post()
{
    /* clean post */
    if (ATTACK_BLOCKED < 10 && $_SESSION[ROOT . '/registration'] == 'visited') {
        $name = $r['name'] = clean($_POST['name'], 0);
        $user = $r['user'] = clean($_POST['user'], 0);
        $email = $r['email'] = clean($_POST['email'], 3);
        $password = substr(sha1(uniqid()), 0, 10);
        $passwordHash = new Redaxscript\Hash(Redaxscript\Config::getInstance());
        $passwordHash->init($password);
        $r['password'] = $passwordHash->getHash();
        $r['description'] = '';
        $r['language'] = Redaxscript\Registry::get('language');
        $r['first'] = $r['last'] = NOW;
        $r['groups'] = Redaxscript\Db::forTablePrefix('groups')->where('alias', 'members')->findOne()->id;
        if ($r['groups'] == '') {
            $r['groups'] = 0;
        }
        $task = $_POST['task'];
        $solution = $_POST['solution'];
    }
    /* validate post */
    $loginValidator = new Redaxscript\Validator\Login();
    $emailValidator = new Redaxscript\Validator\Email();
    $captchaValidator = new Redaxscript\Validator\Captcha();
    if ($name == '') {
        $error = l('name_empty');
    } else {
        if ($user == '') {
            $error = l('user_empty');
        } else {
            if ($email == '') {
                $error = l('email_empty');
            } else {
                if ($loginValidator->validate($user) == Redaxscript\Validator\ValidatorInterface::FAILED) {
                    $error = l('user_incorrect');
                } else {
                    if ($emailValidator->validate($email) == Redaxscript\Validator\ValidatorInterface::FAILED) {
                        $error = l('email_incorrect');
                    } else {
                        if ($captchaValidator->validate($task, $solution) == Redaxscript\Validator\ValidatorInterface::FAILED) {
                            $error = l('captcha_incorrect');
                        } else {
                            if (Redaxscript\Db::forTablePrefix('users')->where('user', $user)->findOne()->id) {
                                $error = l('user_exists');
                            } else {
                                if (USERS_NEW == 0 && s('verification') == 1) {
                                    $r['status'] = 0;
                                    $success = l('registration_verification');
                                } else {
                                    $r['status'] = 1;
                                    $success = l('registration_sent');
                                }
                                /* send login information */
                                $loginRoute = ROOT . '/' . REWRITE_ROUTE . 'login';
                                $loginLink = anchor_element('external', '', '', $loginRoute, $loginRoute);
                                $toArray = array($name => $email);
                                if (s('notification') == 1) {
                                    $toArray[s('author')] = s('email');
                                }
                                $fromArray = array($author => $email);
                                $subject = l('registration');
                                $bodyArray = array('<strong>' . l('name') . l('colon') . '</strong> ' . $name, '<br />', '<strong>' . l('user') . l('colon') . '</strong> ' . $user, '<br />', '<strong>' . l('password') . l('colon') . '</strong> ' . $password, '<br />', '<strong>' . l('login') . l('colon') . '<strong> ' . $loginLink);
                                /* mailer object */
                                $mailer = new Redaxscript\Mailer();
                                $mailer->init($toArray, $fromArray, $subject, $bodyArray);
                                $mailer->send();
                                /* create user */
                                Redaxscript\Db::forTablePrefix('users')->create()->set($r)->save();
                            }
                        }
                    }
                }
            }
        }
    }
    /* handle error */
    if ($error) {
        if (s('blocker') == 1) {
            $_SESSION[ROOT . '/attack_blocked']++;
        }
        notification(l('error_occurred'), $error, l('back'), 'registration');
    } else {
        notification(l('operation_completed'), $success, l('login'), 'login');
    }
    $_SESSION[ROOT . '/registration'] = '';
}
Exemple #15
0
/**
 * admin modules list
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Admin
 * @author Henry Ruhs
 */
function admin_modules_list()
{
    $output = Redaxscript\Hook::trigger('adminModuleListStart');
    /* query modules */
    $result = Redaxscript\Db::forTablePrefix('modules')->orderByAsc('name')->findArray();
    $num_rows = count($result);
    /* collect listing output */
    $output .= '<h2 class="rs-admin-title-content">' . Redaxscript\Language::get('modules') . '</h2>';
    $output .= '<div class="rs-admin-wrapper-table"><table class="rs-admin-table-default rs-admin-table-module">';
    /* collect thead and tfoot */
    $output .= '<thead><tr><th class="rs-admin-col-name">' . Redaxscript\Language::get('name') . '</th><th class="rs-admin-col-alias">' . Redaxscript\Language::get('alias') . '</th><th class="rs-admin-col-version">' . Redaxscript\Language::get('version') . '</th></tr></thead>';
    $output .= '<tfoot><tr><td>' . Redaxscript\Language::get('name') . '</td><td>' . Redaxscript\Language::get('alias') . '</td><td>' . Redaxscript\Language::get('version') . '</td></tr></tfoot>';
    if (!$result || !$num_rows) {
        $error = Redaxscript\Language::get('module_no') . Redaxscript\Language::get('point');
    } else {
        if ($result) {
            $accessValidator = new Redaxscript\Validator\Access();
            $output .= '<tbody>';
            foreach ($result as $r) {
                $access = $r['access'];
                /* access granted */
                if ($accessValidator->validate($access, Redaxscript\Registry::get('myGroups')) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                    if ($r) {
                        foreach ($r as $key => $value) {
                            ${$key} = stripslashes($value);
                        }
                    }
                    $modules_installed_array[] = $alias;
                    /* build class string */
                    if ($status == 1) {
                        $class_status = null;
                    } else {
                        $class_status = 'rs-admin-is-disabled';
                    }
                    /* collect table row */
                    $output .= '<tr';
                    if ($alias) {
                        $output .= ' id="' . $alias . '"';
                    }
                    if ($class_status) {
                        $output .= ' class="' . $class_status . '"';
                    }
                    $output .= '><td>' . $name;
                    /* collect control output */
                    $output .= admin_control('modules_installed', 'modules', $id, $alias, $status, Redaxscript\Registry::get('tableInstall'), Redaxscript\Registry::get('tableEdit'), Redaxscript\Registry::get('tableUninstall'));
                    /* collect alias and version output */
                    $output .= '</td><td>' . $alias . '</td><td>' . $version . '</td></tr>';
                } else {
                    $counter++;
                }
            }
            $output .= '</tbody>';
            /* handle access */
            if ($num_rows == $counter) {
                $error = Redaxscript\Language::get('access_no') . Redaxscript\Language::get('point');
            }
        }
    }
    /* handle error */
    if ($error) {
        $output .= '<tbody><tr><td colspan="3">' . $error . '</td></tr></tbody>';
    }
    /* modules not installed */
    if (Redaxscript\Registry::get('modulesInstall') == 1) {
        /* modules directory */
        $modules_directory = new Redaxscript\Directory();
        $modules_directory->init('modules');
        $modules_directory_array = $modules_directory->getArray();
        if ($modules_directory_array && $modules_installed_array) {
            $modules_not_installed_array = array_diff($modules_directory_array, $modules_installed_array);
        } else {
            if ($modules_directory_array) {
                $modules_not_installed_array = $modules_directory_array;
            }
        }
        if ($modules_not_installed_array) {
            $output .= '<tbody><tr class="rs-admin-row-group"><td colspan="3">' . Redaxscript\Language::get('install') . '</td></tr>';
            foreach ($modules_not_installed_array as $alias) {
                /* collect table row */
                $output .= '<tr';
                if ($alias) {
                    $output .= ' id="' . $alias . '"';
                }
                $output .= '><td colspan="3">' . $alias;
                /* collect control output */
                $output .= admin_control('modules_not_installed', 'modules', $id, $alias, $status, Redaxscript\Registry::get('tableInstall'), Redaxscript\Registry::get('tableEdit'), Redaxscript\Registry::get('tableUninstall'));
                $output .= '</td></tr>';
            }
            $output .= '</tbody>';
        }
    }
    $output .= '</table></div>';
    $output .= Redaxscript\Hook::trigger('adminModuleListEnd');
    echo $output;
}
Exemple #16
0
/**
 * comments
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Comments
 * @author Henry Ruhs
 *
 * @param integer $article
 * @param string $route
 */
function comments($article, $route)
{
    $output = Redaxscript\Hook::trigger('commentStart');
    /* query comments */
    $comments = Redaxscript\Db::forTablePrefix('comments')->where(['status' => 1, 'article' => $article])->whereLanguageIs(Redaxscript\Registry::get('language'))->orderGlobal('rank');
    /* query result */
    $result = $comments->findArray();
    if ($result) {
        $num_rows = count($result);
        $sub_maximum = ceil($num_rows / Redaxscript\Db::getSetting('limit'));
        $sub_active = Redaxscript\Registry::get('lastSubParameter');
        /* sub parameter */
        if (Redaxscript\Registry::get('lastSubParameter') > $sub_maximum || !Redaxscript\Registry::get('lastSubParameter')) {
            $sub_active = 1;
        } else {
            $offset_string = ($sub_active - 1) * Redaxscript\Db::getSetting('limit') . ', ';
        }
    }
    $comments->limit($offset_string . Redaxscript\Db::getSetting('limit'));
    /* query result */
    $result = $comments->findArray();
    $num_rows_active = count($result);
    /* handle error */
    if (!$result || !$num_rows) {
        $error = Redaxscript\Language::get('comment_no');
    } else {
        if ($result) {
            $accessValidator = new Redaxscript\Validator\Access();
            foreach ($result as $r) {
                $access = $r['access'];
                /* access granted */
                if ($accessValidator->validate($access, Redaxscript\Registry::get('myGroups')) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                    if ($r) {
                        foreach ($r as $key => $value) {
                            ${$key} = stripslashes($value);
                        }
                    }
                    /* collect headline output */
                    $output .= Redaxscript\Hook::trigger('commentFragmentStart', $r) . '<h3 id="comment-' . $id . '" class="rs-title-comment">';
                    if ($url) {
                        $output .= '<a href="' . $url . '" rel="nofollow">' . $author . '</a>';
                    } else {
                        $output .= $author;
                    }
                    $output .= '</h3>';
                    /* collect box output */
                    $output .= '<div class="rs-box-comment">' . $text . '</div>';
                    $output .= byline('comments', $id, $author, $date);
                    $output .= Redaxscript\Hook::trigger('commentFragmentEnd', $r);
                    /* admin dock */
                    if (Redaxscript\Registry::get('loggedIn') == Redaxscript\Registry::get('token') && Redaxscript\Registry::get('firstParameter') != 'logout') {
                        $output .= admin_dock('comments', $id);
                    }
                } else {
                    $counter++;
                }
            }
            /* handle access */
            if ($num_rows_active == $counter) {
                $error = Redaxscript\Language::get('access_no');
            }
        }
    }
    /* handle error */
    if ($error) {
        $output = '<div class="rs-box-comment">' . $error . Redaxscript\Language::get('point') . '</div>';
    }
    $output .= Redaxscript\Hook::trigger('commentEnd');
    echo $output;
    /* call pagination as needed */
    if ($sub_maximum > 1 && Redaxscript\Db::getSetting('pagination') == 1) {
        pagination($sub_active, $sub_maximum, $route);
    }
}
/**
 * password reset post
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Password
 * @author Henry Ruhs
 */
function password_reset_post()
{
    /* clean post */
    if (ATTACK_BLOCKED < 10 && $_SESSION[ROOT . '/password_reset'] == 'visited') {
        $post_id = clean($_POST['id'], 0);
        $post_password = clean($_POST['password'], 0);
        $password = hash_generator(10);
        $task = $_POST['task'];
        $solution = $_POST['solution'];
    }
    /* query user information */
    if ($post_id && $post_password) {
        $users_result = Redaxscript\Db::forTablePrefix('users')->where(array('id' => $post_id, 'password' => $post_password, 'status' => 1))->findArray();
        foreach ($users_result as $r) {
            foreach ($r as $key => $value) {
                $key = 'my_' . $key;
                ${$key} = stripslashes($value);
            }
        }
    }
    /* validate post */
    if ($post_id == '' || $post_password == '') {
        $error = l('input_incorrect');
    } else {
        if (sha1($task) != $solution) {
            $error = l('captcha_incorrect');
        } else {
            if ($my_id == '' || $my_password == '') {
                $error = l('access_no');
            } else {
                /* send new password */
                $loginRoute = ROOT . '/' . REWRITE_ROUTE . 'login';
                $loginLink = anchor_element('external', '', '', $loginRoute, $loginRoute);
                $toArray = array($my_name => $my_email);
                $fromArray = array(s('author') => s('email'));
                $subject = l('password_new');
                $bodyArray = array('<strong>' . l('password_new') . l('colon') . '</strong> ' . $password, '<br />', '<strong>' . l('login') . l('colon') . '</strong> ' . $loginLink);
                /* mailer object */
                $mailer = new Redaxscript\Mailer();
                $mailer->init($toArray, $fromArray, $subject, $bodyArray);
                $mailer->send();
                /* update password */
                Redaxscript\Db::forTablePrefix('users')->where(array('id' => $post_id, 'password' => $post_password, 'status' => 1))->findOne()->set('password', sha1($password) . Redaxscript\Registry::get('salt'))->save();
            }
        }
    }
    /* handle error */
    if ($error) {
        if (s('blocker') == 1) {
            $_SESSION[ROOT . '/attack_blocked']++;
        }
        if ($post_id && $post_password) {
            $back_route = 'password_reset/' . $post_id . '/' . $post_password;
        } else {
            $back_route = 'reminder';
        }
        notification(l('error_occurred'), $error, l('back'), $back_route);
    } else {
        notification(l('operation_completed'), l('password_sent'), l('login'), 'login');
    }
    $_SESSION[ROOT . '/password_reset'] = '';
}
Exemple #18
0
/**
 * contact render start
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Modules
 * @author Henry Ruhs
 */
function contact_render_start()
{
    if ($_POST['contact_post']) {
        Redaxscript\Registry::set('centerBreak', true);
    }
}
Exemple #19
0
/**
 * templates list
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Navigation
 * @author Henry Ruhs
 *
 * @param array $options
 */
function templates_list($options)
{
    /* define option variables */
    if (is_array($options)) {
        foreach ($options as $key => $value) {
            $key = 'option_' . $key;
            ${$key} = $value;
        }
    }
    /* templates directory */
    $templates_directory = new Redaxscript\Directory();
    $templates_directory->init('templates', ['admin', 'console', 'install']);
    $templates_directory_array = $templates_directory->getArray();
    /* collect templates output */
    foreach ($templates_directory_array as $value) {
        $class_string = null;
        if ($value == Redaxscript\Registry::get('template')) {
            $class_string = ' class="rs-item-active"';
        }
        $output .= '<li' . $class_string . '><a href="' . Redaxscript\Registry::get('parameterRoute') . Redaxscript\Registry::get('fullRoute') . Redaxscript\Registry::get('templateRoute') . $value . '" rel="nofollow">' . $value . '</a>';
    }
    /* build id string */
    if ($option_id) {
        $id_string = ' id="' . $option_id . '"';
    }
    /* build class string */
    if ($option_class) {
        $class_string = ' class="' . $option_class . '"';
    } else {
        $class_string = ' class="rs-list-templates"';
    }
    /* collect list output */
    if ($output) {
        $output = '<ul' . $id_string . $class_string . '>' . $output . '</ul>';
    }
    echo $output;
}
Exemple #20
0
include_once 'includes/startup.php';
/* install post */
install_post();
/* write database config */
write_config();
/* bootstrap */
include_once 'includes/Bootstrap.php';
startup();
/* migrate deprecated constants */
$registry = Redaxscript\Registry::getInstance();
$registry->init(migrate_constants());
/* define meta */
define('TITLE', l('installation'));
define('ROBOTS', 'none');
/* registry object */
$registry = Redaxscript\Registry::getInstance();
$registry->set('title', l('installation'));
/* call loader else render template */
if (FIRST_PARAMETER == 'loader' && (SECOND_PARAMETER == 'styles' || SECOND_PARAMETER == 'scripts')) {
    echo loader(SECOND_PARAMETER, 'outline');
} else {
    include_once 'templates/install/install.phtml';
}
/**
 * install
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Install
Exemple #21
0
        if (file_exists('modules/' . $value . '/index.php')) {
            include_once 'modules/' . $value . '/index.php';
        }
    }
}
/* call loader else render template */
if (FIRST_PARAMETER == 'loader' && (SECOND_PARAMETER == 'styles' || SECOND_PARAMETER == 'scripts')) {
    echo loader(SECOND_PARAMETER, 'outline');
} else {
    Redaxscript\Hook::trigger('render_start');
    /* transport registry to constants */
    if (Redaxscript\Registry::get('renderBreak')) {
        define(RENDER_BREAK, Redaxscript\Registry::get('renderBreak'));
    }
    if (Redaxscript\Registry::get('centerBreak')) {
        define(CENTER_BREAK, Redaxscript\Registry::get('centerBreak'));
    }
    /* undefine */
    undefine(array('RENDER_BREAK', 'CENTER_BREAK', 'REFRESH_ROUTE', 'DESCRIPTION', 'KEYWORDS', 'ROBOTS', 'TITLE'));
    /* render break */
    if (RENDER_BREAK == 1) {
        return;
    } else {
        /* handle error */
        if (CONTENT_ERROR && CENTER_BREAK == '') {
            header('http/1.0 404 not found');
        }
        include_once 'templates/' . TEMPLATE . '/index.phtml';
    }
    Redaxscript\Hook::trigger('render_end');
}
Exemple #22
0
/**
 * extras
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Contents
 * @author Henry Ruhs
 *
 * @param mixed $filter
 */
function extras($filter = '')
{
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    }
    /* query extras */
    $query = 'SELECT id, title, text, category, article, headline, access FROM ' . PREFIX . 'extras WHERE (language = \'' . LANGUAGE . '\' || language = \'\')';
    if (is_numeric($filter)) {
        $query .= ' && rank = ' . $filter;
    } else {
        if ($filter) {
            $query .= ' && alias = \'' . $filter . '\'';
        } else {
            $query .= ' && status = 1';
        }
    }
    $query .= ' ORDER BY rank';
    $result = mysql_query($query);
    /* collect output */
    if ($result) {
        $accessValidator = new Redaxscript\Validator\Access();
        while ($r = mysql_fetch_assoc($result)) {
            $access = $r['access'];
            $check_access = $accessValidator->validate($access, MY_GROUPS);
            /* if access granted */
            if ($check_access == 1) {
                if ($r) {
                    foreach ($r as $key => $value) {
                        ${$key} = stripslashes($value);
                    }
                }
                /* show if cagegory or article matched */
                if ($category == CATEGORY || $article == ARTICLE || $category == 0 && $article == 0) {
                    /* parser object */
                    $parser = new Redaxscript\Parser(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance(), $text, $route, array('className' => array('break' => 'link_read_more', 'code' => 'box_code')));
                    /* collect headline output */
                    $output .= Redaxscript\Hook::trigger('extra_start', $id);
                    if ($headline == 1) {
                        $output .= '<h3 class="title_extra">' . $title . '</h3>';
                    }
                    /* collect box output */
                    $output .= '<div class="box_extra">' . $parser->getOutput() . '</div>' . Redaxscript\Hook::trigger('extra_end', $id);
                    /* prepend admin dock */
                    if (LOGGED_IN == TOKEN && FIRST_PARAMETER != 'logout') {
                        $output .= admin_dock('extras', $id);
                    }
                }
            }
        }
    }
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    }
    echo $output;
}
/**
 * admin process
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Admin
 * @author Henry Ruhs
 */
function admin_process()
{
    $aliasValidator = new Redaxscript\Validator\Alias();
    $loginValidator = new Redaxscript\Validator\Login();
    $specialFilter = new Redaxscript\Filter\Special();
    /* clean post */
    switch (TABLE_PARAMETER) {
        /* categories */
        case 'categories':
            $parent = $r['parent'] = clean($_POST['parent'], 0);
            /* articles */
        /* articles */
        case 'articles':
            $r['keywords'] = clean($_POST['keywords'], 5);
            $r['template'] = clean($_POST['template'], 0);
            /* extras */
        /* extras */
        case 'extras':
            $title = $r['title'] = clean($_POST['title'], 5);
            if (TABLE_PARAMETER != 'categories') {
                $r['headline'] = clean($_POST['headline'], 0);
            }
            $r['sibling'] = clean($_POST['sibling'], 0);
            /* comments */
        /* comments */
        case 'comments':
            if (TABLE_PARAMETER == 'comments') {
                $r['url'] = clean($_POST['url'], 4);
            }
            $author = $r['author'] = clean($_POST['author'], 0);
            if (TABLE_PARAMETER != 'categories') {
                $text = $r['text'] = clean($_POST['text'], 1);
                $date = $_POST['year'] . '-' . $_POST['month'] . '-' . $_POST['day'] . ' ' . $_POST['hour'] . ':' . $_POST['minute'] . ':00';
                $date = $r['date'] = clean($date, 5);
            }
            $rank = $r['rank'] = clean($_POST['rank'], 0);
            /* groups */
        /* groups */
        case 'groups':
            if (TABLE_PARAMETER != 'comments') {
                $alias = $r['alias'] = clean($_POST['alias'], 2);
            }
            /* users */
        /* users */
        case 'users':
            if (TABLE_PARAMETER != 'groups') {
                $language = $r['language'] = clean($_POST['language'], 0);
            }
            /* modules */
        /* modules */
        case 'modules':
            $alias = clean($_POST['alias'], 2);
            $status = $r['status'] = clean($_POST['status'], 0);
            if (TABLE_PARAMETER != 'groups' && TABLE_PARAMETER != 'users' && GROUPS_EDIT == 1) {
                $access = array_map(array($specialFilter, 'sanitize'), $_POST['access']);
                $access = array_map('clean', $access);
                $access_string = implode(', ', $access);
                if ($access_string == '') {
                    $access_string = null;
                }
                $access = $r['access'] = $access_string;
            }
            if (TABLE_PARAMETER != 'extras' && TABLE_PARAMETER != 'comments') {
                $r['description'] = clean($_POST['description'], 5);
            }
            $token = $_POST['token'];
            break;
    }
    /* clean contents post */
    if (TABLE_PARAMETER == 'articles') {
        $r['infoline'] = clean($_POST['infoline'], 0);
        $comments = $r['comments'] = clean($_POST['comments'], 0);
        if ($category && ID_PARAMETER == '') {
            $status = $r['status'] = Redaxscript\Db::forTablePrefix('categories')->where('id', $category)->findOne()->status;
        }
    }
    if (TABLE_PARAMETER == 'articles' || TABLE_PARAMETER == 'extras') {
        $category = $r['category'] = clean($_POST['category'], 0);
    }
    if (TABLE_PARAMETER == 'articles' || TABLE_PARAMETER == 'extras' || TABLE_PARAMETER == 'comments') {
        if ($date > NOW) {
            $status = $r['status'] = 2;
        } else {
            $date = $r['date'] = NOW;
        }
    }
    if (TABLE_PARAMETER == 'extras' || TABLE_PARAMETER == 'comments') {
        $article = $r['article'] = clean($_POST['article'], 0);
    }
    if (TABLE_PARAMETER == 'comments' && ID_PARAMETER == '') {
        $status = $r['status'] = Redaxscript\Db::forTablePrefix('articles')->where('id', $article)->findOne()->status;
    }
    if (TABLE_PARAMETER == 'comments' || TABLE_PARAMETER == 'users') {
        $email = $r['email'] = clean($_POST['email'], 3);
    }
    /* clean groups post */
    if (TABLE_PARAMETER == 'groups' && (ID_PARAMETER == '' || ID_PARAMETER > 1)) {
        $groups_array = array('categories', 'articles', 'extras', 'comments', 'groups', 'users', 'modules');
        foreach ($groups_array as $value) {
            ${$value} = array_map(array($specialFilter, 'sanitize'), $_POST[$value]);
            ${$value} = array_map('clean', ${$value});
            $groups_string = implode(', ', ${$value});
            if ($groups_string == '') {
                $groups_string = 0;
            }
            $r[$value] = $groups_string;
        }
        $r['settings'] = clean($_POST['settings'], 0);
        $r['filter'] = clean($_POST['filter'], 0);
    }
    if ((TABLE_PARAMETER == 'groups' || TABLE_PARAMETER == 'users') && ID_PARAMETER == 1) {
        $status = $r['status'] = 1;
    }
    if (TABLE_PARAMETER == 'groups' || TABLE_PARAMETER == 'users' || TABLE_PARAMETER == 'modules') {
        $name = $r['name'] = clean($_POST['name'], 0);
    }
    /* clean users post */
    if (TABLE_PARAMETER == 'users') {
        if ($_POST['user']) {
            $user = $r['user'] = clean($_POST['user'], 0);
        } else {
            $user = $r['user'] = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->where('id', ID_PARAMETER)->findOne()->user;
        }
        $password_check = $password_confirm = 1;
        if ($_POST['edit'] && $_POST['password'] == '' && $_POST['password_confirm'] == '' || $_POST['delete']) {
            $password_check = 0;
        }
        if ($_POST['password'] != $_POST['password_confirm']) {
            $password_confirm = 0;
        }
        $password = clean($_POST['password'], 0);
        if ($password_check == 1 && $password_confirm == 1) {
            $passwordHash = new Redaxscript\Hash(Redaxscript\Config::getInstance());
            $passwordHash->init($password);
            $r['password'] = $passwordHash->getHash();
        }
        if ($_POST['new']) {
            $r['first'] = $r['last'] = NOW;
        }
        if (ID_PARAMETER == '' || ID_PARAMETER > 1) {
            $groups = array_map(array($specialFilter, 'sanitize'), $_POST['groups']);
            $groups = array_map('clean', $groups);
            $groups_string = implode(', ', $groups);
            if ($groups_string == '') {
                $groups_string = 0;
            }
            $groups = $r['groups'] = $groups_string;
        }
    }
    $r_keys = array_keys($r);
    $last = end($r_keys);
    /* validate post */
    switch (TABLE_PARAMETER) {
        /* contents */
        case 'categories':
        case 'articles':
        case 'extras':
            if ($title == '') {
                $error = l('title_empty');
            } else {
                $title_id = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->where('id', ID_PARAMETER)->findOne()->title;
                $id_title = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->where('title', $title)->findOne()->id;
            }
            if ($id_title && strcasecmp($title_id, $title) < 0) {
                $error = l('title_exists');
            }
            if (TABLE_PARAMETER == 'categories') {
                $opponent_id = Redaxscript\Db::forTablePrefix('articles')->where('alias', $alias)->findOne()->id;
            }
            if (TABLE_PARAMETER == 'articles') {
                $opponent_id = Redaxscript\Db::forTablePrefix('categories')->where('alias', $alias)->findOne()->id;
            }
            if ($opponent_id) {
                $error = l('alias_exists');
            }
            if (TABLE_PARAMETER != 'groups' && $aliasValidator->validate($alias, Redaxscript\Validator\Alias::MODE_GENERAL) == Redaxscript\Validator\ValidatorInterface::PASSED || $aliasValidator->validate($alias, Redaxscript\Validator\Alias::MODE_DEFAULT) == Redaxscript\Validator\ValidatorInterface::PASSED) {
                $error = l('alias_incorrect');
            }
            /* groups */
        /* groups */
        case 'groups':
            if ($alias == '') {
                $error = l('alias_empty');
            } else {
                $alias_id = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->where('id', ID_PARAMETER)->findOne()->alias;
                $id_alias = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->where('alias', $alias)->findOne()->id;
            }
            if ($id_alias && strcasecmp($alias_id, $alias) < 0) {
                $error = l('alias_exists');
            }
    }
    /* validate general post */
    switch (TABLE_PARAMETER) {
        case 'articles':
        case 'extras':
        case 'comments':
            if ($text == '') {
                $error = l('text_empty');
            }
            break;
        case 'groups':
        case 'users':
        case 'modules':
            if ($name == '') {
                $error = l('name_empty');
            }
            break;
    }
    /* validate users post */
    if (TABLE_PARAMETER == 'users') {
        if ($user == '') {
            $error = l('user_incorrect');
        } else {
            $user_id = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->where('id', ID_PARAMETER)->findOne()->user;
            $id_user = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->where('user', $user)->findOne()->id;
        }
        if ($id_user && strcasecmp($user_id, $user) < 0) {
            $error = l('user_exists');
        }
        if ($loginValidator->validate($user) == Redaxscript\Validator\ValidatorInterface::FAILED) {
            $error = l('user_incorrect');
        }
        if ($password_check == 1) {
            if ($password == '') {
                $error = l('password_empty');
            }
            if ($password_confirm == 0 || $loginValidator->validate($password) == Redaxscript\Validator\ValidatorInterface::FAILED) {
                $error = l('password_incorrect');
            }
        }
    }
    /* validate last post */
    $emailValidator = new Redaxscript\Validator\Email();
    switch (TABLE_PARAMETER) {
        case 'comments':
            if ($author == '') {
                $error = l('author_empty');
            }
        case 'users':
            if ($emailValidator->validate($email) == Redaxscript\Validator\ValidatorInterface::FAILED) {
                $error = l('email_incorrect');
            }
    }
    $route = 'admin';
    /* handle error */
    if ($error) {
        if (ID_PARAMETER == '') {
            $route .= '/new/' . TABLE_PARAMETER;
        } else {
            $route .= '/edit/' . TABLE_PARAMETER . '/' . ID_PARAMETER;
        }
        notification(l('error_occurred'), $error, l('back'), $route);
        return;
    } else {
        if (TABLE_EDIT == 1 || TABLE_DELETE == 1) {
            $route .= '/view/' . TABLE_PARAMETER;
            if ($alias) {
                $route .= '#' . $alias;
            } else {
                if ($user) {
                    $route .= '#' . $user;
                }
            }
        }
    }
    /* process */
    switch (true) {
        /* query new */
        case $_POST['new']:
            Redaxscript\Db::forTablePrefix(Redaxscript\Registry::get('tableParameter'))->create()->set($r)->save();
            notification(l('operation_completed'), '', l('continue'), $route);
            return;
            /* query edit */
        /* query edit */
        case $_POST['edit']:
            Redaxscript\Db::forTablePrefix(Redaxscript\Registry::get('tableParameter'))->whereIdIs(Redaxscript\Registry::get('idParameter'))->findOne()->set($r)->save();
            /* query categories */
            if (TABLE_PARAMETER == 'categories') {
                $categoryChildren = Redaxscript\Db::forTablePrefix(TABLE_PARAMETER)->where('parent', ID_PARAMETER);
                $categoryArray = array_merge($categoryChildren->findArrayFlat(), array(ID_PARAMETER));
                $articleChildren = Redaxscript\Db::forTablePrefix('articles')->whereIn('category', $categoryArray);
                $articleArray = $articleChildren->findArrayFlat();
                if (count($articleArray) > 0) {
                    Redaxscript\Db::forTablePrefix('comments')->whereIn('article', $articleArray)->findMany()->set(array('status' => $status, 'access' => $access))->save();
                }
                $categoryChildren->findMany()->set(array('status' => $status, 'access' => $access))->save();
                $articleChildren->findMany()->set(array('status' => $status, 'access' => $access))->save();
            }
            /* query articles */
            if (TABLE_PARAMETER == 'articles') {
                if ($comments == 0) {
                    $status = 0;
                }
                Redaxscript\Db::forTablePrefix('comments')->where('article', ID_PARAMETER)->findMany()->set(array('status' => $status, 'access' => $access))->save();
            }
            if (USERS_EXCEPTION == 1) {
                $_SESSION[ROOT . '/my_name'] = $name;
                $_SESSION[ROOT . '/my_email'] = $email;
                if (file_exists('languages/' . $language . '.php')) {
                    $_SESSION[ROOT . '/language'] = $language;
                    $_SESSION[ROOT . '/language_selected'] = 1;
                }
            }
            notification(l('operation_completed'), '', l('continue'), $route);
            return;
    }
}
Exemple #24
0
/**
 * helper subset
 *
 * @since 2.1.0
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Migrate
 * @author Kim Kha Nguyen
 */
function helper_subset()
{
    $helper = new Redaxscript\Helper(Redaxscript\Registry::getInstance());
    echo $helper->getSubset();
}
/**
 * extras
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Contents
 * @author Henry Ruhs
 *
 * @param mixed $filter
 */
function extras($filter = '')
{
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    }
    /* query extras */
    $extras = Redaxscript\Db::forTablePrefix('extras')->whereIn('language', array(Redaxscript\Registry::get('language'), ''));
    /* has filter */
    if ($filter) {
        $id = Redaxscript\Db::forTablePrefix('extras')->where('alias', $filter)->findOne()->id;
        /* handle sibling */
        $sibling = Redaxscript\Db::forTablePrefix('extras')->where('id', $id)->findOne()->sibling;
        /* query sibling collection */
        $sibling_array = Redaxscript\Db::forTablePrefix('extras')->whereIn('sibling', array($id, $sibling > 0 ? $sibling : null))->where('language', Redaxscript\Registry::get('language'))->select('id')->findArrayFlat();
        /* process sibling array */
        foreach ($sibling_array as $value) {
            $id_array[] = $value;
        }
        $id_array[] = $sibling;
        $id_array[] = $id;
    } else {
        $id_array = $extras->where('status', 1)->orderByAsc('rank')->select('id')->findArrayFlat();
    }
    /* query result */
    $result = $extras->whereIn('id', $id_array)->findArray();
    /* collect output */
    if ($result) {
        $accessValidator = new Redaxscript\Validator\Access();
        foreach ($result as $r) {
            $access = $r['access'];
            /* access granted */
            if ($accessValidator->validate($access, MY_GROUPS) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                if ($r) {
                    foreach ($r as $key => $value) {
                        ${$key} = stripslashes($value);
                    }
                }
                /* show if cagegory or article matched */
                if ($category == CATEGORY || $article == ARTICLE || $category == 0 && $article == 0) {
                    /* parser object */
                    $parser = new Redaxscript\Parser(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
                    $parser->init($text, array('className' => array('readmore' => 'link_read_more', 'codequote' => 'js_code_quote box_code'), 'route' => $route));
                    /* collect headline output */
                    $output .= Redaxscript\Hook::trigger('extra_start', $r);
                    if ($headline == 1) {
                        $output .= '<h3 class="title_extra" id="extra-' . $alias . '">' . $title . '</h3>';
                    }
                    /* collect box output */
                    $output .= '<div class="box_extra">' . $parser->getOutput() . '</div>' . Redaxscript\Hook::trigger('extra_end', $r);
                    /* prepend admin dock */
                    if (LOGGED_IN == TOKEN && FIRST_PARAMETER != 'logout') {
                        $output .= admin_dock('extras', $id);
                    }
                }
            }
        }
    }
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    }
    echo $output;
}
/**
 * admin last update
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Admin
 * @author Henry Ruhs
 */
function admin_last_update()
{
    if (Redaxscript\Registry::get('myId')) {
        Redaxscript\Db::forTablePrefix('users')->where('id', Redaxscript\Registry::get('myId'))->findOne()->set('last', Redaxscript\Registry::get('now'))->save();
    }
}
/**
 * templates list
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Navigation
 * @author Henry Ruhs
 *
 * @param array $options
 */
function templates_list($options = '')
{
    $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    /* define option variables */
    if (is_array($options)) {
        foreach ($options as $key => $value) {
            $key = 'option_' . $key;
            ${$key} = $value;
        }
    }
    /* templates directory object */
    $templates_directory = new Redaxscript\Directory();
    $templates_directory->init('templates', array('admin', 'install'));
    $templates_directory_array = $templates_directory->getArray();
    /* collect templates output */
    foreach ($templates_directory_array as $value) {
        $class_string = ' class="template_' . $value;
        if ($value == Redaxscript\Registry::get('template')) {
            $class_string .= ' item_active';
        }
        $class_string .= '"';
        $output .= '<li' . $class_string . '>' . anchor_element('internal', '', '', $value, FULL_ROUTE . TEMPLATE_ROUTE . $value, '', 'rel="nofollow"') . '</li>';
    }
    /* build id string */
    if ($option_id) {
        $id_string = ' id="' . $option_id . '"';
    }
    /* build class string */
    if ($option_class) {
        $class_string = ' class="' . $option_class . '"';
    } else {
        $class_string = ' class="list_templates"';
    }
    /* collect list output */
    if ($output) {
        $output = '<ul' . $id_string . $class_string . '>' . $output . '</ul>';
    }
    $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    echo $output;
}
Exemple #28
0
/**
 * extras
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Contents
 * @author Henry Ruhs
 *
 * @param mixed $filter
 */
function extras($filter = '')
{
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_start');
    }
    /* query extras */
    $extras = Redaxscript\Db::forTablePrefix('extras')->whereIn('language', array(Redaxscript\Registry::get('language'), ''));
    /* setup filter */
    if (is_numeric($filter)) {
        $extras->where('rank', $filter);
    } else {
        if ($filter) {
            $extras->where('alias', $filter);
        } else {
            $extras->where('status', 1);
        }
    }
    $extras->orderByAsc('rank');
    /* query result */
    $result = $extras->findArray();
    /* collect output */
    if ($result) {
        $accessValidator = new Redaxscript\Validator\Access();
        foreach ($result as $r) {
            $access = $r['access'];
            /* if access granted */
            if ($accessValidator->validate($access, MY_GROUPS) === Redaxscript\Validator\ValidatorInterface::PASSED) {
                if ($r) {
                    foreach ($r as $key => $value) {
                        ${$key} = stripslashes($value);
                    }
                }
                /* show if cagegory or article matched */
                if ($category == CATEGORY || $article == ARTICLE || $category == 0 && $article == 0) {
                    /* parser object */
                    $parser = new Redaxscript\Parser(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance());
                    $parser->init($text, $route, array('className' => array('break' => 'link_read_more', 'code' => 'box_code')));
                    /* collect headline output */
                    $output .= Redaxscript\Hook::trigger('extra_start', $r);
                    if ($headline == 1) {
                        $output .= '<h3 class="title_extra">' . $title . '</h3>';
                    }
                    /* collect box output */
                    $output .= '<div class="box_extra">' . $parser->getOutput() . '</div>' . Redaxscript\Hook::trigger('extra_end', $r);
                    /* prepend admin dock */
                    if (LOGGED_IN == TOKEN && FIRST_PARAMETER != 'logout') {
                        $output .= admin_dock('extras', $id);
                    }
                }
            }
        }
    }
    if ($filter == '') {
        $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end');
    }
    echo $output;
}
/**
 * check install
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Install
 * @author Henry Ruhs
 *
 * @return integer
 */
function check_install()
{
    global $name, $user, $password, $email;
    $registry = Redaxscript\Registry::getInstance();
    $loginValidator = new Redaxscript\Validator\Login();
    $emailValidator = new Redaxscript\Validator\Email();
    if ($_POST['install_post'] && $registry->get('dbStatus') && $name && $loginValidator->validate($user) == Redaxscript\Validator\ValidatorInterface::PASSED && $loginValidator->validate($password) == Redaxscript\Validator\ValidatorInterface::PASSED && $emailValidator->validate($email) == Redaxscript\Validator\ValidatorInterface::PASSED) {
        $output = 1;
    } else {
        $output = 0;
    }
    return $output;
}
/**
 * future update
 *
 * @since 1.2.1
 * @deprecated 2.0.0
 *
 * @package Redaxscript
 * @category Query
 * @author Henry Ruhs
 *
 * @param string $table
 */
function future_update($table = '')
{
    Redaxscript\Db::forTablePrefix($table)->where('status', 2)->whereLt('date', Redaxscript\Registry::get('now'))->findMany()->set('status', 1)->save();
}