From d9bf22a0e29c2a70049443a0ae8521a2c0492c8b Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 11 Dec 2011 06:38:23 -0500 Subject: initial commit for git repository --- .../openid-php-openid-782224d/admin/adminutil.php | 30 ++++ .../openid-php-openid-782224d/admin/brace_style.pl | 81 +++++++++ models/openid-php-openid-782224d/admin/checkimport | 4 + .../openid-php-openid-782224d/admin/checkimports | 2 + .../openid-php-openid-782224d/admin/darcs-ignore | 3 + models/openid-php-openid-782224d/admin/docblocks | 15 ++ .../openid-php-openid-782224d/admin/docblocks.pl | 26 +++ models/openid-php-openid-782224d/admin/findallphp | 8 + models/openid-php-openid-782224d/admin/findglobals | 5 + models/openid-php-openid-782224d/admin/findphp | 8 + models/openid-php-openid-782224d/admin/fixperms | 15 ++ models/openid-php-openid-782224d/admin/gettlds.py | 47 +++++ .../openid-php-openid-782224d/admin/library-name | 1 + .../openid-php-openid-782224d/admin/longlines.pl | 46 +++++ models/openid-php-openid-782224d/admin/makedoc.sh | 5 + models/openid-php-openid-782224d/admin/mathlib | 18 ++ models/openid-php-openid-782224d/admin/nobadbraces | 4 + models/openid-php-openid-782224d/admin/nobadcase | 14 ++ models/openid-php-openid-782224d/admin/nolonglines | 14 ++ models/openid-php-openid-782224d/admin/notabs | 16 ++ models/openid-php-openid-782224d/admin/open_tag | 17 ++ .../openid-php-openid-782224d/admin/otb_test.php | 20 +++ models/openid-php-openid-782224d/admin/package.xml | 24 +++ .../openid-php-openid-782224d/admin/package2.xml | 74 ++++++++ .../openid-php-openid-782224d/admin/packagexml.py | 155 ++++++++++++++++ .../openid-php-openid-782224d/admin/phpaliases.py | 119 +++++++++++++ .../admin/prepare-release | 12 ++ models/openid-php-openid-782224d/admin/runtests | 71 ++++++++ models/openid-php-openid-782224d/admin/syntaxcheck | 5 + .../openid-php-openid-782224d/admin/texttest.php | 197 +++++++++++++++++++++ .../admin/tutorials/OpenID/OpenID.pkg | 78 ++++++++ models/openid-php-openid-782224d/admin/webtest.php | 12 ++ .../openid-php-openid-782224d/admin/xmlconfig.py | 55 ++++++ 33 files changed, 1201 insertions(+) create mode 100644 models/openid-php-openid-782224d/admin/adminutil.php create mode 100644 models/openid-php-openid-782224d/admin/brace_style.pl create mode 100644 models/openid-php-openid-782224d/admin/checkimport create mode 100644 models/openid-php-openid-782224d/admin/checkimports create mode 100644 models/openid-php-openid-782224d/admin/darcs-ignore create mode 100644 models/openid-php-openid-782224d/admin/docblocks create mode 100644 models/openid-php-openid-782224d/admin/docblocks.pl create mode 100644 models/openid-php-openid-782224d/admin/findallphp create mode 100644 models/openid-php-openid-782224d/admin/findglobals create mode 100644 models/openid-php-openid-782224d/admin/findphp create mode 100644 models/openid-php-openid-782224d/admin/fixperms create mode 100644 models/openid-php-openid-782224d/admin/gettlds.py create mode 100644 models/openid-php-openid-782224d/admin/library-name create mode 100644 models/openid-php-openid-782224d/admin/longlines.pl create mode 100644 models/openid-php-openid-782224d/admin/makedoc.sh create mode 100644 models/openid-php-openid-782224d/admin/mathlib create mode 100644 models/openid-php-openid-782224d/admin/nobadbraces create mode 100644 models/openid-php-openid-782224d/admin/nobadcase create mode 100644 models/openid-php-openid-782224d/admin/nolonglines create mode 100644 models/openid-php-openid-782224d/admin/notabs create mode 100644 models/openid-php-openid-782224d/admin/open_tag create mode 100644 models/openid-php-openid-782224d/admin/otb_test.php create mode 100644 models/openid-php-openid-782224d/admin/package.xml create mode 100644 models/openid-php-openid-782224d/admin/package2.xml create mode 100644 models/openid-php-openid-782224d/admin/packagexml.py create mode 100644 models/openid-php-openid-782224d/admin/phpaliases.py create mode 100644 models/openid-php-openid-782224d/admin/prepare-release create mode 100644 models/openid-php-openid-782224d/admin/runtests create mode 100644 models/openid-php-openid-782224d/admin/syntaxcheck create mode 100644 models/openid-php-openid-782224d/admin/texttest.php create mode 100644 models/openid-php-openid-782224d/admin/tutorials/OpenID/OpenID.pkg create mode 100644 models/openid-php-openid-782224d/admin/webtest.php create mode 100644 models/openid-php-openid-782224d/admin/xmlconfig.py (limited to 'models/openid-php-openid-782224d/admin') diff --git a/models/openid-php-openid-782224d/admin/adminutil.php b/models/openid-php-openid-782224d/admin/adminutil.php new file mode 100644 index 000000000..738983866 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/adminutil.php @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/models/openid-php-openid-782224d/admin/brace_style.pl b/models/openid-php-openid-782224d/admin/brace_style.pl new file mode 100644 index 000000000..ed8332f31 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/brace_style.pl @@ -0,0 +1,81 @@ +#!/usr/bin/env perl -w + +use strict; + +my $filename = $ARGV[0]; + +if (!$filename) { + print "Usage: modified_otb.pl \n"; + exit(1); +} + +my @results = (); +my $line_num = 0; +my ($NONE, $BRACE, $PAREN) = (0, 1, 2); +my $looking_for = $NONE; +my $last_func_name = ""; + +open(HANDLE, "<", $filename) or die "Cannot open $filename\n"; + +# Read the file and track the lines with length > $max_length. +while () { + $line_num++; + # Subtract one because the newline doesn't count toward the + # length. + chomp; + + if (!$looking_for && + ($_ =~ /^\s*function/) && + ($_ =~ /\{/)) { + # Done (bad): we found a function whose opening line ends with + # a brace, which goes against the PEAR coding guidelines. + + ($last_func_name) = $_ =~ /function\s*(.*)\(/; + + push @results, "'$last_func_name' prototype ends with opening ". + "brace, line $line_num"; + } elsif (!$looking_for && + ($_ =~ /^\s*function/) && + ($_ !~ /\)/)) { + ($last_func_name) = $_ =~ /function\s*(.*)\(/; + $looking_for = $PAREN; + } elsif (($looking_for == $PAREN) && + ($_ =~ /\)/) && + ($_ =~ /\{/)) { + # Done (bad): function prototype and brace are on the same + # line. + push @results, "'$last_func_name' prototype ends with with ". + "opening brace, line $line_num"; + $looking_for = $NONE; + } elsif (($looking_for == $PAREN) && + ($_ =~ /\)/) && + ($_ !~ /\{/)) { + $looking_for = $BRACE; + } elsif (!$looking_for && + ($_ =~ /^\s*function/) && + ($_ =~ /\)/) && + ($_ !~ /\{/)) { + ($last_func_name) = $_ =~ /function\s*(.*)\(/; + $looking_for = $BRACE; + } elsif (($looking_for == $BRACE) && + ($_ eq "{")) { + $looking_for = $NONE; + # Done (good): the brace was found on the line after the + # function prototype. + } else { + # We got here because we got a line that we're not interested + # in. + $looking_for = $NONE; + } +} + +# If any long lines were found, notify and exit(1); otherwise, +# exit(0). +if (@results) { + foreach my $result (@results) { + print "$filename: $result\n"; + } + exit(1); +} else { + exit(0); +} diff --git a/models/openid-php-openid-782224d/admin/checkimport b/models/openid-php-openid-782224d/admin/checkimport new file mode 100644 index 000000000..05776d8f4 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/checkimport @@ -0,0 +1,4 @@ +#!/usr/bin/env php + \ No newline at end of file diff --git a/models/openid-php-openid-782224d/admin/checkimports b/models/openid-php-openid-782224d/admin/checkimports new file mode 100644 index 000000000..c4fa471a6 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/checkimports @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +./admin/findphp | xargs -L 1 ./admin/checkimport \ No newline at end of file diff --git a/models/openid-php-openid-782224d/admin/darcs-ignore b/models/openid-php-openid-782224d/admin/darcs-ignore new file mode 100644 index 000000000..8291ce2e0 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/darcs-ignore @@ -0,0 +1,3 @@ +~$ +^doc(/|$) +^CHANGELOG$ diff --git a/models/openid-php-openid-782224d/admin/docblocks b/models/openid-php-openid-782224d/admin/docblocks new file mode 100644 index 000000000..a7f05c3b8 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/docblocks @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +#set -e + +bad_files=$(./admin/findphp | xargs -L 1 /usr/bin/env perl admin/docblocks.pl) + +if [ "$bad_files" ] + then + cat <&2 +These files do not start with docblocks: + +$bad_files + +EOF + exit 1 +fi diff --git a/models/openid-php-openid-782224d/admin/docblocks.pl b/models/openid-php-openid-782224d/admin/docblocks.pl new file mode 100644 index 000000000..0483dbb06 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/docblocks.pl @@ -0,0 +1,26 @@ +#!/usr/bin/env perl -w + +use strict; + +my $filename = $ARGV[0]; + +if (!$filename) { + print "Usage: docblocks.pl \n"; + exit(1); +} + +my %allowed = ("" => 1, + " 1); + +open(HANDLE, "<", $filename) or die "Cannot open $filename\n"; + +while () { + chomp; + + if ($_ =~ /\/\*\*/) { + exit(0); + } elsif (!$allowed{$_}) { + print $filename."\n"; + exit(1); + } +} diff --git a/models/openid-php-openid-782224d/admin/findallphp b/models/openid-php-openid-782224d/admin/findallphp new file mode 100644 index 000000000..59a7306ab --- /dev/null +++ b/models/openid-php-openid-782224d/admin/findallphp @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +find Auth Tests \ + -name _darcs -prune -o \ + \( -type f \ + -a -name \*.php \ + -a ! -name .\* \ + \) diff --git a/models/openid-php-openid-782224d/admin/findglobals b/models/openid-php-openid-782224d/admin/findglobals new file mode 100644 index 000000000..2fcb0e61e --- /dev/null +++ b/models/openid-php-openid-782224d/admin/findglobals @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +# Find all PHP modules that are likely to have global variables +set -e + +./admin/findphp | xargs grep '^\$' diff --git a/models/openid-php-openid-782224d/admin/findphp b/models/openid-php-openid-782224d/admin/findphp new file mode 100644 index 000000000..d529af716 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/findphp @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +find Auth Tests \ + -name _darcs -prune -o \ + \( -type f \ + -a -name \*.php \ + -a ! -name .\* \ + \) | grep -v Tests diff --git a/models/openid-php-openid-782224d/admin/fixperms b/models/openid-php-openid-782224d/admin/fixperms new file mode 100644 index 000000000..0ea094427 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/fixperms @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +cat < 60: + print output_line + line_suffix + output_line = line_prefix + tld + else: + output_line = new_output_line + prefix = separator + +print output_line + suffix diff --git a/models/openid-php-openid-782224d/admin/library-name b/models/openid-php-openid-782224d/admin/library-name new file mode 100644 index 000000000..c67163c1f --- /dev/null +++ b/models/openid-php-openid-782224d/admin/library-name @@ -0,0 +1 @@ +php-openid \ No newline at end of file diff --git a/models/openid-php-openid-782224d/admin/longlines.pl b/models/openid-php-openid-782224d/admin/longlines.pl new file mode 100644 index 000000000..6ce65e87a --- /dev/null +++ b/models/openid-php-openid-782224d/admin/longlines.pl @@ -0,0 +1,46 @@ +#!/usr/bin/env perl -w + +use strict; + +my $filename = $ARGV[0]; + +if (!$filename) { + print "Usage: longlines.pl [length]\n"; + exit(1); +} + +# Set a default maximum line length. +my $max_length = $ARGV[1] || 80; + +my @lines = (); +my $line_num = 0; + +open(HANDLE, "<", $filename) or die "Cannot open $filename\n"; + +# Read the file and track the lines with length > $max_length. +while () { + $line_num++; + # Subtract one because the newline doesn't count toward the + # length. + if (length($_) - 1 > $max_length) { + push @lines, $line_num; + } +} + +# If more than five long lines were found, truncate to five and +# indicate that others were present, too. +if (@lines > 5) { + @lines = @lines[0..4]; + push @lines, "and others"; +} + +# If any long lines were found, notify and exit(1); otherwise, +# exit(0). +if (@lines) { + print $filename." (line".((@lines > 1) ? "s" : "")." ". + join(", ", @lines)." exceed".((@lines == 1) ? "s" : ""). + " length $max_length)\n"; + exit(1); +} else { + exit(0); +} diff --git a/models/openid-php-openid-782224d/admin/makedoc.sh b/models/openid-php-openid-782224d/admin/makedoc.sh new file mode 100644 index 000000000..f07f6c682 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/makedoc.sh @@ -0,0 +1,5 @@ +#!/bin/sh +set -v +phpdoc -p on -t doc -d Auth,admin/tutorials -ti "JanRain OpenID Library" \ + --ignore \*~,BigMath.php,Discover.php,CryptUtil.php,DiffieHellman.php,HMACSHA1.php,KVForm.php,Parse.php,TrustRoot.php,HTTPFetcher.php,ParanoidHTTPFetcher.php,PlainHTTPFetcher.php,ParseHTML.php,URINorm.php,XRI.php,XRIRes.php,Misc.php \ + -dn "OpenID" -o "HTML:frames:phphtmllib" diff --git a/models/openid-php-openid-782224d/admin/mathlib b/models/openid-php-openid-782224d/admin/mathlib new file mode 100644 index 000000000..53f50d06c --- /dev/null +++ b/models/openid-php-openid-782224d/admin/mathlib @@ -0,0 +1,18 @@ +#!/usr/bin/env php +type; +} + +?> diff --git a/models/openid-php-openid-782224d/admin/nobadbraces b/models/openid-php-openid-782224d/admin/nobadbraces new file mode 100644 index 000000000..ee060dccd --- /dev/null +++ b/models/openid-php-openid-782224d/admin/nobadbraces @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -e + +./admin/findphp | xargs -L 1 /usr/bin/env perl admin/brace_style.pl diff --git a/models/openid-php-openid-782224d/admin/nobadcase b/models/openid-php-openid-782224d/admin/nobadcase new file mode 100644 index 000000000..c2c266237 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/nobadcase @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +bad=$(./admin/findphp | xargs egrep -n "^[^\'\"]*\b(TRUE|FALSE|NULL)\b") + +if [ ! -z "$bad" ] + then + cat <&2 +These files contain wrongly capitalized constants: + +$bad + +EOF + exit 1 +fi diff --git a/models/openid-php-openid-782224d/admin/nolonglines b/models/openid-php-openid-782224d/admin/nolonglines new file mode 100644 index 000000000..3e2addc70 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/nolonglines @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +files_with_long_lines=$(./admin/findphp | + xargs -L 1 -I FILENAME /usr/bin/env perl admin/longlines.pl FILENAME 80) + +if [ "$files_with_long_lines" ] + then + cat <&2 +Found lines > 80 characters in: + +$files_with_long_lines +EOF + exit 1 +fi diff --git a/models/openid-php-openid-782224d/admin/notabs b/models/openid-php-openid-782224d/admin/notabs new file mode 100644 index 000000000..b6a7df012 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/notabs @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# +# Look in the local directory for PHP files that have tabs in them. If +# there are files with tabs, print the list of files and exit with +# non-zero status. + +tabs=$(./admin/findphp | xargs egrep -n ' ' | sort) + +if [ ! -z "$tabs" ] + then + cat <&2 +Found tabs in: +$tabs +EOF + exit 1 +fi diff --git a/models/openid-php-openid-782224d/admin/open_tag b/models/openid-php-openid-782224d/admin/open_tag new file mode 100644 index 000000000..27fe1c5c5 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/open_tag @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +bad_files=$(./admin/findphp | + xargs -L 1 grep -H -m 1 "&2 +These PHP files do NOT begin with \ No newline at end of file diff --git a/models/openid-php-openid-782224d/admin/package.xml b/models/openid-php-openid-782224d/admin/package.xml new file mode 100644 index 000000000..c959ba9ec --- /dev/null +++ b/models/openid-php-openid-782224d/admin/package.xml @@ -0,0 +1,24 @@ + + + %(package_name)s + %(package_summary)s + + %(package_description)s + + %(license_name)s + %(maintainers)s + + %(version)s + %(date)s + %(release_stability)s + + + + %(contents_version_1)s + + + + + diff --git a/models/openid-php-openid-782224d/admin/package2.xml b/models/openid-php-openid-782224d/admin/package2.xml new file mode 100644 index 000000000..d3bd5251f --- /dev/null +++ b/models/openid-php-openid-782224d/admin/package2.xml @@ -0,0 +1,74 @@ + + + %(package_name)s + %(uri)s + %(package_summary)s + + %(package_description)s + + %(leads)s + %(date)s + + %(version)s + %(version)s + + + %(release_stability)s + %(release_stability)s + + %(license_name)s + + + + + %(contents)s + + + + + 4.3.0 + + + 1.4.5 + + + + + PHPUnit + pear.php.net + 1.1.1 + + + PEAR_DB + pear.php.net + 1.80 + + + pgsql + + + mysql + + + sqlite + + + bcmath + + + gmp + + + + + + diff --git a/models/openid-php-openid-782224d/admin/packagexml.py b/models/openid-php-openid-782224d/admin/packagexml.py new file mode 100644 index 000000000..e83240594 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/packagexml.py @@ -0,0 +1,155 @@ +#!/usr/bin/python + +import os +import os.path + +def makeMaintainerXML(leads): + maintainer_template = """ + + %(user)s + %(name)s + %(email)s + lead + + """ + + return "" + \ + "".join([maintainer_template % l for l in leads]) + \ + "" + +def makeLeadXML(leads): + lead_template = """ + + %(name)s + %(user)s + %(email)s + %(active)s + + """ + + return "".join([lead_template % l for l in leads]) + +INDENT_STRING = " " + +def buildContentsXMLFordir(dir_or_file, roles, depth=0, dir_role=None, + all_files=False): + """ + Returns a list of strings, each of which is either a XML + element for the given file or a element which contains other + elements. + """ + + try: + entries = os.listdir(dir_or_file) + dir_role_s = '' + if dir_role: + dir_role_s = ' role="%s"' % (dir_role) + lines = ['%s' % (INDENT_STRING * depth, + os.path.basename(dir_or_file), + dir_role_s)] + + for entry in entries: + lines += buildContentsXMLFordir(dir_or_file + os.sep + entry, roles, + depth + 1, dir_role, all_files) + + lines.append('%s' % (INDENT_STRING * depth)) + + return lines + except OSError: + try: + extension = dir_or_file.split(".")[-1] + except: + if not all_files: + return [] + + if all_files and dir_role: + return ['%s' % + (INDENT_STRING * depth, os.path.basename(dir_or_file), dir_role)] + elif extension in roles: # Ends in an extension we care about + return ['%s' % + (INDENT_STRING * depth, os.path.basename(dir_or_file), + roles[extension])] + else: + return [] + +def buildContentsXML(roles, *dirs): + lines = [] + + for directory in dirs: + lines.append("\n".join(buildContentsXMLFordir(directory, roles, 1))) + + return "\n".join(lines) + +def buildDocsXML(*dirs): + lines = [] + + for directory in dirs: + lines.append("\n".join(buildContentsXMLFordir(directory, {}, 1, 'doc', + all_files=True))) + + return "\n".join(lines) + +if __name__ == "__main__": + def usage(progname): + print "Usage: %s " % (progname) + + import sys + import time + + try: + import xmlconfig + except: + print "Could not import XML configuration module xmlconfig" + sys.exit(1) + + # Expect sys.argv[2] to be the name of the XML file template to + # use for processing. + try: + template_f = open(sys.argv[2], 'r') + except Exception, e: + usage(sys.argv[0]) + print "Could not open template file:", str(e) + sys.exit(1) + + # Expect sys.argv[1] to be the version number to include in the + # package.xml file. + try: + version = sys.argv[1] + except: + usage(sys.argv[0]) + sys.exit(2) + + # Expect sys.argv[3] to be the name of the release notes file. + try: + release_file = sys.argv[3] + release_file_h = open(release_file, 'r') + release_notes = release_file_h.read().strip() + release_file_h.close() + except Exception, e: + usage(sys.argv[0]) + print str(e) + sys.exit(3) + + data = xmlconfig.__dict__.copy() + + contentsXml = buildContentsXML({'php': 'php'}, *xmlconfig.contents_dirs) + docsXml = buildDocsXML(*xmlconfig.docs_dirs) + + contents = '\n' + contentsXml + \ + "\n" + docsXml + '\n ' + + contents_v1 = '\n' + contentsXml + \ + "\n" + docsXml + '\n ' + + data['contents'] = contents + data['contents_version_1'] = contents_v1 + data['leads'] = makeLeadXML(xmlconfig.leads) + data['maintainers'] = makeMaintainerXML(xmlconfig.leads) + data['date'] = time.strftime("%Y-%m-%d") + data['version'] = version + data['uri'] = "%s%s-%s.tgz" % (data['package_base_uri'], data['package_name'], + version) + data['release_notes'] = release_notes + + template_data = template_f.read() + print template_data % data diff --git a/models/openid-php-openid-782224d/admin/phpaliases.py b/models/openid-php-openid-782224d/admin/phpaliases.py new file mode 100644 index 000000000..c4ce21684 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/phpaliases.py @@ -0,0 +1,119 @@ +#!/usr/bin/env python + +"""This script searches files for functions that are just aliases in +PHP source code. This is not 100% reliable, so it should not be +automated, but it's useful to run once in a while to make sure that +all of the matches it finds are not really legitimate aliases. + +Usage: + + parse_aliases.py [PHP source code filename]... +""" + +import sys + +# Fetch this URL to get the file that is parsed into the aliases list +alias_url = 'http://www.zend.com/phpfunc/all_aliases.php' + +header_tok = ''; +footer_tok = ''; + +# Example line of the table that we parse: +# 'bzclosephp-src/ext/bz2/bz2.cfclose' + +import re + +line_re = re.compile(r''' +\A + +]+"> + +([^<>]+) + +]+">[^<>]+ + + +(?: + ]+\.php"> + ( [^<>]+ ) + +| ( [^<>]+ ) +) + + + + +\Z +''', re.VERBOSE) + +def parseString(s): + _, rest = s.split(header_tok, 1) + body, _ = rest.split(footer_tok, 1) + + lines = body.split('\n') + assert [s.strip() for s in lines[-2:]] == ['', ''] + assert lines[0].strip().startswith('|\$|)\s*\b(%s)\b' % ('|'.join(aliases.keys()))) + +def checkAliasesFile(alias_re, f): + found = [] + line_num = 1 + for line in f: + for mo in alias_re.finditer(line): + if mo.group(1): + continue + alias = mo.group(2) + found.append((line_num, alias)) + line_num += 1 + return found + +def checkAliases(alias_re, filename): + return checkAliasesFile(alias_re, file(filename, 'r')) + +def checkAliasesFiles(alias_re, filenames): + found = [] + for filename in filenames: + file_found = checkAliases(alias_re, filename) + found.extend([(filename, n, a) for (n, a) in file_found]) + return found + +def dumpResults(aliases, found, out=sys.stdout): + for filename, n, a in found: + print >>out, "%s:%d %s -> %s" % (filename, n, a, aliases[a]) + +def main(alias_file, *filenames): + aliases = parseFileName(alias_file) + alias_re = getAliasRE(aliases) + found = checkAliasesFiles(alias_re, filenames) + dumpResults(aliases, found) + return found + +if __name__ == '__main__': + found = main(*sys.argv[1:]) + if found: + sys.exit(1) diff --git a/models/openid-php-openid-782224d/admin/prepare-release b/models/openid-php-openid-782224d/admin/prepare-release new file mode 100644 index 000000000..98415a9da --- /dev/null +++ b/models/openid-php-openid-782224d/admin/prepare-release @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# +# Prepare this repository for release + +REPO_ROOT=$(dirname $(dirname $(readlink --canonicalize "$0"))) +cd "$REPO_ROOT" + +bash ./admin/fixperms + +./admin/makedoc.sh + +darcs changes --from-tag=. --summary > CHANGELOG diff --git a/models/openid-php-openid-782224d/admin/runtests b/models/openid-php-openid-782224d/admin/runtests new file mode 100644 index 000000000..b018c8749 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/runtests @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +# Get the absolute path containing this script +cd $(dirname "$0") +HERE=$PWD + +test_import () { + ./admin/checkimports +} + +test_syntax () { + ./admin/syntaxcheck +} + +test_tabs () { + /usr/bin/env bash "$HERE/notabs" +} + +test_longlines () { + /usr/bin/env bash "$HERE/nolonglines" +} + +test_nobadbraces () { + /usr/bin/env bash "$HERE/nobadbraces" +} + +test_nobadcase () { + /usr/bin/env bash "$HERE/nobadcase" +} + +test_opentag () { + /usr/bin/env bash "$HERE/open_tag" +} + +test_docblocks () { + /usr/bin/env bash "$HERE/docblocks" +} + +test_php () { + if uname -a | grep -i cygwin >/dev/null 2>/dev/null ; then + /usr/bin/env php "$(dirname "$0")/texttest.php" --insecure-rand \ + $TEXTTEST_ARGS + else + /usr/bin/env php "$HERE/texttest.php" $TEXTTEST_ARGS + fi +} + +tests="syntax tabs longlines nobadbraces nobadcase opentag docblocks php import" + +failures= + +# Run in repository root (parent of this directory) +cd $(dirname "$HERE") + +chmod +x ./admin/fixperms +./admin/fixperms + +for test_name in $tests + do + echo "Running test $test_name" 1>&2 + if ! eval "test_$test_name" + then + failures="$failures $test_name" + fi +done + +if [ ! -z "$failures" ] + then + echo "Failures in: $failures" 1>&2 + exit 1 +fi diff --git a/models/openid-php-openid-782224d/admin/syntaxcheck b/models/openid-php-openid-782224d/admin/syntaxcheck new file mode 100644 index 000000000..f94b7fad0 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/syntaxcheck @@ -0,0 +1,5 @@ +#!/usr/bin/env bash + +for file in `./admin/findallphp` + do php -l $file +done diff --git a/models/openid-php-openid-782224d/admin/texttest.php b/models/openid-php-openid-782224d/admin/texttest.php new file mode 100644 index 000000000..422dd1de0 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/texttest.php @@ -0,0 +1,197 @@ +failures() as $failure) { + echo $failure->toString(); + } + + foreach ($this->errors() as $failure) { + echo $failure->toString(); + } + } +} + +function microtime_float() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} + +$longopts = array('no-math', + 'buggy-gmp', + 'no-curl', + 'math-lib=', + 'insecure-rand', + 'thorough', + 'extra-tests='); + +$con = new Console_Getopt; +$args = $con->readPHPArgv(); +array_shift($args); +$options = $con->getopt2($args, "", $longopts); + +if (PEAR::isError($options)) { + print $options->message . "\n"; + exit(1); +} + +list($flags, $tests_to_run) = $options; + +$math_type = array(); +$extra_test_modules = array(); +$thorough = false; +foreach ($flags as $flag) { + list($option, $value) = $flag; + switch ($option) { + case '--insecure-rand': + define('Auth_OpenID_RAND_SOURCE', null); + break; + case '--no-math': + define('Auth_OpenID_NO_MATH_SUPPORT', true); + break; + case '--buggy-gmp': + define('Auth_OpenID_BUGGY_GMP', true); + break; + case '--no-curl': + define('Auth_Yadis_CURL_OVERRIDE', true); + break; + case '--thorough': + define('Tests_Auth_OpenID_thorough', true); + break; + case '--extra-tests': + $extra_test_modules[] = $value; + break; + default: + print "Unrecognized option: $option\n"; + exit(1); + } +} + +// ******** Math library selection *********** +// XXX FIXME +// case '--math-lib': +// $math_type[] = $value; +// break; +if ($math_type && false) { + if (defined('Auth_OpenID_NO_MATH_SUPPORT')) { + print "--no-math and --math-lib are mutually exclusive\n"; + exit(1); + } + require_once('Auth/OpenID/BigMath.php'); + $new_extensions = array(); + foreach ($math_type as $lib) { + $found = false; + foreach (Auth_OpenID_math_extensions() as $ext) { + if ($ext['extension'] == $lib) { + $new_extensions[] = $ext; + $found = true; + break; + } + } + + if (!$found) { + print "Unknown math library specified: $lib\n"; + exit(1); + } + } + $_Auth_OpenID_math_extensions = $new_extensions; +} + +// ******** End math library selection ********** + +$suites = loadSuite($tests_to_run); + +// ******** Load additional test suites ******** +foreach ($extra_test_modules as $filename) { + if (!global_require_once($filename)) { + continue; + } + $module_name = basename($filename, '.php'); + $class_name = "Tests_Auth_OpenID_${module_name}_Test"; + $suites[] = makeSuite($class_name); +} + + +$totals = array( + 'run' => 0, + 'error' => 0, + 'failure' => 0, + 'time' => 0 + ); + +foreach ($suites as $suite) { + $name = $suite->getName(); + echo "========================================== +Test suite: $name +------------------------------------------ +"; + + $result = new TextTestResult(); + $before = microtime_float(); + $suite->run($result); + $after = microtime_float(); + + $run = $result->count(); + $error = $result->errorCount(); + $failure = $result->failureCount(); + $delta = $after - $before; + $totals['run'] += $run; + $totals['error'] += $error; + $totals['failure'] += $failure; + $totals['time'] += $delta; + $human_delta = round($delta, 3); + echo "\nRan $run tests in $human_delta seconds"; + if ($error || $failure) { + echo " with $error errors, $failure failures"; + } + echo " +========================================== + +"; + + $failures = $result->failures(); + foreach($failures as $failure) { + $test = $failure->failedTest(); + $testName = $test->getName(); + $exception = $failure->thrownException(); + echo "* Failure in $testName: $exception + +"; + } +} + +$before = microtime_float(); +$run = $totals['run']; +$error = $totals['error']; +$failure = $totals['failure']; +$time = round($totals['time'], 3); +echo "Ran a total of $run tests in $time seconds with $error errors, $failure failures\n"; +if ($totals['error'] || $totals['failure']) { + exit(1); +} + +?> diff --git a/models/openid-php-openid-782224d/admin/tutorials/OpenID/OpenID.pkg b/models/openid-php-openid-782224d/admin/tutorials/OpenID/OpenID.pkg new file mode 100644 index 000000000..cb0aa620a --- /dev/null +++ b/models/openid-php-openid-782224d/admin/tutorials/OpenID/OpenID.pkg @@ -0,0 +1,78 @@ + + + PHP OpenID API + + + + + JanRain, Inc. + + {@link mailto:openid@janrain.com openid@janrain.com} + + + + + + This is a complete implementation of the OpenID authentication + protocol. This package contains: + + + An OpenID server + An OpenID consumer + Stores for MySQL, PostgreSQL, SQLite, and filesystem-based OpenID data storage + PHPUnit unit tests + An example server and consumer + + + + + For Package Users + + + To install this package, copy the Auth/ + directory in this package to a directory in your PHP include path. + Alternatively, modify your PHP include path to include the + directory that contains Auth/. Any + applications that need this package will then be able to use it. + + + + + + For Developers + + + + See the server and consumer examples in the + examples/ directory of the package. For + details on how to run the examples, see + examples/README. If you want to create your + own OpenID data storage class, please see the {@link Auth_OpenID_OpenIDStore} + class. For information on integrating OpenID relying party support into your site, see + the class documentation for {@link Consumer.php}. + + + + + + + References + + + + {@link http://github.com/openid/php-openid PHP OpenID Library} + + + + {@link http://www.janrain.com JanRain, Inc.} + + + + {@link http://openid.net/developers/dev-mailing-lists/ OpenID Development Discussion Lists} + + + + + + + diff --git a/models/openid-php-openid-782224d/admin/webtest.php b/models/openid-php-openid-782224d/admin/webtest.php new file mode 100644 index 000000000..1076623f0 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/webtest.php @@ -0,0 +1,12 @@ +addSuites($suites); +$gui->show(); + +?> diff --git a/models/openid-php-openid-782224d/admin/xmlconfig.py b/models/openid-php-openid-782224d/admin/xmlconfig.py new file mode 100644 index 000000000..ac029b518 --- /dev/null +++ b/models/openid-php-openid-782224d/admin/xmlconfig.py @@ -0,0 +1,55 @@ + +""" +This is the package.xml data needed for the PHP OpenID PEAR +package.xml file. Use the 'packagexml.py' program to generate a +package.xml file for a release of this library. +""" + +# This is a list of dicts describing the project leads. This will be +# used to generate XML elements. +leads = [ + {'name': 'Jonathan Daugherty', + 'user': 'cygnus', + 'email': 'cygnus@janrain.com', + 'active': 'yes'}, + {'name': 'Josh Hoyt', + 'user': 'jhoyt', + 'email': 'josh@janrain.com', + 'active': 'yes'} + ] + +# The package name. +package_name = 'Auth_OpenID' + +# The package description. +package_description = 'An implementation of the OpenID single sign-on authentication protocol.' + +# Package summary. +package_summary = 'PHP OpenID' + +# License string. +license_name = 'Apache' + +# License URI. +license_uri = 'http://www.apache.org/licenses/LICENSE-2.0' + +# Director(ies) containing package source, relative to the admin/ +# directory. All .php files in these directories will be included in +# the element of the output XML and will be assigned the +# role 'php'. +contents_dirs = ['../Auth',] + +# Director(ies) containing package documentation. All files and +# subdirectories in these directories will be included in the +# element in the output XML and will be assigned the role +# 'doc'. +docs_dirs = ['../doc', '../examples'] + +# The HTTP package base URI. This is the place on the web where the +# PEAR-installable tarballs will live, and this (plus the package +# tarball name) will be the URL that users pass to "pear install". +package_base_uri = 'http://www.openidenabled.com/resources/downloads/php-openid/pear/' + +# The release stability. Maybe this should be a commandline parameter +# since it might differ from release to release. +release_stability = 'stable' -- cgit v1.2.3