function toggleexpand($contentid, $collapse = false) { $userid = get_userid(); $openedArray = array(); if (get_preference($userid, 'collapse', '') != '') { $tmp = explode('.', get_preference($userid, 'collapse')); foreach ($tmp as $thisCol) { $colind = substr($thisCol, 0, strpos($thisCol, '=')); $openedArray[$colind] = 1; } } if ($collapse) { $openedArray[$contentid] = 0; } else { $openedArray[$contentid] = 1; } $cs = ''; foreach ($openedArray as $key => $val) { if ($val == 1) { $cs .= $key . '=1.'; } } set_preference($userid, 'collapse', $cs); }
set_preference($userid, 'wysiwyg', $wysiwyg); set_preference($userid, 'syntaxhighlighter', $syntaxhighlighter); set_preference($userid, 'default_cms_language', $default_cms_lang); set_preference($userid, 'admintheme', $admintheme); set_preference($userid, 'bookmarks', $bookmarks); set_preference($userid, 'hide_help_links', $hide_help_links); set_preference($userid, 'indent', $indent); set_preference($userid, 'enablenotifications', $enablenotifications); set_preference($userid, 'paging', $paging); set_preference($userid, 'date_format_string', $date_format_string); set_preference($userid, 'default_parent', $default_parent); set_preference($userid, 'homepage', $homepage); set_preference($userid, 'ignoredmodules', implode(',', $ignoredmodules)); set_preference($userid, 'listtemplates_pagelimit', $listtemplates_pagelimit); set_preference($userid, 'liststylesheets_pagelimit', $liststylesheets_pagelimit); set_preference($userid, 'listgcbs_pagelimit', $listgcbs_pagelimit); audit(-1, '', 'Edited User Preferences'); $page_message = lang('prefsupdated'); #redirect("index.php"); #return; } else { if (!isset($_POST["edituserprefs"])) { $gcb_wysiwyg = get_preference($userid, 'gcb_wysiwyg', 1); $wysiwyg = get_preference($userid, 'wysiwyg'); $syntaxhighlighter = get_preference($userid, 'syntaxhighlighter'); $default_cms_lang = get_preference($userid, 'default_cms_language'); $old_default_cms_lang = $default_cms_lang; $admintheme = get_preference($userid, 'admintheme'); $bookmarks = get_preference($userid, 'bookmarks'); $indent = get_preference($userid, 'indent', true); $enablenotifications = get_preference($userid, 'enablenotifications', 1);
} $userid = get_userid(); $access = check_permission($userid, 'Modify Group Assignments'); if (!$access) { die('Permission Denied'); return; } $userops =& $gCms->GetUserOperations(); $adminuser = $userops->UserInGroup($userid, 1) || $userid == 1; $message = ''; include_once "header.php"; global $gCms; $db =& $gCms->GetDb(); if (isset($_POST['filter'])) { $disp_group = $_POST['groupsel']; set_preference($userid, 'changegroupassign_group', $disp_group); } $disp_group = get_preference($userid, 'changegroupassign_group', -1); // always display the group pulldown global $gCms; $groupops =& $gCms->GetGroupOperations(); $userops =& $gCms->GetUserOperations(); $tmp = new stdClass(); $tmp->name = lang('all_groups'); $tmp->id = -1; $allgroups = array($tmp); $groups = array($tmp); $group_list = $groupops->LoadGroups(); foreach ($group_list as $onegroup) { if ($onegroup->id == 1 && $adminuser == false) { continue;
set_preference($userid, 'wysiwyg', $wysiwyg); set_preference($userid, 'syntaxhighlighter', $syntaxhighlighter); set_preference($userid, 'default_cms_language', $default_cms_language); set_preference($userid, 'admintheme', $admintheme); set_preference($userid, 'bookmarks', $bookmarks); set_preference($userid, 'hide_help_links', $hide_help_links); set_preference($userid, 'indent', $indent); set_preference($userid, 'enablenotifications', $enablenotifications); set_preference($userid, 'paging', $paging); set_preference($userid, 'date_format_string', $date_format_string); set_preference($userid, 'default_parent', $default_parent); set_preference($userid, 'listtemplates_pagelimit', $listtemplates_pagelimit); set_preference($userid, 'liststylesheets_pagelimit', $liststylesheets_pagelimit); set_preference($userid, 'listgcbs_pagelimit', $listgcbs_pagelimit); set_preference($userid, 'ignoredmodules', implode(',', $ignoredmodules)); set_preference($userid, 'homepage', $homepage); # Audit, message, cleanup audit($userid, 'Admin Username: '******'Edited'); $message = lang('prefsupdated'); cmsms()->clear_cached_files(); } // end of prefs submit /** * Build page */ include_once "header.php"; if ($error != "") { $themeObject->ShowErrors($error); } if ($message != "") { $themeObject->ShowMessage($message);
function preContent(&$db) { // check if db info is correct as it should at this point to prevent an undeleted installation dir // to be used for sending spam by messing up $_POST variables $db = ADONewConnection($_POST['dbms'], 'pear:date:extend:transaction'); if (!empty($_POST['db_port'])) { $db->port = $_POST['db_port']; } if (!$db->Connect($_POST['host'], $_POST['username'], $_POST['password'], $_POST['database'])) { $this->errors[] = ilang('could_not_connect_db'); return; } $newconfig = cmsms()->GetConfig(); $newconfig['dbms'] = trim($_POST['dbms']); $newconfig['db_hostname'] = trim($_POST['host']); $newconfig['db_username'] = trim($_POST['username']); $newconfig['db_password'] = trim($_POST['password']); $newconfig['db_name'] = trim($_POST['database']); $newconfig['db_prefix'] = trim($_POST['prefix']); $newconfig['db_port'] = (int) $_POST['db_port']; $newconfig['root_url'] = rtrim(trim($_POST['docroot']), '/'); $tmp = trim($_POST['querystr']); if ($tmp != 'page') { $newconfig['query_var'] = $_POST['querystr']; } $newconfig['timezone'] = $_POST['timezone']; $newconfig['default_encoding'] = $_POST['default_encoding']; $newconfig->save(); if (file_exists(cms_join_path(TMP_CACHE_LOCATION, 'SITEDOWN'))) { if (!unlink(cms_join_path(TMP_CACHE_LOCATION, 'SITEDOWN'))) { echo ilang('install_admin_sitedown'); } } #Make sure $gCms->db is set #Do module installation if (isset($_POST["createtables"]) && $_POST['createtables'] != 0) { $gCms = cmsms(); global $DONT_LOAD_DB; $DONT_LOAD_DB = 'force'; $db = $gCms->GetDb(); $db->SetFetchMode(ADODB_FETCH_ASSOC); echo '<p>' . ilang('install_admin_update_hierarchy'); $contentops = cmsms()->GetContentOperations(); $contentops->SetAllHierarchyPositions(); echo " [" . ilang('done') . "]</p>"; echo '<p>' . ilang('install_admin_set_core_event'); Events::SetupCoreEvents(); echo " [" . ilang('done') . "]</p>"; echo '<p>' . ilang('install_admin_install_modules'); $modops = $gCms->GetModuleOperations(); $modops->LoadModules(TRUE); $allmodules = $modops->GetAllModuleNames(); if (is_array($allmodules) && count($allmodules)) { foreach ($allmodules as $module_name) { $obj = $modops->get_module_instance($module_name, '', TRUE); } } echo " [" . ilang('done') . "]</p>"; echo '<p>' . ilang('install_admin_clear_cache'); $contentops->ClearCache(); echo " [" . ilang('done') . "]</p>"; // Insert new site preferences set_site_preference('global_umask', $_POST['umask']); set_site_preference('frontendlang', $_POST['frontendlang']); set_preference(1, 'default_cms_language', $_POST['default_cms_lang']); } else { $this->smarty->assign('tables_notinstalled', 1); } $link = str_replace(" ", "%20", $_POST['docroot']); if ($_POST['email_accountinfo'] == 1 && !empty($_POST['adminemail'])) { echo '<p>' . ilang('install_admin_emailing'); $to = $_POST['adminemail']; $subject = ilang('email_accountinfo_subject'); $message = ilang('email_accountinfo_message', $_POST['adminusername'], $_POST['adminpassword'], "{$link}/admin/"); $message = html_entity_decode($message, ENT_QUOTES); // Encoded from TC echo @mail($to, $subject, $message) ? " [" . ilang('done') . "]" : "<strong>[" . ilang('failed') . "]</strong>"; echo "</p>"; } }
set_preference($userid, 'wysiwyg', $wysiwyg); set_preference($userid, 'syntaxhighlighter', $syntaxhighlighter); set_preference($userid, 'default_cms_language', $default_cms_language); set_preference($userid, 'admintheme', $admintheme); set_preference($userid, 'bookmarks', $bookmarks); set_preference($userid, 'hide_help_links', $hide_help_links); set_preference($userid, 'indent', $indent); set_preference($userid, 'enablenotifications', $enablenotifications); set_preference($userid, 'paging', $paging); set_preference($userid, 'date_format_string', $date_format_string); set_preference($userid, 'default_parent', $default_parent); set_preference($userid, 'homepage', $homepage); set_preference($userid, 'listtemplates_pagelimit', $listtemplates_pagelimit); set_preference($userid, 'liststylesheets_pagelimit', $liststylesheets_pagelimit); set_preference($userid, 'listgcbs_pagelimit', $listgcbs_pagelimit); set_preference($userid, 'ignoredmodules', implode(',', $ignoredmodules)); # Audit, message, cleanup audit($userid, 'Admin Username: '******'Edited'); $message = lang('prefsupdated'); cmsms()->clear_cached_files(); } // end of prefs submit /** * Build page */ include_once "header.php"; if ($error != "") { $themeObject->ShowErrors($error); } if ($message != "") { $themeObject->ShowMessage($message);
function set_preference($userid, $prefname, $value) { return set_preference($this->id, $prefname, $value); }
if ($result) { #Perform the adduser_post callback foreach ($gCms->modules as $key => $value) { if ($gCms->modules[$key]['installed'] == true && $gCms->modules[$key]['active'] == true) { $gCms->modules[$key]['object']->AddUserPost($newuser); } } Events::SendEvent('Core', 'AddUserPost', array('user' => &$newuser)); # set some default preferences, based on the user creating this user $adminid = get_userid(); $userid = $newuser->id; set_preference($userid, 'wysiwyg', get_preference($adminid, 'wysiwyg')); set_preference($userid, 'default_cms_language', get_preference($adminid, 'default_cms_language')); set_preference($userid, 'admintheme', get_site_preference('logintheme', 'default')); set_preference($userid, 'bookmarks', get_preference($adminid, 'bookmarks')); set_preference($userid, 'recent', get_preference($adminid, 'recent')); if ($assign_group_perm && isset($_POST['groups'])) { $iquery = "insert into " . cms_db_prefix() . "user_groups (user_id,group_id) VALUES (?,?)"; foreach ($group_list as $thisGroup) { if (isset($_POST['g' . $thisGroup->id]) && $_POST['g' . $thisGroup->id] == 1) { $result = $db->Execute($iquery, array($userid, $thisGroup->id)); } } } audit($newuser->id, $newuser->username, 'Added User'); redirect("listusers.php" . $urlext); } else { $error .= "<li>" . lang('errorinsertinguser') . "</li>"; } } }
} if (isset($params['agelimit'])) { $agelimit = (int) $params['agelimit']; } if (isset($params['pagelimit'])) { $pagelimit = (int) $params['pagelimit']; } set_preference($userid, 'cgf_filter_key1', $key1); set_preference($userid, 'cgf_filter_key2', $key2); set_preference($userid, 'cgf_filter_key3', $key3); set_preference($userid, 'cgf_filter_title', $input_title); set_preference($userid, 'cgf_filter_authorname', $input_authorname); set_preference($userid, 'cgf_filter_authoremail', $input_authoremail); set_preference($userid, 'cgf_filter_status', $input_status); set_preference($userid, 'cgf_filter_agelimit', $agelimit); set_preference($userid, 'cgf_filter_pagelimit', $pagelimit); } # # Build the query # if ($key1 != -1) { $where[] = 'key1 = ?'; $qparms[] = $key1; } if ($key2 != -1) { $where[] = 'key2 = ?'; $qparms[] = $key2; } if ($key3 != -1) { $where[] = 'key3 = ?'; $qparms[] = $key3;
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Or read it online: http: //www.gnu.org/licenses/licenses.html#GPL # #------------------------------------------------------------------------- if (!$this->CheckPermission('Manage Uploads') && !$this->CheckPermission('Upload Files to Uploads')) { return; } $db = cmsms()->GetDb(); $curpage = 1; if (isset($params['filespage'])) { $curpage = (int) $params['filespage']; } // get the current category for the filter if (isset($params['submitfilter'])) { set_preference(get_userid(FALSE), 'uploads_category', isset($params['input_category']) ? $params['input_category'] : ''); set_preference(get_userid(FALSE), 'uploads_pagelimit', (int) $params['input_pagelimit']); } $curcategory = get_preference(get_userid(FALSE), 'uploads_category', ''); $pagelimit = get_preference(get_userid(FALSE), 'uploads_pagelimit', 50); $offset = -1; // get the categories for the filter $categorylist = array(); $query = "SELECT * FROM " . cms_db_prefix() . "module_uploads_categories ORDER BY upload_category_name ASC"; $dbresult = $db->Execute($query); if (!$dbresult) { $smarty->assign('error', 1); $smarty->assign('message', $this->Lang('error_nocategories')); } else { while ($row = $dbresult->FetchRow()) { if ($curcategory == '') { $curcategory = $row['upload_category_id'];