Index: includes/file.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/file.inc,v retrieving revision 1.135 diff -u -r1.135 file.inc --- includes/file.inc 20 Sep 2008 03:49:23 -0000 1.135 +++ includes/file.inc 29 Sep 2008 22:38:02 -0000 @@ -96,7 +96,7 @@ if (strpos($path, file_directory_path() . '/') === 0) { $path = trim(substr($path, strlen(file_directory_path())), '\\/'); } - switch (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC)) { + switch (variable_get('file_downloads')) { case FILE_DOWNLOADS_PUBLIC: return $GLOBALS['base_url'] . '/' . file_directory_path() . '/' . str_replace('\\', '/', $path); case FILE_DOWNLOADS_PRIVATE: @@ -399,7 +399,7 @@ $original = $filename; // Allow potentially insecure uploads for very savvy users and admin - if (!variable_get('allow_insecure_uploads', 0)) { + if (!variable_get('allow_insecure_uploads')) { $whitelist = array_unique(explode(' ', trim($extensions))); // Split the filename up by periods. The first part becomes the basename @@ -587,7 +587,7 @@ $extensions = ''; foreach ($user->roles as $rid => $name) { $extensions .= ' ' . variable_get("upload_extensions_$rid", - variable_get('upload_extensions_default', 'jpg jpeg gif png txt html doc xls pdf ppt pps odt ods odp')); + variable_get('upload_extensions_default')); } // Begin building file object. @@ -1026,7 +1026,7 @@ * @return A string containing a temp directory. */ function file_directory_temp() { - $temporary_directory = variable_get('file_directory_temp', NULL); + $temporary_directory = variable_get('file_directory_temp'); if (is_null($temporary_directory)) { $directories = array(); @@ -1065,7 +1065,7 @@ * @return A string containing the path to Drupal's 'files' directory. */ function file_directory_path() { - return variable_get('file_directory_path', conf_path() . '/files'); + return variable_get('file_directory_path'); } /** @@ -1100,354 +1100,7 @@ */ function file_get_mimetype($filename, $mapping = NULL) { if (!is_array($mapping)) { - $mapping = variable_get('mime_extension_mapping', array( - 'ez' => 'application/andrew-inset', - 'atom' => 'application/atom', - 'atomcat' => 'application/atomcat+xml', - 'atomsrv' => 'application/atomserv+xml', - 'cap|pcap' => 'application/cap', - 'cu' => 'application/cu-seeme', - 'tsp' => 'application/dsptype', - 'spl' => 'application/x-futuresplash', - 'hta' => 'application/hta', - 'jar' => 'application/java-archive', - 'ser' => 'application/java-serialized-object', - 'class' => 'application/java-vm', - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'image/x-corelphotopaint', - 'nb' => 'application/mathematica', - 'mdb' => 'application/msaccess', - 'doc|dot' => 'application/msword', - 'bin' => 'application/octet-stream', - 'oda' => 'application/oda', - 'ogg|ogx' => 'application/ogg', - 'pdf' => 'application/pdf', - 'key' => 'application/pgp-keys', - 'pgp' => 'application/pgp-signature', - 'prf' => 'application/pics-rules', - 'ps|ai|eps' => 'application/postscript', - 'rar' => 'application/rar', - 'rdf' => 'application/rdf+xml', - 'rss' => 'application/rss+xml', - 'rtf' => 'application/rtf', - 'smi|smil' => 'application/smil', - 'wpd' => 'application/wordperfect', - 'wp5' => 'application/wordperfect5.1', - 'xhtml|xht' => 'application/xhtml+xml', - 'xml|xsl' => 'application/xml', - 'zip' => 'application/zip', - 'cdy' => 'application/vnd.cinderella', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'kmz' => 'application/vnd.google-earth.kmz', - 'xul' => 'application/vnd.mozilla.xul+xml', - 'xls|xlb|xlt' => 'application/vnd.ms-excel', - 'cat' => 'application/vnd.ms-pki.seccat', - 'stl' => 'application/vnd.ms-pki.stl', - 'ppt|pps' => 'application/vnd.ms-powerpoint', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odb' => 'application/vnd.oasis.opendocument.database', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'otg' => 'application/vnd.oasis.opendocument.graphics-template', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'otp' => 'application/vnd.oasis.opendocument.presentation-template', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'ott' => 'application/vnd.oasis.opendocument.text-template', - 'oth' => 'application/vnd.oasis.opendocument.text-web', - 'docm' => 'application/vnd.ms-word.document.macroEnabled.12', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', - 'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12', - 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', - 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', - 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', - 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', - 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', - 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', - 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', - 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', - 'cod' => 'application/vnd.rim.cod', - 'mmf' => 'application/vnd.smaf', - 'sdc' => 'application/vnd.stardivision.calc', - 'sds' => 'application/vnd.stardivision.chart', - 'sda' => 'application/vnd.stardivision.draw', - 'sdd' => 'application/vnd.stardivision.impress', - 'sdf' => 'application/vnd.stardivision.math', - 'sdw' => 'application/vnd.stardivision.writer', - 'sgl' => 'application/vnd.stardivision.writer-global', - 'sxc' => 'application/vnd.sun.xml.calc', - 'stc' => 'application/vnd.sun.xml.calc.template', - 'sxd' => 'application/vnd.sun.xml.draw', - 'std' => 'application/vnd.sun.xml.draw.template', - 'sxi' => 'application/vnd.sun.xml.impress', - 'sti' => 'application/vnd.sun.xml.impress.template', - 'sxm' => 'application/vnd.sun.xml.math', - 'sxw' => 'application/vnd.sun.xml.writer', - 'sxg' => 'application/vnd.sun.xml.writer.global', - 'stw' => 'application/vnd.sun.xml.writer.template', - 'sis' => 'application/vnd.symbian.install', - 'vsd' => 'application/vnd.visio', - 'wbxml' => 'application/vnd.wap.wbxml', - 'wmlc' => 'application/vnd.wap.wmlc', - 'wmlsc' => 'application/vnd.wap.wmlscriptc', - 'wk' => 'application/x-123', - '7z' => 'application/x-7z-compressed', - 'abw' => 'application/x-abiword', - 'dmg' => 'application/x-apple-diskimage', - 'bcpio' => 'application/x-bcpio', - 'torrent' => 'application/x-bittorrent', - 'cab' => 'application/x-cab', - 'cbr' => 'application/x-cbr', - 'cbz' => 'application/x-cbz', - 'cdf' => 'application/x-cdf', - 'vcd' => 'application/x-cdlink', - 'pgn' => 'application/x-chess-pgn', - 'cpio' => 'application/x-cpio', - 'csh' => 'text/x-csh', - 'deb|udeb' => 'application/x-debian-package', - 'dcr|dir|dxr' => 'application/x-director', - 'dms' => 'application/x-dms', - 'wad' => 'application/x-doom', - 'dvi' => 'application/x-dvi', - 'rhtml' => 'application/x-httpd-eruby', - 'flac' => 'application/x-flac', - 'pfa|pfb|gsf|pcf|pcf.Z' => 'application/x-font', - 'mm' => 'application/x-freemind', - 'gnumeric' => 'application/x-gnumeric', - 'sgf' => 'application/x-go-sgf', - 'gcf' => 'application/x-graphing-calculator', - 'gtar|tgz|taz' => 'application/x-gtar', - 'hdf' => 'application/x-hdf', - 'phtml|pht|php' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'php3' => 'application/x-httpd-php3', - 'php3p' => 'application/x-httpd-php3-preprocessed', - 'php4' => 'application/x-httpd-php4', - 'ica' => 'application/x-ica', - 'ins|isp' => 'application/x-internet-signup', - 'iii' => 'application/x-iphone', - 'iso' => 'application/x-iso9660-image', - 'jnlp' => 'application/x-java-jnlp-file', - 'js' => 'application/x-javascript', - 'jmz' => 'application/x-jmol', - 'chrt' => 'application/x-kchart', - 'kil' => 'application/x-killustrator', - 'skp|skd|skt|skm' => 'application/x-koan', - 'kpr|kpt' => 'application/x-kpresenter', - 'ksp' => 'application/x-kspread', - 'kwd|kwt' => 'application/x-kword', - 'latex' => 'application/x-latex', - 'lha' => 'application/x-lha', - 'lyx' => 'application/x-lyx', - 'lzh' => 'application/x-lzh', - 'lzx' => 'application/x-lzx', - 'frm|maker|frame|fm|fb|book|fbdoc' => 'application/x-maker', - 'mif' => 'application/x-mif', - 'wmd' => 'application/x-ms-wmd', - 'wmz' => 'application/x-ms-wmz', - 'com|exe|bat|dll' => 'application/x-msdos-program', - 'msi' => 'application/x-msi', - 'nc' => 'application/x-netcdf', - 'pac' => 'application/x-ns-proxy-autoconfig', - 'nwc' => 'application/x-nwc', - 'o' => 'application/x-object', - 'oza' => 'application/x-oz-application', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'crl' => 'application/x-pkcs7-crl', - 'pyc|pyo' => 'application/x-python-code', - 'qtl' => 'application/x-quicktimeplayer', - 'rpm' => 'application/x-redhat-package-manager', - 'sh' => 'text/x-sh', - 'shar' => 'application/x-shar', - 'swf|swfl' => 'application/x-shockwave-flash', - 'sit|sitx' => 'application/x-stuffit', - 'sv4cpio' => 'application/x-sv4cpio', - 'sv4crc' => 'application/x-sv4crc', - 'tar' => 'application/x-tar', - 'tcl' => 'application/x-tcl', - 'gf' => 'application/x-tex-gf', - 'pk' => 'application/x-tex-pk', - 'texinfo|texi' => 'application/x-texinfo', - '~|%|bak|old|sik' => 'application/x-trash', - 't|tr|roff' => 'application/x-troff', - 'man' => 'application/x-troff-man', - 'me' => 'application/x-troff-me', - 'ms' => 'application/x-troff-ms', - 'ustar' => 'application/x-ustar', - 'src' => 'application/x-wais-source', - 'wz' => 'application/x-wingz', - 'crt' => 'application/x-x509-ca-cert', - 'xcf' => 'application/x-xcf', - 'fig' => 'application/x-xfig', - 'xpi' => 'application/x-xpinstall', - 'au|snd' => 'audio/basic', - 'mid|midi|kar' => 'audio/midi', - 'mpga|mpega|mp2|mp3|m4a' => 'audio/mpeg', - 'm3u' => 'audio/x-mpegurl', - 'oga|spx' => 'audio/ogg', - 'sid' => 'audio/prs.sid', - 'aif|aiff|aifc' => 'audio/x-aiff', - 'gsm' => 'audio/x-gsm', - 'wma' => 'audio/x-ms-wma', - 'wax' => 'audio/x-ms-wax', - 'ra|rm|ram' => 'audio/x-pn-realaudio', - 'ra' => 'audio/x-realaudio', - 'pls' => 'audio/x-scpls', - 'sd2' => 'audio/x-sd2', - 'wav' => 'audio/x-wav', - 'alc' => 'chemical/x-alchemy', - 'cac|cache' => 'chemical/x-cache', - 'csf' => 'chemical/x-cache-csf', - 'cbin|cascii|ctab' => 'chemical/x-cactvs-binary', - 'cdx' => 'chemical/x-cdx', - 'cer' => 'chemical/x-cerius', - 'c3d' => 'chemical/x-chem3d', - 'chm' => 'chemical/x-chemdraw', - 'cif' => 'chemical/x-cif', - 'cmdf' => 'chemical/x-cmdf', - 'cml' => 'chemical/x-cml', - 'cpa' => 'chemical/x-compass', - 'bsd' => 'chemical/x-crossfire', - 'csml|csm' => 'chemical/x-csml', - 'ctx' => 'chemical/x-ctx', - 'cxf|cef' => 'chemical/x-cxf', - 'emb|embl' => 'chemical/x-embl-dl-nucleotide', - 'spc' => 'chemical/x-galactic-spc', - 'inp|gam|gamin' => 'chemical/x-gamess-input', - 'fch|fchk' => 'chemical/x-gaussian-checkpoint', - 'cub' => 'chemical/x-gaussian-cube', - 'gau|gjc|gjf' => 'chemical/x-gaussian-input', - 'gal' => 'chemical/x-gaussian-log', - 'gcg' => 'chemical/x-gcg8-sequence', - 'gen' => 'chemical/x-genbank', - 'hin' => 'chemical/x-hin', - 'istr|ist' => 'chemical/x-isostar', - 'jdx|dx' => 'chemical/x-jcamp-dx', - 'kin' => 'chemical/x-kinemage', - 'mcm' => 'chemical/x-macmolecule', - 'mmd|mmod' => 'chemical/x-macromodel-input', - 'mol' => 'chemical/x-mdl-molfile', - 'rd' => 'chemical/x-mdl-rdfile', - 'rxn' => 'chemical/x-mdl-rxnfile', - 'sd|sdf' => 'chemical/x-mdl-sdfile', - 'tgf' => 'chemical/x-mdl-tgf', - 'mcif' => 'chemical/x-mmcif', - 'mol2' => 'chemical/x-mol2', - 'b' => 'chemical/x-molconn-Z', - 'gpt' => 'chemical/x-mopac-graph', - 'mop|mopcrt|mpc|dat|zmt' => 'chemical/x-mopac-input', - 'moo' => 'chemical/x-mopac-out', - 'mvb' => 'chemical/x-mopac-vib', - 'asn' => 'chemical/x-ncbi-asn1-spec', - 'prt|ent' => 'chemical/x-ncbi-asn1-ascii', - 'val|aso' => 'chemical/x-ncbi-asn1-binary', - 'pdb|ent' => 'chemical/x-pdb', - 'ros' => 'chemical/x-rosdal', - 'sw' => 'chemical/x-swissprot', - 'vms' => 'chemical/x-vamas-iso14976', - 'vmd' => 'chemical/x-vmd', - 'xtel' => 'chemical/x-xtel', - 'xyz' => 'chemical/x-xyz', - 'gif' => 'image/gif', - 'ief' => 'image/ief', - 'jpeg|jpg|jpe' => 'image/jpeg', - 'pcx' => 'image/pcx', - 'png' => 'image/png', - 'svg|svgz' => 'image/svg+xml', - 'tiff|tif' => 'image/tiff', - 'djvu|djv' => 'image/vnd.djvu', - 'wbmp' => 'image/vnd.wap.wbmp', - 'ras' => 'image/x-cmu-raster', - 'cdr' => 'image/x-coreldraw', - 'pat' => 'image/x-coreldrawpattern', - 'cdt' => 'image/x-coreldrawtemplate', - 'ico' => 'image/x-icon', - 'art' => 'image/x-jg', - 'jng' => 'image/x-jng', - 'bmp' => 'image/x-ms-bmp', - 'psd' => 'image/x-photoshop', - 'pnm' => 'image/x-portable-anymap', - 'pbm' => 'image/x-portable-bitmap', - 'pgm' => 'image/x-portable-graymap', - 'ppm' => 'image/x-portable-pixmap', - 'rgb' => 'image/x-rgb', - 'xbm' => 'image/x-xbitmap', - 'xpm' => 'image/x-xpixmap', - 'xwd' => 'image/x-xwindowdump', - 'eml' => 'message/rfc822', - 'igs|iges' => 'model/iges', - 'msh|mesh|silo' => 'model/mesh', - 'wrl|vrml' => 'model/vrml', - 'ics|icz' => 'text/calendar', - 'css' => 'text/css', - 'csv' => 'text/csv', - '323' => 'text/h323', - 'html|htm|shtml' => 'text/html', - 'uls' => 'text/iuls', - 'mml' => 'text/mathml', - 'asc|txt|text|pot' => 'text/plain', - 'rtx' => 'text/richtext', - 'sct|wsc' => 'text/scriptlet', - 'tm|ts' => 'text/texmacs', - 'tsv' => 'text/tab-separated-values', - 'jad' => 'text/vnd.sun.j2me.app-descriptor', - 'wml' => 'text/vnd.wap.wml', - 'wmls' => 'text/vnd.wap.wmlscript', - 'bib' => 'text/x-bibtex', - 'boo' => 'text/x-boo', - 'h++|hpp|hxx|hh' => 'text/x-c++hdr', - 'c++|cpp|cxx|cc' => 'text/x-c++src', - 'h' => 'text/x-chdr', - 'htc' => 'text/x-component', - 'c' => 'text/x-csrc', - 'd' => 'text/x-dsrc', - 'diff|patch' => 'text/x-diff', - 'hs' => 'text/x-haskell', - 'java' => 'text/x-java', - 'lhs' => 'text/x-literate-haskell', - 'moc' => 'text/x-moc', - 'p|pas' => 'text/x-pascal', - 'gcd' => 'text/x-pcs-gcd', - 'pl|pm' => 'text/x-perl', - 'py' => 'text/x-python', - 'etx' => 'text/x-setext', - 'tcl|tk' => 'text/x-tcl', - 'tex|ltx|sty|cls' => 'text/x-tex', - 'vcs' => 'text/x-vcalendar', - 'vcf' => 'text/x-vcard', - '3gp' => 'video/3gpp', - 'dl' => 'video/dl', - 'dif|dv' => 'video/dv', - 'fli' => 'video/fli', - 'gl' => 'video/gl', - 'mpeg|mpg|mpe' => 'video/mpeg', - 'mp4' => 'video/mp4', - 'ogv' => 'video/ogg', - 'qt|mov' => 'video/quicktime', - 'mxu' => 'video/vnd.mpegurl', - 'lsf|lsx' => 'video/x-la-asf', - 'mng' => 'video/x-mng', - 'asf|asx' => 'video/x-ms-asf', - 'wm' => 'video/x-ms-wm', - 'wmv' => 'video/x-ms-wmv', - 'wmx' => 'video/x-ms-wmx', - 'wvx' => 'video/x-ms-wvx', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie', - 'ice' => 'x-conference/x-cooltalk', - 'sisx' => 'x-epoc/x-sisx-app', - 'vrm|vrml|wrl' => 'x-world/x-vrml', - 'xps' => 'application/vnd.ms-xpsdocument', - )); + $mapping = variable_get('mime_extension_mapping'); } foreach ($mapping as $ext_preg => $mime_match) { if (preg_match('!\.('. $ext_preg .')$!i', $filename)) { Index: includes/mail.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/mail.inc,v retrieving revision 1.15 diff -u -r1.15 mail.inc --- includes/mail.inc 20 Sep 2008 20:22:23 -0000 1.15 +++ includes/mail.inc 29 Sep 2008 22:38:02 -0000 @@ -81,7 +81,7 @@ * accepted at php-level, which still doesn't guarantee it to be delivered.) */ function drupal_mail($module, $key, $to, $language, $params = array(), $from = NULL, $send = TRUE) { - $default_from = variable_get('site_mail', ini_get('sendmail_from')); + $default_from = variable_get('site_mail'); // Bundle up the variables into a structured array for altering. $message = array( @@ -172,8 +172,8 @@ */ function drupal_mail_send($message) { // Allow for a custom mail backend. - if (variable_get('smtp_library', '') && file_exists(variable_get('smtp_library', ''))) { - include_once DRUPAL_ROOT . '/' . variable_get('smtp_library', ''); + if (variable_get('smtp_library') && file_exists(variable_get('smtp_library'))) { + include_once DRUPAL_ROOT . '/' . variable_get('smtp_library'); return drupal_mail_wrapper($message); } else { Index: includes/language.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/language.inc,v retrieving revision 1.16 diff -u -r1.16 language.inc --- includes/language.inc 14 Apr 2008 17:48:33 -0000 1.16 +++ includes/language.inc 29 Sep 2008 22:38:02 -0000 @@ -13,7 +13,7 @@ global $user; // Configured presentation language mode. - $mode = variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE); + $mode = variable_get('language_negotiation'); // Get a list of enabled languages. $languages = language_list('enabled'); $languages = $languages[1]; @@ -113,7 +113,7 @@ $options['language'] = $language; } - switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) { + switch (variable_get('language_negotiation')) { case LANGUAGE_NEGOTIATION_NONE: // No language dependent path allowed in this mode. unset($options['language']); Index: includes/session.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/session.inc,v retrieving revision 1.60 diff -u -r1.60 session.inc --- includes/session.inc 27 Sep 2008 20:37:00 -0000 1.60 +++ includes/session.inc 29 Sep 2008 22:38:02 -0000 @@ -154,7 +154,7 @@ // Last access time is updated no more frequently // than once every 180 seconds. // This reduces contention in the users table. - if ($user->uid && REQUEST_TIME - $user->access > variable_get('session_write_interval', 180)) { + if ($user->uid && REQUEST_TIME - $user->access > variable_get('session_write_interval')) { db_query("UPDATE {users} SET access = %d WHERE uid = %d", REQUEST_TIME, $user->uid); } } Index: includes/cache.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/cache.inc,v retrieving revision 1.24 diff -u -r1.24 cache.inc --- includes/cache.inc 17 Sep 2008 07:11:55 -0000 1.24 +++ includes/cache.inc 29 Sep 2008 22:38:02 -0000 @@ -18,8 +18,8 @@ global $user; // Garbage collection necessary when enforcing a minimum cache lifetime - $cache_flush = variable_get('cache_flush', 0); - if ($cache_flush && ($cache_flush + variable_get('cache_lifetime', 0) <= REQUEST_TIME)) { + $cache_flush = variable_get('cache_flush'); + if ($cache_flush && ($cache_flush + variable_get('cache_lifetime') <= REQUEST_TIME)) { // Reset the variable immediately to prevent a meltdown in heavy load situations. variable_set('cache_flush', 0); // Time to flush old cache data @@ -30,7 +30,7 @@ if (isset($cache->data)) { // If the data is permanent or we're not enforcing a minimum cache lifetime // always return the cached data. - if ($cache->expire == CACHE_PERMANENT || !variable_get('cache_lifetime', 0)) { + if ($cache->expire == CACHE_PERMANENT || !variable_get('cache_lifetime')) { if ($cache->serialized) { $cache->data = unserialize($cache->data); } @@ -150,19 +150,19 @@ } if (empty($cid)) { - if (variable_get('cache_lifetime', 0)) { + if (variable_get('cache_lifetime')) { // We store the time in the current user's $user->cache variable which // will be saved into the sessions table by _sess_write(). We then // simulate that the cache was flushed for this user by not returning // cached data that was cached before the timestamp. $user->cache = REQUEST_TIME; - $cache_flush = variable_get('cache_flush', 0); + $cache_flush = variable_get('cache_flush'); if ($cache_flush == 0) { // This is the first request to clear the cache, start a timer. variable_set('cache_flush', REQUEST_TIME); } - else if (REQUEST_TIME > ($cache_flush + variable_get('cache_lifetime', 0))) { + else if (REQUEST_TIME > ($cache_flush + variable_get('cache_lifetime'))) { // Clear the cache for everyone, cache_flush_delay seconds have // passed since the first request to clear the cache. db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire < %d", CACHE_PERMANENT, REQUEST_TIME); Index: includes/menu.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/menu.inc,v retrieving revision 1.292 diff -u -r1.292 menu.inc --- includes/menu.inc 22 Sep 2008 03:19:43 -0000 1.292 +++ includes/menu.inc 29 Sep 2008 22:38:02 -0000 @@ -256,7 +256,7 @@ $ancestors = array(); $length = $number_parts - 1; $end = (1 << $number_parts) - 1; - $masks = variable_get('menu_masks', array()); + $masks = variable_get('menu_masks'); // Only examine patterns that actually exist as router items (the masks). foreach ($masks as $i) { if ($i > $end) { @@ -387,7 +387,7 @@ if (_menu_site_is_offline()) { return MENU_SITE_OFFLINE; } - if (variable_get('menu_rebuild_needed', FALSE)) { + if (variable_get('menu_rebuild_needed')) { menu_rebuild(); } if ($router_item = menu_get_item($path)) { @@ -950,7 +950,7 @@ // Use array_values() so that the indices are numeric for array_merge(). $args = $parents = array_unique(array_values($parents)); $placeholders = implode(', ', array_fill(0, count($args), '%d')); - $expanded = variable_get('menu_expanded', array()); + $expanded = variable_get('menu_expanded'); // Check whether the current menu has any links set to be expanded. if (in_array($menu_name, $expanded)) { // Collect all the links set to be expanded, and then add all of @@ -1262,7 +1262,7 @@ * Return an array of links to be rendered as the Main menu. */ function menu_main_menu() { - return menu_navigation_links(variable_get('menu_main_links_source', 'main-menu')); + return menu_navigation_links(variable_get('menu_main_links_source')); } /** @@ -1272,11 +1272,11 @@ // If the secondary menu source is set as the primary menu, we display the // second level of the primary menu. - if (variable_get('menu_secondary_links_source', 'secondary-menu') == variable_get('menu_main_links_source', 'main-menu')) { - return menu_navigation_links(variable_get('menu_main_links_source', 'main-menu'), 1); + if (variable_get('menu_secondary_links_source') == variable_get('menu_main_links_source')) { + return menu_navigation_links(variable_get('menu_main_links_source'), 1); } else { - return menu_navigation_links(variable_get('menu_secondary_links_source', 'secondary-menu'), 0); + return menu_navigation_links(variable_get('menu_secondary_links_source'), 0); } } @@ -2457,7 +2457,7 @@ */ function _menu_site_is_offline() { // Check if site is set to offline mode. - if (variable_get('site_offline', 0)) { + if (variable_get('site_offline')) { // Check if the user has administration privileges. if (user_access('administer site configuration')) { // Ensure that the offline message is displayed only once [allowing for Index: includes/theme.maintenance.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.maintenance.inc,v retrieving revision 1.18 diff -u -r1.18 theme.maintenance.inc --- includes/theme.maintenance.inc 20 Sep 2008 20:22:23 -0000 1.18 +++ includes/theme.maintenance.inc 29 Sep 2008 22:38:02 -0000 @@ -43,7 +43,7 @@ drupal_load('module', 'system'); drupal_load('module', 'filter'); - $theme = variable_get('maintenance_theme', 'minnelli'); + $theme = variable_get('maintenance_theme'); } $themes = list_themes(); @@ -231,12 +231,12 @@ // Construct page title if (drupal_get_title()) { - $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); + $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name')); } else { - $head_title = array(variable_get('site_name', 'Drupal')); - if (variable_get('site_slogan', '')) { - $head_title[] = variable_get('site_slogan', ''); + $head_title = array(variable_get('site_name')); + if (variable_get('site_slogan')) { + $head_title[] = variable_get('site_slogan'); } } $variables['head_title'] = implode(' | ', $head_title); @@ -244,7 +244,7 @@ $variables['front_page'] = url(); $variables['breadcrumb'] = ''; $variables['feed_icons'] = ''; - $variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE)); + $variables['footer_message'] = filter_xss_admin(variable_get('site_footer')); $variables['head'] = drupal_get_html_head(); $variables['help'] = ''; $variables['language'] = $GLOBALS['language']; @@ -255,8 +255,8 @@ $variables['main_menu'] = array(); $variables['secondary_menu'] = array(); $variables['search_box'] = ''; - $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''); - $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''); + $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name') : ''); + $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan') : ''); $variables['css'] = drupal_add_css(); $variables['styles'] = drupal_get_css(); $variables['scripts'] = drupal_get_js(); Index: includes/path.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/path.inc,v retrieving revision 1.24 diff -u -r1.24 path.inc --- includes/path.inc 24 Jun 2008 22:12:15 -0000 1.24 +++ includes/path.inc 29 Sep 2008 22:38:02 -0000 @@ -18,7 +18,7 @@ $_GET['q'] = drupal_get_normal_path(trim($_GET['q'], '/')); } else { - $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage', 'node')); + $_GET['q'] = drupal_get_normal_path(variable_get('site_frontpage')); } } @@ -218,7 +218,7 @@ function drupal_is_front_page() { // As drupal_init_path updates $_GET['q'] with the 'site_frontpage' path, // we can check it against the 'site_frontpage' variable. - return $_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage', 'node')); + return $_GET['q'] == drupal_get_normal_path(variable_get('site_frontpage')); } /** @@ -236,7 +236,7 @@ static $regexps; if (!isset($regexps[$patterns])) { - $regexps[$patterns] = '/^(' . preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1' . preg_quote(variable_get('site_frontpage', 'node'), '/') . '\2'), preg_quote($patterns, '/')) . ')$/'; + $regexps[$patterns] = '/^(' . preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\($|\|)/'), array('|', '.*', '\1' . preg_quote(variable_get('site_frontpage'), '/') . '\2'), preg_quote($patterns, '/')) . ')$/'; } return (bool)preg_match($regexps[$patterns], $path); } Index: includes/actions.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/actions.inc,v retrieving revision 1.18 diff -u -r1.18 actions.inc --- includes/actions.inc 26 Sep 2008 16:13:37 -0000 1.18 +++ includes/actions.inc 29 Sep 2008 22:38:02 -0000 @@ -40,7 +40,7 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a2 = NULL) { static $stack; $stack++; - if ($stack > variable_get('actions_max_stack', 35)) { + if ($stack > variable_get('actions_max_stack')) { watchdog('actions', 'Stack overflow: too many calls to actions_do(). Aborting to prevent infinite recursion.', array(), WATCHDOG_ERROR); return; } Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.799 diff -u -r1.799 common.inc --- includes/common.inc 20 Sep 2008 20:22:23 -0000 1.799 +++ includes/common.inc 29 Sep 2008 22:38:02 -0000 @@ -329,8 +329,7 @@ drupal_maintenance_theme(); drupal_set_header($_SERVER['SERVER_PROTOCOL'] . ' 503 Service unavailable'); drupal_set_title(t('Site offline')); - print theme('maintenance_page', filter_xss_admin(variable_get('site_offline_message', - t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))))); + print theme('maintenance_page', t(filter_xss_admin(variable_get('site_offline_message')), array('@site' => variable_get('site_name')))); } /** @@ -346,7 +345,7 @@ $_REQUEST['destination'] = $_GET['q']; } - $path = drupal_get_normal_path(variable_get('site_404', '')); + $path = drupal_get_normal_path(variable_get('site_404')); if ($path && $path != $_GET['q']) { // Set the active item in case there are tabs to display, or other // dependencies on the path. @@ -375,7 +374,7 @@ $_REQUEST['destination'] = $_GET['q']; } - $path = drupal_get_normal_path(variable_get('site_403', '')); + $path = drupal_get_normal_path(variable_get('site_403')); if ($path && $path != $_GET['q']) { // Set the active item in case there are tabs to display or other // dependencies on the path. @@ -419,7 +418,7 @@ // can't tie this call to any error because there is no surefire way to // tell whether a request has failed, so we add the check to places where // some parsing has failed. - if (!$self_test && variable_get('drupal_http_request_fails', FALSE)) { + if (!$self_test && variable_get('drupal_http_request_fails')) { $self_test = TRUE; $works = module_invoke('system', 'check_http_request'); $self_test = FALSE; @@ -621,7 +620,7 @@ $entry = $types[$errno] . ': ' . $message . ' in ' . $filename . ' on line ' . $line . '.'; // Force display of error messages in update.php. - if (variable_get('error_level', 1) == 1 || strstr($_SERVER['SCRIPT_NAME'], 'update.php')) { + if (variable_get('error_level') == 1 || strstr($_SERVER['SCRIPT_NAME'], 'update.php')) { drupal_set_message($entry, 'error'); } @@ -817,7 +816,7 @@ // handful of string replacements. See settings.php for examples. // Cache the $custom_strings variable to improve performance. if (!isset($custom_strings[$langcode])) { - $custom_strings[$langcode] = variable_get('locale_custom_strings_' . $langcode, array()); + $custom_strings[$langcode] = variable_get('locale_custom_strings_' . $langcode); } // Custom strings work for English too, even if locale module is disabled. if (isset($custom_strings[$langcode][$string])) { @@ -1215,11 +1214,11 @@ function format_date($timestamp, $type = 'medium', $format = '', $timezone = NULL, $langcode = NULL) { if (!isset($timezone)) { global $user; - if (variable_get('configurable_timezones', 1) && $user->uid && strlen($user->timezone)) { + if (variable_get('configurable_timezones') && $user->uid && strlen($user->timezone)) { $timezone = $user->timezone; } else { - $timezone = variable_get('date_default_timezone', 0); + $timezone = variable_get('date_default_timezone'); } } @@ -1227,17 +1226,17 @@ switch ($type) { case 'small': - $format = variable_get('date_format_short', 'm/d/Y - H:i'); + $format = variable_get('date_format_short'); break; case 'large': - $format = variable_get('date_format_long', 'l, F j, Y - H:i'); + $format = variable_get('date_format_long'); break; case 'custom': // No change to format. break; case 'medium': default: - $format = variable_get('date_format_medium', 'D, m/d/Y - H:i'); + $format = variable_get('date_format_medium'); } $max = strlen($format); @@ -1375,7 +1374,7 @@ // Cache the clean_url variable to improve performance. if (!isset($clean_url)) { - $clean_url = (bool)variable_get('clean_url', '0'); + $clean_url = (bool)variable_get('clean_url'); } if (!isset($options['base_url'])) { @@ -1525,7 +1524,7 @@ */ function drupal_page_footer() { - if (variable_get('cache', CACHE_DISABLED) != CACHE_DISABLED) { + if (variable_get('cache') != CACHE_DISABLED) { page_set_cache(); } @@ -1750,15 +1749,15 @@ $no_module_preprocess = ''; $no_theme_preprocess = ''; - $preprocess_css = (variable_get('preprocess_css', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')); + $preprocess_css = (variable_get('preprocess_css') && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')); $directory = file_directory_path(); - $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC); + $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads') == FILE_DOWNLOADS_PUBLIC); // A dummy query-string is added to filenames, to gain control over // browser-caching. The string changes on every update or full cache // flush, forcing browsers to load a new copy of the files, as the // URL changed. - $query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1); + $query_string = '?' . substr(variable_get('css_js_query_string'), 0, 1); foreach ($css as $media => $types) { // If CSS preprocessing is off, we still need to output the styles. @@ -2102,9 +2101,9 @@ $preprocessed = ''; $no_preprocess = array('core' => '', 'module' => '', 'theme' => ''); $files = array(); - $preprocess_js = (variable_get('preprocess_js', FALSE) && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')); + $preprocess_js = (variable_get('preprocess_js') && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')); $directory = file_directory_path(); - $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC); + $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads') == FILE_DOWNLOADS_PUBLIC); // A dummy query-string is added to filenames, to gain control over // browser-caching. The string changes on every update or full cache @@ -2112,7 +2111,7 @@ // URL changed. Files that should not be cached (see drupal_add_js()) // get REQUEST_TIME as query-string instead, to enforce reload on every // page request. - $query_string = '?' . substr(variable_get('css_js_query_string', '0'), 0, 1); + $query_string = '?' . substr(variable_get('css_js_query_string'), 0, 1); // For inline Javascript to validate as XHTML, all Javascript containing // XHTML needs to be wrapped in CDATA. To make that backwards compatible @@ -2377,7 +2376,7 @@ * String to encode */ function drupal_urlencode($text) { - if (variable_get('clean_url', '0')) { + if (variable_get('clean_url')) { return str_replace(array('%2F', '%26', '%23', '//'), array('/', '%2526', '%2523', '/%252F'), rawurlencode($text)); @@ -2432,7 +2431,7 @@ * The private key. */ function drupal_get_private_key() { - if (!($key = variable_get('drupal_private_key', 0))) { + if (!($key = variable_get('drupal_private_key'))) { $key = md5(drupal_random_bytes(64)); variable_set('drupal_private_key', $key); } @@ -2465,7 +2464,7 @@ */ function drupal_valid_token($token, $value = '', $skip_anonymous = FALSE) { global $user; - return (($skip_anonymous && $user->uid == 0) || ($token == md5(session_id() . $value . variable_get('drupal_private_key', '')))); + return (($skip_anonymous && $user->uid == 0) || ($token == md5(session_id() . $value . variable_get('drupal_private_key')))); } /** @@ -2553,7 +2552,7 @@ // This will fail in some cases, see page_get_cache() for the explanation. if ($data = ob_get_contents()) { $cache = TRUE; - if (variable_get('page_compression', TRUE) && function_exists('gzencode')) { + if (variable_get('page_compression') && function_exists('gzencode')) { // We do not store the data in case the zlib mode is deflate. // This should be rarely happening. if (zlib_get_coding_type() == 'deflate') { @@ -2586,7 +2585,7 @@ @set_time_limit(240); // Fetch the cron semaphore - $semaphore = variable_get('cron_semaphore', FALSE); + $semaphore = variable_get('cron_semaphore'); if ($semaphore) { if (REQUEST_TIME - $semaphore > 3600) { @@ -2629,7 +2628,7 @@ */ function drupal_cron_cleanup() { // See if the semaphore is still locked. - if (variable_get('cron_semaphore', FALSE)) { + if (variable_get('cron_semaphore')) { watchdog('cron', 'Cron run exceeded the time limit and was aborted.', array(), WATCHDOG_WARNING); // Release cron semaphore @@ -2674,7 +2673,7 @@ // table contains the name of the current profile, and we can call variable_get() // to determine what one is active. if (!isset($profile)) { - $profile = variable_get('install_profile', 'default'); + $profile = variable_get('install_profile'); } $searchdir = array($directory); $files = array(); @@ -3590,7 +3589,7 @@ * This is also called from update.php. */ function _drupal_flush_css_js() { - $string_history = variable_get('css_js_query_string', '00000000000000000000'); + $string_history = variable_get('css_js_query_string'); $new_character = $string_history[0]; $characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'; while (strpos($string_history, $new_character) !== FALSE) { Index: includes/install.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/install.inc,v retrieving revision 1.71 diff -u -r1.71 install.inc --- includes/install.inc 27 Sep 2008 20:03:35 -0000 1.71 +++ includes/install.inc 29 Sep 2008 22:38:02 -0000 @@ -590,6 +590,11 @@ } } + // Delete the module's variables automagically. + foreach (array_keys(module_invoke($module, 'variables')) as $variable) { + variable_del($variable); + } + drupal_set_installed_schema_version($module, SCHEMA_UNINSTALLED); } Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.228 diff -u -r1.228 bootstrap.inc --- includes/bootstrap.inc 20 Sep 2008 20:22:23 -0000 1.228 +++ includes/bootstrap.inc 29 Sep 2008 22:38:02 -0000 @@ -500,15 +500,12 @@ * * @param $name * The name of the variable to return. - * @param $default - * The default value to use if this variable has never been set. * @return * The value of the variable. */ -function variable_get($name, $default) { +function variable_get($name) { global $conf; - - return isset($conf[$name]) ? $conf[$name] : $default; + return isset($conf[$name]) ? $conf[$name] : variable_default($name); } /** @@ -522,15 +519,104 @@ */ function variable_set($name, $value) { global $conf; - - db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); - + // Do not store default values in the database. + if ($value == variable_default($name)) { + variable_del($name); + } + else { + db_merge('variable')->key(array('name' => $name))->fields(array('value' => serialize($value)))->execute(); + } + // Clear the cache and reset the variable. cache_clear_all('variables', 'cache'); - $conf[$name] = $value; } /** + * Gets the default value for a given variable. + * + * @param $name + * The name of the variable in question. + * @param $refresh + * If TRUE, refreshes the internal static cache. Defaults to FALSE. + * @return + * The default value for that variable, to be used in case no value is set. + */ +function variable_default($name, $refresh = FALSE) { + static $defaults; + static $invoked = FALSE; + if ($refresh) { + $defaults = array(); + $invoked = FALSE; + } + if (empty($defaults)) { + // These variables need to be initialized here because they are required to + // exist before the database is set up and the variable system initialized. + $defaults['cache_inc'] = './includes/cache.inc'; + $defaults['page_cache_fastpath'] = FALSE; + $defaults['blocked_ips'] = NULL; + $defaults['session_inc'] = './includes/session.inc'; + $defaults['dev_query'] = 0; + $defaults['reverse_proxy'] = 0; + $defaults['reverse_proxy_addresses'] = array(); + $defaults['cache'] = CACHE_DISABLED; + $defaults['cache_flush'] = 0; + $defaults['language_count'] = 1; + $defaults['session_write_interval'] = 180; + $defaults['site_frontpage'] = 'node'; + $defaults['install_profile_modules'] = array(); + $defaults['install_locale_batch_components'] = array(); + $defaults['password_inc'] = './includes/password.inc'; + $defaults['language_default'] = (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => ''); + } + // We use function_exists() here, because the registry may not be available early on in the page process. + if (!$invoked && !isset($defaults[$name]) && !array_key_exists($name, $defaults) && function_exists('module_invoke_all') && function_exists('drupal_alter') && (!defined('MAINTENANCE_MODE') || MAINTENANCE_MODE != 'update')) { + $invoked = TRUE; + $defaults += module_invoke_all('variables'); + drupal_alter('variable_defaults', $defaults); + } + if (empty($name)) { + return NULL; + } + if (isset($defaults[$name]) || array_key_exists($name, $defaults)) { + return $defaults[$name]; + } + // If we did not find the variable + $ancestor = variable_ancestor($name); + if ($ancestor) { + return variable_get($ancestor); + } + return NULL; +} + +/** + * Returns the ancestor of a given variable. The ancestor is defined as the + * variable name with everything after the last underscore chopped off, and the + * last underscore chopped off too for good measure. For example, for the + * variable 'foo_bar_baz_32', the following variables would be looked for by + * the variable ancestry sytem: + * * foo_bar_baz_32 + * * foo_bar_baz + * * foo_bar + * * foo + * If none of these are found, NULL is then returned by variable_default(). + * FALSE is returned by this function once we get down to try to find the + * variable ancestor of 'foo'. + * + * @param $name + * The name of the variable to return the ancestor of. + * @return + * The ancestor of the variable specified in $name, or FALSE on failure. + */ +function variable_ancestor($name) { + $parts = explode('_', $name); + if (count($parts) === 1) { + return FALSE; + } + array_pop($parts); + return implode('_', $parts); +} + +/** * Unset a persistent variable. * * @param $name @@ -662,7 +748,7 @@ header("Expires: Sun, 19 Nov 1978 05:00:00 GMT"); header("Cache-Control: must-revalidate"); - if (variable_get('page_compression', TRUE)) { + if (variable_get('page_compression')) { // Determine if the browser accepts gzipped data. if (@strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') === FALSE && function_exists('gzencode')) { // Strip the gzip header and run uncompress. @@ -919,7 +1005,7 @@ // Because this function is called on every page request, we first check // for an array of IP addresses in settings.php before querying the // database. - $blocked_ips = variable_get('blocked_ips', NULL); + $blocked_ips = variable_get('blocked_ips'); if (isset($blocked_ips) && is_array($blocked_ips)) { return in_array($ip, $blocked_ips); } @@ -1006,12 +1092,12 @@ case DRUPAL_BOOTSTRAP_EARLY_PAGE_CACHE: // Allow specifying special cache handlers in settings.php, like // using memcached or files for storing cache information. - require_once DRUPAL_ROOT . '/' . variable_get('cache_inc', 'includes/cache.inc'); + require_once DRUPAL_ROOT . '/' . variable_get('cache_inc'); // If the page_cache_fastpath is set to TRUE in settings.php and // page_cache_fastpath (implemented in the special implementation of // cache.inc) printed the page and indicated this with a returned TRUE // then we are done. - if (variable_get('page_cache_fastpath', FALSE) && page_cache_fastpath()) { + if (variable_get('page_cache_fastpath') && page_cache_fastpath()) { exit; } break; @@ -1035,7 +1121,7 @@ break; case DRUPAL_BOOTSTRAP_SESSION: - require_once DRUPAL_ROOT . '/' . variable_get('session_inc', 'includes/session.inc'); + require_once DRUPAL_ROOT . '/' . variable_get('session_inc'); session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy_sid', '_sess_gc'); session_start(); break; @@ -1045,7 +1131,7 @@ $conf = variable_init(isset($conf) ? $conf : array()); // Load module handling. require_once DRUPAL_ROOT . '/includes/module.inc'; - $cache_mode = variable_get('cache', CACHE_DISABLED); + $cache_mode = variable_get('cache'); // Get the page from the cache. $cache = $cache_mode == CACHE_DISABLED ? '' : page_get_cache(); // If the skipping of the bootstrap hooks is not enforced, call hook_boot. @@ -1116,7 +1202,7 @@ // Ensure the language is correctly returned, even without multilanguage support. // Useful for eg. XML/HTML 'lang' attributes. - if (variable_get('language_count', 1) == 1) { + if (variable_get('language_count') == 1) { $language = language_default(); } else { @@ -1141,7 +1227,7 @@ // Init language list if (!isset($languages)) { - if (variable_get('language_count', 1) > 1 || module_exists('locale')) { + if (variable_get('language_count') > 1 || module_exists('locale')) { $result = db_query('SELECT * FROM {languages} ORDER BY weight ASC, name ASC'); while ($row = db_fetch_object($result)) { $languages['language'][$row->language] = $row; @@ -1177,7 +1263,7 @@ * Optional property of the language object to return */ function language_default($property = NULL) { - $language = variable_get('language_default', (object) array('language' => 'en', 'name' => 'English', 'native' => 'English', 'direction' => 0, 'enabled' => 1, 'plurals' => 0, 'formula' => '', 'domain' => '', 'prefix' => '', 'weight' => 0, 'javascript' => '')); + $language = variable_get('language_default'); return $property ? $language->$property : $language; } @@ -1199,11 +1285,11 @@ if (!isset($ip_address) || $reset) { $ip_address = $_SERVER['REMOTE_ADDR']; - if (variable_get('reverse_proxy', 0)) { + if (variable_get('reverse_proxy')) { if (array_key_exists('HTTP_X_FORWARDED_FOR', $_SERVER)) { // If an array of known reverse proxy IPs is provided, then trust // the XFF header if request really comes from one of them. - $reverse_proxy_addresses = variable_get('reverse_proxy_addresses', array()); + $reverse_proxy_addresses = variable_get('reverse_proxy_addresses'); if (!empty($reverse_proxy_addresses) && in_array($ip_address, $reverse_proxy_addresses, TRUE)) { // If there are several arguments, we need to check the most // recently added one, i.e. the last one. Index: includes/password.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/password.inc,v retrieving revision 1.3 diff -u -r1.3 password.inc --- includes/password.inc 26 May 2008 17:12:54 -0000 1.3 +++ includes/password.inc 29 Sep 2008 22:38:02 -0000 @@ -15,23 +15,6 @@ */ /** - * The standard log2 number of iterations for password stretching. This should - * increase by 1 at least every other Drupal version in order to counteract - * increases in the speed and power of computers available to crack the hashes. - */ -define('DRUPAL_HASH_COUNT', 14); - -/** - * The minimum allowed log2 number of iterations for password stretching. - */ -define('DRUPAL_MIN_HASH_COUNT', 7); - -/** - * The maximum allowed log2 number of iterations for password stretching. - */ -define('DRUPAL_MAX_HASH_COUNT', 30); - -/** * Returns a string for mapping an int to the corresponding base 64 character. */ function _password_itoa64() { @@ -180,7 +163,7 @@ function user_hash_password($password, $count_log2 = 0) { if (empty($count_log2)) { // Use the standard iteration count. - $count_log2 = variable_get('password_count_log2', DRUPAL_HASH_COUNT); + $count_log2 = variable_get('password_count_log2'); } return _password_crypt($password, _password_generate_salt($count_log2)); } @@ -238,6 +221,6 @@ return TRUE; } // Check whether the iteration count used differs from the standard number. - return (_password_get_count_log2($account->pass) != variable_get('password_count_log2', DRUPAL_HASH_COUNT)); + return (_password_get_count_log2($account->pass) != variable_get('password_count_log2')); } Index: includes/image.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/image.inc,v retrieving revision 1.26 diff -u -r1.26 image.inc --- includes/image.inc 8 Jul 2008 01:08:15 -0000 1.26 +++ includes/image.inc 29 Sep 2008 22:38:02 -0000 @@ -63,7 +63,7 @@ static $toolkit; if (!$toolkit) { - $toolkit = variable_get('image_toolkit', 'gd'); + $toolkit = variable_get('image_toolkit'); if (isset($toolkit) && drupal_function_exists("image_" . $toolkit . "_resize")) { } Index: includes/locale.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/locale.inc,v retrieving revision 1.187 diff -u -r1.187 locale.inc --- includes/locale.inc 27 Sep 2008 20:23:30 -0000 1.187 +++ includes/locale.inc 29 Sep 2008 22:38:02 -0000 @@ -459,7 +459,7 @@ LANGUAGE_NEGOTIATION_PATH_DEFAULT => t('Path prefix only.'), LANGUAGE_NEGOTIATION_PATH => t('Path prefix with language fallback.'), LANGUAGE_NEGOTIATION_DOMAIN => t('Domain name only.')), - '#default_value' => variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE), + '#default_value' => variable_get('language_negotiation'), '#description' => t("Select the mechanism used to determine your site's presentation language. Modifying this setting may break all incoming URLs and should be used with caution in a production environment.") ); $form['submit'] = array( @@ -963,7 +963,7 @@ if ($enabled) { // Increment enabled language count if we are adding an enabled language. - variable_set('language_count', variable_get('language_count', 1) + 1); + variable_set('language_count', variable_get('language_count') + 1); } // Force JavaScript translation file creation for the newly added language. @@ -1755,7 +1755,7 @@ if (!isset($header)) { if (isset($language)) { - $header = '# ' . $language->name . ' translation of ' . variable_get('site_name', 'Drupal') . "\n"; + $header = '# ' . $language->name . ' translation of ' . variable_get('site_name') . "\n"; $header .= '# Generated by ' . $user->name . ' <' . $user->mail . ">\n"; $header .= "#\n"; $header .= "msgid \"\"\n"; @@ -2061,7 +2061,7 @@ * New content of the 'javascript_parsed' variable. */ function _locale_invalidate_js($langcode = NULL) { - $parsed = variable_get('javascript_parsed', array()); + $parsed = variable_get('javascript_parsed'); if (empty($langcode)) { // Invalidate all languages. @@ -2149,7 +2149,7 @@ // Construct the filepath where JS translation files are stored. // There is (on purpose) no front end to edit that variable. - $dir = file_create_path(variable_get('locale_js_directory', 'languages')); + $dir = file_create_path(variable_get('locale_js_directory')); // Delete old file, if we have no translations anymore, or a different file to be saved. if (!empty($language->javascript) && (!$data || $language->javascript != $data_hash)) { Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.437 diff -u -r1.437 theme.inc --- includes/theme.inc 20 Sep 2008 20:22:23 -0000 1.437 +++ includes/theme.inc 29 Sep 2008 22:38:02 -0000 @@ -54,7 +54,7 @@ // Only select the user selected theme if it is available in the // list of enabled themes. - $theme = !empty($user->theme) && !empty($themes[$user->theme]->status) ? $user->theme : variable_get('theme_default', 'garland'); + $theme = !empty($user->theme) && !empty($themes[$user->theme]->status) ? $user->theme : variable_get('theme_default'); // Allow modules to override the present theme... only select custom theme // if it is available in the list of installed themes. @@ -884,10 +884,10 @@ $defaults['toggle_node_info_' . $type] = 1; } } - $settings = array_merge($defaults, variable_get('theme_settings', array())); + $settings = array_merge($defaults, variable_get('theme_settings')); if ($key) { - $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_' . $key . '_settings'), array())); + $settings = array_merge($settings, variable_get(str_replace('/', '_', 'theme_settings_' . $key), array())); } // Only offer search box if search.module is enabled. @@ -925,7 +925,7 @@ $theme_object = $themes[$theme_key]; if ($settings['mission'] == '') { - $settings['mission'] = variable_get('site_mission', ''); + $settings['mission'] = variable_get('site_mission'); } if (!$settings['toggle_mission']) { @@ -1654,7 +1654,7 @@ $output .= ' (' . t('not verified') . ')'; } else { - $output = variable_get('anonymous', t('Anonymous')); + $output = variable_get('anonymous'); } return $output; @@ -1818,12 +1818,12 @@ // Construct page title if (drupal_get_title()) { - $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name', 'Drupal')); + $head_title = array(strip_tags(drupal_get_title()), variable_get('site_name')); } else { - $head_title = array(variable_get('site_name', 'Drupal')); - if (variable_get('site_slogan', '')) { - $head_title[] = variable_get('site_slogan', ''); + $head_title = array(variable_get('site_name')); + if (variable_get('site_slogan')) { + $head_title[] = variable_get('site_slogan'); } } $variables['head_title'] = implode(' | ', $head_title); @@ -1831,7 +1831,7 @@ $variables['front_page'] = url(); $variables['breadcrumb'] = theme('breadcrumb', drupal_get_breadcrumb()); $variables['feed_icons'] = drupal_get_feeds(); - $variables['footer_message'] = filter_xss_admin(variable_get('site_footer', FALSE)); + $variables['footer_message'] = filter_xss_admin(variable_get('site_footer')); $variables['head'] = drupal_get_html_head(); $variables['help'] = theme('help'); $variables['language'] = $GLOBALS['language']; @@ -1842,8 +1842,8 @@ $variables['main_menu'] = theme_get_setting('toggle_main_menu') ? menu_main_menu() : array(); $variables['secondary_menu'] = theme_get_setting('toggle_secondary_menu') ? menu_secondary_menu() : array(); $variables['search_box'] = (theme_get_setting('toggle_search') ? drupal_get_form('search_theme_form') : ''); - $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name', 'Drupal') : ''); - $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan', '') : ''); + $variables['site_name'] = (theme_get_setting('toggle_name') ? variable_get('site_name') : ''); + $variables['site_slogan'] = (theme_get_setting('toggle_slogan') ? variable_get('site_slogan') : ''); $variables['css'] = drupal_add_css(); $variables['styles'] = drupal_get_css(); $variables['scripts'] = drupal_get_js(); Index: includes/form.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/form.inc,v retrieving revision 1.289 diff -u -r1.289 form.inc --- includes/form.inc 27 Sep 2008 19:47:42 -0000 1.289 +++ includes/form.inc 29 Sep 2008 22:38:02 -0000 @@ -405,7 +405,7 @@ // We'll clear out the cached copies of the form and its stored data // here, as we've finished with them. The in-memory copies are still // here, though. - if (variable_get('cache', CACHE_DISABLED) == CACHE_DISABLED && !empty($form_state['values']['form_build_id'])) { + if (variable_get('cache') == CACHE_DISABLED && !empty($form_state['values']['form_build_id'])) { cache_clear_all('form_' . $form_state['values']['form_build_id'], 'cache_form'); cache_clear_all('storage_' . $form_state['values']['form_build_id'], 'cache_form'); } @@ -1663,7 +1663,7 @@ $element['#tree'] = TRUE; // Determine the order of day, month, year in the site's chosen date format. - $format = variable_get('date_format_short', 'm/d/Y - H:i'); + $format = variable_get('date_format_short'); $sort = array(); $sort['day'] = max(strpos($format, 'd'), strpos($format, 'j')); $sort['month'] = max(strpos($format, 'm'), strpos($format, 'M')); Index: modules/syslog/syslog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/syslog/syslog.module,v retrieving revision 1.18 diff -u -r1.18 syslog.module --- modules/syslog/syslog.module 31 Aug 2008 09:15:13 -0000 1.18 +++ modules/syslog/syslog.module 29 Sep 2008 22:38:03 -0000 @@ -14,6 +14,15 @@ } /** + * Implementation of hook_variables(). + */ +function syslog_variables() { + return array( + 'syslog_facility' => DEFAULT_SYSLOG_FACILITY, + ); +} + +/** * Implementation of hook_help(). */ function syslog_help($path, $arg) { @@ -41,7 +50,6 @@ $form['syslog_facility'] = array( '#type' => 'select', '#title' => t('Send events to this syslog facility'), - '#default_value' => variable_get('syslog_facility', DEFAULT_SYSLOG_FACILITY), '#options' => syslog_facility_list(), '#description' => t('Select the syslog facility code under which Drupal\'s messages should be sent. On UNIX/Linux systems, Drupal can flag its messages with the code LOG_LOCAL0 through LOG_LOCAL7; for Microsoft Windows, all messages are flagged with the code LOG_USER. Depending on the system configuration, syslog and other logging tools use this code to identify or filter Drupal messages from within the entire system log. For more information on syslog, see Syslog help.', array( '@syslog_help' => url('admin/help/syslog'))), @@ -73,7 +81,7 @@ if (!$log_init) { $log_init = TRUE; - openlog('drupal', LOG_NDELAY, variable_get('syslog_facility', DEFAULT_SYSLOG_FACILITY)); + openlog('drupal', LOG_NDELAY, variable_get('syslog_facility')); } syslog($entry['severity'], theme('syslog_format', $entry)); Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.464 diff -u -r1.464 forum.module --- modules/forum/forum.module 19 Sep 2008 20:25:02 -0000 1.464 +++ modules/forum/forum.module 29 Sep 2008 22:38:03 -0000 @@ -7,6 +7,21 @@ */ /** + * Implementation of hook_variables(). + */ +function forum_variables() { + return array( + 'forum_nav_vocabulary' => '', + 'forum_containers' => array(), + 'forum_hot_topic' => 15, + 'forum_per_page' => 25, + 'forum_order' => 1, + 'forum_block_num_active' => 5, + 'forum_block_num_new' => 5, + ); +} + +/** * Implementation of hook_help(). */ function forum_help($path, $arg) { @@ -28,7 +43,7 @@ case 'admin/build/forum/add/forum': return '

' . t('A forum holds related or similar forum topics (a forum topic is the initial post to a threaded discussion). For example, a forum named "Fruit" may contain forum topics titled "Apples" and "Bananas", respectively.') . '

'; case 'admin/build/forum/settings': - return '

' . t('These settings allow you to adjust the display of your forum topics. The content types available for use within a forum may be selected by editing the Content types on the forum vocabulary page.', array('@forum-vocabulary' => url('admin/content/taxonomy/edit/vocabulary/' . variable_get('forum_nav_vocabulary', '')))) . '

'; + return '

' . t('These settings allow you to adjust the display of your forum topics. The content types available for use within a forum may be selected by editing the Content types on the forum vocabulary page.', array('@forum-vocabulary' => url('admin/content/taxonomy/edit/vocabulary/' . variable_get('forum_nav_vocabulary')))) . '

'; } } @@ -74,7 +89,7 @@ * An associative array containing the term data or FALSE if the term cannot be loaded, or is not part of the forum vocabulary. */ function forum_term_load($tid) { - $result = db_query(db_rewrite_sql('SELECT t.tid, t.vid, t.name, t.description, t.weight FROM {term_data} t WHERE t.tid = %d AND t.vid = %d', 't', 'tid'), $tid, variable_get('forum_nav_vocabulary', '')); + $result = db_query(db_rewrite_sql('SELECT t.tid, t.vid, t.name, t.description, t.weight FROM {term_data} t WHERE t.tid = %d AND t.vid = %d', 't', 'tid'), $tid, variable_get('forum_nav_vocabulary')); return db_fetch_array($result); } @@ -163,7 +178,7 @@ // types assigned to the forum vocabulary. If forum_nav_vocabulary // is undefined or the vocabulary does not exist, it clearly cannot // be assigned to $node->type, so return to avoid E_ALL warnings. - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get('forum_nav_vocabulary'); $vocabulary = taxonomy_vocabulary_load($vid); if (empty($vocabulary)) { return; @@ -220,7 +235,7 @@ if ($node->taxonomy) { // Extract the node's proper topic ID. $vocabulary = $vid; - $containers = variable_get('forum_containers', array()); + $containers = variable_get('forum_containers'); foreach ($node->taxonomy as $term) { if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) { if (in_array($term, $containers)) { @@ -328,7 +343,7 @@ * Implementation of hook_taxonomy(). */ function forum_taxonomy($op, $type, $term = NULL) { - if ($op == 'delete' && $term['vid'] == variable_get('forum_nav_vocabulary', '')) { + if ($op == 'delete' && $term['vid'] == variable_get('forum_nav_vocabulary')) { switch ($type) { case 'term': $results = db_query('SELECT tn.nid FROM {term_node} tn WHERE tn.tid = %d', $term['tid']); @@ -338,7 +353,7 @@ } // For containers, remove the tid from the forum_containers variable. - $containers = variable_get('forum_containers', array()); + $containers = variable_get('forum_containers'); $key = array_search($term['tid'], $containers); if ($key !== FALSE) { unset($containers[$key]); @@ -355,7 +370,7 @@ * Implementation of hook_form_alter(). */ function forum_form_alter(&$form, $form_state, $form_id) { - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get('forum_nav_vocabulary'); if (isset($form['vid']) && $form['vid']['#value'] == $vid) { // Hide critical options from forum vocabulary. if ($form_id == 'taxonomy_form_vocabulary') { @@ -378,7 +393,7 @@ } if ($form_id == 'forum_node_form') { // Make the vocabulary required for 'real' forum-nodes. - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get('forum_nav_vocabulary'); $form['taxonomy'][$vid]['#required'] = TRUE; $form['taxonomy'][$vid]['#options'][''] = t('- Please choose -'); } @@ -407,7 +422,7 @@ return $blocks; case 'configure': - $form['forum_block_num_' . $delta] = array('#type' => 'select', '#title' => t('Number of topics'), '#default_value' => variable_get('forum_block_num_' . $delta, '5'), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20))); + $form['forum_block_num_' . $delta] = array('#type' => 'select', '#title' => t('Number of topics'), '#default_value' => variable_get('forum_block_num_' . $delta), '#options' => drupal_map_assoc(array(2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20))); return $form; case 'save': @@ -420,14 +435,14 @@ case 'active': $title = t('Active forum topics'); $sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid INNER JOIN {term_data} td ON td.tid = tn.tid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND td.vid = %d ORDER BY l.last_comment_timestamp DESC"); - $result = db_query_range($sql, variable_get('forum_nav_vocabulary', ''), 0, variable_get('forum_block_num_active', '5')); + $result = db_query_range($sql, variable_get('forum_nav_vocabulary'), 0, variable_get('forum_block_num_active')); $content = node_title_list($result); break; case 'new': $title = t('New forum topics'); $sql = db_rewrite_sql("SELECT n.nid, n.title, l.comment_count FROM {node} n INNER JOIN {term_node} tn ON tn.vid = n.vid INNER JOIN {term_data} td ON td.tid = tn.tid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 AND td.vid = %d ORDER BY n.nid DESC"); - $result = db_query_range($sql, variable_get('forum_nav_vocabulary', ''), 0, variable_get('forum_block_num_new', '5')); + $result = db_query_range($sql, variable_get('forum_nav_vocabulary'), 0, variable_get('forum_block_num_new')); $content = node_title_list($result); break; } @@ -449,7 +464,7 @@ $form['title'] = array('#type' => 'textfield', '#title' => check_plain($type->title_label), '#default_value' => !empty($node->title) ? $node->title : '', '#required' => TRUE, '#weight' => -5); if (!empty($node->nid)) { - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get('forum_nav_vocabulary'); $forum_terms = taxonomy_node_get_terms_by_vocabulary($node, $vid); // if editing, give option to leave shadows $shadow = (count($forum_terms) > 1); @@ -487,7 +502,7 @@ function forum_get_forums($tid = 0) { $forums = array(); - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get('forum_nav_vocabulary'); $_forums = taxonomy_get_tree($vid, $tid); if (count($_forums)) { @@ -503,7 +518,7 @@ } foreach ($_forums as $forum) { - if (in_array($forum->tid, variable_get('forum_containers', array()))) { + if (in_array($forum->tid, variable_get('forum_containers'))) { $forum->container = 1; } @@ -635,7 +650,7 @@ function template_preprocess_forums(&$variables) { global $user; - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get('forum_nav_vocabulary'); $vocabulary = taxonomy_vocabulary_load($vid); $title = !empty($vocabulary->name) ? $vocabulary->name : ''; @@ -691,7 +706,7 @@ $variables['forums'] = ''; } - if ($variables['tid'] && !in_array($variables['tid'], variable_get('forum_containers', array()))) { + if ($variables['tid'] && !in_array($variables['tid'], variable_get('forum_containers'))) { $variables['topics'] = theme('forum_topic_list', $variables['tid'], $variables['topics'], $variables['sortby'], $variables['forum_per_page']); drupal_add_feed(url('taxonomy/term/' . $variables['tid'] . '/0/feed'), 'RSS - ' . $title); } @@ -846,7 +861,7 @@ * @see theme_forum_icon() */ function template_preprocess_forum_icon(&$variables) { - $variables['hot_threshold'] = variable_get('forum_hot_topic', 15); + $variables['hot_threshold'] = variable_get('forum_hot_topic'); if ($variables['num_posts'] > $variables['hot_threshold']) { $variables['icon'] = $variables['new_posts'] ? 'hot-new' : 'hot'; } @@ -875,7 +890,7 @@ $output = ''; // get previous and next topic - $sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 ORDER BY n.sticky DESC, " . _forum_get_topic_order_sql(variable_get('forum_order', 1)); + $sql = "SELECT n.nid, n.title, n.sticky, l.comment_count, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {term_node} r ON n.nid = r.nid AND r.tid = %d WHERE n.status = 1 ORDER BY n.sticky DESC, " . _forum_get_topic_order_sql(variable_get('forum_order')); $result = db_query(db_rewrite_sql($sql), isset($variables['node']->tid) ? $variables['node']->tid : 0); $stop = $variables['prev'] = $variables['next'] = 0; Index: modules/forum/forum.install =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.install,v retrieving revision 1.19 diff -u -r1.19 forum.install --- modules/forum/forum.install 25 Jun 2008 07:47:20 -0000 1.19 +++ modules/forum/forum.install 29 Sep 2008 22:38:03 -0000 @@ -12,7 +12,7 @@ } function forum_enable() { - if ($vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary', 0))) { + if ($vocabulary = taxonomy_vocabulary_load(variable_get('forum_nav_vocabulary'))) { // Existing install. Add back forum node type, if the forums // vocabulary still exists. Keep all other node types intact there. $vocabulary = (array) $vocabulary; @@ -47,17 +47,10 @@ drupal_load('module', 'taxonomy'); // Delete the vocabulary. - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get('forum_nav_vocabulary'); taxonomy_del_vocabulary($vid); db_query('DROP TABLE {forum}'); - variable_del('forum_containers'); - variable_del('forum_nav_vocabulary'); - variable_del('forum_hot_topic'); - variable_del('forum_per_page'); - variable_del('forum_order'); - variable_del('forum_block_num_active'); - variable_del('forum_block_num_new'); } /** @@ -108,7 +101,7 @@ function forum_update_6000() { $ret = array(); - $vid = variable_get('forum_nav_vocabulary', 0); + $vid = variable_get('forum_nav_vocabulary'); $vocabularies = taxonomy_get_vocabularies(); if (!isset($vocabularies[$vid])) { $vocabulary = array( Index: modules/forum/forum.test =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.test,v retrieving revision 1.4 diff -u -r1.4 forum.test --- modules/forum/forum.test 19 Sep 2008 20:25:02 -0000 1.4 +++ modules/forum/forum.test 29 Sep 2008 22:38:03 -0000 @@ -117,7 +117,7 @@ */ function editForumTaxonomy() { // Backup forum taxonomy. - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get('forum_nav_vocabulary'); // This function returns NULL (the cache value is false). // $original_settings = taxonomy_vocabulary_load($vid); $original_settings = db_fetch_array(db_query('SELECT v.* FROM {vocabulary} v WHERE v.vid = %d', $vid)); @@ -197,7 +197,7 @@ $this->assertRaw(t('Created new @type %term.', array('%term' => $name, '@type' => t($type))), t(ucfirst($type) . ' was created')); // Verify forum. - $term = db_fetch_array(db_query("SELECT * FROM {term_data} t WHERE t.vid = %d AND t.name = '%s' AND t.description = '%s'", variable_get('forum_nav_vocabulary', ''), $name, $description)); + $term = db_fetch_array(db_query("SELECT * FROM {term_data} t WHERE t.vid = %d AND t.name = '%s' AND t.description = '%s'", variable_get('forum_nav_vocabulary'), $name, $description)); $this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database'); // Verify forum hierarchy. Index: modules/forum/forum.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.pages.inc,v retrieving revision 1.2 diff -u -r1.2 forum.pages.inc --- modules/forum/forum.pages.inc 26 Jul 2007 06:48:03 -0000 1.2 +++ modules/forum/forum.pages.inc 29 Sep 2008 22:38:03 -0000 @@ -11,12 +11,12 @@ */ function forum_page($tid = 0) { $topics = ''; - $forum_per_page = variable_get('forum_per_page', 25); - $sortby = variable_get('forum_order', 1); + $forum_per_page = variable_get('forum_per_page'); + $sortby = variable_get('forum_order'); $forums = forum_get_forums($tid); $parents = taxonomy_get_parents_all($tid); - if ($tid && !in_array($tid, variable_get('forum_containers', array()))) { + if ($tid && !in_array($tid, variable_get('forum_containers'))) { $topics = forum_get_topics($tid, $sortby, $forum_per_page); } Index: modules/forum/forum.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.admin.inc,v retrieving revision 1.13 diff -u -r1.13 forum.admin.inc --- modules/forum/forum.admin.inc 19 Sep 2008 20:25:02 -0000 1.13 +++ modules/forum/forum.admin.inc 29 Sep 2008 22:38:03 -0000 @@ -54,7 +54,7 @@ '#description' => t('Forums are displayed in ascending order by weight (forums with equal weights are displayed alphabetically).'), ); - $form['vid'] = array('#type' => 'hidden', '#value' => variable_get('forum_nav_vocabulary', '')); + $form['vid'] = array('#type' => 'hidden', '#value' => variable_get('forum_nav_vocabulary')); $form['submit' ] = array('#type' => 'submit', '#value' => t('Save')); if ($edit['tid']) { $form['delete'] = array('#type' => 'submit', '#value' => t('Delete')); @@ -83,7 +83,7 @@ switch ($status) { case SAVED_NEW: if ($container) { - $containers = variable_get('forum_containers', array()); + $containers = variable_get('forum_containers'); $containers[] = $form_state['values']['tid']; variable_set('forum_containers', $containers); } @@ -138,7 +138,7 @@ $form['vid'] = array( '#type' => 'hidden', - '#value' => variable_get('forum_nav_vocabulary', ''), + '#value' => variable_get('forum_nav_vocabulary'), ); $form['submit'] = array( '#type' => 'submit', @@ -190,21 +190,18 @@ $number = drupal_map_assoc(array(5, 10, 15, 20, 25, 30, 35, 40, 50, 60, 80, 100, 150, 200, 250, 300, 350, 400, 500)); $form['forum_hot_topic'] = array('#type' => 'select', '#title' => t('Hot topic threshold'), - '#default_value' => variable_get('forum_hot_topic', 15), '#options' => $number, '#description' => t('The number of posts a topic must have to be considered "hot".'), ); $number = drupal_map_assoc(array(10, 25, 50, 75, 100)); $form['forum_per_page'] = array('#type' => 'select', '#title' => t('Topics per page'), - '#default_value' => variable_get('forum_per_page', 25), '#options' => $number, '#description' => t('Default number of forum topics displayed per page.'), ); $forder = array(1 => t('Date - newest first'), 2 => t('Date - oldest first'), 3 => t('Posts - most active first'), 4 => t('Posts - least active first')); $form['forum_order'] = array('#type' => 'radios', '#title' => t('Default order'), - '#default_value' => variable_get('forum_order', '1'), '#options' => $forder, '#description' => t('Default display order for topics.'), ); @@ -217,7 +214,7 @@ function forum_overview(&$form_state) { module_load_include('inc', 'taxonomy', 'taxonomy.admin'); - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get('forum_nav_vocabulary'); $vocabulary = taxonomy_vocabulary_load($vid); $form = taxonomy_overview_terms($form_state, $vocabulary); drupal_set_title('Forums'); @@ -226,7 +223,7 @@ if (isset($form[$key]['#term'])) { $term = $form[$key]['#term']; $form[$key]['view']['#markup'] = l($term['name'], 'forum/' . $term['tid']); - if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers', array()))) { + if (in_array($form[$key]['#term']['tid'], variable_get('forum_containers'))) { $form[$key]['edit']['#markup'] = l(t('edit container'), 'admin/build/forum/edit/container/' . $term['tid']); } else { @@ -264,7 +261,7 @@ $parent = 0; } - $vid = variable_get('forum_nav_vocabulary', ''); + $vid = variable_get('forum_nav_vocabulary'); $children = taxonomy_get_tree($vid, $tid); // A term can't be the child of itself, nor of its children. Index: modules/dblog/dblog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v retrieving revision 1.27 diff -u -r1.27 dblog.module --- modules/dblog/dblog.module 21 Aug 2008 19:36:37 -0000 1.27 +++ modules/dblog/dblog.module 29 Sep 2008 22:38:03 -0000 @@ -13,6 +13,15 @@ */ /** + * Implementation of hook_variables(). + */ +function dblog_variables() { + return array( + 'dblog_row_limit' => 1000, + ); +} + +/** * Implementation of hook_help(). */ function dblog_help($path, $arg) { @@ -97,7 +106,7 @@ function dblog_cron() { // Cleanup the watchdog table $max = db_result(db_query('SELECT MAX(wid) FROM {watchdog}')); - db_query('DELETE FROM {watchdog} WHERE wid <= %d', $max - variable_get('dblog_row_limit', 1000)); + db_query('DELETE FROM {watchdog} WHERE wid <= %d', $max - variable_get('dblog_row_limit')); } /** Index: modules/dblog/dblog.test =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.test,v retrieving revision 1.9 diff -u -r1.9 dblog.test --- modules/dblog/dblog.test 17 Sep 2008 07:11:56 -0000 1.9 +++ modules/dblog/dblog.test 29 Sep 2008 22:38:03 -0000 @@ -57,7 +57,7 @@ $this->assertResponse(200); // Check row limit variable. - $current_limit = variable_get('dblog_row_limit', 1000); + $current_limit = variable_get('dblog_row_limit'); $this->assertTrue($current_limit == $row_limit, t('[Cache] Row limit variable of @count equals row limit of @limit', array('@count' => $current_limit, '@limit' => $row_limit))); // Verify dblog row limit equals specified row limit. $current_limit = unserialize(db_result(db_query("SELECT value FROM {variable} WHERE name = '%s'", 'dblog_row_limit'))); Index: modules/dblog/dblog.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/dblog/dblog.admin.inc,v retrieving revision 1.8 diff -u -r1.8 dblog.admin.inc --- modules/dblog/dblog.admin.inc 19 Jul 2008 07:44:45 -0000 1.8 +++ modules/dblog/dblog.admin.inc 29 Sep 2008 22:38:03 -0000 @@ -16,7 +16,6 @@ $form['dblog_row_limit'] = array( '#type' => 'select', '#title' => t('Discard log entries above the following row limit'), - '#default_value' => variable_get('dblog_row_limit', 1000), '#options' => drupal_map_assoc(array(100, 1000, 10000, 100000, 1000000)), '#description' => t('The maximum number of rows to keep in the database log. Older entries will be automatically discarded. (Requires a correctly configured cron maintenance task.)', array('@cron' => url('admin/reports/status'))) ); Index: modules/simpletest/tests/system_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/system_test.module,v retrieving revision 1.2 diff -u -r1.2 system_test.module --- modules/simpletest/tests/system_test.module 8 Sep 2008 20:49:47 -0000 1.2 +++ modules/simpletest/tests/system_test.module 29 Sep 2008 22:38:03 -0000 @@ -42,8 +42,7 @@ $items['system-test/variable-get'] = array( 'title' => 'Variable Get', - 'page callback' => 'variable_get', - 'page arguments' => array('simpletest_bootstrap_variable_test', NULL), + 'page callback' => 'simpletest_bootstrap_variable_test', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); @@ -51,6 +50,11 @@ return $items; } +function simpletest_bootstrap_variable_test() { + echo variable_get('simpletest_bootstrap_variable_test'); + exit; +} + function system_test_basic_auth_page() { $output = t('$_SERVER[\'PHP_AUTH_USER\'] is @username.', array('@username' => $_SERVER['PHP_AUTH_USER'])); $output .= t('$_SERVER[\'PHP_AUTH_PW\'] is @password.', array('@password' => $_SERVER['PHP_AUTH_PW'])); Index: modules/simpletest/tests/bootstrap.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/bootstrap.test,v retrieving revision 1.3 diff -u -r1.3 bootstrap.test --- modules/simpletest/tests/bootstrap.test 15 Sep 2008 20:48:09 -0000 1.3 +++ modules/simpletest/tests/bootstrap.test 29 Sep 2008 22:38:03 -0000 @@ -133,20 +133,23 @@ * testVariable */ function testVariable() { + // Retrieving default values for variables. + $default_anonymous = 'Anonymous'; // The default anonymous variable from System module. + $anonymous = variable_get('anonymous'); + $this->assertIdentical($anonymous, $default_anonymous, t('Retrieving default values for variables')); + // Setting and retrieving values. $variable = $this->randomName(); variable_set('simpletest_bootstrap_variable_test', $variable); - $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test', NULL), t('Setting and retrieving values')); + $this->assertIdentical($variable, variable_get('simpletest_bootstrap_variable_test'), t('Setting and retrieving values')); // Make sure the variable persists across multiple requests. - $this->drupalGet('system-test/variable-get'); - $this->assertText($variable, t('Variable persists across multiple requests')); + $retrieved_variable = $this->drupalGet('system-test/variable-get'); + $this->assertIdentical($retrieved_variable, $variable, t('Variable persists across multiple requests')); // Deleting variables. - $default_value = $this->randomName(); variable_del('simpletest_bootstrap_variable_test'); - $variable = variable_get('simpletest_bootstrap_variable_test', $default_value); - $this->assertIdentical($variable, $default_value, t('Deleting variables')); + $variable = variable_get('simpletest_bootstrap_variable_test'); + $this->assertIdentical($variable, NULL, t('Deleting variables')); } - } Index: modules/blogapi/blogapi.module =================================================================== RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v retrieving revision 1.126 diff -u -r1.126 blogapi.module --- modules/blogapi/blogapi.module 17 Sep 2008 21:07:47 -0000 1.126 +++ modules/blogapi/blogapi.module 29 Sep 2008 22:38:03 -0000 @@ -7,6 +7,15 @@ */ /** + * Implementation of hook_variables(). + */ +function blogapi_variables() { + return array( + 'blogapi_node_types' => blogapi_node_types_default(), + ); +} + +/** * Implementation of hook_help(). */ function blogapi_help($path, $arg) { @@ -193,7 +202,7 @@ $edit = array(); $edit['type'] = $blogid; // Get the node type defaults. - $node_type_default = variable_get('node_options_' . $edit['type'], array('status', 'promote')); + $node_type_default = variable_get('node_options_' . $edit['type'], array('status')); $edit['uid'] = $user->uid; $edit['name'] = $user->name; $edit['promote'] = in_array('promote', $node_type_default); @@ -575,16 +584,21 @@ } /** + * Returns the default value for the node types listing. + */ +function blogapi_node_types_default() { + $node_types = array_map('check_plain', node_get_types('names')); + return isset($node_types['blog']) ? array('blog' => 1) : array(); +} + +/** * Add some settings to the admin_settings form. */ function blogapi_admin_settings() { - $node_types = array_map('check_plain', node_get_types('names')); - $defaults = isset($node_types['blog']) ? array('blog' => 1) : array(); $form['blogapi_node_types'] = array( '#type' => 'checkboxes', '#title' => t('Enable for external blogging clients'), '#required' => TRUE, - '#default_value' => variable_get('blogapi_node_types', $defaults), '#options' => $node_types, '#description' => t('Select the content types available to external blogging clients via Blog API. If supported, each enabled content type will be displayed as a separate "blog" by the external client.') ); @@ -741,7 +755,7 @@ } function _blogapi_get_node_types() { - $available_types = array_keys(array_filter(variable_get('blogapi_node_types', array('blog' => 1)))); + $available_types = array_keys(array_filter(variable_get('blogapi_node_types'))); $types = array(); foreach (node_get_types() as $type => $name) { if (node_access('create', $type) && in_array($type, $available_types)) { Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.269 diff -u -r1.269 system.install --- modules/system/system.install 27 Sep 2008 20:16:17 -0000 1.269 +++ modules/system/system.install 29 Sep 2008 22:38:03 -0000 @@ -126,19 +126,19 @@ // Report cron status. if ($phase == 'runtime') { // Cron warning threshold defaults to two days. - $threshold_warning = variable_get('cron_threshold_warning', 172800); + $threshold_warning = variable_get('cron_threshold_warning'); // Cron error threshold defaults to two weeks. - $threshold_error = variable_get('cron_threshold_error', 1209600); + $threshold_error = variable_get('cron_threshold_error'); // Cron configuration help text. $help = $t('For more information, see the online handbook entry for configuring cron jobs.', array('@cron-handbook' => 'http://drupal.org/cron')); // Determine when cron last ran. If never, use the install time to // determine the warning or error status. - $cron_last = variable_get('cron_last', NULL); + $cron_last = variable_get('cron_last'); $never_run = FALSE; if (!is_numeric($cron_last)) { $never_run = TRUE; - $cron_last = variable_get('install_time', 0); + $cron_last = variable_get('install_time'); } // Determine severity based on time since cron last ran. @@ -171,7 +171,7 @@ } $description .= ' ' . $t('You can run cron manually.', array('@cron' => url('admin/reports/status/run-cron'))); - $description .= '
' . $t('To run cron from outside the site, go to !cron', array('!cron' => url('cron.php', array('absolute' => TRUE, 'query' => 'cron_key=' . variable_get('cron_key', 'drupal'))))); + $description .= '
' . $t('To run cron from outside the site, go to !cron', array('!cron' => url('cron.php', array('absolute' => TRUE, 'query' => 'cron_key=' . variable_get('cron_key'))))); $requirements['cron'] = array( 'title' => $t('Cron maintenance tasks'), @@ -219,7 +219,7 @@ } } else { - if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) { + if (variable_get('file_downloads') == FILE_DOWNLOADS_PUBLIC) { $requirements['file system']['value'] = $t('Writable (public download method)'); } else { @@ -284,7 +284,7 @@ $requirements['update status'] = array( 'value' => $t('Enabled'), ); - if (variable_get('drupal_http_request_fails', FALSE)) { + if (variable_get('drupal_http_request_fails')) { $requirements['http requests'] = array( 'title' => $t('HTTP request status'), 'value' => $t('Fails'), @@ -2018,7 +2018,7 @@ $ret[] = update_sql("DELETE FROM {menu_links} WHERE menu_name IN ('" . implode("', '", $_SESSION['menu_bogus_menus']) . "')"); } - $menu_primary_menu = variable_get('menu_primary_menu', 0); + $menu_primary_menu = variable_get('menu_primary_menu'); // Ensure that we wind up with a system menu named 'primary-links'. if (isset($_SESSION['menu_menu_map'][2])) { // The primary links menu that ships with Drupal 5 has mid = 2. If this @@ -2045,7 +2045,7 @@ $_SESSION['menu_menu_map'][$updated_primary_links_menu] = 'primary-links'; } - $menu_secondary_menu = variable_get('menu_secondary_menu', 0); + $menu_secondary_menu = variable_get('menu_secondary_menu'); // Ensure that we wind up with a system menu named 'secondary-links'. if (isset($_SESSION['menu_menu_map'][$menu_secondary_menu]) && $menu_secondary_menu > 1 && $menu_secondary_menu != $updated_primary_links_menu) { // We use the menu that is currently assigned to the secondary links @@ -2070,7 +2070,7 @@ } // Update menu OTF preferences. - $mid = variable_get('menu_parent_items', 0); + $mid = variable_get('menu_parent_items'); $menu_name = ($mid && isset($_SESSION['menu_menu_map'][$mid])) ? $_SESSION['menu_menu_map'][$mid] : 'navigation'; variable_set('menu_default_node_menu', $menu_name); variable_del('menu_parent_items'); @@ -2493,7 +2493,7 @@ function system_update_6041() { $weight = intval((db_result(db_query("SELECT weight FROM {system} WHERE name = 'taxonomy'"))) + 1); $ret = array(); - $vid = intval(variable_get('forum_nav_vocabulary', '')); + $vid = intval(variable_get('forum_nav_vocabulary')); if (db_table_exists('vocabulary') && $vid) { $ret[] = update_sql("UPDATE {vocabulary} SET required = 0 WHERE vid = " . $vid); $ret[] = update_sql("UPDATE {system} SET weight = " . $weight . " WHERE name = 'forum'"); @@ -2506,7 +2506,7 @@ */ function system_update_6042() { foreach (list_themes() as $theme) { - $stylesheet = variable_get('color_' . $theme->name . '_stylesheet', NULL); + $stylesheet = variable_get('color_' . $theme->name . '_stylesheet'); if (!empty($stylesheet)) { variable_set('color_' . $theme->name . '_stylesheets', array($stylesheet)); variable_del('color_' . $theme->name . '_stylesheet'); @@ -2621,7 +2621,7 @@ $ret[] = update_sql("DELETE FROM {term_node} WHERE vid = 0"); // Only execute the rest of this function if 6043 was run in RC1 or before. - if (variable_get('system_update_6043_RC2', FALSE)) { + if (variable_get('system_update_6043_RC2')) { variable_del('system_update_6043_RC2'); return $ret; } @@ -2685,7 +2685,7 @@ */ function system_update_6046() { $ret = array(); - if (!variable_get('file_directory_path', FALSE)) { + if (!variable_get('file_directory_path')) { variable_set('file_directory_path', 'files'); $ret[] = array('success' => TRUE, 'query' => "variable_set('file_directory_path')"); } @@ -2856,12 +2856,12 @@ } } // Rename forum module's block variables. - $forum_block_num_0 = variable_get('forum_block_num_0', NULL); + $forum_block_num_0 = variable_get('forum_block_num_0'); if (isset($forum_block_num_0)) { variable_set('forum_block_num_active', $forum_block_num_0); variable_del('forum_block_num_0'); } - $forum_block_num_1 = variable_get('forum_block_num_1', NULL); + $forum_block_num_1 = variable_get('forum_block_num_1'); if (isset($forum_block_num_1)) { variable_set('forum_block_num_new', $forum_block_num_1); variable_del('forum_block_num_1'); @@ -3048,6 +3048,38 @@ } /** + * Update lots of variables for the variable renaming that comes along with the + * new hook_variables(). + */ +function system_update_7011() { + $ret = array(); + $renamings = array( + 'color_%_screenshot' => 'color_screenshot_%', + 'color_%_stylesheets' => 'color_stylesheets_%', + 'color_%_logo' => 'color_logo_%', + 'color_%_palette' => 'color_palette_%', + 'color_%_files' => 'color_files_%', + 'upload_extensions_default' => 'upload_extensions', + 'upload_uploadsize_default' => 'upload_uploadsize', + 'upload_usersize_default' => 'upload_usersize', + 'user_mail_status_%_notify' => 'user_mail_notify_status_%', + ); + foreach ($renamings as $variable => $renamed) { + $parts = explode('%', $variable); + // Escape the % for db_query(). + $sql_variable = str_replace('%', '%%', $variable); + $result = db_query("SELECT name FROM {variable} WHERE name LIKE '$sql_variable'"); + while ($data = db_fetch_array($result)) { + $old_name = $data['name']; + $name = str_replace($parts, '', $data['name']); + $renamed_variable = str_replace('%', $name, $renamed); + $ret[] = update_sql("UPDATE {variable} SET name = '$renamed_variable' WHERE name = '$old_name'"); + } + } + return $ret; +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */ Index: modules/system/system.test =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.test,v retrieving revision 1.12 diff -u -r1.12 system.test --- modules/system/system.test 15 Sep 2008 20:48:09 -0000 1.12 +++ modules/system/system.test 29 Sep 2008 22:38:03 -0000 @@ -222,7 +222,7 @@ $this->assertResponse(403); // Run cron anonymously with the valid cron key. - $key = variable_get('cron_key', 'drupal'); + $key = variable_get('cron_key'); $this->drupalGet('cron.php', array('query' => 'cron_key=' . $key)); $this->assertResponse(200); Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.94 diff -u -r1.94 system.admin.inc --- modules/system/system.admin.inc 27 Sep 2008 19:03:30 -0000 1.94 +++ modules/system/system.admin.inc 29 Sep 2008 22:38:03 -0000 @@ -153,14 +153,12 @@ '#options' => $options, '#title' => t('Administration theme'), '#description' => t('Choose which theme the administration pages should display in. If you choose "System default" the administration pages will use the same theme as the rest of the site.'), - '#default_value' => variable_get('admin_theme', '0'), ); $form['node_admin_theme'] = array( '#type' => 'checkbox', '#title' => t('Use administration theme for content editing'), '#description' => t('Use the administration theme when editing existing posts or creating new ones.'), - '#default_value' => variable_get('node_admin_theme', '0'), ); $form['#submit'][] = 'system_admin_theme_submit'; @@ -203,7 +201,7 @@ ); $options[$theme->name] = ''; - if (!empty($theme->status) || $theme->name == variable_get('admin_theme', '0')) { + if (!empty($theme->status) || $theme->name == variable_get('admin_theme')) { $form[$theme->name]['operations'] = array('#markup' => l(t('configure'), 'admin/build/themes/settings/' . $theme->name) ); } else { @@ -234,7 +232,7 @@ $form['theme_default'] = array( '#type' => 'radios', '#options' => $options, - '#default_value' => variable_get('theme_default', 'garland'), + '#default_value' => variable_get('theme_default'), ); $form['buttons']['submit'] = array( '#type' => 'submit', @@ -272,7 +270,7 @@ } } } - if (($admin_theme = variable_get('admin_theme', '0')) != '0' && $admin_theme != $form_state['values']['theme_default']) { + if (($admin_theme = variable_get('admin_theme')) != '0' && $admin_theme != $form_state['values']['theme_default']) { drupal_set_message(t('Please note that the administration theme is still set to the %admin_theme theme; consequently, the theme on this page remains unchanged. All non-administrative sections of the site, however, will show the selected %selected_theme theme by default.', array( '!admin_theme_page' => url('admin/settings/admin'), '%admin_theme' => $admin_theme, @@ -376,7 +374,7 @@ // Some features are not always available $disabled = array(); - if (!variable_get('user_pictures', 0)) { + if (!variable_get('user_pictures')) { $disabled['toggle_node_user_picture'] = TRUE; $disabled['toggle_comment_user_picture'] = TRUE; } @@ -1208,49 +1206,42 @@ $form['site_name'] = array( '#type' => 'textfield', '#title' => t('Name'), - '#default_value' => variable_get('site_name', 'Drupal'), '#description' => t('The name of this website.'), '#required' => TRUE ); $form['site_mail'] = array( '#type' => 'textfield', '#title' => t('E-mail address'), - '#default_value' => variable_get('site_mail', ini_get('sendmail_from')), '#description' => t("The From address in automated e-mails sent during registration and new password requests, and other notifications. (Use an address ending in your site's domain to help prevent this e-mail being flagged as spam.)"), '#required' => TRUE, ); $form['site_slogan'] = array( '#type' => 'textfield', '#title' => t('Slogan'), - '#default_value' => variable_get('site_slogan', ''), '#description' => t("Your site's motto, tag line, or catchphrase (often displayed alongside the title of the site).") ); $form['site_mission'] = array( '#type' => 'textarea', '#title' => t('Mission'), - '#default_value' => variable_get('site_mission', ''), '#description' => t("Your site's mission or focus statement (often prominently displayed on the front page).") ); $form['site_footer'] = array( '#type' => 'textarea', '#title' => t('Footer message'), - '#default_value' => variable_get('site_footer', ''), '#description' => t('This text will be displayed at the bottom of each page. Useful for adding a copyright notice to your pages.') ); $form['anonymous'] = array( '#type' => 'textfield', '#title' => t('Anonymous user'), - '#default_value' => variable_get('anonymous', t('Anonymous')), '#description' => t('The name used to indicate anonymous users.'), '#required' => TRUE, ); $form['site_frontpage'] = array( '#type' => 'textfield', '#title' => t('Default front page'), - '#default_value' => variable_get('site_frontpage', 'node'), '#size' => 40, '#description' => t('The home page displays content from this relative URL. If unsure, specify "node".'), - '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='), + '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url') ? '' : '?q='), '#required' => TRUE, ); $form['#validate'][] = 'system_site_information_settings_validate'; @@ -1289,23 +1280,21 @@ $form['site_403'] = array( '#type' => 'textfield', '#title' => t('Default 403 (access denied) page'), - '#default_value' => variable_get('site_403', ''), '#size' => 40, '#description' => t('This page is displayed when the requested document is denied to the current user. If unsure, specify nothing.'), - '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=') + '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url') ? '' : '?q=') ); $form['site_404'] = array( '#type' => 'textfield', '#title' => t('Default 404 (not found) page'), - '#default_value' => variable_get('site_404', ''), '#size' => 40, '#description' => t('This page is displayed when no other content matches the requested document. If unsure, specify nothing.'), - '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=') + '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url') ? '' : '?q=') ); $form['error_level'] = array( - '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('error_level', 1), + '#type' => 'select', '#title' => t('Error reporting'), '#options' => array(t('Write errors to the log'), t('Write errors to the log and to the screen')), '#description' => t('Specify where Drupal, PHP and SQL errors are logged. While it is recommended that a site running in a production environment write errors to the log only, in a development or testing environment it may be helpful to write errors both to the log and to the screen.') ); @@ -1353,7 +1342,6 @@ $form['page_cache']['cache'] = array( '#type' => 'radios', '#title' => t('Caching mode'), - '#default_value' => variable_get('cache', CACHE_DISABLED), '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Normal (recommended for production sites, no side effects)'), CACHE_AGGRESSIVE => t('Aggressive (experts only, possible side effects)')), '#description' => $description ); @@ -1363,14 +1351,12 @@ $form['page_cache']['cache_lifetime'] = array( '#type' => 'select', '#title' => t('Minimum cache lifetime'), - '#default_value' => variable_get('cache_lifetime', 0), '#options' => $period, '#description' => t('On high-traffic sites, it may be necessary to enforce a minimum cache lifetime. The minimum cache lifetime is the minimum amount of time that will elapse before the cache is emptied and recreated, and is applied to both page and block caches. A larger minimum cache lifetime offers better performance, but users will not see new content for a longer period of time.') ); $form['page_cache']['page_compression'] = array( '#type' => 'radios', '#title' => t('Page compression'), - '#default_value' => variable_get('page_compression', TRUE), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t("By default, Drupal compresses the pages it caches in order to save bandwidth and improve download times. This option should be disabled when using a webserver that performs compression."), ); @@ -1384,7 +1370,6 @@ $form['block_cache']['block_cache'] = array( '#type' => 'radios', '#title' => t('Block cache'), - '#default_value' => variable_get('block_cache', CACHE_DISABLED), '#options' => array(CACHE_DISABLED => t('Disabled'), CACHE_NORMAL => t('Enabled (recommended)')), '#disabled' => count(module_implements('node_grants')), '#description' => t('Note that block caching is inactive when modules defining content access restrictions are enabled.'), @@ -1397,11 +1382,11 @@ ); $directory = file_directory_path(); - $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC); + $is_writable = is_dir($directory) && is_writable($directory) && (variable_get('file_downloads') == FILE_DOWNLOADS_PUBLIC); $form['bandwidth_optimizations']['preprocess_css'] = array( '#type' => 'radios', '#title' => t('Optimize CSS files'), - '#default_value' => intval(variable_get('preprocess_css', 0) && $is_writable), + '#default_value' => intval(variable_get('preprocess_css') && $is_writable), '#disabled' => !$is_writable, '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('This option can interfere with theme development and should only be enabled in a production environment.'), @@ -1409,7 +1394,7 @@ $form['bandwidth_optimizations']['preprocess_js'] = array( '#type' => 'radios', '#title' => t('Optimize JavaScript files'), - '#default_value' => intval(variable_get('preprocess_js', 0) && $is_writable), + '#default_value' => intval(variable_get('preprocess_js') && $is_writable), '#disabled' => !$is_writable, '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('This option can interfere with module development and should only be enabled in a production environment.'), @@ -1472,7 +1457,6 @@ $form['file_downloads'] = array( '#type' => 'radios', '#title' => t('Download method'), - '#default_value' => variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC), '#options' => array(FILE_DOWNLOADS_PUBLIC => t('Public - files are available using HTTP directly.'), FILE_DOWNLOADS_PRIVATE => t('Private - files are transferred by Drupal.')), '#description' => t('Choose the Public download method unless you wish to enforce fine-grained access controls over file downloads. Changing the download method will modify all download paths and may cause unexpected problems on an existing site.') ); @@ -1492,7 +1476,6 @@ $form['image_toolkit'] = array( '#type' => 'radios', '#title' => t('Select an image processing toolkit'), - '#default_value' => variable_get('image_toolkit', image_get_toolkit()), '#options' => $toolkits_available ); } @@ -1516,14 +1499,12 @@ $form['feed_default_items'] = array( '#type' => 'select', '#title' => t('Number of items in each feed'), - '#default_value' => variable_get('feed_default_items', 10), '#options' => drupal_map_assoc(array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20, 25, 30)), '#description' => t('Default number of items to include in each feed.') ); $form['feed_item_length'] = array( '#type' => 'select', '#title' => t('Feed content'), - '#default_value' => variable_get('feed_item_length', 'teaser'), '#options' => array('title' => t('Titles only'), 'teaser' => t('Titles plus teaser'), 'fulltext' => t('Full text')), '#description' => t('Global setting for the default display of content items in each feed.') ); @@ -1578,7 +1559,6 @@ $form['locale']['date_default_timezone'] = array( '#type' => 'select', '#title' => t('Default time zone'), - '#default_value' => variable_get('date_default_timezone', 0), '#options' => $zones, '#description' => t('Select the default site time zone.') ); @@ -1586,7 +1566,6 @@ $form['locale']['configurable_timezones'] = array( '#type' => 'radios', '#title' => t('User-configurable time zones'), - '#default_value' => variable_get('configurable_timezones', 1), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('When enabled, users can set their own time zone and dates will be displayed accordingly.') ); @@ -1594,7 +1573,6 @@ $form['locale']['date_first_day'] = array( '#type' => 'select', '#title' => t('First day of week'), - '#default_value' => variable_get('date_first_day', 0), '#options' => array(0 => t('Sunday'), 1 => t('Monday'), 2 => t('Tuesday'), 3 => t('Wednesday'), 4 => t('Thursday'), 5 => t('Friday'), 6 => t('Saturday')), '#description' => t('The first day of the week for calendar views.') ); @@ -1604,7 +1582,7 @@ '#title' => t('Formatting'), ); - $date_format_short = variable_get('date_format_short', $date_short[1]); + $date_format_short = variable_get('date_format_short'); $form['date_formats']['date_format_short'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1616,7 +1594,7 @@ '#description' => t('The short format of date display.'), ); - $default_short_custom = variable_get('date_format_short_custom', (isset($date_short_choices[$date_format_short]) ? $date_format_short : '')); + $default_short_custom = variable_get('date_format_short_custom'); $form['date_formats']['date_format_short_custom'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1627,7 +1605,7 @@ '#description' => t('A user-defined short date format. See the PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(REQUEST_TIME, 'custom', $default_short_custom))), ); - $date_format_medium = variable_get('date_format_medium', $date_medium[1]); + $date_format_medium = variable_get('date_format_medium'); $form['date_formats']['date_format_medium'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1639,7 +1617,7 @@ '#description' => t('The medium sized date display.'), ); - $default_medium_custom = variable_get('date_format_medium_custom', (isset($date_medium_choices[$date_format_medium]) ? $date_format_medium : '')); + $default_medium_custom = variable_get('date_format_medium_custom'); $form['date_formats']['date_format_medium_custom'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1650,7 +1628,7 @@ '#description' => t('A user-defined medium date format. See the PHP manual for available options. This format is currently set to display as %date.', array('@url' => 'http://php.net/manual/function.date.php', '%date' => format_date(REQUEST_TIME, 'custom', $default_medium_custom))), ); - $date_format_long = variable_get('date_format_long', $date_long[0]); + $date_format_long = variable_get('date_format_long'); $form['date_formats']['date_format_long'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1662,7 +1640,7 @@ '#description' => t('Longer date format used for detailed display.') ); - $default_long_custom = variable_get('date_format_long_custom', (isset($date_long_choices[$date_format_long]) ? $date_format_long : '')); + $default_long_custom = variable_get('date_format_long_custom'); $form['date_formats']['date_format_long_custom'] = array( '#prefix' => '
', '#suffix' => '
', @@ -1715,7 +1693,6 @@ $form['site_offline'] = array( '#type' => 'radios', '#title' => t('Site status'), - '#default_value' => variable_get('site_offline', 0), '#options' => array(t('Online'), t('Offline')), '#description' => t('When set to "Online", all visitors will be able to browse your site normally. When set to "Offline", only users with the "administer site configuration" permission will be able to access your site to perform maintenance; all other visitors will see the site offline message configured below. Authorized users can log in during "Offline" mode directly via the user login page.', array('@user-login' => url('user'))), ); @@ -1723,7 +1700,6 @@ $form['site_offline_message'] = array( '#type' => 'textarea', '#title' => t('Site offline message'), - '#default_value' => variable_get('site_offline_message', t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))), '#description' => t('Message to show visitors when the site is in offline mode.') ); @@ -1740,12 +1716,11 @@ $form['clean_url'] = array( '#type' => 'radios', '#title' => t('Clean URLs'), - '#default_value' => variable_get('clean_url', 0), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('This option makes Drupal emit "clean" URLs (i.e. without ?q= in the URL).'), ); - if (!variable_get('clean_url', 0)) { + if (!variable_get('clean_url')) { if (strpos(request_uri(), '?q=') !== FALSE) { drupal_add_js(drupal_get_path('module', 'system') . '/system.js', 'module'); Index: modules/system/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.module,v retrieving revision 1.624 diff -u -r1.624 system.module --- modules/system/system.module 27 Sep 2008 19:47:43 -0000 1.624 +++ modules/system/system.module 29 Sep 2008 22:38:03 -0000 @@ -42,6 +42,434 @@ define('DRUPAL_MAXIMUM_TEMP_FILE_AGE', 21600); /** + * Implementation of hook_variables(). + */ +function system_variables() { + return array( + 'cron_key' => 'drupal', + 'install_profile_modules' => array(), + 'site_name' => 'Drupal', + 'site_mail' => ini_get('sendmail_from'), + 'install_locale_batch_components' => array(), + 'update_d6_requirements' => FALSE, + 'actions_max_stack' => 35, + 'page_compression' => TRUE, + 'cache_flush' => 0, + 'cache_lifetime' => 0, + 'site_404' => '', + 'site_403' => '', + 'drupal_http_request_fails' => FALSE, + 'error_level' => 1, + 'configurable_timezones' => 1, + 'date_default_timezone' => 0, + 'date_format_short' => 'm/d/Y - H:i', + 'date_format_long' => 'l, F j, Y - H:i', + 'date_format_medium' => 'D, m/d/Y - H:i', + 'clean_url' => '0', + 'preprocess_css' => FALSE, + 'file_downloads' => FILE_DOWNLOADS_PUBLIC, + 'css_js_query_string' => '0', + 'preprocess_js' => FALSE, + 'drupal_private_key' => '', + 'cron_semaphore' => FALSE, + 'install_profile' => 'default', + 'anonymous' => 'Anonymous', + 'allow_insecure_uploads' => 0, + 'upload_extensions_default' => 'jpg jpeg gif png txt html doc xls pdf ppt pps odt ods odp', + 'file_directory_temp' => NULL, + 'file_directory_path' => conf_path() . '/files', + 'image_toolkit' => 'gd', + 'language_negotiation' => LANGUAGE_NEGOTIATION_NONE, + 'javascript_parsed' => array(), + 'locale_js_directory' => 'languages', + 'smtp_library' => '', + 'menu_masks' => array(), + 'menu_rebuild_needed' => FALSE, + 'menu_expanded' => array(), + 'menu_main_menu_source' => 'main-menu', + 'menu_secondary_menu_source' => 'secondary-menu', + 'site_offline' => 0, + 'theme_default' => 'garland', + 'theme_settings' => array(), + 'site_mission' => '', + 'site_slogan' => '', + 'site_footer' => '', + 'maintenance_theme' => 'minnelli', + 'site_slogan' => '', + 'admin_theme' => 0, + 'node_admin_theme' => 0, + 'image_jpeg_quality' => 75, + 'date_first_day' => 0, + 'date_format_short_custom' => '', + 'date_format_medium_custom' => '', + 'date_format_long_custom' => '', + 'site_offline_message' => '@site is currently under maintenance. We should be back shortly. Thank you for your patience.', + 'cron_threshold_warning' => 172800, + 'cron_threshold_error' => 1209600, + 'cron_last' => NULL, + 'install_time' => 0, + 'menu_primary_menu' => 0, + 'menu_secondary_menu' => 0, + 'menu_parent_items' => 0, + 'system_update_6043_RC2' => FALSE, + 'forum_block_num_0' => NULL, + 'forum_block_num_1' => NULL, + 'drupal_badge_color' => 'powered-blue', + 'drupal_badge_size' => '80x15', + 'admin_compact_mode' => FALSE, + 'locale_custom_strings' => array(), + 'mime_extension_mapping' => array( + 'ez' => 'application/andrew-inset', + 'atom' => 'application/atom', + 'atomcat' => 'application/atomcat+xml', + 'atomsrv' => 'application/atomserv+xml', + 'cap|pcap' => 'application/cap', + 'cu' => 'application/cu-seeme', + 'tsp' => 'application/dsptype', + 'spl' => 'application/x-futuresplash', + 'hta' => 'application/hta', + 'jar' => 'application/java-archive', + 'ser' => 'application/java-serialized-object', + 'class' => 'application/java-vm', + 'hqx' => 'application/mac-binhex40', + 'cpt' => 'image/x-corelphotopaint', + 'nb' => 'application/mathematica', + 'mdb' => 'application/msaccess', + 'doc|dot' => 'application/msword', + 'bin' => 'application/octet-stream', + 'oda' => 'application/oda', + 'ogg|ogx' => 'application/ogg', + 'pdf' => 'application/pdf', + 'key' => 'application/pgp-keys', + 'pgp' => 'application/pgp-signature', + 'prf' => 'application/pics-rules', + 'ps|ai|eps' => 'application/postscript', + 'rar' => 'application/rar', + 'rdf' => 'application/rdf+xml', + 'rss' => 'application/rss+xml', + 'rtf' => 'application/rtf', + 'smi|smil' => 'application/smil', + 'wpd' => 'application/wordperfect', + 'wp5' => 'application/wordperfect5.1', + 'xhtml|xht' => 'application/xhtml+xml', + 'xml|xsl' => 'application/xml', + 'zip' => 'application/zip', + 'cdy' => 'application/vnd.cinderella', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'kmz' => 'application/vnd.google-earth.kmz', + 'xul' => 'application/vnd.mozilla.xul+xml', + 'xls|xlb|xlt' => 'application/vnd.ms-excel', + 'cat' => 'application/vnd.ms-pki.seccat', + 'stl' => 'application/vnd.ms-pki.stl', + 'ppt|pps' => 'application/vnd.ms-powerpoint', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'otg' => 'application/vnd.oasis.opendocument.graphics-template', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'otp' => 'application/vnd.oasis.opendocument.presentation-template', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + 'oth' => 'application/vnd.oasis.opendocument.text-web', + 'docm' => 'application/vnd.ms-word.document.macroEnabled.12', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dotm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.template', + 'potm' => 'application/vnd.ms-powerpoint.template.macroEnabled.12', + 'potx' => 'application/vnd.openxmlformats-officedocument.presentationml.template', + 'ppam' => 'application/vnd.ms-powerpoint.addin.macroEnabled.12', + 'ppsm' => 'application/vnd.ms-powerpoint.slideshow.macroEnabled.12', + 'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow', + 'pptm' => 'application/vnd.ms-powerpoint.presentation.macroEnabled.12', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'xlam' => 'application/vnd.ms-excel.addin.macroEnabled.12', + 'xlsb' => 'application/vnd.ms-excel.sheet.binary.macroEnabled.12', + 'xlsm' => 'application/vnd.ms-excel.sheet.macroEnabled.12', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xltm' => 'application/vnd.ms-excel.template.macroEnabled.12', + 'xltx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.template', + 'cod' => 'application/vnd.rim.cod', + 'mmf' => 'application/vnd.smaf', + 'sdc' => 'application/vnd.stardivision.calc', + 'sds' => 'application/vnd.stardivision.chart', + 'sda' => 'application/vnd.stardivision.draw', + 'sdd' => 'application/vnd.stardivision.impress', + 'sdf' => 'application/vnd.stardivision.math', + 'sdw' => 'application/vnd.stardivision.writer', + 'sgl' => 'application/vnd.stardivision.writer-global', + 'sxc' => 'application/vnd.sun.xml.calc', + 'stc' => 'application/vnd.sun.xml.calc.template', + 'sxd' => 'application/vnd.sun.xml.draw', + 'std' => 'application/vnd.sun.xml.draw.template', + 'sxi' => 'application/vnd.sun.xml.impress', + 'sti' => 'application/vnd.sun.xml.impress.template', + 'sxm' => 'application/vnd.sun.xml.math', + 'sxw' => 'application/vnd.sun.xml.writer', + 'sxg' => 'application/vnd.sun.xml.writer.global', + 'stw' => 'application/vnd.sun.xml.writer.template', + 'sis' => 'application/vnd.symbian.install', + 'vsd' => 'application/vnd.visio', + 'wbxml' => 'application/vnd.wap.wbxml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wk' => 'application/x-123', + '7z' => 'application/x-7z-compressed', + 'abw' => 'application/x-abiword', + 'dmg' => 'application/x-apple-diskimage', + 'bcpio' => 'application/x-bcpio', + 'torrent' => 'application/x-bittorrent', + 'cab' => 'application/x-cab', + 'cbr' => 'application/x-cbr', + 'cbz' => 'application/x-cbz', + 'cdf' => 'application/x-cdf', + 'vcd' => 'application/x-cdlink', + 'pgn' => 'application/x-chess-pgn', + 'cpio' => 'application/x-cpio', + 'csh' => 'text/x-csh', + 'deb|udeb' => 'application/x-debian-package', + 'dcr|dir|dxr' => 'application/x-director', + 'dms' => 'application/x-dms', + 'wad' => 'application/x-doom', + 'dvi' => 'application/x-dvi', + 'rhtml' => 'application/x-httpd-eruby', + 'flac' => 'application/x-flac', + 'pfa|pfb|gsf|pcf|pcf.Z' => 'application/x-font', + 'mm' => 'application/x-freemind', + 'gnumeric' => 'application/x-gnumeric', + 'sgf' => 'application/x-go-sgf', + 'gcf' => 'application/x-graphing-calculator', + 'gtar|tgz|taz' => 'application/x-gtar', + 'hdf' => 'application/x-hdf', + 'phtml|pht|php' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'php3' => 'application/x-httpd-php3', + 'php3p' => 'application/x-httpd-php3-preprocessed', + 'php4' => 'application/x-httpd-php4', + 'ica' => 'application/x-ica', + 'ins|isp' => 'application/x-internet-signup', + 'iii' => 'application/x-iphone', + 'iso' => 'application/x-iso9660-image', + 'jnlp' => 'application/x-java-jnlp-file', + 'js' => 'application/x-javascript', + 'jmz' => 'application/x-jmol', + 'chrt' => 'application/x-kchart', + 'kil' => 'application/x-killustrator', + 'skp|skd|skt|skm' => 'application/x-koan', + 'kpr|kpt' => 'application/x-kpresenter', + 'ksp' => 'application/x-kspread', + 'kwd|kwt' => 'application/x-kword', + 'latex' => 'application/x-latex', + 'lha' => 'application/x-lha', + 'lyx' => 'application/x-lyx', + 'lzh' => 'application/x-lzh', + 'lzx' => 'application/x-lzx', + 'frm|maker|frame|fm|fb|book|fbdoc' => 'application/x-maker', + 'mif' => 'application/x-mif', + 'wmd' => 'application/x-ms-wmd', + 'wmz' => 'application/x-ms-wmz', + 'com|exe|bat|dll' => 'application/x-msdos-program', + 'msi' => 'application/x-msi', + 'nc' => 'application/x-netcdf', + 'pac' => 'application/x-ns-proxy-autoconfig', + 'nwc' => 'application/x-nwc', + 'o' => 'application/x-object', + 'oza' => 'application/x-oz-application', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'crl' => 'application/x-pkcs7-crl', + 'pyc|pyo' => 'application/x-python-code', + 'qtl' => 'application/x-quicktimeplayer', + 'rpm' => 'application/x-redhat-package-manager', + 'sh' => 'text/x-sh', + 'shar' => 'application/x-shar', + 'swf|swfl' => 'application/x-shockwave-flash', + 'sit|sitx' => 'application/x-stuffit', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'tar' => 'application/x-tar', + 'tcl' => 'application/x-tcl', + 'gf' => 'application/x-tex-gf', + 'pk' => 'application/x-tex-pk', + 'texinfo|texi' => 'application/x-texinfo', + '~|%|bak|old|sik' => 'application/x-trash', + 't|tr|roff' => 'application/x-troff', + 'man' => 'application/x-troff-man', + 'me' => 'application/x-troff-me', + 'ms' => 'application/x-troff-ms', + 'ustar' => 'application/x-ustar', + 'src' => 'application/x-wais-source', + 'wz' => 'application/x-wingz', + 'crt' => 'application/x-x509-ca-cert', + 'xcf' => 'application/x-xcf', + 'fig' => 'application/x-xfig', + 'xpi' => 'application/x-xpinstall', + 'au|snd' => 'audio/basic', + 'mid|midi|kar' => 'audio/midi', + 'mpga|mpega|mp2|mp3|m4a' => 'audio/mpeg', + 'm3u' => 'audio/x-mpegurl', + 'oga|spx' => 'audio/ogg', + 'sid' => 'audio/prs.sid', + 'aif|aiff|aifc' => 'audio/x-aiff', + 'gsm' => 'audio/x-gsm', + 'wma' => 'audio/x-ms-wma', + 'wax' => 'audio/x-ms-wax', + 'ra|rm|ram' => 'audio/x-pn-realaudio', + 'ra' => 'audio/x-realaudio', + 'pls' => 'audio/x-scpls', + 'sd2' => 'audio/x-sd2', + 'wav' => 'audio/x-wav', + 'alc' => 'chemical/x-alchemy', + 'cac|cache' => 'chemical/x-cache', + 'csf' => 'chemical/x-cache-csf', + 'cbin|cascii|ctab' => 'chemical/x-cactvs-binary', + 'cdx' => 'chemical/x-cdx', + 'cer' => 'chemical/x-cerius', + 'c3d' => 'chemical/x-chem3d', + 'chm' => 'chemical/x-chemdraw', + 'cif' => 'chemical/x-cif', + 'cmdf' => 'chemical/x-cmdf', + 'cml' => 'chemical/x-cml', + 'cpa' => 'chemical/x-compass', + 'bsd' => 'chemical/x-crossfire', + 'csml|csm' => 'chemical/x-csml', + 'ctx' => 'chemical/x-ctx', + 'cxf|cef' => 'chemical/x-cxf', + 'emb|embl' => 'chemical/x-embl-dl-nucleotide', + 'spc' => 'chemical/x-galactic-spc', + 'inp|gam|gamin' => 'chemical/x-gamess-input', + 'fch|fchk' => 'chemical/x-gaussian-checkpoint', + 'cub' => 'chemical/x-gaussian-cube', + 'gau|gjc|gjf' => 'chemical/x-gaussian-input', + 'gal' => 'chemical/x-gaussian-log', + 'gcg' => 'chemical/x-gcg8-sequence', + 'gen' => 'chemical/x-genbank', + 'hin' => 'chemical/x-hin', + 'istr|ist' => 'chemical/x-isostar', + 'jdx|dx' => 'chemical/x-jcamp-dx', + 'kin' => 'chemical/x-kinemage', + 'mcm' => 'chemical/x-macmolecule', + 'mmd|mmod' => 'chemical/x-macromodel-input', + 'mol' => 'chemical/x-mdl-molfile', + 'rd' => 'chemical/x-mdl-rdfile', + 'rxn' => 'chemical/x-mdl-rxnfile', + 'sd|sdf' => 'chemical/x-mdl-sdfile', + 'tgf' => 'chemical/x-mdl-tgf', + 'mcif' => 'chemical/x-mmcif', + 'mol2' => 'chemical/x-mol2', + 'b' => 'chemical/x-molconn-Z', + 'gpt' => 'chemical/x-mopac-graph', + 'mop|mopcrt|mpc|dat|zmt' => 'chemical/x-mopac-input', + 'moo' => 'chemical/x-mopac-out', + 'mvb' => 'chemical/x-mopac-vib', + 'asn' => 'chemical/x-ncbi-asn1-spec', + 'prt|ent' => 'chemical/x-ncbi-asn1-ascii', + 'val|aso' => 'chemical/x-ncbi-asn1-binary', + 'pdb|ent' => 'chemical/x-pdb', + 'ros' => 'chemical/x-rosdal', + 'sw' => 'chemical/x-swissprot', + 'vms' => 'chemical/x-vamas-iso14976', + 'vmd' => 'chemical/x-vmd', + 'xtel' => 'chemical/x-xtel', + 'xyz' => 'chemical/x-xyz', + 'gif' => 'image/gif', + 'ief' => 'image/ief', + 'jpeg|jpg|jpe' => 'image/jpeg', + 'pcx' => 'image/pcx', + 'png' => 'image/png', + 'svg|svgz' => 'image/svg+xml', + 'tiff|tif' => 'image/tiff', + 'djvu|djv' => 'image/vnd.djvu', + 'wbmp' => 'image/vnd.wap.wbmp', + 'ras' => 'image/x-cmu-raster', + 'cdr' => 'image/x-coreldraw', + 'pat' => 'image/x-coreldrawpattern', + 'cdt' => 'image/x-coreldrawtemplate', + 'ico' => 'image/x-icon', + 'art' => 'image/x-jg', + 'jng' => 'image/x-jng', + 'bmp' => 'image/x-ms-bmp', + 'psd' => 'image/x-photoshop', + 'pnm' => 'image/x-portable-anymap', + 'pbm' => 'image/x-portable-bitmap', + 'pgm' => 'image/x-portable-graymap', + 'ppm' => 'image/x-portable-pixmap', + 'rgb' => 'image/x-rgb', + 'xbm' => 'image/x-xbitmap', + 'xpm' => 'image/x-xpixmap', + 'xwd' => 'image/x-xwindowdump', + 'eml' => 'message/rfc822', + 'igs|iges' => 'model/iges', + 'msh|mesh|silo' => 'model/mesh', + 'wrl|vrml' => 'model/vrml', + 'ics|icz' => 'text/calendar', + 'css' => 'text/css', + 'csv' => 'text/csv', + '323' => 'text/h323', + 'html|htm|shtml' => 'text/html', + 'uls' => 'text/iuls', + 'mml' => 'text/mathml', + 'asc|txt|text|pot' => 'text/plain', + 'rtx' => 'text/richtext', + 'sct|wsc' => 'text/scriptlet', + 'tm|ts' => 'text/texmacs', + 'tsv' => 'text/tab-separated-values', + 'jad' => 'text/vnd.sun.j2me.app-descriptor', + 'wml' => 'text/vnd.wap.wml', + 'wmls' => 'text/vnd.wap.wmlscript', + 'bib' => 'text/x-bibtex', + 'boo' => 'text/x-boo', + 'h++|hpp|hxx|hh' => 'text/x-c++hdr', + 'c++|cpp|cxx|cc' => 'text/x-c++src', + 'h' => 'text/x-chdr', + 'htc' => 'text/x-component', + 'c' => 'text/x-csrc', + 'd' => 'text/x-dsrc', + 'diff|patch' => 'text/x-diff', + 'hs' => 'text/x-haskell', + 'java' => 'text/x-java', + 'lhs' => 'text/x-literate-haskell', + 'moc' => 'text/x-moc', + 'p|pas' => 'text/x-pascal', + 'gcd' => 'text/x-pcs-gcd', + 'pl|pm' => 'text/x-perl', + 'py' => 'text/x-python', + 'etx' => 'text/x-setext', + 'tcl|tk' => 'text/x-tcl', + 'tex|ltx|sty|cls' => 'text/x-tex', + 'vcs' => 'text/x-vcalendar', + 'vcf' => 'text/x-vcard', + '3gp' => 'video/3gpp', + 'dl' => 'video/dl', + 'dif|dv' => 'video/dv', + 'fli' => 'video/fli', + 'gl' => 'video/gl', + 'mpeg|mpg|mpe' => 'video/mpeg', + 'mp4' => 'video/mp4', + 'ogv' => 'video/ogg', + 'qt|mov' => 'video/quicktime', + 'mxu' => 'video/vnd.mpegurl', + 'lsf|lsx' => 'video/x-la-asf', + 'mng' => 'video/x-mng', + 'asf|asx' => 'video/x-ms-asf', + 'wm' => 'video/x-ms-wm', + 'wmv' => 'video/x-ms-wmv', + 'wmx' => 'video/x-ms-wmx', + 'wvx' => 'video/x-ms-wvx', + 'avi' => 'video/x-msvideo', + 'movie' => 'video/x-sgi-movie', + 'ice' => 'x-conference/x-cooltalk', + 'sisx' => 'x-epoc/x-sisx-app', + 'vrm|vrml|wrl' => 'x-world/x-vrml', + 'xps' => 'application/vnd.ms-xpsdocument', + ), + ); +} + +/** * Implementation of hook_help(). */ function system_help($path, $arg) { @@ -674,7 +1102,7 @@ * Menu item access callback - only admin or enabled themes can be accessed. */ function _system_themes_access($theme) { - return user_access('administer site configuration') && ($theme->status || $theme->name == variable_get('admin_theme', '0')); + return user_access('administer site configuration') && ($theme->status || $theme->name == variable_get('admin_theme')); } /** @@ -682,9 +1110,9 @@ */ function system_init() { // Use the administrative theme if the user is looking at a page in the admin/* path. - if (arg(0) == 'admin' || (variable_get('node_admin_theme', '0') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'))) { + if (arg(0) == 'admin' || (variable_get('node_admin_theme') && arg(0) == 'node' && (arg(1) == 'add' || arg(2) == 'edit'))) { global $custom_theme; - $custom_theme = variable_get('admin_theme', '0'); + $custom_theme = variable_get('admin_theme'); drupal_add_css(drupal_get_path('module', 'system') . '/admin.css', 'module'); } @@ -719,7 +1147,7 @@ if ($type == 'form' && $category == 'account') { $form['theme_select'] = system_theme_select_form(t('Selecting a different theme will change the look and feel of the site.'), isset($edit['theme']) ? $edit['theme'] : NULL, 2); - if (variable_get('configurable_timezones', 1)) { + if (variable_get('configurable_timezones')) { $zones = _system_zonelist(); $form['timezone'] = array( '#type' => 'fieldset', @@ -730,7 +1158,7 @@ $form['timezone']['timezone'] = array( '#type' => 'select', '#title' => t('Time zone'), - '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone', 0), + '#default_value' => strlen($edit['timezone']) ? $edit['timezone'] : variable_get('date_default_timezone'), '#options' => $zones, '#description' => t('Select your current local time. Dates and times throughout this site will be displayed using this time zone.'), ); @@ -760,13 +1188,13 @@ $form['wrapper']['color'] = array( '#type' => 'select', '#title' => t('Badge color'), - '#default_value' => variable_get('drupal_badge_color', 'powered-blue'), + '#default_value' => variable_get('drupal_badge_color'), '#options' => array('powered-black' => t('Black'), 'powered-blue' => t('Blue'), 'powered-gray' => t('Gray')), ); $form['wrapper']['size'] = array( '#type' => 'select', '#title' => t('Badge size'), - '#default_value' => variable_get('drupal_badge_size', '80x15'), + '#default_value' => variable_get('drupal_badge_size'), '#options' => array('80x15' => t('Small'), '88x31' => t('Medium'), '135x42' => t('Large')), ); return $form; @@ -775,7 +1203,7 @@ variable_set('drupal_badge_size', $edit['size']); break; case 'view': - $image_path = 'misc/' . variable_get('drupal_badge_color', 'powered-blue') . '-' . variable_get('drupal_badge_size', '80x15') . '.png'; + $image_path = 'misc/' . variable_get('drupal_badge_color') . '-' . variable_get('drupal_badge_size') . '.png'; $block['subject'] = NULL; // Don't display a title $block['content'] = theme('system_powered_by', $image_path); return $block; @@ -821,7 +1249,7 @@ */ function system_admin_theme_submit($form, &$form_state) { // If we're changing themes, make sure the theme has its blocks initialized. - if ($form_state['values']['admin_theme'] && $form_state['values']['admin_theme'] != variable_get('admin_theme', '0')) { + if ($form_state['values']['admin_theme'] && $form_state['values']['admin_theme'] != variable_get('admin_theme')) { $result = db_result(db_query("SELECT COUNT(*) FROM {blocks} WHERE theme = '%s'", $form_state['values']['admin_theme'])); if (!$result) { system_initialize_theme_blocks($form_state['values']['admin_theme']); @@ -865,7 +1293,7 @@ foreach ($enabled as $info) { // For the default theme, revert to an empty string so the user's theme updates when the site theme is changed. - $info->key = $info->name == variable_get('theme_default', 'garland') ? '' : $info->name; + $info->key = $info->name == variable_get('theme_default') ? '' : $info->name; $screenshot = NULL; $theme_key = $info->name; @@ -880,7 +1308,7 @@ $screenshot = $screenshot ? theme('image', $screenshot, t('Screenshot for %theme theme', array('%theme' => $info->name)), '', array('class' => 'screenshot'), FALSE) : t('no screenshot'); $form['themes'][$info->key]['screenshot'] = array('#markup' => $screenshot); - $form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name, '#markup' => dirname($info->filename) . ($info->name == variable_get('theme_default', 'garland') ? '
' . t('(site default theme)') . '' : '')); + $form['themes'][$info->key]['description'] = array('#type' => 'item', '#title' => $info->name, '#markup' => dirname($info->filename) . ($info->name == variable_get('theme_default') ? '
' . t('(site default theme)') . '' : '')); $options[$info->key] = ''; } @@ -1164,7 +1592,7 @@ function system_initialize_theme_blocks($theme) { // Initialize theme's blocks if none already registered. if (!(db_result(db_query("SELECT COUNT(*) FROM {blocks} WHERE theme = '%s'", $theme)))) { - $default_theme = variable_get('theme_default', 'garland'); + $default_theme = variable_get('theme_default'); $regions = system_region_list($theme); $result = db_query("SELECT * FROM {blocks} WHERE theme = '%s'", $default_theme); while ($block = db_fetch_array($result)) { @@ -1189,6 +1617,8 @@ * The form structure. */ function system_settings_form($form) { + $form = _system_settings_form_variable_defaults($form); + $form['buttons']['submit'] = array('#type' => 'submit', '#value' => t('Save configuration') ); $form['buttons']['reset'] = array('#type' => 'submit', '#value' => t('Reset to defaults') ); @@ -1201,6 +1631,32 @@ } /** + * Helper function for system_settings_form() - fill in default values for + * variable derived form items recursively. + * + * @param $form + * The form to fill in default values of. + * @return + * The form with filled-in default values. + */ +function _system_settings_form_variable_defaults($form) { + foreach (element_children($form) as $child) { + if (isset($form[$child]['#type'])) { + $info = _element_info($form[$child]['#type']); + // Only add the default value if #variable is not FALSE and the form item + // is used for input and it doesn't already have a #value or a + // #default_value. + if (isset($info['#input']) && $info['#input'] && (!isset($form[$child]['#variable']) || !$form[$child]['#variable']) && !isset($form[$child]['#value']) && !isset($form[$child]['#default_value'])) { + $form[$child]['#default_value'] = variable_get($child); + } + } + // Recursively do this for all children. + $form[$child] = _system_settings_form_variable_defaults($form[$child]); + } + return $form; +} + +/** * Execute the system_settings_form. * * If you want node type configure style handling of your checkboxes, @@ -1257,7 +1713,7 @@ $old = 'toggle_node_info_' . $info->old_type; $new = 'toggle_node_info_' . $info->type; - $theme_settings = variable_get('theme_settings', array()); + $theme_settings = variable_get('theme_settings'); if (isset($theme_settings[$old])) { $theme_settings[$new] = $theme_settings[$old]; unset($theme_settings[$old]); @@ -1331,7 +1787,7 @@ */ function system_admin_compact_mode() { global $user; - return (isset($user->admin_compact_mode)) ? $user->admin_compact_mode : variable_get('admin_compact_mode', FALSE); + return (isset($user->admin_compact_mode)) ? $user->admin_compact_mode : variable_get('admin_compact_mode'); } /** @@ -1888,7 +2344,7 @@ $account = $params['account']; $context = $params['context']; $variables = array( - '%site_name' => variable_get('site_name', 'Drupal'), + '%site_name' => variable_get('site_name'), '%username' => $account->name, ); if ($context['hook'] == 'taxonomy') { @@ -1944,8 +2400,8 @@ function system_message_action(&$object, $context = array()) { global $user; $variables = array( - '%site_name' => variable_get('site_name', 'Drupal'), - '%username' => $user->name ? $user->name : variable_get('anonymous', t('Anonymous')), + '%site_name' => variable_get('site_name'), + '%username' => $user->name ? $user->name : variable_get('anonymous'), ); // This action can be called in any context, but if placeholders @@ -2038,7 +2494,7 @@ $zones = array(); foreach ($zonelist as $offset) { $zone = $offset * 3600; - $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long', 'l, F j, Y - H:i') . ' O', $zone); + $zones[$zone] = format_date($timestamp, 'custom', variable_get('date_format_long') . ' O', $zone); } return $zones; } Index: modules/system/image.gd.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/image.gd.inc,v retrieving revision 1.2 diff -u -r1.2 image.gd.inc --- modules/system/image.gd.inc 16 Jul 2008 21:59:28 -0000 1.2 +++ modules/system/image.gd.inc 29 Sep 2008 22:38:03 -0000 @@ -34,7 +34,6 @@ '#description' => t('Define the image quality for JPEG manipulations. Ranges from 0 to 100. Higher values mean better image quality but bigger files.'), '#size' => 10, '#maxlength' => 3, - '#default_value' => variable_get('image_jpeg_quality', 75), '#field_suffix' => t('%'), ); $form['#element_validate'] = array('image_gd_settings_validate'); @@ -209,7 +208,7 @@ return FALSE; } if ($extension == 'jpeg') { - return $close_func($res, $destination, variable_get('image_jpeg_quality', 75)); + return $close_func($res, $destination, variable_get('image_jpeg_quality')); } else { return $close_func($res, $destination); Index: modules/aggregator/aggregator.test =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.test,v retrieving revision 1.8 diff -u -r1.8 aggregator.test --- modules/aggregator/aggregator.test 15 Sep 2008 21:06:06 -0000 1.8 +++ modules/aggregator/aggregator.test 29 Sep 2008 22:38:03 -0000 @@ -65,7 +65,7 @@ $this->assertResponse(200, t('rss.xml is reachable.')); // Our tests are based off of rss.xml, so let's find out how many elements should be related. - $feed_count = db_result(db_query_range(db_rewrite_sql('SELECT COUNT(*) FROM {node} n WHERE n.promote = 1 AND n.status = 1'), 0, variable_get('feed_default_items', 10))); + $feed_count = db_result(db_query_range(db_rewrite_sql('SELECT COUNT(*) FROM {node} n WHERE n.promote = 1 AND n.status = 1'), 0, variable_get('feed_default_items'))); $feed_count = $feed_count > 10 ? 10 : $feed_count; // Refresh the feed (simulated link click). Index: modules/aggregator/aggregator.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/aggregator/aggregator.admin.inc,v retrieving revision 1.16 diff -u -r1.16 aggregator.admin.inc --- modules/aggregator/aggregator.admin.inc 17 Sep 2008 07:11:56 -0000 1.16 +++ modules/aggregator/aggregator.admin.inc 29 Sep 2008 22:38:02 -0000 @@ -398,24 +398,23 @@ $form['aggregator_allowed_html_tags'] = array( '#type' => 'textfield', '#title' => t('Allowed HTML tags'), '#size' => 80, '#maxlength' => 255, - '#default_value' => variable_get('aggregator_allowed_html_tags', '