Example #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}");
    }
}
Example #2
0
/**
 * Build a comment list
 *
 * @param  string $suffix
 * @param  string $tableName
 * @param  string $securityToken
 * @return string
 */
function ADMIN_buildCommentList($suffix, $tableName, $securityToken)
{
    global $_CONF, $_PLUGINS, $_TABLES, $LANG_ADMIN, $LANG01, $LANG03, $LANG28, $LANG29;
    $headerArray = array(array('text' => '<input type="checkbox" name="select_all' . $suffix . '" id="select_all' . $suffix . '"' . XHTML . '>', 'field' => 'selector', 'sort' => false), array('text' => $LANG01[4], 'field' => 'edit', 'sort' => false), array('text' => $LANG_ADMIN['type'], 'field' => 'type', 'sort' => true), array('text' => $LANG29[36], 'field' => 'sid', 'sort' => true), array('text' => $LANG29[14], 'field' => 'date', 'sort' => true), array('text' => $LANG_ADMIN['title'], 'field' => 'title', 'sort' => true), array('text' => $LANG03[9], 'field' => 'comment', 'sort' => true), array('text' => $LANG28[3], 'field' => 'uid', 'sort' => true), array('text' => $LANG03[105], 'field' => 'ipaddress', 'sort' => true));
    $defaultSortArray = array('field' => 'date', 'direction' => 'desc');
    $textArray = array('has_extras' => true, 'title' => $suffix === SUFFIX_COMMENTS ? $LANG03[101] : $LANG29[41], 'form_url' => $_CONF['site_admin_url'] . '/comment.php');
    $itemType = \Geeklog\Input::fPost('item_type', '');
    switch ($itemType) {
        case 'article':
        case 'all':
            break;
        case 'staticpages':
            if (!in_array('staticpages', $_PLUGINS)) {
                $itemType = '';
            }
            break;
        case 'polls':
            if (!in_array('polls', $_PLUGINS)) {
                $itemType = '';
            }
            break;
        default:
            $itemType = '';
            break;
    }
    if ($itemType === '' || $itemType === 'all') {
        $sqlForType = '';
    } else {
        $sqlForType = " AND (type = '" . DB_escapeString($itemType) . "') ";
    }
    $queryArray = array('table' => $tableName, 'sql' => "SELECT * FROM " . $_TABLES[$tableName] . " WHERE (1 = 1) ", 'query_fields' => array('type', 'sid', 'date', 'title', 'comment', 'uid', 'ipaddress'), 'default_filter' => $sqlForType . COM_getPermSql('AND'));
    $filter = getTypeSelector($itemType);
    $options = array();
    $actionSelector = '<select name="bulk_action' . $suffix . '" id="bulk_action' . $suffix . '">' . LB . '<option value="do_nothing">' . $LANG03[102] . '</option>' . LB;
    if ($suffix === SUFFIX_COMMENT_SUBMISSIONS) {
        $actionSelector .= '<option value="bulk_approve">' . $LANG29[1] . '</option>' . LB;
    }
    $actionSelector .= '<option value="bulk_delete">' . $LANG29[2] . '</option>' . LB . '<option value="bulk_ban_user">' . $LANG03[103] . '</option>' . LB;
    if (in_array('spamx', $_PLUGINS)) {
        $actionSelector .= '<option value="bulk_ban_ip_address">' . $LANG03[104] . '</option>' . LB;
    }
    $actionSelector .= '</select>' . LB . '<input type="submit" name="submit" id="bulk_action_submit' . $suffix . '" value="' . $LANG_ADMIN['submit'] . '"' . XHTML . '>' . LB . '<input type="hidden" name="list" value="' . $suffix . '"' . XHTML . '>' . LB;
    $securityTokenTag = '<input type="hidden" name="' . CSRF_TOKEN . '" value="' . $securityToken . '"' . XHTML . '>' . LB;
    $formArray = array('top' => '', 'bottom' => $actionSelector . $securityTokenTag);
    $commentList = ADMIN_list('comments', 'ADMIN_getListField_comments', $headerArray, $textArray, $queryArray, $defaultSortArray, $filter, $suffix, $options, $formArray);
    return $commentList;
}
Example #3
0
 /**
  * Delete language items
  */
 public static function adminMassDelete()
 {
     global $_CONF, $_TABLES;
     self::checkAccessRights();
     self::checkSecurityToken();
     $ids = \Geeklog\Input::fPost('delitem', array());
     if (!is_array($ids)) {
         $ids = (array) $ids;
     }
     if (count($ids) === 0) {
         self::adminShowList();
     } else {
         foreach ($ids as &$id) {
             $id = intval($id, 10);
         }
         unset($id);
         $sql = "DELETE FROM {$_TABLES['language_items']} " . " WHERE (id IN (" . implode(',', $ids) . ")) ";
         DB_query($sql);
         $redirect = $_CONF['site_admin_url'] . '/language.php?msg=130';
         header('Location: ' . $redirect);
     }
 }
Example #4
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__));
Example #5
0
// | Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.           |
// |                                                                           |
// +---------------------------------------------------------------------------+
global $_CONF, $LANG_ADMIN;
// Geeklog common function library
require_once './../lib-common.php';
// Security check to ensure user even belongs on this page
require_once './auth.inc.php';
// Include admin library
require_once $_CONF['path_system'] . 'lib-admin.php';
// Include Language class
require_once $_CONF['path_system'] . 'classes/language.class.php';
// Make sure user has rights to access this page
Language::checkAccessRights();
// Main
$mode = \Geeklog\Input::post('mode', \Geeklog\Input::get('mode', ''));
switch ($mode) {
    case 'list':
        Language::adminShowList();
        break;
    case 'edit':
        Language::adminShowEditor();
        break;
    case $LANG_ADMIN['save']:
        Language::adminSave();
        break;
    case $LANG_ADMIN['delete']:
        Language::adminDelete();
        break;
    default:
        if (isset($_POST['delitem'])) {
Example #6
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);
}