function display_log_list() { global $lang_viewlog_php, $folder_icon, $delete_all_icon, $delete_this_icon, $view_icon, $lang_date; $log_list = getloglist('logs/'); if (count($log_list) > 0) { foreach ($log_list as $log) { $mtime = localised_date($log['mtime'], $lang_date['log']); $filesize = cpg_format_bytes($log['filesize']); echo <<<EOT <tr> <td class="tableb"> {$folder_icon} <a href= "viewlog.php?log={$log['logname']}">{$log['logname']}</a> ( <em>{$filesize}</em>, {$lang_viewlog_php['last_updated']}: <em>{$mtime}</em>) </td> </tr> EOT; } echo <<<EOT <tr> <td class="tableb" align="center"> <button type="button" class="button" name="dall" value="{$lang_viewlog_php['delete_all']}" id="dall" onclick="window.location='viewlog.php?action=dall';">{$delete_all_icon}{$lang_viewlog_php['delete_all']}</button> </td> </tr> EOT; } else { cpg_die(INFORMATION, $lang_viewlog_php['no_logs'], __FILE__, __LINE__); } }
function list_users($search = '') { global $CONFIG, $cpg_udb, $CPG_PHP_SELF, $LINEBREAK; //, $PHP_SELF; global $lang_usermgr_php, $lang_byte_units, $lang_date, $lang_common, $icon_array; global $lim_user, $number_of_columns, $template_tab_display; global $USER_DATA; $superCage = Inspekt::makeSuperCage(); list($timestamp, $form_token) = getFormToken(); $number_of_columns_minus_one = $number_of_columns - 1; $number_of_columns_minus_three = $number_of_columns - 3; $number_of_columns_minus_four = $number_of_columns - 4; $sort_codes = array('name_a' => 'user_name ASC', 'name_d' => 'user_name DESC', 'group_a' => 'group_name ASC', 'group_d' => 'group_name DESC', 'reg_a' => 'user_regdate ASC', 'reg_d' => 'user_regdate DESC', 'pic_a' => 'pic_count ASC', 'pic_d' => 'pic_count DESC', 'disku_a' => 'disk_usage ASC', 'disku_d' => 'disk_usage DESC', 'lv_a' => 'user_lastvisit ASC', 'lv_d' => 'user_lastvisit DESC'); $sort = 'reg_d'; if ($superCage->get->keyExists('sort') && ($matches = $superCage->get->getMatched('sort', '/^[a-z_]+$/'))) { if ($sort_codes[$matches[0]]) { $sort = $matches[0]; } } $makereadonly = $CONFIG['bridge_enable'] ? 'style="display:none;" disabled="disabled" ' : ''; $user_count = $cpg_udb->get_user_count(); if (!$user_count) { cpg_die(CRITICAL_ERROR, $lang_usermgr_php['err_no_users'], __FILE__, __LINE__); } $user_per_page = 25; $page = $superCage->get->testInt('page') ? $superCage->get->getInt('page') : 1; $lower_limit = ($page - 1) * $user_per_page; $lower_limit = ($page - 1) * $user_per_page; $username = ''; if ($search) { $username = '******' . $search; $users_search = $cpg_udb->get_users(array('users_per_page' => $user_count, 'lower_limit' => 0, 'search' => $search, 'sort' => $sort)); $user_count = count($users_search); } $tab_tmpl = $template_tab_display; $tab_tmpl['page_link'] = strtr($tab_tmpl['page_link'], array('{LINK}' => 'usermgr.php?sort=' . $sort . '&page=%d' . $username)); $tab_tmpl['left_text'] = strtr($tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_usermgr_php['u_user_on_p_pages'])); $users = $cpg_udb->get_users(array('users_per_page' => $user_per_page, 'lower_limit' => $lower_limit, 'search' => $search, 'sort' => $sort)); $total_pages = ceil($user_count / $user_per_page); $tabs = create_tabs($user_count, $page, $total_pages, $tab_tmpl); $lb = '<span id="album_listbox_wrapper" style="display:none">'; $lb .= $lang_usermgr_php['sort_by'] . ': '; $lb .= "<select name=\"album_listbox\" id=\"album_listbox\" class=\"listbox\" onchange=\"if(this.options[this.selectedIndex].value) window.location.href='{$CPG_PHP_SELF}?page={$page}&sort='+this.options[this.selectedIndex].value;\">" . $LINEBREAK; foreach ($sort_codes as $key => $value) { $selected = $key == $sort ? 'selected="selected"' : ""; $lb .= ' <option value="' . $key . '" ' . $selected . '>' . $lang_usermgr_php[$key] . '</option>' . $LINEBREAK; } $lb .= '</select>' . $LINEBREAK; $lb .= '</span>' . $LINEBREAK; echo <<<EOT <script type="text/javascript" language="javascript"> <!-- function selectaction(d,box) { // check if an action has been selected var action = document.editForm.action.value; if (action == '') { return false; } // check if at least one user has been selected var checked_counter = 0; var checked_string = ''; var f = document.editForm; for (i = 0; i < f.length; i++) { if (f[i].type == "checkbox" && f[i].name.indexOf(box) >= 0) { if (f[i].checked) { checked_counter = checked_counter + 1; if (checked_string == '') { checked_string = f[i].name; } else { checked_string = checked_string + ',' + f[i].name; } } } } if (checked_counter == 0) { document.editForm.action.value = ''; alert('{$lang_usermgr_php['alert_no_selection']}'); return false; } document.editForm.id.value = checked_string; document.editForm.new_password.style.display = "none"; document.editForm.group.style.display = "none"; document.editForm.go.style.display = "none"; document.editForm.delete_files.style.display = "none"; document.editForm.delete_comments.style.display = "none"; switch(document.editForm.action.value) { case "delete": document.editForm.delete_files.style.display = "inline"; document.editForm.delete_comments.style.display = "inline"; document.editForm.go.style.display = "inline"; break; case "reset_password": document.editForm.new_password.style.display = "inline"; document.editForm.go.style.display = "inline"; break; case "change_group": document.editForm.new_password.value = ''; document.editForm.group.style.display = "inline"; if (document.editForm.group.value != '') { document.editForm.submit(); } break; case "add_group": document.editForm.new_password.value = ''; document.editForm.group.style.display = "inline"; if (document.editForm.group.value != '') { document.editForm.submit(); } break; default: document.editForm.new_password.value = ''; document.editForm.submit(); break; } } addonload("show_section('album_listbox_wrapper')"); addonload("show_section('checkAll')"); addonload("show_section('checkAll2')"); addonload("show_section('action')"); --> </script> EOT; echo '<form method="get" action="delete.php" name="editForm" id="cpgform">'; if ($superCage->post->keyExists('username')) { $search_filter = '<td align="center">' . $lang_usermgr_php['search_result'] . $superCage->post->getEscaped('username') . '</td>'; } else { $search_filter = ''; } $help = ' ' . cpg_display_help('f=users.htm&as=user_cp&ae=user_cp_end&top=1', '650', '500'); $usermgr_table_header = <<<EOT <input type="hidden" name="id" value="" /> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td> EOT; if (!$lim_user) { $usermgr_table_header .= cpg_fetch_icon('user_mgr', 2) . $lang_usermgr_php['user_manager'] . $help; } else { $usermgr_table_header .= cpg_fetch_icon('user_mgr', 2) . $lang_usermgr_php['memberlist']; } $usermgr_table_header .= <<<EOT </td> {$search_filter} <td class="sortorder_options" align="right"> {$lb} </td> </tr> </table> EOT; starttable('100%', $usermgr_table_header, $number_of_columns); // Accept header addons echo CPGPluginAPI::filter('usermgr_header', ''); if ($CONFIG['user_manager_hide_file_stats']) { $pictures_quota_header = ''; } else { $pictures_quota_header = <<<EOT <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['pictures']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=pic_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['pic_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=pic_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['pic_d']}" /></a> </td> <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['disk_space_used']}/{$lang_usermgr_php['disk_space_quota']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=disku_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['disku_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=disku_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['disku_d']}" /></a> </td> EOT; } if (!$lim_user) { echo <<<EOT <tr> <td class="tableh1" align="center"> <input type="checkbox" {$makereadonly}name="checkAll" id="checkAll" onclick="selectAll('cpgform');" class="checkbox" title="{$lang_common['check_uncheck_all']}" style="display:none" /> </td> <td class="tableh1" colspan="2"> <span class="statlink">{$lang_usermgr_php['name']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=name_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=name_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_d']}" /></a> </td> <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['status']}</span> </td> <td class="tableh1"> <span class="statlink"><a href="groupmgr.php" class="statlink">{$lang_usermgr_php['group']}</a></span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=group_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=group_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_d']}" /></a> </td> <td class="tableh1"> <span class="statlink">{$lang_usermgr_php['registered_on']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=reg_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=reg_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_d']}" /></a> </td> <td class="tableh1"> <span class="statlink">{$lang_usermgr_php['last_visit']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=lv_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=lv_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_d']}" /></a> </td> <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['comments']}</span> </td> {$pictures_quota_header} </tr> EOT; } else { echo <<<EOT <tr> <td class="tableh1" colspan="2"> <span class="statlink">{$lang_usermgr_php['name']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=name_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=name_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['name_d']}" /></a> </td> <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['status']}</span> </td> <td class="tableh1"><span class="statlink">{$lang_usermgr_php['group']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=group_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=group_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['group_d']}" /></a> </td> <td class="tableh1"> <span class="statlink">{$lang_usermgr_php['registered_on']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=reg_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=reg_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['reg_d']}" /></a> </td> <td class="tableh1"> <span class="statlink">{$lang_usermgr_php['last_visit']}</span> <a href="{$CPG_PHP_SELF}?page={$page}&sort=lv_a{$username}"><img src="images/ascending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_a']}" /></a> <a href="{$CPG_PHP_SELF}?page={$page}&sort=lv_d{$username}"><img src="images/descending.png" width="9" height="9" border="0" alt="" title="{$lang_usermgr_php['lv_d']}" /></a> </td> <td class="tableh1" align="center"> <span class="statlink">{$lang_usermgr_php['comments']}</span> </td> {$pictures_quota_header} </tr> EOT; } $loop_counter = 0; // query total number of files uploaded $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} LIMIT 1"); $tempPicCount = mysql_fetch_array($result); $totalPictureCount = $tempPicCount[0]; $totalPictureCount_fmt = cpg_float2decimal($totalPictureCount); mysql_free_result($result); unset($tempPicCount); // query total space used $result = cpg_db_query("SELECT SUM(total_filesize) FROM {$CONFIG['TABLE_PICTURES']} LIMIT 1"); $tempSpaceCount = mysql_fetch_array($result); $totalSpaceCount = $tempSpaceCount[0]; $totalSpaceCount_fmt = cpg_format_bytes($totalSpaceCount); mysql_free_result($result); unset($tempSpaceCount); // query total number of comments posted $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_COMMENTS']} LIMIT 1"); $tempCommentCount = mysql_fetch_array($result); $totalCommentCount = $tempCommentCount[0]; $totalCommentCount_fmt = cpg_float2decimal($totalCommentCount); mysql_free_result($result); unset($tempCommentCount); foreach ($users as $user) { if ($loop_counter == 0) { $row_style_class = 'tableb'; } else { $row_style_class = 'tableb tableb_alternate'; } $loop_counter++; if ($loop_counter > 1) { $loop_counter = 0; } if ($user['disk_usage'] == '') { $user['disk_usage'] = 0; } $group_quota_separator = '/'; // Determine actual quota if user belongs to more than one user group if ($user_groups = cpg_get_groups($user['user_id'])) { $quota = mysql_fetch_assoc(cpg_db_query("SELECT MAX(group_quota) AS disk_max, MIN(group_quota) AS disk_min FROM {$CONFIG['TABLE_USERGROUPS']} WHERE group_quota >= 0 AND group_id IN (" . implode(", ", $user_groups) . ")")); $user['group_quota'] = $quota["disk_min"] ? $quota["disk_max"] : 0; } if ($user['group_quota']) { $disk_usage_output = theme_display_bar($user['disk_usage'], $user['group_quota'], 150, '', '', $group_quota_separator . $user['group_quota'] . ' ' . $lang_byte_units[1], 'red', 'green'); } else { $disk_usage_output = theme_display_bar($user['disk_usage'], $user['group_quota'], 150, '', '', ' ' . $lang_byte_units[1], 'green', 'green'); } if ($user['user_active'] == 'NO') { //$user['group_name'] = '<i>' . $lang_usermgr_php['inactive'] . '</i>'; $user['status'] = cpg_fetch_icon('offline', 0, $lang_usermgr_php['status_inactive']); $action = 'activate'; } else { $user['status'] = cpg_fetch_icon('online', 0, $lang_usermgr_php['status_active']); $action = 'deactivate'; } if (!$lim_user) { $user['status'] = '<a href="delete.php?id=u' . $user['user_id'] . '&album_listbox=' . $sort . '&action=' . $action . '&what=user&form_token=' . $form_token . '&timestamp=' . $timestamp . '" title="">' . $user['status'] . '</a>'; } $user['user_regdate'] = localised_date($user['user_regdate'], $lang_date['register']); if ($user['user_lastvisit']) { $user['user_lastvisit'] = localised_date($user['user_lastvisit'], $lang_date['register']); } else { $user['user_lastvisit'] = $lang_usermgr_php['never']; } $view_profile = '<a href="profile.php?uid=' . $user['user_id'] . '">' . cpg_fetch_icon('my_profile', 0, $lang_usermgr_php['view_profile']) . '</a>'; if ($user['pic_count']) { $last_uploads = '<a href="thumbnails.php?album=lastupby&uid=' . $user['user_id'] . '">' . cpg_fetch_icon('last_uploads', 0, $lang_usermgr_php['latest_upload']) . '</a>'; } else { if ($lim_user == 0) { $last_uploads = cpg_fetch_icon('last_uploads_disabled', 0, $lang_usermgr_php['no_latest_upload']); } else { $last_uploads = cpg_fetch_icon('blank', 0); } } // fetch number of comments and add link to comments if applicable if ($lim_user == 0) { $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = {$user['user_id']}"); // display all comments for the admin } else { $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = {$user['user_id']} AND approval = 'YES' "); // only display approved comments for non-admin } $commentCount = mysql_fetch_array($result); $user['comment_num'] = $commentCount[0]; mysql_free_result($result); if ($user['comment_num'] > 0) { $user_comment_link = '<a href="thumbnails.php?album=lastcomby&uid=' . $user['user_id'] . '">' . cpg_fetch_icon('comment', 0, $lang_usermgr_php['last_comments'] . '(' . $user['comment_num'] . ')') . '</a>'; } else { $user_comment_link = cpg_fetch_icon('blank', 0, $lang_usermgr_php['no_last_comments']); } // create comments bar $comment_quota_output = theme_display_bar($user['comment_num'], $totalCommentCount, 60, '', '', '', 'red', ''); // create files bar $file_quota_output = theme_display_bar($user['pic_count'], $totalPictureCount, 60, '', '', '', 'red', ''); // Look up banned table if (mysql_num_rows(cpg_db_query("SELECT user_name FROM {$CONFIG['TABLE_BANNED']} WHERE user_name = '" . addslashes($user['user_name']) . "' AND brute_force=0 LIMIT 1"))) { $ban_user_link = '<a href="banning.php">' . cpg_fetch_icon('ban_user_disabled', 0, $lang_usermgr_php['user_is_banned']) . '</a>'; $ban_memberlist = cpg_fetch_icon('ban_user_disabled', 0, $lang_usermgr_php['user_is_banned']); } else { $ban_user_link = '<a href="banning.php?ban_user='******'user_id'] . '">' . cpg_fetch_icon('ban_user', 0, $lang_usermgr_php['ban_user']) . '</a>'; $ban_memberlist = ''; } if (!$lim_user) { if ($user['user_id'] == $USER_DATA['user_id']) { $profile_link = 'profile.php?op=edit_profile'; $checkbox_html = ''; $ban_user_link = cpg_fetch_icon('blank', 0); } else { $profile_link = $CPG_PHP_SELF . '?op=edit&user_id=' . $user['user_id'] . '&form_token=' . $form_token . '&timestamp=' . $timestamp; $checkbox_html = '<input name="u' . $user['user_id'] . '" ' . $makereadonly . 'type="checkbox" value="" class="checkbox" />'; } $profile_link = '<a href="' . $profile_link . '">' . cpg_fetch_icon('edit', 0, $lang_usermgr_php['edit_profile']) . '</a>'; if ($CONFIG['user_manager_hide_file_stats']) { $pictures_quota_data = ''; } else { $pictures_quota_data = <<<EOT <td class="{$row_style_class}" align="right">{$file_quota_output}</td> <td class="{$row_style_class}" align="center">{$disk_usage_output}</td> EOT; } echo <<<EOT <tr> <td class="{$row_style_class}" align="center">{$checkbox_html}</td> <td class="{$row_style_class}">{$user['user_name']}</td> <td class="{$row_style_class}" align="left"> {$view_profile} {$profile_link} {$last_uploads} {$ban_user_link} {$user_comment_link} </td> <td class="{$row_style_class}">{$user['status']}</td> <td class="{$row_style_class}">{$user['group_name']}</td> <td class="{$row_style_class}">{$user['user_regdate']}</td> <td class="{$row_style_class}">{$user['user_lastvisit']}</td> <td class="{$row_style_class}" align="right">{$comment_quota_output}</td> {$pictures_quota_data} </tr> EOT; } else { if ($CONFIG['user_manager_hide_file_stats']) { $pictures_quota_data = ''; } else { $pictures_quota_data = <<<EOT <td class="{$row_style_class}" align="right">{$user['pic_count']}</td> <td class="{$row_style_class}" align="center">{$disk_usage_output}</td> EOT; } echo <<<EOT <tr> <td class="{$row_style_class}">{$user['user_name']}</td> <td class="{$row_style_class}">{$view_profile}{$last_uploads}{$user_comment_link}</td> <td class="{$row_style_class}">{$user['status']}{$ban_memberlist}</td> <td class="{$row_style_class}">{$user['group_name']}</td> <td class="{$row_style_class}">{$user['user_regdate']}</td> <td class="{$row_style_class}">{$user['user_lastvisit']}</td> <td class="{$row_style_class}" align="right">{$user['comment_num']}</td> {$pictures_quota_data} </tr> EOT; } } // while //mysql_free_result($result); if ($CONFIG['user_manager_hide_file_stats']) { $pictures_quota_footer = ''; } else { $pictures_quota_footer = <<<EOT <td align="right" class="tablef">{$totalPictureCount_fmt}</td> <td align="right" class="tablef">{$totalSpaceCount_fmt}</td> EOT; } if (!$lim_user) { if ($search) { $search_string_default = 'value="' . $search . '"'; } else { $search_string_default = 'value="' . $lang_usermgr_php['search'] . '" onfocus="this.value=\'\'"'; } $help = cpg_display_help('f=users.htm&as=user_cp_search&ae=user_cp_search_end&top=1', '400', '150'); echo <<<EOT <tr> <td class="tablef" align="center"><input type="checkbox" name="checkAll2" id="checkAll2" {$makereadonly}onclick="selectAll('cpgform');" class="checkbox" title="{$lang_common['check_uncheck_all']}" style="display:none" /></td> <td colspan="{$number_of_columns_minus_four}" class="tablef"> <table cellpadding="0" cellspacing="0" width="100%" border="0"> <tr> <td align="left"> <select name="action" id="action" size="1" class="listbox" {$makereadonly}onchange="return selectaction(this,'u');" style="display:none"> <option value="" selected="selected">{$lang_usermgr_php['with_selected']}</option> <option value="delete">{$lang_common['delete']}</option> <option value="activate">{$lang_usermgr_php['activate']}</option> <option value="deactivate">{$lang_usermgr_php['deactivate']}</option> <option value="reset_password">{$lang_usermgr_php['reset_password']}</option> <option value="change_group">{$lang_usermgr_php['change_primary_membergroup']}</option> <option value="add_group">{$lang_usermgr_php['add_secondary_membergroup']}</option> </select> <input type="hidden" name="what" value="user"/> <input type="text" name="new_password" value="{$lang_usermgr_php['password']}" size="8" maxlength="25" class="textinput" onfocus="this.value='';" style="display:none" /> <select name="group" size="1" class="listbox" style="display:none" onchange="return selectaction(this,'u');"> <option value="">{$lang_usermgr_php['select_group']}</option> EOT; $sql = "SELECT group_id, group_name FROM {$CONFIG['TABLE_USERGROUPS']} ORDER BY group_name"; $result = cpg_db_query($sql); $group_list = cpg_db_fetch_rowset($result); mysql_free_result($result); if (isset($element[1])) { $sel_group = $user_data[$element[1]]; } else { $sel_group = ''; } foreach ($group_list as $group) { if ($group['group_id'] != 3) { print ' <option value="' . $group['group_id'] . '"' . ($group['group_id'] == $sel_group ? ' selected' : '') . '>' . $group['group_name'] . '</option>' . $LINEBREAK; } } $help_create = ' ' . cpg_display_help('f=users.htm&as=user_cp_new&ae=user_cp_new_end', '600', '250'); $create_new_user_icon = cpg_fetch_icon('add_user', 2); list($timestamp, $form_token) = getFormToken(); echo <<<EOT </select> <select name="delete_files" size="1" class="listbox" style="display:none"> <option value="no">{$lang_usermgr_php['delete_files_no']}</option> <option value="yes">{$lang_usermgr_php['delete_files_yes']}</option> </select> <select name="delete_comments" size="1" class="listbox" style="display:none"> <option value="no">{$lang_usermgr_php['delete_comments_no']}</option> <option value="yes">{$lang_usermgr_php['delete_comments_yes']}</option> </select> <button type="submit" class="button" name="go" value="{$lang_usermgr_php['submit']}" style="display:none">{$icon_array['ok']}{$lang_usermgr_php['submit']}</button> </td> </tr> </table> <input type="hidden" name="form_token" value="{$form_token}" /> <input type="hidden" name="timestamp" value="{$timestamp}" /> </td> <td align="right" class="tablef">{$totalCommentCount_fmt}</td> {$pictures_quota_footer} </tr> EOT; endtable(); echo '</form>'; starttable('100%'); echo <<<EOT <tr> <td colspan="{$number_of_columns}" class="tablef" align="center" valign="middle"> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td class="tablef" align="center" valign="middle"> <form method="post" action="{$CPG_PHP_SELF}" name="searchUser" id="cpgform2"> <input type="text" name="username" class="textinput" {$search_string_default} /> <button type="submit" class="button" name="user_search" value="{$lang_usermgr_php['search_submit']}">{$icon_array['search']}{$lang_usermgr_php['search_submit']}</button> {$help} </form> </td> <td class="tablef" align="center" valign="middle"> <a href="{$CPG_PHP_SELF}?op=new_user&form_token={$form_token}&timestamp={$timestamp}" {$makereadonly}class="admin_menu">{$create_new_user_icon}{$lang_usermgr_php['create_new_user']}</a> {$help_create} </td> </tr> </table> </td> </tr> EOT; } else { echo <<<EOT <tr> <td colspan="{$number_of_columns_minus_three}" class="tablef" align="left" valign="middle"> {$lang_usermgr_php['total']} </td> <td class="tablef" align="right" valign="middle"> {$totalCommentCount_fmt} </td> {$pictures_quota_footer} </tr> EOT; } // Accept footer addons for the user manager echo CPGPluginAPI::filter('usermgr_footer', ''); if ($tabs) { echo <<<EOT <tr> <td colspan="{$number_of_columns}" style="padding: 0px;"> <table width="100%" cellspacing="0" cellpadding="0"> <tr> {$tabs} </tr> </table> </td> </tr> EOT; } endtable(); }
if ($user_data['disk_usage'] != '') { $disk_usage = $user_data['disk_usage']; } else { $disk_usage = 0; } $group_quota = '0'; $group_quota_separator = ''; if ($USER_DATA['group_quota']) { $group_quota = $USER_DATA['group_quota']; $group_quota_separator = '/'; } if (!GALLERY_ADMIN_MODE && $group_quota > 0) { $disk_usage = ceil($disk_usage / 1024); $disk_usage_output = theme_display_bar($disk_usage, $group_quota, 300, '', '', $group_quota_separator . $group_quota . $lang_byte_units[1], 'red', 'green'); } else { $disk_usage_output = cpg_format_bytes($disk_usage); } $form_data = array('username' => $user_data['user_name'], 'reg_date' => localised_date($user_data['user_regdate'], $lang_date['register']), 'status' => $user_status, 'group' => $user_data['group_name'] . $group_list, 'email' => $user_data['user_email'], 'disk_usage' => $disk_usage_output, 'user_profile1' => $user_data['user_profile1'], 'user_profile2' => $user_data['user_profile2'], 'user_profile3' => $user_data['user_profile3'], 'user_profile4' => $user_data['user_profile4'], 'user_profile5' => $user_data['user_profile5'], 'user_profile6' => $user_data['user_profile6']); $title = sprintf($lang_register_php['x_s_profile'], stripslashes(USER_NAME)); pageheader($title); echo <<<EOT <form name="cpgform" id="cpgform" method="post" action="{$CPG_PHP_SELF}"> EOT; starttable(-1, cpg_fetch_icon('my_profile', 2) . $title, 2); make_form($edit_profile_form_param, $form_data); $pic_count = cpgUserPicCount(USER_ID); $user_thumb = cpgUserThumb(USER_ID); $userID = USER_ID; $lastComArray = cpgUserLastComment(USER_ID); if ($lastComArray['count'] > 0) {
} if ($superCage->get->keyExists('h') && preg_match('/^(lang_[a-z0-9_]+)(\\[([a-z0-9_]+)\\])?$/', $superCage->get->getEscaped('h'), $matches)) { $header = !isset($matches[2]) ? ${$matches[1]} : ${$matches[1]}[$matches[3]]; } else { $header = ''; } if ($superCage->get->keyExists('t') && preg_match('/^(lang_[a-z0-9_]+)(\\[([a-z0-9_]+)\\])?$/', $superCage->get->getEscaped('t'), $matches)) { if ($matches[1] == 'lang_tmp_picture_manager') { $text = <<<EOT <ul> <li>{$lang_picmgr_php['explanation1']}</li> <li>{$lang_picmgr_php['explanation2']}</li> </ul> EOT; } elseif ($matches[1] == 'lang_tmp_upload') { $restriction_filesize = sprintf($lang_upload_php['restriction_filesize'], '<strong>' . cpg_format_bytes($CONFIG['max_upl_size'] * 1024) . '</strong>'); if ($CONFIG['allowed_img_types'] != '') { $allowed_img_types = '<li>' . sprintf($lang_upload_php['allowed_img_types'], $CONFIG['allowed_img_types']) . '</li>'; } else { $allowed_img_types = ''; } if ($CONFIG['allowed_mov_types'] != '') { $allowed_mov_types = '<li>' . sprintf($lang_upload_php['allowed_mov_types'], $CONFIG['allowed_mov_types']) . '</li>'; } else { $allowed_mov_types = ''; } if ($CONFIG['allowed_snd_types'] != '') { $allowed_snd_types = '<li>' . sprintf($lang_upload_php['allowed_snd_types'], $CONFIG['allowed_snd_types']) . '</li>'; } else { $allowed_snd_types = ''; }
function form_instructions() { global $lang_upload_php, $max_file_size; $max_fsize = sprintf($lang_upload_php['max_fsize'], cpg_format_bytes($max_file_size)); echo <<<EOT <tr> <td colspan="2" class="tableh2"> <noscript> <div class="cpg_message_error">{$lang_upload_php['err_js_disabled']}<br /> {$lang_upload_php['err_alternate_method']}</div> </noscript> <div id="divLoadingContent" class="cpg_message_info" style="display: none;">{$lang_upload_php['flash_loading']}</div> <div id="divLongLoading" class="cpg_message_warning" style="display: none;">{$lang_upload_php['err_flash_disabled']}<br />{$lang_upload_php['err_alternate_method']}</div> <div id="divAlternateContent" class="cpg_message_error" style="display: none;">{$lang_upload_php['err_flash_version']}<br />{$lang_upload_php['err_alternate_method']}</div> <div id="divMaxFilesize" style="display: none;"><strong>{$max_fsize}</strong></div> </td> </tr> EOT; }
/** * cpg_debug_output() * * defined new debug_output function here in functions.inc.php instead of theme.php with different function names to avoid incompatibilities with users not updating their themes as required. Advanced info is only output if (GALLERY_ADMIN_MODE == TRUE) * **/ function cpg_debug_output() { global $USER, $USER_DATA, $CONFIG, $cpg_time_start, $query_stats, $queries, $lang_cpg_debug_output, $CPG_PHP_SELF, $superCage, $CPG_PLUGINS, $LINEBREAK; if ($CONFIG['performance_timestamp'] == 0 || date('Y-m-d', $CONFIG['performance_timestamp']) < date('Y-m-d')) { // The metering data in the config table are outdated, let's write fresh values. // Currently happens each day. To extend the metering period to a whole week, // use 'Y-m-W' for both date functions above. Use 'Y-m' to extend the period over // one month and subsequently 'Y' for an entire year. $CONFIG['performance_timestamp'] = time(); cpg_config_set('performance_timestamp', $CONFIG['performance_timestamp']); $CONFIG['performance_page_generation_time'] = 0; $CONFIG['performance_page_query_time'] = 0; $CONFIG['performance_page_query_count'] = 0; } $time_end = cpgGetMicroTime(); $time = round(($time_end - $cpg_time_start) * 1000, 2); if ($CONFIG['performance_page_generation_time'] < $time) { $CONFIG['performance_page_generation_time'] = $time; cpg_config_set('performance_page_generation_time', $CONFIG['performance_page_generation_time']); } $query_count = count($query_stats); $total_query_time = round(array_sum($query_stats), 2); if ($CONFIG['performance_page_query_time'] < $total_query_time) { $CONFIG['performance_page_query_time'] = $total_query_time; cpg_config_set('performance_page_query_time', $CONFIG['performance_page_query_time']); } if ($CONFIG['performance_page_query_count'] < $query_count) { $CONFIG['performance_page_query_count'] = $query_count; cpg_config_set('performance_page_query_count', $CONFIG['performance_page_query_count']); } $debug_underline = '
------------------
'; $debug_separate = '
==========================
'; $debug_toggle_link = $lang_cpg_debug_output['debug_output'] . ': <span class="detail_head_collapsed">' . $lang_cpg_debug_output['show_hide'] . '</span>'; $debug_help = ' ' . cpg_display_help('f=empty.htm&h=lang_cpg_debug_output[debug_output_explain]&t=lang_cpg_debug_output[copy_and_paste_instructions]', 470, 245); $debug_phpinfo_link = GALLERY_ADMIN_MODE ? '<a href="phpinfo.php" class="admin_menu">' . cpg_fetch_icon('phpinfo', 1) . $lang_cpg_debug_output['phpinfo'] . '</a> ' : ''; echo <<<EOT <script language="javascript" type="text/javascript"> <!-- addonload("document.getElementById('debug_output_select_all').style.display = 'inline'"); //--> </script> <form name="debug" action="{$CPG_PHP_SELF}" id="debug"> EOT; starttable('100%', cpg_fetch_icon('bug', 2) . $lang_cpg_debug_output['debug_info'] . $debug_help, 2); echo <<<EOT <tr> <td> </td> </tr> <tr> <td valign="top" align="left" class="tableb"> {$debug_phpinfo_link}{$debug_toggle_link} <span class="detail_body"> <button type="button" class="button" name="debug_output_select_all" style="display:none" id="debug_output_select_all" value="{$lang_cpg_debug_output['select_all']}" onclick="HighlightAll('debug.debugtext');">{$lang_cpg_debug_output['select_all']}</button><br /> <textarea rows="30" cols="60" class="debug_text" name="debugtext"> EOT; echo "USER: "******"USER DATA:"; echo $debug_underline; echo htmlentities(print_r($USER_DATA, true)); echo $debug_separate; echo "Queries:"; echo $debug_underline; echo htmlentities(print_r($queries, true)); echo $debug_separate; echo "GET :"; echo $debug_underline; echo htmlentities(print_r($superCage->get->_source, true)); echo $debug_separate; echo "POST :"; echo $debug_underline; echo htmlentities(print_r($superCage->post->_source, true)); echo $debug_separate; echo "COOKIE :"; echo $debug_underline; echo htmlentities(print_r($superCage->cookie->_source, true)); echo $debug_separate; if ($superCage->cookie->keyExists('PHPSESSID')) { echo "SESSION :"; echo $debug_underline; if (!isset($_SESSION)) { session_id($superCage->cookie->getAlnum('PHPSESSID')); session_start(); } echo htmlentities(print_r($_SESSION, true)); echo $debug_separate; } if (GALLERY_ADMIN_MODE) { $table = array(); echo "VERSION INFO :"; echo $debug_underline; $my_php_version = phpversion(); if ($my_php_version == '') { $my_php_version = PHP_VERSION; } if (version_compare($my_php_version, '4.3.0', '>=')) { $version_comment = 'OK'; } else { $version_comment = 'Your PHP version isn\'t good enough! Minimum requirements: 4.3.0'; } $table[] = array('PHP version', $my_php_version, $version_comment); $mySqlVersion = cpg_phpinfo_mysql_version(); if (version_compare($mySqlVersion, '3.23.23', '>=')) { $version_comment = 'OK'; } else { $version_comment = 'Your MySQL version isn\'t good enough! Minimum requirements: 3.23.23'; } $table[] = array('MySQL version', $mySqlVersion, $version_comment); $table[] = array('Coppermine version', COPPERMINE_VERSION, COPPERMINE_VERSION_STATUS); echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($table); echo $debug_separate; if (function_exists('gd_info') == true) { echo 'Module: GD'; echo $debug_underline; $gd_array = gd_info(); $table = array(); if (array_key_exists('GD Version', $gd_array) == TRUE) { $table[] = array('Exact version', preg_replace('/[[:alpha:][:space:]()]+/', '', $gd_array['GD Version'])); } foreach ($gd_array as $key => $value) { $table[] = array($key, $value); } echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($gd_array); unset($table); echo $debug_separate; } else { echo cpg_phpinfo_mod_output('gd', 'text', '|'); } echo 'Key config settings'; echo $debug_underline; $table = array(); $table[] = array('site_url', $CONFIG['site_url']); $table[] = array('charset', $CONFIG['charset']); $table[] = array('allow_private_albums', $CONFIG['allow_private_albums']); $table[] = array('cookie_name', $CONFIG['cookie_name']); $table[] = array('cookie_path', $CONFIG['cookie_path']); $table[] = array('impath', $CONFIG['impath']); $table[] = array('lang', $CONFIG['lang']); $table[] = array('main_page_layout', $CONFIG['main_page_layout']); $table[] = array('silly_safe_mode', $CONFIG['silly_safe_mode']); $table[] = array('smtp_host', $CONFIG['smtp_host']); $table[] = array('theme', $CONFIG['theme']); $table[] = array('thumb_method', $CONFIG['thumb_method']); echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($table); echo $debug_separate; echo 'Plugins'; echo $debug_underline; $table = array(); foreach ($CPG_PLUGINS as $plugin) { $table[] = array('Name', $plugin->name); $table[] = array('Actions', implode(', ', array_keys($plugin->actions))); $table[] = array('Filters', implode(', ', array_keys($plugin->filters))); $table[] = array('--------------'); } echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($table); echo $debug_separate; echo 'Server restrictions'; echo $debug_underline; $table = array(); $table[] = array('safe_mode', ini_get('safe_mode')); $table[] = array('safe_mode_exec_dir', ini_get('safe_mode_exec_dir')); $table[] = array('safe_mode_gid', ini_get('safe_mode_gid')); $table[] = array('safe_mode_include_dir', ini_get('safe_mode_include_dir')); $table[] = array('sql.safe_mode', ini_get('sql.safe_mode')); $table[] = array('disable_functions', ini_get('disable_functions')); $table[] = array('file_uploads', ini_get('file_uploads')); $table[] = array('include_path', ini_get('include_path')); $table[] = array('open_basedir', ini_get('open_basedir')); $table[] = array('allow_url_fopen', ini_get('allow_url_fopen')); $table[] = array('max_execution_time', ini_get('max_execution_time')); $table[] = array('max_input_time', ini_get('max_input_time')); $table[] = array('upload_max_filesize', ini_get('upload_max_filesize')); $table[] = array('post_max_size', ini_get('post_max_size')); $table[] = array('memory_limit', ini_get('memory_limit')); $table[] = array('suhosin.post.max_vars', ini_get('suhosin.post.max_vars')); $table[] = array('suhosin.request.max_vars', ini_get('suhosin.request.max_vars')); echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($table); echo $LINEBREAK . $debug_separate; echo 'Page (performance)'; echo $debug_underline; $table = array(); $table[] = array('Parameter', 'Current', 'Peak'); if (function_exists('memory_get_peak_usage')) { $peak_memory_usage = cpg_format_bytes(memory_get_peak_usage()); } else { $peak_memory_usage = 'n/a'; } $table[] = array('Memory usage', cpg_format_bytes(memory_get_usage()), $peak_memory_usage); $table[] = array('Page generation', $time . ' ms', $CONFIG['performance_page_generation_time'] . ' ms'); $table[] = array('Page query time', $total_query_time . ' ms', $CONFIG['performance_page_query_time'] . ' ms'); $table[] = array('Page query count', $query_count, $CONFIG['performance_page_query_count']); echo cpg_fill_string_array_with_spaces($table, ' ', 'left', 'string'); unset($table); echo $LINEBREAK . $debug_separate; } echo <<<EOT </textarea> </span> </td> </tr> EOT; if ($CONFIG['debug_notice'] != 0) { // Maze's error report system global $cpgdebugger; $report = $cpgdebugger->stop(); //$debug_notices_icon = cpg_fetch_icon('text_left', 2); if (GALLERY_ADMIN_MODE) { $notices_help = 'notices_help_admin'; } else { $notices_help = 'notices_help_non_admin'; } $notices_help = ' ' . cpg_display_help('f=empty.htm&h=lang_cpg_debug_output[notices]&t=lang_cpg_debug_output[' . $notices_help . ']', 470, 245); if (is_array($report)) { echo <<<EOT <tr> <td class="tableh2"> {$lang_cpg_debug_output['notices']}{$notices_help} </td> </tr> EOT; $noticesLoopCounter = 0; foreach ($report as $file => $errors) { if ($noticesLoopCounter / 2 == floor($noticesLoopCounter / 2)) { $cellstyle = 'tableb tableb_alternate'; } else { $cellstyle = 'tableb'; } echo <<<EOT <tr> <td class="{$cellstyle}"> EOT; //echo '<strong>' . substr($file, $strstart) . '</strong><ul>'; //$strstart does not exist echo '<strong>' . $file . '</strong><ul>'; foreach ($errors as $error) { echo "<li>{$error}</li>"; } echo <<<EOT </ul> </td> </tr> EOT; $noticesLoopCounter++; } } } endtable(); echo '</form>'; }
$option_output['plugin_enlargeit_buttonhist'] .= ''; } else { $option_output['plugin_enlargeit_buttonhist'] .= ' disabled="disabled"'; } if ($enlargeit_gd_version == '') { $enlargeit_gd_version = $lang_plugin_enlargeit['not_available']; } $gd_version_string = sprintf($lang_plugin_enlargeit['gd_version'], $enlargeit_gd_version); $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']} WHERE histogram_filesize>'0'"); list($cache_count) = mysql_fetch_row($result); mysql_free_result($result); $result = cpg_db_query("SELECT SUM(histogram_filesize) AS sum_histogram FROM {$CONFIG['TABLE_PICTURES']} WHERE histogram_filesize>'0'"); $row = mysql_fetch_assoc($result); $cache_sum = $row['sum_histogram']; mysql_free_result($result); $cached_files = sprintf($lang_plugin_enlargeit['file_cache_x_files_using_x_bytes'], cpg_float2decimal($cache_count), cpg_format_bytes($cache_sum)); if ($CONFIG['plugin_enlargeit_buttonnav'] == '1') { $option_output['plugin_enlargeit_buttonnav'] = 'checked="checked"'; } else { $option_output['plugin_enlargeit_buttonnav'] = ''; } if ($CONFIG['plugin_enlargeit_buttonclose'] == '1') { $option_output['plugin_enlargeit_buttonclose'] = 'checked="checked"'; } else { $option_output['plugin_enlargeit_buttonclose'] = ''; } if ($CONFIG['plugin_enlargeit_flvplayer'] == '0') { $option_output['plugin_enlargeit_flvplayer_0'] = 'checked="checked"'; $option_output['plugin_enlargeit_flvplayer_1'] = ''; } elseif ($CONFIG['plugin_enlargeit_flvplayer'] == '1') { //