/** * reminder form * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Reminder * @author Henry Ruhs */ function reminder_form() { $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start'); /* disable fields if attack blocked */ if (ATTACK_BLOCKED > 9) { $code_disabled = ' disabled="disabled"'; } /* captcha object */ $captcha = new Redaxscript\Captcha(Redaxscript\Language::getInstance()); $captcha->init(); /* collect output */ $output .= '<h2 class="title_content">' . l('reminder') . '</h2>'; $output .= form_element('form', 'form_reminder', 'js_validate_form form_default form_reminder', '', '', '', 'action="' . REWRITE_ROUTE . 'reminder" method="post"'); $output .= form_element('fieldset', '', 'set_reminder', '', '', l('reminder_request') . l('point')) . '<ul>'; $output .= '<li>' . form_element('email', 'email', 'field_text field_note', 'email', '', l('email'), 'maxlength="50" required="required" autofocus="autofocus"' . $code_disabled) . '</li>'; /* collect captcha task output */ $output .= '<li>' . form_element('number', 'task', 'field_text field_note', 'task', '', $captcha->getTask(), 'min="1" max="20" required="required"' . $code_disabled) . '</li>'; $output .= '</ul></fieldset>'; /* collect captcha solution output */ $captchaHash = new Redaxscript\Hash(Redaxscript\Config::getInstance()); $captchaHash->init($captcha->getSolution()); $output .= form_element('hidden', '', '', 'solution', $captchaHash->getHash()); /* collect hidden and button output */ $output .= form_element('hidden', '', '', 'token', TOKEN); $output .= form_element('button', '', 'js_submit button_default', 'reminder_post', l('submit'), '', $code_disabled); $output .= '</form>'; $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end'); $_SESSION[ROOT . '/reminder'] = 'visited'; echo $output; }
/** * login form * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Login * @author Henry Ruhs */ function login_form() { $output = Redaxscript\Hook::trigger(__FUNCTION__ . '_start'); /* disable fields if attack blocked */ if (ATTACK_BLOCKED > 9) { $code_disabled = ' disabled="disabled"'; } /* captcha object */ if (s('captcha') > 0) { $captcha = new Redaxscript\Captcha(Redaxscript\Language::getInstance()); $captcha->init(); } /* reminder question */ if (s('reminder') == 1) { $legend = anchor_element('internal', '', 'link_legend', l('reminder_question') . l('question_mark'), 'reminder', '', 'rel="nofollow"'); } else { $legend = l('fields_limited') . l('point'); } /* collect output */ $output .= '<h2 class="title_content">' . l('login') . '</h2>'; $output .= form_element('form', 'form_login', 'js_validate_form form_default form_login', '', '', '', 'action="' . REWRITE_ROUTE . 'login" method="post"'); $output .= form_element('fieldset', '', 'set_login', '', '', $legend) . '<ul>'; $output .= '<li>' . form_element('text', 'user', 'field_text field_note', 'user', '', l('user'), 'maxlength="50" required="required" autofocus="autofocus"' . $code_disabled) . '</li>'; $output .= '<li>' . form_element('password', 'password', 'js_unmask_password field_text field_note', 'password', '', l('password'), 'maxlength="50" required="required" autocomplete="off"' . $code_disabled) . '</li>'; /* collect captcha task output */ if (LOGGED_IN != TOKEN && s('captcha') > 0) { $output .= '<li>' . form_element('number', 'task', 'field_text field_note', 'task', '', $captcha->getTask(), 'min="1" max="20" required="required"' . $code_disabled) . '</li>'; } $output .= '</ul></fieldset>'; /* collect captcha solution output */ if (s('captcha') > 0) { $captchaHash = new Redaxscript\Hash(Redaxscript\Config::getInstance()); $captchaHash->init($captcha->getSolution()); if (LOGGED_IN == TOKEN) { $output .= form_element('hidden', '', '', 'task', $captchaHash->getRaw()); } $output .= form_element('hidden', '', '', 'solution', $captchaHash->getHash()); } /* collect hidden and button output */ $output .= form_element('hidden', '', '', 'token', TOKEN); $output .= form_element('button', '', 'js_submit button_default', 'login_post', l('submit'), '', $code_disabled); $output .= '</form>'; $output .= Redaxscript\Hook::trigger(__FUNCTION__ . '_end'); $_SESSION[ROOT . '/login'] = '******'; echo $output; }
/** * contact form * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Modules * @author Henry Ruhs */ function contact_form() { /* disable fields if attack blocked */ if (ATTACK_BLOCKED > 9) { $code_readonly = $code_disabled = ' disabled="disabled"'; } else { if (LOGGED_IN == TOKEN) { $author = MY_USER; $email = MY_EMAIL; $code_readonly = ' readonly="readonly"'; } } /* captcha object */ if (s('captcha') > 0) { $captcha = new Redaxscript\Captcha(Redaxscript\Language::getInstance()); $captcha->init(); } /* collect output */ $output = form_element('form', 'form_contact', 'js_validate_form form_default form_contact', '', '', '', 'method="post"'); $output .= form_element('fieldset', '', 'set_contact', '', '', l('fields_required') . l('point')) . '<ul>'; $output .= '<li>' . form_element('text', 'author', 'field_text field_note', 'author', $author, '* ' . l('author'), 'maxlength="50" required="required"' . $code_readonly) . '</li>'; $output .= '<li>' . form_element('email', 'email', 'field_text field_note', 'email', $email, '* ' . l('email'), 'maxlength="50" required="required"' . $code_readonly) . '</li>'; $output .= '<li>' . form_element('url', 'url', 'field_text', 'url', '', l('url'), 'maxlength="50"' . $code_disabled) . '</li>'; $output .= '<li>' . form_element('textarea', 'text', 'js_auto_resize js_editor_textarea field_textarea field_note', 'text', '', '* ' . l('message'), 'rows="5" cols="100" required="required"' . $code_disabled) . '</li>'; /* collect captcha task output */ if (LOGGED_IN != TOKEN && s('captcha') > 0) { $output .= '<li>' . form_element('number', 'task', 'field_text field_note', 'task', '', $captcha->getTask(), 'min="1" max="20" required="required"' . $code_disabled) . '</li>'; } $output .= '</ul></fieldset>'; /* collect captcha solution output */ if (s('captcha') > 0) { if (LOGGED_IN == TOKEN) { $output .= form_element('hidden', '', '', 'task', $captcha->getSolution('raw')); } $output .= form_element('hidden', '', '', 'solution', $captcha->getSolution()); } /* collect hidden and button output */ $output .= form_element('hidden', '', '', 'token', TOKEN); $output .= form_element('button', '', 'js_submit button_default', 'contact_post', l('submit'), '', $code_disabled); $output .= '</form>'; $_SESSION[ROOT . '/contact'] = 'visited'; echo $output; }
/** * 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; }
} case USERS_NEW == 1: case USERS_EDIT == 1: case USERS_DELETE == 1: case USERS_EXCEPTION == 1: if (TABLE_PARAMETER == 'users') { include_once 'includes/admin_users.php'; } break; } } /* module files as needed */ $modules_include = Redaxscript\Hook::get(); if ($modules_include) { /* language object */ $language = Redaxscript\Language::getInstance(); /* process modules */ foreach ($modules_include as $value) { /* language */ $language->load(array('modules/' . $value . '/languages/en.json', 'modules/' . $value . '/languages/' . LANGUAGE . '.json')); /* config */ if (file_exists('modules/' . $value . '/config.php')) { include_once 'modules/' . $value . '/config.php'; } /* index */ if (file_exists('modules/' . $value . '/index.php')) { include_once 'modules/' . $value . '/index.php'; } } } /* call loader else render template */
/** * language shortcut * * @since 2.2.0 * @deprecated 2.0.0 * * @package Redaxscript * @category Migrate * @author Henry Ruhs * * @param string $key * @param string $index * * @return string */ function l($key = null, $index = null) { $language = Redaxscript\Language::getInstance(); $output = $language->get($key, $index); return $output; }
/** * 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; }
/** * admin delete * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Admin * @author Henry Ruhs */ function admin_delete() { $tableParameter = Redaxscript\Registry::get('tableParameter'); $idParameter = Redaxscript\Registry::get('idParameter'); if ($tableParameter == 'categories' || $tableParameter == 'articles' || $tableParameter == 'extras' || $tableParameter == 'comments' || $tableParameter == 'groups' || $tableParameter == 'users') { Redaxscript\Db::forTablePrefix($tableParameter)->where('id', $idParameter)->findMany()->delete(); } /* query categories */ if ($tableParameter == 'categories') { $categoryChildren = Redaxscript\Db::forTablePrefix($tableParameter)->where('parent', $idParameter); $categoryArray = array_merge($categoryChildren->findFlatArray(), [$idParameter]); $articleChildren = Redaxscript\Db::forTablePrefix('articles')->whereIn('category', $categoryArray); $articleArray = $articleChildren->findFlatArray(); if (count($articleArray) > 0) { Redaxscript\Db::forTablePrefix('comments')->whereIn('article', $articleArray)->findMany()->delete(); } $categoryChildren->findMany()->delete(); $articleChildren->findMany()->delete(); /* reset extras */ Redaxscript\Db::forTablePrefix('extras')->whereIn('category', $categoryArray)->findMany()->set('category', 0)->save(); } /* query articles */ if ($tableParameter == 'articles') { Redaxscript\Db::forTablePrefix('comments')->where('article', $idParameter)->findMany()->delete(); /* reset extras */ Redaxscript\Db::forTablePrefix('extras')->where('article', $idParameter)->findMany()->set('article', 0)->save(); /* reset homepage */ if ($idParameter == Redaxscript\Db::getSetting('homepage')) { Redaxscript\Db::forTablePrefix('settings')->where('name', 'homepage')->findOne()->set('value', 0)->save(); } } /* handle exception */ if ($tableParameter == 'users' && $idParameter == Redaxscript\Registry::get('myId')) { $logoutController = new Redaxscript\Controller\Logout(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance(), Redaxscript\Request::getInstance()); echo $logoutController->process(); } else { $route = 'admin'; if (Redaxscript\Registry::get('tableEdit') == 1 || Redaxscript\Registry::get('tableEdit') == 1) { $route .= '/view/' . $tableParameter; } /* show success */ $messenger = new Redaxscript\Admin\Messenger(Redaxscript\Registry::getInstance()); echo $messenger->setRoute(Redaxscript\Language::get('continue'), $route)->doRedirect()->success(Redaxscript\Language::get('operation_completed')); } }
/** * 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 router * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Admin * @author Henry Ruhs */ function admin_router() { $firstParameter = Redaxscript\Registry::get('firstParameter'); $adminParameter = Redaxscript\Registry::get('adminParameter'); $tableParameter = Redaxscript\Registry::get('tableParameter'); $idParameter = Redaxscript\Registry::get('idParameter'); $aliasParameter = Redaxscript\Registry::get('aliasParameter'); $tokenParameter = Redaxscript\Registry::get('tokenParameter'); $usersException = $tableParameter == 'users' && $idParameter == Redaxscript\Registry::get('myId'); $messenger = new Redaxscript\Admin\Messenger(Redaxscript\Registry::getInstance()); Redaxscript\Hook::trigger('adminRouterStart'); if (Redaxscript\Registry::get('adminRouterBreak') == 1) { return; } /* last seen update */ if ($firstParameter == 'admin' && !$adminParameter || $adminParameter == 'view' && $tableParameter == 'users' || Redaxscript\Registry::get('cronUpdate')) { admin_last_update(); } /* validate routing */ switch (true) { case $adminParameter && !in_array($adminParameter, ['new', 'view', 'edit', 'up', 'down', 'sort', 'publish', 'unpublish', 'enable', 'disable', 'install', 'uninstall', 'delete', 'process', 'update']): case $adminParameter == 'process' && !$_POST['new'] && !$_POST['edit']: case $adminParameter == 'update' && !$_POST['update']: case $adminParameter && !in_array($tableParameter, ['categories', 'articles', 'extras', 'comments', 'groups', 'users', 'modules', 'settings']): case !$aliasParameter && ($adminParameter == 'install' || $adminParameter == 'uninstall'): case !$idParameter && in_array($adminParameter, ['edit', 'up', 'down', 'publish', 'unpublish', 'enable', 'disable']) && $tableParameter != 'settings': case is_numeric($idParameter) && !Redaxscript\Db::forTablePrefix($tableParameter)->where('id', $idParameter)->findOne()->id: /* show error */ echo $messenger->setRoute(Redaxscript\Language::get('back'), 'admin')->error(Redaxscript\Language::get('something_wrong')); return; } /* define access variables */ if ($adminParameter && $tableParameter) { if ($tableParameter == 'modules') { $install = Redaxscript\Registry::get('modulesInstall'); $uninstall = Redaxscript\Registry::get('modulesUninstall'); } else { if ($tableParameter != 'settings') { $new = Redaxscript\Registry::get('tableNew'); if ($tableParameter == 'comments') { $articles_total = Redaxscript\Db::forTablePrefix('articles')->count(); $articles_comments_disable = Redaxscript\Db::forTablePrefix('articles')->where('comments', 0)->count(); if ($articles_total == $articles_comments_disable) { $new = 0; } } $delete = Redaxscript\Registry::get('tableDelete'); } } $edit = Redaxscript\Registry::get('tableEdit'); } if ($edit == 1 || $delete == 1) { $accessValidator = new Redaxscript\Validator\Access(); $access = Redaxscript\Db::forTablePrefix($tableParameter)->where('id', $idParameter)->findOne()->access; $check_access = $accessValidator->validate($access, Redaxscript\Registry::get('myGroups')); } /* validate access */ switch (true) { case $adminParameter == 'new' && $new == 0: case $adminParameter == 'view' && in_array($tableParameter, ['categories', 'articles', 'extras', 'comments', 'groups', 'users']) && $new == 0 && $edit == 0 && $delete == 0: case $adminParameter == 'view' && $tableParameter == 'settings': case $adminParameter == 'view' && $tableParameter == 'modules' && $edit == 0 && $install == 0 && $uninstall == 0: case $adminParameter == 'edit' && $edit == 0 && !$usersException: case in_array($adminParameter, ['up', 'down', 'sort', 'publish', 'unpublish', 'enable', 'disable']) && $edit == 0: case $adminParameter == 'install' && $install == 0: case $adminParameter == 'uninstall' && $uninstall == 0: case $adminParameter == 'delete' && $delete == 0 && !$usersException: case $adminParameter == 'process' && $_POST['new'] && $new == 0: case $adminParameter == 'process' && $_POST['edit'] && $edit == 0 && !$usersException: case $adminParameter == 'process' && $_POST['groups'] && !Redaxscript\Registry::get('groupsEdit'): case $adminParameter == 'update' && $edit == 0: case $idParameter == 1 && ($adminParameter == 'disable' || $adminParameter == 'delete') && ($tableParameter == 'groups' || $tableParameter == 'users'): case is_numeric($idParameter) && $tableParameter && $check_access == 0 && !$usersException: /* show error */ echo $messenger->setRoute(Redaxscript\Language::get('back'), 'admin')->error(Redaxscript\Language::get('error_occurred'), Redaxscript\Language::get('access_no')); return; } /* check token */ if (in_array($adminParameter, ['up', 'down', 'sort', 'publish', 'unpublish', 'enable', 'disable', 'install', 'uninstall', 'delete']) && !$tokenParameter) { /* show error */ echo $messenger->setRoute(Redaxscript\Language::get('back'), 'admin')->error(Redaxscript\Language::get('error_occurred'), Redaxscript\Language::get('token_no')); return; } /* admin routing */ if ($firstParameter == 'admin' && !$adminParameter) { contents(); } switch ($adminParameter) { case 'new': if ($tableParameter == 'categories') { $categoryForm = new Redaxscript\Admin\View\CategoryForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $categoryForm->render(); } if ($tableParameter == 'articles') { $articleForm = new Redaxscript\Admin\View\ArticleForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $articleForm->render(); } if ($tableParameter == 'extras') { $extraForm = new Redaxscript\Admin\View\ExtraForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $extraForm->render(); } if ($tableParameter == 'comments') { $commentForm = new Redaxscript\Admin\View\CommentForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $commentForm->render(); } if ($tableParameter == 'groups') { $groupForm = new Redaxscript\Admin\View\GroupForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $groupForm->render(); } if ($tableParameter == 'users') { $userForm = new Redaxscript\Admin\View\UserForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $userForm->render(); } return; case 'view': if (in_array($tableParameter, ['categories', 'articles', 'extras', 'comments'])) { admin_contents_list(); } if (in_array($tableParameter, ['groups', 'users', 'modules'])) { call_user_func('admin_' . $tableParameter . '_list'); } return; case 'edit': if ($tableParameter == 'categories') { $categoryForm = new Redaxscript\Admin\View\CategoryForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $categoryForm->render($idParameter); } if ($tableParameter == 'articles') { $articleForm = new Redaxscript\Admin\View\ArticleForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $articleForm->render($idParameter); } if ($tableParameter == 'extras') { $extraForm = new Redaxscript\Admin\View\ExtraForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $extraForm->render($idParameter); } if ($tableParameter == 'comments') { $commentForm = new Redaxscript\Admin\View\CommentForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $commentForm->render($idParameter); } if ($tableParameter == 'groups') { $groupForm = new Redaxscript\Admin\View\GroupForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $groupForm->render($idParameter); } if ($tableParameter == 'users') { $userForm = new Redaxscript\Admin\View\UserForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $userForm->render($idParameter); } if ($tableParameter == 'modules') { $moduleForm = new Redaxscript\Admin\View\ModuleForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $moduleForm->render($idParameter); } if ($tableParameter == 'settings') { $settingForm = new Redaxscript\Admin\View\SettingForm(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); echo $settingForm->render(); } return; case 'up': case 'down': admin_move(); return; case 'sort': admin_sort(); return; case 'publish': case 'enable': admin_status(1); return; case 'unpublish': case 'disable': admin_status(0); return; case 'install': case 'uninstall': admin_install(); return; case 'delete': case 'process': case 'update': call_user_func('admin_' . $adminParameter); return; } Redaxscript\Hook::trigger('adminRouterEnd'); }
/** * scripts transport * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Loader * @author Henry Ruhs * * @param string|boolean $minify * @return string */ function scripts_transport($minify = '') { /* extend redaxscript object */ $public_registry = array('token', 'loggedIn', 'firstParameter', 'secondParameter', 'thirdParameter', 'adminParameter', 'tableParameter', 'idParameter', 'aliasParameter', 'lastParameter', 'firstTable', 'secondTable', 'thirdTable', 'lastTable', 'fullRoute', 'fullTopRoute', 'rewriteRoute', 'languageRoute', 'templateRoute', 'refreshRoute', 'myBrowser', 'myBrowserVersion', 'myEngine', 'myDesktop', 'myMobile', 'myTablet'); /* collect output */ $output = 'if (typeof rs === \'object\')' . PHP_EOL; $output .= '{' . PHP_EOL; /* languages object */ $language = Redaxscript\Language::getInstance(); /* add language */ $output .= 'rs.language = ' . json_encode($language->get()) . ';' . PHP_EOL; /* add registry */ $output .= 'rs.registry = {};'; foreach ($public_registry as $value) { $output .= 'rs.registry.' . $value . ' = \'' . Redaxscript\Registry::get($value) . '\';' . PHP_EOL; } /* baseURL fallback */ $output .= 'if (rs.baseURL === \'\')' . PHP_EOL; $output .= '{' . PHP_EOL; $output .= 'rs.baseURL = \'' . ROOT . '\\/\';' . PHP_EOL; $output .= '}' . PHP_EOL; /* generator and version */ $output .= 'rs.generator = \'' . l('name', '_package') . ' ' . l('version', '_package') . '\';' . PHP_EOL; $output .= 'rs.version = \'' . l('version', '_package') . '\';' . PHP_EOL; $output .= '}' . PHP_EOL; /* minify */ if ($minify) { $minifier = new Redaxscript\Minifier(); $output = $minifier->scripts($output); } return $output; }
/** * 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('extraStart'); } $categoryId = Redaxscript\Registry::get('categoryId'); $articleId = Redaxscript\Registry::get('articleId'); $firstParameter = Redaxscript\Registry::get('firstParameter'); /* query extras */ $extras = Redaxscript\Db::forTablePrefix('extras')->whereLanguageIs(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', [$id, $sibling > 0 ? $sibling : null])->where('language', Redaxscript\Registry::get('language'))->select('id')->findFlatArray(); /* 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')->findFlatArray(); } /* query result */ if ($id_array) { $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, Redaxscript\Registry::get('myGroups')) === Redaxscript\Validator\ValidatorInterface::PASSED) { if ($r) { foreach ($r as $key => $value) { ${$key} = stripslashes($value); } } /* show if category or article matched */ if ($category === $categoryId || $article === $articleId || !$category && !$article) { /* parser */ $parser = new Redaxscript\Parser(Redaxscript\Registry::getInstance(), Redaxscript\Language::getInstance()); $parser->init($text, ['route' => $route]); /* collect headline output */ $output .= Redaxscript\Hook::trigger('extraFragmentStart', $r); if ($headline == 1) { $output .= '<h3 class="rs-title-extra" id="extra-' . $alias . '">' . $title . '</h3>'; } /* collect box output */ $output .= '<div class="rs-box-extra">' . $parser->getOutput() . '</div>' . Redaxscript\Hook::trigger('extraFragmentEnd', $r); /* prepend admin dock */ if (Redaxscript\Registry::get('loggedIn') == Redaxscript\Registry::get('token') && $firstParameter != 'logout') { $output .= admin_dock('extras', $id); } } } } } if (!$filter) { $output .= Redaxscript\Hook::trigger('extraEnd'); } echo $output; }
/** * scripts transport * * @since 1.2.1 * @deprecated 2.0.0 * * @package Redaxscript * @category Loader * @author Henry Ruhs * * @param string|boolean $minify * @return string */ function scripts_transport($minify = '') { /* languages object */ $language = Redaxscript\Language::getInstance(); /* languages transport */ $output = 'var l = ' . json_encode($language->get()) . ';' . PHP_EOL; /* extend redaxscript object */ $public_constants = array('TOKEN', 'LOGGED_IN', 'FIRST_PARAMETER', 'FIRST_SUB_PARAMETER', 'SECOND_PARAMETER', 'SECOND_SUB_PARAMETER', 'THIRD_PARAMETER', 'THIRD_SUB_PARAMETER', 'ADMIN_PARAMETER', 'TABLE_PARAMETER', 'ID_PARAMETER', 'ALIAS_PARAMETER', 'LAST_PARAMETER', 'LAST_SUB_PARAMETER', 'FIRST_TABLE', 'SECOND_TABLE', 'THIRD_TABLE', 'LAST_TABLE', 'FULL_ROUTE', 'FULL_TOP_ROUTE', 'REWRITE_ROUTE', 'LANGUAGE_ROUTE', 'TEMPLATE_ROUTE', 'REFRESH_ROUTE', 'MY_IP', 'MY_BROWSER', 'MY_BROWSER_VERSION', 'MY_ENGINE', 'MY_DESKTOP', 'MY_MOBILE', 'MY_TABLET'); /* collect output */ $output .= 'if (typeof r === \'object\')' . PHP_EOL; $output .= '{' . PHP_EOL; /* add constants */ $output .= 'r.constants = {};'; foreach ($public_constants as $value) { $output .= 'r.constants.' . $value . ' = \'' . constant($value) . '\';' . PHP_EOL; } /* baseURL fallback */ $output .= 'if (r.baseURL === \'\')' . PHP_EOL; $output .= '{' . PHP_EOL; $output .= 'r.baseURL = \'' . ROOT . '\\/\';' . PHP_EOL; $output .= '}' . PHP_EOL; /* generator and version */ $output .= 'r.generator = \'' . l('name', '_package') . ' ' . l('version', '_package') . '\';' . PHP_EOL; $output .= 'r.version = \'' . l('version', '_package') . '\';' . PHP_EOL; $output .= '}' . PHP_EOL; /* minify */ if ($minify) { $output = minify('scripts', $output); } return $output; }