📄 xoopslists.php
字号:
<?php
// $Id: xoopslists.php 1029 2007-09-09 03:49:25Z phppp $
// ------------------------------------------------------------------------ //
// XOOPS - PHP Content Management System //
// Copyright (c) 2000 XOOPS.org //
// <http://www.xoops.org/> //
// ------------------------------------------------------------------------ //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation; either version 2 of the License, or //
// (at your option) any later version. //
// //
// You may not change or alter any portion of this comment or credits //
// of supporting developers from this source code or any supporting //
// source code which is considered copyrighted (c) material of the //
// original comment or credit authors. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program; if not, write to the Free Software //
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
// ------------------------------------------------------------------------ //
// Author: The XOOPS Project //
// URL: http://www.xoops.org/ //
// Project: The XOOPS Project //
// ------------------------------------------------------------------------- //
if ( !defined("XOOPS_LISTS_INCLUDED") ) {
define("XOOPS_LISTS_INCLUDED",1);
class XoopsLists
{
function getTimeZoneList()
{
include_once XOOPS_ROOT_PATH.'/language/'.$GLOBALS['xoopsConfig']['language'].'/timezone.php';
$time_zone_list = array ("-12" => _TZ_GMTM12, "-11" => _TZ_GMTM11, "-10" => _TZ_GMTM10, "-9" => _TZ_GMTM9, "-8" => _TZ_GMTM8, "-7" => _TZ_GMTM7, "-6" => _TZ_GMTM6, "-5" => _TZ_GMTM5, "-4" => _TZ_GMTM4, "-3.5" => _TZ_GMTM35, "-3" => _TZ_GMTM3, "-2" => _TZ_GMTM2, "-1" => _TZ_GMTM1, "0" => _TZ_GMT0, "1" => _TZ_GMTP1, "2" => _TZ_GMTP2, "3" => _TZ_GMTP3, "3.5" => _TZ_GMTP35, "4" => _TZ_GMTP4, "4.5" => _TZ_GMTP45, "5" => _TZ_GMTP5, "5.5" => _TZ_GMTP55, "6" => _TZ_GMTP6, "7" => _TZ_GMTP7, "8" => _TZ_GMTP8, "9" => _TZ_GMTP9, "9.5" => _TZ_GMTP95, "10" => _TZ_GMTP10, "11" => _TZ_GMTP11, "12" => _TZ_GMTP12);
return $time_zone_list;
}
/*
* gets list of themes folder from themes directory
*/
function getThemesList()
{
return XoopsLists::getDirListAsArray(XOOPS_THEME_PATH.'/');
}
/*
* gets a list of module folders from the modules directory
*/
function getModulesList()
{
return XoopsLists::getDirListAsArray(XOOPS_ROOT_PATH."/modules/");
}
/*
* gets list of name of directories inside a directory
*/
function getDirListAsArray( $dirname ) {
$ignored = array( 'cvs', '_darcs' );
$list = array();
if ( substr( $dirname, -1 ) != '/' ) {
$dirname .= '/';
}
if ( $handle = opendir( $dirname ) ) {
while ( $file = readdir( $handle ) ) {
if ( substr( $file, 0, 1 ) == '.' || in_array( strtolower( $file ), $ignored ) ) continue;
if ( is_dir( $dirname . $file ) ) {
$list[$file] = $file;
}
}
closedir( $handle );
asort( $list );
reset( $list );
}
return $list;
}
/*
* gets list of all files in a directory
*/
function getFileListAsArray($dirname, $prefix="")
{
$filelist = array();
if (substr($dirname, -1) == '/') {
$dirname = substr($dirname, 0, -1);
}
if (is_dir($dirname) && $handle = opendir($dirname)) {
while (false !== ($file = readdir($handle))) {
if (!preg_match("/^[\.]{1,2}$/",$file) && is_file($dirname.'/'.$file)) {
$file = $prefix.$file;
$filelist[$file] = $file;
}
}
closedir($handle);
asort($filelist);
reset($filelist);
}
return $filelist;
}
/*
* gets list of image file names in a directory
*/
function getImgListAsArray($dirname, $prefix="")
{
$filelist = array();
if ($handle = opendir($dirname)) {
while (false !== ($file = readdir($handle))) {
if ( preg_match("/(\.gif|\.jpg|\.png)$/i", $file) ) {
$file = $prefix.$file;
$filelist[$file] = $file;
}
}
closedir($handle);
asort($filelist);
reset($filelist);
}
return $filelist;
}
/*
* gets list of html file names in a certain directory
*/
function getHtmlListAsArray($dirname, $prefix="")
{
$filelist = array();
if ($handle = opendir($dirname)) {
while (false !== ($file = readdir($handle))) {
if ( ( preg_match( "/(\.htm|\.html|\.xhtml)$/i", $file ) && !is_dir( $file ) ) ) {
$file = $prefix.$file;
$filelist[$file] = $prefix.$file;
}
}
closedir($handle);
asort($filelist);
reset($filelist);
}
return $filelist;
}
/*
* gets list of avatar file names in a certain directory
* if directory is not specified, default directory will be searched
*/
function getAvatarsList($avatar_dir="")
{
$avatars = array();
if ( $avatar_dir != "" ) {
$avatars = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/images/avatar/".$avatar_dir."/", $avatar_dir."/");
} else {
$avatars = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/images/avatar/");
}
return $avatars;
}
/*
* gets list of all avatar image files inside default avatars directory
*/
function getAllAvatarsList()
{
$avatars = array();
$dirlist = array();
$dirlist = XoopsLists::getDirListAsArray(XOOPS_ROOT_PATH."/images/avatar/");
if ( count($dirlist) > 0 ) {
foreach ( $dirlist as $dir ) {
$avatars[$dir] =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/images/avatar/".$dir."/", $dir."/");
}
} else {
return false;
}
return $avatars;
}
/*
* gets list of subject icon image file names in a certain directory
* if directory is not specified, default directory will be searched
*/
function getSubjectsList($sub_dir="")
{
$subjects = array();
if($sub_dir != ""){
$subjects = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/images/subject/".$sub_dir, $sub_dir."/");
} else {
$subjects = XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/images/subject/");
}
return $subjects;
}
/*
* gets list of language folders inside default language directory
*/
function getLangList()
{
$lang_list = array();
$lang_list = XoopsLists::getDirListAsArray(XOOPS_ROOT_PATH."/language/");
return $lang_list;
}
function getCountryList()
{
$country_list = array (
"" => "-",
"AD" => "Andorra",
"AE" => "United Arab Emirates",
"AF" => "Afghanistan",
"AG" => "Antigua and Barbuda",
"AI" => "Anguilla",
"AL" => "Albania",
"AM" => "Armenia",
"AN" => "Netherlands Antilles",
"AO" => "Angola",
"AQ" => "Antarctica",
"AR" => "Argentina",
"AS" => "American Samoa",
"AT" => "Austria",
"AU" => "Australia",
"AW" => "Aruba",
"AZ" => "Azerbaijan",
"BA" => "Bosnia and Herzegovina",
"BB" => "Barbados",
"BD" => "Bangladesh",
"BE" => "Belgium",
"BF" => "Burkina Faso",
"BG" => "Bulgaria",
"BH" => "Bahrain",
"BI" => "Burundi",
"BJ" => "Benin",
"BM" => "Bermuda",
"BN" => "Brunei Darussalam",
"BO" => "Bolivia",
"BR" => "Brazil",
"BS" => "Bahamas",
"BT" => "Bhutan",
"BV" => "Bouvet Island",
"BW" => "Botswana",
"BY" => "Belarus",
"BZ" => "Belize",
"CA" => "Canada",
"CC" => "Cocos (Keeling) Islands",
"CF" => "Central African Republic",
"CG" => "Congo",
"CH" => "Switzerland",
"CI" => "Cote D'Ivoire (Ivory Coast)",
"CK" => "Cook Islands",
"CL" => "Chile",
"CM" => "Cameroon",
"CN" => "China",
"CO" => "Colombia",
"CR" => "Costa Rica",
"CS" => "Czechoslovakia (former)",
"CU" => "Cuba",
"CV" => "Cape Verde",
"CX" => "Christmas Island",
"CY" => "Cyprus",
"CZ" => "Czech Republic",
"DE" => "Germany",
"DJ" => "Djibouti",
"DK" => "Denmark",
"DM" => "Dominica",
"DO" => "Dominican Republic",
"DZ" => "Algeria",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -