Ejemplo n.º 1
0
/**
 * Move a route UP or Down
 *
 * @param int $rid
 */
function moveRoute($rid)
{
    global $_TABLES;
    $rid = intval($rid, 10);
    $direction = \Geeklog\Input::fGet('dir', '');
    // if the router id exists
    if (DB_count($_TABLES['routes'], 'rid', $rid)) {
        $rid = DB_escapeString($rid);
        if ($direction === 'up') {
            $sql = "UPDATE {$_TABLES['routes']} SET priority = priority - 11 WHERE rid = " . $rid;
            DB_query($sql);
            reorderRoutes();
        } elseif ($direction === 'down') {
            $sql = "UPDATE {$_TABLES['routes']} SET priority = priority + 11 WHERE rid = " . $rid;
            DB_query($sql);
            reorderRoutes();
        }
    } else {
        COM_errorLog("block admin error: Attempt to move an non-existing route id: {$rid}");
    }
}
Ejemplo n.º 2
0
                if (!@unlink($path)) {
                    $failures[] = $path;
                }
            }
        }
    }
    if (!@rmdir($baseDir)) {
        $failures[] = $baseDir;
    }
    return $failures;
}
// Main
global $_TABLES, $LANG_SUCCESS, $MESSAGE;
$type = \Geeklog\Input::fGet('type', 'install');
$submit = \Geeklog\Input::post('submit', '');
$language = \Geeklog\Input::fGet('language', 'english');
$language = preg_replace('/[^a-z0-9\\-_]/', '', $language);
$languagePath = dirname(__FILE__) . '/language/' . $language . '.php';
if (is_readable($languagePath)) {
    require_once dirname(__FILE__) . '/language/' . $language . '.php';
} else {
    require_once dirname(__FILE__) . '/language/english.php';
}
// enable detailed error reporting
$_CONF['rootdebug'] = true;
// Prevent the template class from creating a cache file
$_CONF['cache_templates'] = false;
switch ($submit) {
    case $LANG_SUCCESS[24]:
        // Delete all the fies and directories
        $failures = SUCCESS_deleteAll(dirname(__FILE__));
Ejemplo n.º 3
0
 /**
  * Show editor
  *
  * @param array $A
  */
 public static function adminShowEditor(array $A = array())
 {
     global $_CONF, $LANG_ADMIN, $LANG_LANG, $MESSAGE, $_TABLES;
     self::checkAccessRights();
     $id = \Geeklog\Input::fGet('id', \Geeklog\Input::fPost('id', 0));
     $id = intval($id, 10);
     if ($id < 1) {
         $id = 0;
     }
     if ($id === 0) {
         $A = self::getEmptyRecord();
     } elseif (count($A) === 0) {
         $sql = "SELECT * FROM {$_TABLES['language_items']} WHERE id = {$id} ";
         $resultSet = DB_query($sql);
         if (DB_numRows($resultSet) == 1) {
             $A = DB_fetchArray($resultSet, false);
         } else {
             $id = 0;
             $A = self::getEmptyRecord();
         }
     } else {
         $id = $A['id'];
     }
     // Get UI language options
     $languageOptions = '';
     $currentLanguage = COM_getLanguage();
     foreach (glob($_CONF['path_language'] . '*.php') as $language) {
         $language = basename($language);
         $language = str_replace('.php', '', $language);
         $isCurrent = $language === $currentLanguage ? ' selected="selected"' : '';
         $languageOptions .= "<option{$isCurrent}>{$language}</option>" . PHP_EOL;
     }
     $isNew = $id === 0;
     if ($isNew) {
         $deleteOption = '';
         $allow_delete = false;
     } else {
         $deleteOption = '<li><input type="submit" value="' . $LANG_ADMIN['delete'] . '" name="mode" class="submit" onclick="return confirm(\'' . $MESSAGE[76] . '\');"' . XHTML . '</li>';
         $allow_delete = true;
     }
     $token = SEC_createToken(self::SEC_TOKEN_LIFESPAN);
     $content = COM_startBlock($LANG_LANG['language_editor'], '', COM_getBlockTemplate('_admin_block', 'header'));
     $content .= SEC_getTokenExpiryNotice($token);
     $editor = COM_newTemplate($_CONF['path_layout'] . 'admin/language');
     $editor->set_file('language_editor', 'language_editor.thtml');
     $editor->set_var(array('id' => $A['id'], 'id_to_display' => $isNew ? 'N/A' : $A['id'], 'var_name' => $A['var_name'], 'language' => $A['language'], 'language_options' => $languageOptions, 'name' => $A['name'], 'value' => $A['value'], 'site_admin_url' => $_CONF['site_admin_url'], 'delete_option' => $deleteOption, 'allow_delete' => $allow_delete, 'lang_language_editor' => $LANG_LANG['language_editor'], 'lang_id' => $LANG_LANG['id'], 'lang_var_name' => $LANG_LANG['var_name'], 'lang_language' => $LANG_LANG['language'], 'lang_name' => $LANG_LANG['name'], 'lang_value' => $LANG_LANG['value'], 'lang_save' => $LANG_ADMIN['save'], 'lang_delete' => $LANG_ADMIN['delete'], 'lang_cancel' => $LANG_ADMIN['cancel'], 'confirm_message' => $MESSAGE[76], 'token_name' => CSRF_TOKEN, 'token_value' => $token));
     $editor->parse('output', 'language_editor');
     $content .= $editor->finish($editor->get_var('output'));
     $content .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
     $display = COM_createHTMLDocument($content, array('pagetitle' => 'Language Items'));
     COM_output($display);
 }
Ejemplo n.º 4
0
 * so it's safe to always use your own copy.
 * This should hold all custom hacks to make upgrading easier.
 */
if (file_exists($_CONF['path_system'] . 'lib-custom.php')) {
    require_once $_CONF['path_system'] . 'lib-custom.php';
}
// Session management library
require_once $_CONF['path_system'] . 'lib-sessions.php';
SESS_sessionCheck();
// Load user data
TimeZoneConfig::setUserTimeZone();
if (COM_isAnonUser()) {
    $_USER['advanced_editor'] = $_CONF['advanced_editor'];
}
// Retrieve new topic if found
$topic = \Geeklog\Input::fGet('topic', \Geeklog\Input::fPost('topic', ''));
// See if user has access to view topic
if ($topic != '') {
    $test_topic = DB_getItem($_TABLES['topics'], 'tid', "tid = '{$topic}' " . COM_getPermSQL('AND'));
    if (strtolower($topic) !== strtolower($test_topic)) {
        $topic = '';
    } else {
        // Make it equal to the db version since case maybe different
        $topic = $test_topic;
    }
}
// Set theme
$useTheme = '';
if (isset($_POST['usetheme'])) {
    $useTheme = COM_sanitizeFilename($_POST['usetheme'], true);
}