aboutsummaryrefslogtreecommitdiff
path: root/models/openid-php-openid-782224d/admin
diff options
context:
space:
mode:
Diffstat (limited to 'models/openid-php-openid-782224d/admin')
-rw-r--r--models/openid-php-openid-782224d/admin/adminutil.php30
-rw-r--r--models/openid-php-openid-782224d/admin/brace_style.pl81
-rw-r--r--models/openid-php-openid-782224d/admin/checkimport4
-rw-r--r--models/openid-php-openid-782224d/admin/checkimports2
-rw-r--r--models/openid-php-openid-782224d/admin/darcs-ignore3
-rw-r--r--models/openid-php-openid-782224d/admin/docblocks15
-rw-r--r--models/openid-php-openid-782224d/admin/docblocks.pl26
-rw-r--r--models/openid-php-openid-782224d/admin/findallphp8
-rw-r--r--models/openid-php-openid-782224d/admin/findglobals5
-rw-r--r--models/openid-php-openid-782224d/admin/findphp8
-rw-r--r--models/openid-php-openid-782224d/admin/fixperms15
-rw-r--r--models/openid-php-openid-782224d/admin/gettlds.py47
-rw-r--r--models/openid-php-openid-782224d/admin/library-name1
-rw-r--r--models/openid-php-openid-782224d/admin/longlines.pl46
-rw-r--r--models/openid-php-openid-782224d/admin/makedoc.sh5
-rw-r--r--models/openid-php-openid-782224d/admin/mathlib18
-rw-r--r--models/openid-php-openid-782224d/admin/nobadbraces4
-rw-r--r--models/openid-php-openid-782224d/admin/nobadcase14
-rw-r--r--models/openid-php-openid-782224d/admin/nolonglines14
-rw-r--r--models/openid-php-openid-782224d/admin/notabs16
-rw-r--r--models/openid-php-openid-782224d/admin/open_tag17
-rw-r--r--models/openid-php-openid-782224d/admin/otb_test.php20
-rw-r--r--models/openid-php-openid-782224d/admin/package.xml24
-rw-r--r--models/openid-php-openid-782224d/admin/package2.xml74
-rw-r--r--models/openid-php-openid-782224d/admin/packagexml.py155
-rw-r--r--models/openid-php-openid-782224d/admin/phpaliases.py119
-rw-r--r--models/openid-php-openid-782224d/admin/prepare-release12
-rw-r--r--models/openid-php-openid-782224d/admin/runtests71
-rw-r--r--models/openid-php-openid-782224d/admin/syntaxcheck5
-rw-r--r--models/openid-php-openid-782224d/admin/texttest.php197
-rw-r--r--models/openid-php-openid-782224d/admin/tutorials/OpenID/OpenID.pkg78
-rw-r--r--models/openid-php-openid-782224d/admin/webtest.php12
-rw-r--r--models/openid-php-openid-782224d/admin/xmlconfig.py55
33 files changed, 1201 insertions, 0 deletions
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 @@
+<?php
+
+/**
+ * Add a directory to the include path
+ *
+ * @param dir: The directory to add to the path
+ * @param at_start: If true, place this directory at the beginning of
+ * the include path. Otherwise, place it at the end.
+ */
+function includeAdd($dir, $at_start=false)
+{
+ $path = ini_get('include_path');
+ if (strlen($path)) {
+ $newpath = $at_start ? "$dir:$path" : "$path:$dir";
+ } else {
+ $newpath = $dir;
+ }
+
+ ini_set('include_path', $newpath);
+}
+
+/**
+ * Return the parent directory of this module.
+ */
+function getParent()
+{
+ return dirname(dirname(realpath(__FILE__)));
+}
+
+?> \ 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 <filename>\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 (<HANDLE>) {
+ $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
+<?php
+require_once $argv[1];
+?> \ 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 <<EOF 1>&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 <filename>\n";
+ exit(1);
+}
+
+my %allowed = ("" => 1,
+ "<?php" => 1);
+
+open(HANDLE, "<", $filename) or die "Cannot open $filename\n";
+
+while (<HANDLE>) {
+ 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 <<EOF | xargs chmod +x
+admin/checkimport
+admin/checkimports
+admin/docblocks
+admin/findphp
+admin/findglobals
+admin/fixperms
+admin/makedoc.sh
+admin/mathlib
+admin/prepare-release
+admin/runtests
+admin/findallphp
+admin/syntaxcheck
+EOF
diff --git a/models/openid-php-openid-782224d/admin/gettlds.py b/models/openid-php-openid-782224d/admin/gettlds.py
new file mode 100644
index 000000000..430063808
--- /dev/null
+++ b/models/openid-php-openid-782224d/admin/gettlds.py
@@ -0,0 +1,47 @@
+"""
+Fetch the current TLD list from the IANA Web site, parse it, and print
+an expression suitable for direct insertion into each library's trust
+root validation module
+
+Usage:
+ python gettlds.py (php|python|ruby)
+
+Then cut-n-paste.
+"""
+
+import urllib2
+
+import sys
+
+langs = {
+ 'php': (r"'/\.(",
+ "'", "|", "|' .",
+ r")\.?$/'"),
+ 'python': ("['",
+ "'", "', '", "',",
+ "']"),
+ 'ruby': ("%w'",
+ "", " ", "",
+ "'"),
+ }
+
+lang = sys.argv[1]
+prefix, line_prefix, separator, line_suffix, suffix = langs[lang]
+
+f = urllib2.urlopen('http://data.iana.org/TLD/tlds-alpha-by-domain.txt')
+tlds = []
+output_line = ""
+for input_line in f:
+ if input_line.startswith('#'):
+ continue
+
+ tld = input_line.strip().lower()
+ new_output_line = output_line + prefix + tld
+ if len(new_output_line) > 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 <filename> [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 (<HANDLE>) {
+ $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
+<?php
+
+require_once 'adminutil.php';
+includeAdd(getParent());
+
+require_once 'Auth/OpenID/CryptUtil.php';
+
+$lib =& Auth_OpenID_MathLibrary::getLibWrapper();
+
+if ($lib === null) {
+ fwrite(STDERR, 'No math library present\n');
+ exit(1);
+} else {
+ print $lib->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 <<EOF 1>&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 <<EOF 1>&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 <<EOF 1>&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 "<?php" -c |
+ grep ":0" |
+ awk -F: '{ print $1 }')
+
+if [ "$bad_files" ]
+ then
+ cat <<EOF 1>&2
+These PHP files do NOT begin with <?php :
+
+$bad_files
+
+EOF
+ exit 1
+fi
diff --git a/models/openid-php-openid-782224d/admin/otb_test.php b/models/openid-php-openid-782224d/admin/otb_test.php
new file mode 100644
index 000000000..b2fc99ff9
--- /dev/null
+++ b/models/openid-php-openid-782224d/admin/otb_test.php
@@ -0,0 +1,20 @@
+<?php
+
+function fail1() {
+}
+
+function pass1()
+{
+}
+
+function fail2(
+ ) {
+
+}
+
+function pass2(
+ )
+{
+}
+
+?> \ 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 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<package version="1.0">
+ <name>%(package_name)s</name>
+ <summary>%(package_summary)s</summary>
+ <description>
+ %(package_description)s
+ </description>
+ <license>%(license_name)s</license>
+ %(maintainers)s
+ <release>
+ <version>%(version)s</version>
+ <date>%(date)s</date>
+ <state>%(release_stability)s</state>
+ <notes>
+ <![CDATA[
+ %(release_notes)s
+ ]]>
+ </notes>
+ %(contents_version_1)s
+ </release>
+ <deps>
+ <dep type="php" rel="ge" version="4.3.0" />
+ </deps>
+</package>
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 @@
+<?xml version="1.0"?>
+<package version="2.0" xmlns="http://pear.php.net/dtd/package-2.0"
+ xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd">
+ <name>%(package_name)s</name>
+ <uri>%(uri)s</uri>
+ <summary>%(package_summary)s</summary>
+ <description>
+ %(package_description)s
+ </description>
+ %(leads)s
+ <date>%(date)s</date>
+ <version>
+ <release>%(version)s</release>
+ <api>%(version)s</api>
+ </version>
+ <stability>
+ <release>%(release_stability)s</release>
+ <api>%(release_stability)s</api>
+ </stability>
+ <license uri="%(license_uri)s">%(license_name)s</license>
+ <notes>
+ <![CDATA[
+ %(release_notes)s
+ ]]>
+ </notes>
+ <contents>
+ %(contents)s
+ </contents>
+ <dependencies>
+ <required>
+ <php>
+ <min>4.3.0</min>
+ </php>
+ <pearinstaller>
+ <min>1.4.5</min>
+ </pearinstaller>
+ </required>
+ <optional>
+ <package>
+ <name>PHPUnit</name>
+ <channel>pear.php.net</channel>
+ <min>1.1.1</min>
+ </package>
+ <package>
+ <name>PEAR_DB</name>
+ <channel>pear.php.net</channel>
+ <min>1.80</min>
+ </package>
+ <extension>
+ <name>pgsql</name>
+ </extension>
+ <extension>
+ <name>mysql</name>
+ </extension>
+ <extension>
+ <name>sqlite</name>
+ </extension>
+ <extension>
+ <name>bcmath</name>
+ </extension>
+ <extension>
+ <name>gmp</name>
+ </extension>
+ </optional>
+ </dependencies>
+ <!-- There really isn't much we should put in the phprelease tag,
+ although we should probably make a windows-specific release tag. -->
+ <phprelease/>
+</package>
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 = """
+ <maintainer>
+ <user>%(user)s</user>
+ <name>%(name)s</name>
+ <email>%(email)s</email>
+ <role>lead</role>
+ </maintainer>
+ """
+
+ return "<maintainers>" + \
+ "".join([maintainer_template % l for l in leads]) + \
+ "</maintainers>"
+
+def makeLeadXML(leads):
+ lead_template = """
+<lead>
+ <name>%(name)s</name>
+ <user>%(user)s</user>
+ <email>%(email)s</email>
+ <active>%(active)s</active>
+</lead>
+ """
+
+ 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 <file> XML
+ element for the given file or a <dir> element which contains other
+ <file> elements.
+ """
+
+ try:
+ entries = os.listdir(dir_or_file)
+ dir_role_s = ''
+ if dir_role:
+ dir_role_s = ' role="%s"' % (dir_role)
+ lines = ['%s<dir name="%s"%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</dir>' % (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<file name="%s" role="%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<file name="%s" role="%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 <package version> <xml template file> <release notes file>" % (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 = '<dir name="/">\n' + contentsXml + \
+ "\n" + docsXml + '\n </dir>'
+
+ contents_v1 = '<filelist><dir name="/" baseinstalldir="Auth">\n' + contentsXml + \
+ "\n" + docsXml + '\n </dir></filelist>'
+
+ 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 <name of alias file> [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 = '<!-- END OF HEADER -->';
+footer_tok = '<!-- FOOTER -->';
+
+# Example line of the table that we parse:
+# '<tr bgcolor="#EFEFFF"><td><a href="function.bzclose.php">bzclose</a></td><td><a href="http://lxr.php.net/source/php-src/ext/bz2/bz2.c#48">php-src/ext/bz2/bz2.c</a></td><td><a href="function.fclose.php">fclose</a></td></tr>'
+
+import re
+
+line_re = re.compile(r'''
+\A
+
+<tr\ bgcolor="[^">]+">
+
+<td><a\ href="[^>"]+\.php">([^<>]+)</a></td>
+
+<td><a\ href="[^">]+">[^<>]+</a></td>
+
+<td>
+(?:
+ <a\ href="[^">]+\.php">
+ ( [^<>]+ )
+ </a>
+| ( [^<>]+ )
+)
+</td>
+
+</tr>
+
+\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:]] == ['</table>', '']
+ assert lines[0].strip().startswith('<table')
+ del lines[0], lines[-2:]
+ aliases = {}
+ for line in lines:
+ mo = line_re.match(line)
+ assert mo, line
+ alias, master1, master2 = mo.groups()
+ if master1:
+ master = master1
+ else:
+ assert master2
+ master = master2
+ aliases[alias] = master
+
+ return aliases
+
+def parseFile(f):
+ return parseString(f.read())
+
+def parseFileName(fn):
+ return parseFile(file(fn, 'r'))
+
+def parseURL(url):
+ return parseFile(urllib2.urlopen(url))
+
+def getAliasRE(aliases):
+ return re.compile(r'(->|\$|)\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 @@
+<?php
+
+require_once 'Tests/TestDriver.php';
+require_once 'PHPUnit/Framework.php';
+require_once 'Console/Getopt.php';
+
+class TextTestResult extends PHPUnit_Framework_TestResult {
+ function addError(&$test, &$t, $time=0)
+ {
+ parent::addError($test, $t, $time);
+ echo "E";
+ }
+
+ function addFailure(&$test, &$t, $time=0)
+ {
+ parent::addFailure($test, $t, $time);
+ echo "F";
+ }
+
+ function addPassedTest(&$test)
+ {
+ parent::addPassedTest($test);
+ echo ".";
+ }
+
+ function dumpBadResults()
+ {
+ foreach ($this->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 @@
+<refentry id="{@id}">
+ <refnamediv>
+ <refname>PHP OpenID API</refname>
+
+ </refnamediv>
+ <refsynopsisdiv>
+ <author>
+ JanRain, Inc.
+ <authorblurb>
+ {@link mailto:openid@janrain.com openid@janrain.com}
+ </authorblurb>
+ </author>
+ </refsynopsisdiv>
+
+ <para>
+ This is a complete implementation of the OpenID authentication
+ protocol. This package contains:
+
+ <itemizedlist>
+ <listitem>An OpenID server</listitem>
+ <listitem>An OpenID consumer</listitem>
+ <listitem>Stores for MySQL, PostgreSQL, SQLite, and filesystem-based OpenID data storage</listitem>
+ <listitem>PHPUnit unit tests</listitem>
+ <listitem>An example server and consumer</listitem>
+ </itemizedlist>
+ </para>
+
+ <refsect1 id="{@id users}">
+ <title>For Package Users</title>
+
+ <para>
+ To install this package, copy the <literal>Auth/</literal>
+ directory in this package to a directory in your PHP include path.
+ Alternatively, modify your PHP include path to include the
+ directory that contains <literal>Auth/</literal>. Any
+ applications that need this package will then be able to use it.
+ </para>
+
+ </refsect1>
+
+ <refsect1 id="{@id developers}">
+ <title>For Developers</title>
+
+ <para>
+
+ See the server and consumer examples in the
+ <literal>examples/</literal> directory of the package. For
+ details on how to run the examples, see
+ <literal>examples/README</literal>. 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}.
+
+ </para>
+
+ </refsect1>
+
+ <refsect1 id="{@id references}">
+ <title>References</title>
+ <para>
+ <itemizedlist>
+ <listitem>
+ {@link http://github.com/openid/php-openid PHP OpenID Library}
+ </listitem>
+
+ <listitem>
+ {@link http://www.janrain.com JanRain, Inc.}
+ </listitem>
+
+ <listitem>
+ {@link http://openid.net/developers/dev-mailing-lists/ OpenID Development Discussion Lists}
+ </listitem>
+ </itemizedlist>
+ </para>
+ </refsect1>
+
+</refentry>
+
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 @@
+<?php
+
+require_once 'Tests/TestDriver.php';
+
+$suites = loadSuite();
+
+// Create and run the user interface
+$gui = new PHPUnit_GUI_HTML();
+$gui->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 <lead> 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 <contents> 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
+# <contents> 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'