Merge branch '3.8'

Conflicts:
	lib/Alchemy/Phrasea/Controller/Admin/TaskManager.php
	lib/Alchemy/Phrasea/Controller/Root/Account.php
	lib/Alchemy/Phrasea/Core/Version.php
	lib/classes/User/Adapter.php
	lib/classes/eventsmanager/broker.php
	lib/classes/eventsmanager/notify/autoregister.php
	lib/classes/eventsmanager/notify/order.php
	lib/classes/eventsmanager/notify/register.php
	lib/classes/eventsmanager/notify/uploadquarantine.php
	lib/classes/eventsmanager/notify/validationdone.php
	templates/web/admin/index.html.twig
This commit is contained in:
Romain Neutron
2013-11-12 19:19:13 +01:00
155 changed files with 338 additions and 14338 deletions

View File

@@ -84,13 +84,13 @@ class Step35 implements DatasUpgraderInterface
try {
$this->updateMetadatas($record, $row['xml']);
} catch (Exception $e) {
} catch (\Exception $e) {
$this->app['monolog']->addError(sprintf("Error while upgrading metadatas for record %d on databox %d : %s", $record->get_record_id(), $record->get_sbas_id(), $e->getMessage()));
}
try {
$record->set_binary_status($row['status']);
} catch (Exception $e) {
} catch (\Exception $e) {
$this->app['monolog']->addError(sprintf("Error while upgrading status for record %d on databox %d : %s", $record->get_record_id(), $record->get_sbas_id(), $e->getMessage()));
}
unset($record);

View File

@@ -74,9 +74,15 @@ class Users implements ControllerProviderInterface
try {
$rights = new UserHelper\Edit($app, $app['request']);
if (!$app['request']->request->get('reset_before_apply')) {
$rights->apply_rights();
}
if ($app['request']->request->get('template')) {
if ($app['request']->request->get('reset_before_apply')) {
$rights->resetRights();
}
$rights->apply_template();
}
@@ -200,6 +206,9 @@ class Users implements ControllerProviderInterface
$controllers->post('/apply_template/', function () use ($app) {
$users = new UserHelper\Edit($app, $app['request']);
if ($app['request']->request->get('reset_before_apply')) {
$users->resetRights();
}
$users->apply_template();
return $app->redirectPath('admin_users_search');

View File

@@ -323,7 +323,7 @@ class Account implements ControllerProviderInterface
return $app['twig']->render('account/account.html.twig', array(
'user' => $app['authentication']->getUser(),
'evt_mngr' => $app['events-manager'],
'notifications' => $app['events-manager']->list_notifications_available(),
'notifications' => $app['events-manager']->list_notifications_available($app['authentication']->getUser()->get_id()),
));
}
@@ -372,6 +372,7 @@ class Account implements ControllerProviderInterface
);
if (0 === count(array_diff($accountFields, array_keys($request->request->all())))) {
try {
$app['phraseanet.appbox']->get_connection()->beginTransaction();
@@ -403,7 +404,7 @@ class Account implements ControllerProviderInterface
$app['EM']->persist($ftpCredential);
$app['EM']->flush();
$app->addFlash('success', _('login::notification: Changements enregistres'));
} catch (Exception $e) {
} catch (\Exception $e) {
$app->addFlash('error', _('forms::erreurs lors de l\'enregistrement des modifications'));
$app['phraseanet.appbox']->get_connection()->rollBack();
}
@@ -411,15 +412,12 @@ class Account implements ControllerProviderInterface
$requestedNotifications = (array) $request->request->get('notifications', array());
foreach ($app['events-manager']->list_notifications_available() as $notifications) {
foreach ($app['events-manager']->list_notifications_available($app['authentication']->getUser()->get_id()) as $notifications) {
foreach ($notifications as $notification) {
$notifId = $notification['id'];
$notifName = sprintf('notification_%s', $notifId);
if (isset($requestedNotifications[$notifId])) {
$app['authentication']->getUser()->setPrefs($notifName, '1');
if (isset($requestedNotifications[$notification['id']])) {
$app['authentication']->getUser()->set_notification_preference($app, $notification['id'], '1');
} else {
$app['authentication']->getUser()->setPrefs($notifName, '0');
$app['authentication']->getUser()->set_notification_preference($app, $notification['id'], '0');
}
}
}

View File

@@ -66,12 +66,12 @@ class Xmlhttp implements ControllerProviderInterface
$connbas = $databox->get_connection();
$domct = $databox->get_dom_cterms();
if (!($domct instanceof DOMDocument)) {
if (!($domct instanceof \DOMDocument)) {
throw new \Exception('Unable to load cterms');
}
$domth = $databox->get_dom_thesaurus();
if (!($domth instanceof DOMDocument)) {
if (!($domth instanceof \DOMDocument)) {
throw new \Exception('Unable to load thesaurus');
}
@@ -83,10 +83,6 @@ class Xmlhttp implements ControllerProviderInterface
$q = "/thesaurus//te[@id='" . $request->get("tid") . "']";
}
if ($request->get("debug")) {
printf("qth: %s<br/>\n", $q);
}
$parentnode = $xpathth->query($q)->item(0);
if (!$parentnode) {
throw new \Exception('Unable to find branch');
@@ -165,9 +161,6 @@ class Xmlhttp implements ControllerProviderInterface
if ($ct2->nodeType != XML_ELEMENT_NODE || $ct2->nodeName != 'sy') {
continue;
}
if ($request->get('debug')) {
printf("ct2:%s \n", var_export($ct2, true));
}
$nid = $parentnode->getAttribute("nextid");
$parentnode->setAttribute("nextid", (int) $nid + 1);
@@ -526,10 +519,6 @@ class Xmlhttp implements ControllerProviderInterface
$xpath = $databox->get_xpath_thesaurus();
$q = "/thesaurus//sy[@id='" . $request->get('id') . "']";
if ($request->get('debug')) {
print("q:" . $q . "<br/>\n");
}
$nodes = $xpath->query($q);
if ($nodes->length > 0) {
$n2 = $nodes->item(0);
@@ -859,10 +848,6 @@ class Xmlhttp implements ControllerProviderInterface
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ($request->get('debug')) {
printf("/*\n thid=%s\n %s \n */\n", $thid, $sql);
}
foreach ($rs as $rowbas) {
$t_nrec[$thid] = $rowbas;
}
@@ -879,10 +864,6 @@ class Xmlhttp implements ControllerProviderInterface
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ($request->get('debug')) {
printf("/*\n thid=%s\n %s \n */\n", $thid, $sql);
}
foreach ($rs as $rowbas) {
$t_nrec[$thid . $rowbas['k']] = $rowbas;
}
@@ -900,10 +881,6 @@ class Xmlhttp implements ControllerProviderInterface
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ($request->get('debug')) {
printf("/*\n thid=%s\n %s \n */\n", $thid, $sql);
}
foreach ($rs as $rowbas) {
$t_nrec[$thid] = $rowbas;
}
@@ -920,19 +897,11 @@ class Xmlhttp implements ControllerProviderInterface
$rs = $stmt->fetchAll(\PDO::FETCH_ASSOC);
$stmt->closeCursor();
if ($request->get('debug')) {
printf("/*\n thid=%s\n %s \n */\n", $thid, $sql);
}
foreach ($rs as $rowbas) {
$t_nrec[$thid . '.' . $rowbas['k']] = $rowbas;
}
}
if ($request->get('debug')) {
printf("/* %s */\n", var_export($t_nrec, true));
}
$databox = $app['phraseanet.appbox']->get_databox($sbid);
if ($request->get('type') == 'T') {
$xqroot = 'thesaurus';
@@ -953,9 +922,6 @@ class Xmlhttp implements ControllerProviderInterface
} else {
$q = '/' . $xqroot . '//te[@id=\'' . $thid . '\']';
}
if ($request->get('debug')) {
print("q:" . $q . "<br/>\n");
}
$nodes = $xpath->query($q);
if ($nodes->length > 0) {
@@ -1009,10 +975,6 @@ class Xmlhttp implements ControllerProviderInterface
}
}
if ($request->get('debug')) {
printf("tts(%s) : <pre>%s</pre><br/>\n", $nts, var_export($tts, true));
}
if ($nts > 0) {
$field0 = $node0->getAttribute('field');
if ($field0) {
@@ -1026,9 +988,6 @@ class Xmlhttp implements ControllerProviderInterface
} elseif ($request->get('type') == 'C') {
$tts = array_reverse($tts);
}
if ($request->get('debug')) {
printf("%s: type=%s : <pre>%s</pre><br/>\n", __LINE__, $request->get('type'), var_export($tts, true));
}
foreach ($tts as $ts) {
$class = '';
@@ -1155,9 +1114,6 @@ class Xmlhttp implements ControllerProviderInterface
$xpath = $databox->get_xpath_thesaurus();
$q = '/thesaurus';
if ($request->get('debug')) {
print('q:' . $q . '<br/>\n');
}
if (($znode = $xpath->query($q)->item(0))) {
$q2 = '//sy';
if ($request->get('t')) {
@@ -1194,9 +1150,6 @@ class Xmlhttp implements ControllerProviderInterface
$html .= '</p>';
}
}
if ($request->get('debug')) {
printf('zhtml=%s<br/>\n', $html);
}
}
return new Response($html);
@@ -1304,10 +1257,6 @@ class Xmlhttp implements ControllerProviderInterface
$xpath = $databox->get_xpath_thesaurus();
$q = '/thesaurus';
if ($request->get('debug')) {
print('q:' . $q . '<br/>\n');
}
if (($znode = $xpath->query($q)->item(0))) {
$q2 = '//sy';
if ($request->get('t')) {
@@ -1317,18 +1266,12 @@ class Xmlhttp implements ControllerProviderInterface
$q2 .= ' and starts-with(@k, \'' . \thesaurus::xquery_escape($app['unicode']->remove_indexer_chars($t[1])) . '\')';
$q2 = '//sy[' . $q2 . ']';
}
if ($request->get('debug')) {
print('q2:' . $q2 . '<br/>\n');
}
$nodes = $xpath->query($q2, $znode);
if ($mod == 'TREE') {
for ($i = 0; $i < $nodes->length; $i++) {
$nodes->item($i)->setAttribute('bold', '1');
for ($n = $nodes->item($i)->parentNode; $n && $n->nodeType == XML_ELEMENT_NODE && $n->nodeName == 'te'; $n = $n->parentNode) {
$n->setAttribute('open', '1');
if ($request->get('debug')) {
printf('opening node te id=%s<br/>\n', $n->getAttribute('id'));
}
}
}
@@ -1346,9 +1289,6 @@ class Xmlhttp implements ControllerProviderInterface
$zhtml .= '</p>';
}
}
if ($request->get('debug')) {
printf('zhtml=%s<br/>\n', $zhtml);
}
$html->appendChild($ret->createTextNode($zhtml));
}
@@ -1434,10 +1374,6 @@ class Xmlhttp implements ControllerProviderInterface
$tsbas['b' . $sbas_id]['tids'][] = implode('.', $id);
}
if ($request->get('debug')) {
var_dump($tsbas);
}
$appbox = $app['phraseanet.appbox'];
// first, count the number of records to update
@@ -1489,22 +1425,12 @@ class Xmlhttp implements ControllerProviderInterface
$stmt = $connbas->prepare($sql);
$stmt->execute();
if ($request->get('debug')) {
printf("(%d) sql: \n", __LINE__);
var_dump($sql);
}
$tsbas[$ksbas]['trids'] = $stmt->fetchAll(\PDO::FETCH_COLUMN, 0);
$stmt->closeCursor();
$ret['nRecsToUpdate'] += count($tsbas[$ksbas]['trids']);
}
if ($request->get('debug')) {
printf("(%d) nRecsToUpdate = %d \ntsbas: \n", __LINE__, $ret['nRecsToUpdate']);
print_r($tsbas);
}
if ($ret['nRecsToUpdate'] <= self::SEARCH_REPLACE_MAXREC) {
foreach ($tsbas as $sbas) {
@@ -1518,10 +1444,6 @@ class Xmlhttp implements ControllerProviderInterface
// fix caption of records
foreach ($sbas['trids'] as $rid) {
if ($request->get('debug')) {
printf("(%d) ======== working on record_id = %d ======= \n", __LINE__, $rid);
}
try {
$record = $databox->get_record($rid);
@@ -1531,17 +1453,10 @@ class Xmlhttp implements ControllerProviderInterface
/* @var $field caption_field */
foreach ($record->get_caption()->get_fields(null, true) as $field) {
$meta_struct_id = $field->get_meta_struct_id();
if ($request->get('debug')) {
printf("(%d) field '%s' meta_struct_id=%s \n", __LINE__, $field->get_name(), $meta_struct_id);
}
/* @var $v caption_Field_Value */
$fname = $field->get_name();
if (!array_key_exists($fname, $sbas['tvals'])) {
foreach ($field->get_values() as $v) {
if ($request->get('debug')) {
printf("(%d) ...v = '%s' (meta_id=%s) keep \n", __LINE__, $v->getValue(), $v->getId());
}
$metadatask[] = array(
'meta_struct_id' => $meta_struct_id,
'meta_id' => $v->getId(),
@@ -1558,9 +1473,6 @@ class Xmlhttp implements ControllerProviderInterface
}
}
if ($request->get('debug')) {
printf("(%d) ...v = '%s' (meta_id=%s) %s \n", __LINE__, $v->getValue(), $v->getId(), ($keep ? '' : '!!! drop !!!'));
}
if ($keep) {
$metadatask[] = array(
'meta_struct_id' => $meta_struct_id,
@@ -1578,13 +1490,6 @@ class Xmlhttp implements ControllerProviderInterface
}
}
if ($request->get('debug')) {
printf("(%d) metadatask: \n", __LINE__);
var_dump($metadatask);
printf("(%d) metadatasd: \n", __LINE__);
var_dump($metadatasd);
}
if (count($metadatasd) > 0) {
if (!$request->get('debug')) {
$record->set_metadatas($metadatasd, true);
@@ -1596,10 +1501,6 @@ class Xmlhttp implements ControllerProviderInterface
}
}
// delete the branch from the cterms
if ($request->get('debug')) {
printf("cterms before :\n%s \n", $sbas['domct']->saveXML());
}
foreach ($sbas['tvals'] as $tval) {
foreach ($tval as $sy) {
// remove candidate from cterms
@@ -1608,9 +1509,6 @@ class Xmlhttp implements ControllerProviderInterface
$ret['ctermsDeleted'][] = $sbas['sbas_id'] . '.' . $te->getAttribute('id');
}
}
if ($request->get('debug')) {
printf("cterms after :\n%s \n", $sbas['domct']->saveXML());
}
if (!$request->get('debug')) {
$databox->saveCterms($sbas['domct']);
}
@@ -1669,21 +1567,13 @@ class Xmlhttp implements ControllerProviderInterface
if (($q !== null) && $domth) {
$xpath = new \DOMXPath($domth);
if ($request->get('debug'))
print('q:' . $q . "\n");
$t = $this->splitTermAndContext($request->get('t'));
$q2 = 'starts-with(@w, \'' . \thesaurus::xquery_escape($app['unicode']->remove_indexer_chars($t[0])) . '\')';
if ($t[1])
$q2 .= ' and starts-with(@k, \'' . \thesaurus::xquery_escape($app['unicode']->remove_indexer_chars($t[1])) . '\')';
$q2 = '//sy[' . $q2 . ' and @lng=\'' . $lng . '\']';
if ($request->get('debug'))
print('q2:' . $q2 . "\n");
$q .= $q2;
if ($request->get('debug'))
print('q:' . $q . "\n");
$nodes = $xpath->query($q);
@@ -1691,8 +1581,6 @@ class Xmlhttp implements ControllerProviderInterface
$nodes->item($i)->setAttribute('bold', '1');
for ($n = $nodes->item($i)->parentNode; $n && $n->nodeType == XML_ELEMENT_NODE && $n->nodeName == 'te'; $n = $n->parentNode) {
$n->setAttribute('open', '1');
if ($request->get('debug'))
printf("opening node te id=%s \n", $n->getAttribute('id'));
}
}

View File

@@ -431,7 +431,7 @@ class PhraseaEngine implements SearchEngineInterface
$data['record_id'],
$resultNumber
));
} catch (Exception $e) {
} catch (\Exception $e) {
}
$resultNumber++;

View File

@@ -506,7 +506,7 @@ class SphinxSearchEngine implements SearchEngineInterface
);
$results->add($record);
} catch (Exception $e) {
} catch (\Exception $e) {
}
$resultOffset++;

View File

@@ -69,7 +69,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
*
* @var array
*/
protected static $def_values = array(
public static $def_values = array(
'view' => 'thumbs',
'images_per_page' => 20,
'images_size' => 120,
@@ -275,6 +275,9 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
protected $password;
protected $preferences_loaded = false;
protected $notifications_preferences_loaded = false;
/**
*
* @param Integer $id
@@ -1030,7 +1033,7 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
protected function load_preferences()
{
if ($this->_prefs) {
if ($this->preferences_loaded) {
return $this;
}
@@ -1051,42 +1054,49 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
}
$this->_prefs[$k] = $v;
$this->update_pref($k, $v);
}
}
$this->load_notifications_preferences($this->app);
$this->preferences_loaded = true;
return $this;
}
protected function load_notifications_preferences(Application $app)
{
$notifications = $app['events-manager']->list_notifications_available();
$this->load_preferences();
$notifications = $app['events-manager']->list_notifications_available($this->id);
foreach ($notifications as $notification_group => $nots) {
foreach ($nots as $notification) {
if (!isset($this->_prefs['notification_' . $notification['id']])) {
$this->_prefs['notification_' . $notification['id']] = '1';
$this->update_pref('notification_' . $notification['id'], '1');
}
}
}
$this->notification_preferences_loaded = true;
}
public function get_notifications_preference(Application $app, $notification_id)
{
$this->load_preferences($app);
if (!$this->notifications_preferences_loaded)
$this->load_notifications_preferences($app);
return isset($this->_prefs['notification_' . $notification_id]) ? $this->_prefs['notification_' . $notification_id] : null;
return isset($this->_prefs['notification_' . $notification_id]) ? $this->_prefs['notification_' . $notification_id] : '0';
}
public function set_notification_preference(Application $app, $notification_id, $value)
{
$this->load_preferences($app);
if (!$this->notifications_preferences_loaded)
$this->load_notifications_preferences($app);
return $this->_prefs['notification_' . $notification_id] = $value ? '1' : '0';
$prop = 'notification_' . $notification_id;
$value = $value ? '1' : '0';
$this->setPrefs($prop, $value);
return ;
}
public function get_display_name()
@@ -1172,15 +1182,11 @@ class User_Adapter implements User_Interface, cache_cacheableInterface
return $this->_prefs[$prop];
}
public function getPrefs($prop)
public function getPrefs($prop, $default = null)
{
$this->load_preferences();
if (!isset($this->_prefs[$prop])) {
$this->_prefs[$prop] = null;
$this->update_pref($prop, null);
}
return $this->_prefs[$prop];
return array_key_exists($prop, $this->_prefs) ? $this->_prefs[$prop] : $default;
}
public static function get_sys_admins(Application $app)

View File

@@ -56,7 +56,7 @@ class eventsmanager_broker
foreach ($this->pool_classes[$classname]->get_events() as $event)
$this->bind($event, $classname);
if ($type === 'notify' && $this->pool_classes[$classname]->is_available())
if ($type === 'notify' && $this->pool_classes[$classname])
$this->notifications[] = $classname;
}
}
@@ -273,11 +273,14 @@ class eventsmanager_broker
return $this;
}
public function list_notifications_available()
public function list_notifications_available($usr_id)
{
$personnal_notifications = array();
foreach ($this->notifications as $notification) {
if (!$this->pool_classes[$notification]->is_available($usr_id)) {
continue;
}
$group = $this->pool_classes[$notification]->get_group();
$group = $group === null ? _('Notifications globales') : $group;

View File

@@ -214,21 +214,22 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
$bool = false;
if ( ! $this->app['authentication']->isAuthenticated() || ! $this->app['registration.enabled']) {
if (!$this->app['registration.enabled']) {
return false;
}
if ($this->app['acl']->get($this->app['authentication']->getUser())->has_right('manageusers') === true) {
$bool = true;
try {
$user = \User_Adapter::getInstance($usr_id, $this->app);
} catch (\Exception $e) {
return false;
}
return $bool;
return $user->ACL()->has_right('manageusers');
}
}

View File

@@ -159,10 +159,11 @@ class eventsmanager_notify_bridgeuploadfail extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
return true;
}

View File

@@ -144,10 +144,11 @@ class eventsmanager_notify_downloadmailfail extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
return true;
}

View File

@@ -176,10 +176,11 @@ class eventsmanager_notify_feed extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
return true;
}

View File

@@ -182,20 +182,18 @@ class eventsmanager_notify_order extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
$bool = false;
if ( !$this->app['authentication']->isAuthenticated()) {
try {
$user = \User_Adapter::getInstance($usr_id, $this->app);
} catch (\Exception $e) {
return false;
}
if ($this->app['acl']->get($this->app['authentication']->getUser())->has_right('order_master')) {
$bool = true;
}
return $bool;
return $user->ACL()->has_right('order_master');
}
}

View File

@@ -196,10 +196,11 @@ class eventsmanager_notify_orderdeliver extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
return true;
}

View File

@@ -141,10 +141,11 @@ class eventsmanager_notify_ordernotdelivered extends eventsmanager_notifyAbstrac
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
return true;
}

View File

@@ -162,10 +162,11 @@ class eventsmanager_notify_push extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
return true;
}

View File

@@ -193,21 +193,24 @@ class eventsmanager_notify_register extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
$bool = false;
if ( !$this->app['authentication']->isAuthenticated() || ! $this->app['registration.enabled']) {
if (!$this->app['registration.enabled']) {
return false;
}
try {
$user = \User_Adapter::getInstance($usr_id, $this->app);
} catch (\Exception $e) {
return false;
if ($this->app['acl']->get($this->app['authentication']->getUser())->has_right('manageusers')) {
$bool = true;
}
return $bool;
return $user->ACL()->has_right('manageusers');
}
}

View File

@@ -182,15 +182,18 @@ class eventsmanager_notify_uploadquarantine extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
if (null !== $this->app['authentication']->getUser()) {
return $this->app['acl']->get($this->app['authentication']->getUser())->has_right('addrecord');
}
try {
$user = \User_Adapter::getInstance($usr_id, $this->app);
} catch (\Exception $e) {
return false;
}
return $user->ACL()->has_right('addrecord');
}
}

View File

@@ -190,10 +190,11 @@ class eventsmanager_notify_validate extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
return true;
}

View File

@@ -178,21 +178,18 @@ class eventsmanager_notify_validationdone extends eventsmanager_notifyAbstract
}
/**
* @param integer $usr_id The id of the user to check
*
* @return boolean
*/
public function is_available()
public function is_available($usr_id)
{
$bool = false;
if ( ! $this->app['authentication']->isAuthenticated()) {
try {
$user = \User_Adapter::getInstance($usr_id, $this->app);
} catch (\Exception $e) {
return false;
}
if ($this->app['acl']->get($this->app['authentication']->getUser())->has_right('push')) {
$bool = true;
}
return $bool;
return $user->ACL()->has_right('push');
}
}

View File

@@ -187,10 +187,11 @@ class eventsmanager_notify_validationreminder extends eventsmanager_notifyAbstra
}
/**
* @param integer $usr_id The id of the user to check
*
* @return string
*/
public function is_available()
public function is_available($usr_id)
{
return true;
}

View File

@@ -11,7 +11,7 @@ abstract class eventsmanager_notifyAbstract extends eventsmanager_eventAbstract
abstract public function datas($datas, $unread);
public function is_available()
public function is_available($usr_id)
{
return true;
}

View File

@@ -0,0 +1,73 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2012 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Alchemy\Phrasea\Application;
class patch_381alpha3a implements patchInterface
{
/** @var string */
private $release = '3.8.1-alpha.3';
/** @var array */
private $concern = array(base::APPLICATION_BOX);
/**
* {@inheritdoc}
*/
public function get_release()
{
return $this->release;
}
/**
* {@inheritdoc}
*/
public function require_all_upgrades()
{
return false;
}
/**
* {@inheritdoc}
*/
public function concern()
{
return $this->concern;
}
/**
* {@inheritdoc}
*/
public function apply(base $appbox, Application $app)
{
$propSql = $propArgs = array();
$n = 0;
foreach (\User_Adapter::$def_values as $prop => $value) {
if ('start_page_query' === $prop) {
continue;
}
$propSql[] = '(prop = :prop_'.$n.' AND value = :value_'.$n.')';
$propArgs[':prop_'.$n] = $prop;
$propArgs[':value_'.$n] = $value;
$n++;
}
$sql = "DELETE FROM usr_settings
WHERE 1 AND (".implode(' OR ', $propSql)." OR value IS NULL OR (value = 1 AND prop LIKE 'notification_%'))";
$stmt = $appbox->get_connection()->prepare($sql);
$stmt->execute($propArgs);
$stmt->closeCursor();
return true;
}
}

View File

@@ -42,9 +42,11 @@ $groups = array(
, '//assets/jquery.ui/i18n/jquery-ui-i18n.js'
, '//include/jquery.kb-event.js'
, '//skins/admin/users.js'
, '//skins/admin/template-dialogs.js'
, '//skins/admin/editusers.js'
, '//include/jquery.common.js'
, '//include/jquery.tooltip.js'
, '//skins/prod/jquery.Dialog.js'
, '//include/jslibs/jquery.contextmenu_scroll.js'
, '//assets/blueimp-load-image/load-image.js'
, '//assets/jquery-file-upload/jquery.iframe-transport.js'

View File

@@ -154,7 +154,7 @@
{% for notification in nots %}
<li>
<label class="checkbox" for="notif_{{ notification["id"] }}">
<input type="checkbox" id="notif_{{ notification["id"] }}" name="notifications[{{ notification["id"] }}]" {% if not app["authentication"].getUser().getPrefs("notification_" ~ notification["id"]) == "0" %}checked{% endif %} value="1"/>
<input type="checkbox" id="notif_{{ notification["id"] }}" name="notifications[{{ notification["id"] }}]" {% if not app["authentication"].getUser().get_notifications_preference(app, notification["id"]) == "0" %}checked{% endif %} value="1"/>
{{ notification["description"] }}
</label>
<p class="form_alert help-block"></p>

View File

@@ -18,10 +18,8 @@
<script type="text/javascript" src="/assets/tinymce/tinymce.js"></script>
<script type="text/javascript" src="{{ path('minifier', { 'g' : 'admin' }) }}"></script>
<script type="text/javascript">
var p4 = p4 || {};
p4.users = {
sel:[]
};
var p4 = p4 || {};
p4.users = {sel:[]};
var bodySize = {x:0,y:0};
var language = {
@@ -36,7 +34,14 @@
annuler : '{% trans 'boutton::annuler' %}',
errorFileApiTooBig : '{% trans 'This file is too big' %}',
requiredValue: '{% trans 'This field is required' %}',
attention: '{% trans 'Attention' %}'
attention: '{% trans 'Attention' %}',
reset_template_do_reset_apply_button: '{% trans 'Reset and apply' %}',
reset_template_confirm_dialog_title: '{% trans 'Confirm reset users rights before applying template' %}',
reset_template_do_confirm_choice: '{% trans 'Rights will be erased before applying template, do you confirm?' %}',
reset_template_do_reset_button: '{% trans 'Reset and apply template' %}',
reset_template_do_not_reset_button: '{% trans 'Apply template' %}',
reset_template_dialog_title: '{% trans 'Reset rights before applying template?' %}',
reset_template_ask_choice: '{% trans 'Would you like to reset rights before applying the template?' %}'
};
function sessionactive(){

View File

@@ -58,7 +58,7 @@
</fieldset>
</form>
<form id="users_apply_template" method="post" action="{{ path('admin_users_apply_template') }}" target="_self" class="form-inline pull-left" style="margin:0">
<form id="users_apply_template" method="post" action="{{ path('admin_users_apply_template') }}" target="_self" class="form-inline pull-left no-ajax" style="margin:0">
<fieldset class="admin_head_opts">
<span>{% trans 'Apply a template' %}</span>
<select name="template_chooser" class="input-medium">

View File

@@ -48,4 +48,50 @@ class userTest extends PhraseanetPHPUnitAbstract
$repo = self::$DI['app']['EM']->getRepository('Alchemy\Phrasea\Model\Entities\UsrAuthProvider');
$this->assertNull($repo->findWithProviderAndId('custom-one', 12345));
}
public function testGetPref()
{
$user = $this->get_user();
$this->assertNull($user->getPrefs('lalala'));
$this->assertSame('popo', $user->getPrefs('lalala', 'popo'));
$this->assertSame(\User_Adapter::$def_values['editing_top_box'], $user->getPrefs('editing_top_box'));
}
public function testSetPref()
{
$user = $this->get_user();
$user->setPrefs('prout', 'pooop');
$this->assertSame('pooop', $user->getPrefs('prout'));
}
public function testGetNotificationPref()
{
$user = $this->get_user();
$this->assertSame('1', $user->get_notifications_preference(self::$DI['app'], 'eventsmanager_notify_push'));
}
public function testNotificationPref()
{
$user = $this->get_user();
$this->assertSame('1', $user->get_notifications_preference(self::$DI['app'], 'eventsmanager_notify_push'));
$user->set_notification_preference(self::$DI['app'], 'eventsmanager_notify_push', false);
$this->assertSame('0', $user->get_notifications_preference(self::$DI['app'], 'eventsmanager_notify_push'));
$user->set_notification_preference(self::$DI['app'], 'eventsmanager_notify_push', true);
$this->assertSame('1', $user->get_notifications_preference(self::$DI['app'], 'eventsmanager_notify_push'));
}
private function get_user()
{
$usr_id = \User_Adapter::get_usr_id_from_login(self::$DI['app'], 'notif_ref_test');
if ($usr_id) {
$user = \User_Adapter::getInstance($usr_id, self::$DI['app']);
$user->delete();
}
return \User_Adapter::create(self::$DI['app'], 'notif_ref_test', mt_rand(), null, false);
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

View File

@@ -1,26 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery Validation Plugin Password Extension demo</title>
<style>
iframe { width: 800px; height: 75px; }
iframe.milk { height: 500px; }
a { display: block; }
</style>
</head>
<body>
<iframe src="plain.html"></iframe>
<a href="plain.html">Plain</a>
<iframe src="localized.html"></iframe>
<a href="localized.html">Localized</a>
<iframe src="milk.html" class="milk"></iframe>
<a href="milk.html">Integrated</a>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 538 B

View File

@@ -1,92 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery Validation Plugin Password Extension demo</title>
<script type="text/javascript" src="../lib/jquery.js"></script>
<script type="text/javascript" src="../lib/jquery.validate.js"></script>
<script type="text/javascript" src="../jquery.validate.password.js"></script>
<script id="demo" type="text/javascript">
$.validator.passwordRating.messages = {
"similar-to-username": "Zu ähnlich zum Benutzername",
"too-short": "Zu kurz",
"very-weak": "Sehr schwach",
"weak": "Schwach",
"good": "Gut",
"strong": "Ausgezeichnet"
}
$(document).ready(function() {
$("#register").validate();
$("#password").valid();
});
</script>
<style>
label {
width: 7em;
float: left;
}
label.error { display: none !important; }
.password-meter-label {
color: #666;
float: left;
width: 7em;
padding: 0;
}
.password-meter {
width: 190px;
margin-left: 7em;
vertical-align: middle;
}
.password-meter-message {
float: left;
text-align: center;
font-weight: bold;
color: black;
padding-left: 5px;
background: #eee;
height: 18px;
width: 221px;
}
.password-meter-message-very-weak {
background: #ff8080;
}
.password-meter-message-weak {
background: #fffb80;
}
.password-meter-message-good {
background: #80d1ff;
}
.password-meter-message-strong {
background: #8cff80;
}
</style>
</head>
<body>
<form id="register">
<div style="clear:both">
<label for="password">Passwort:</label>
<input class="password" name="password" id="password" />
</div>
<label class="password-meter-label" for="password">Passwortstärke:</label>
<div class="password-meter">
<div class="password-meter-message">
&nbsp;
</div>
</div>
</form>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2623402-1";
urchinTracker();
</script>
</body>
</html>

View File

@@ -1,236 +0,0 @@
/* GENERAL ELEMENTS */
* { margin: 0; padding: 0; }
body, input, select, textarea { font-family: verdana, arial, helvetica, sans-serif; font-size: 11px; }
body { color: #333; background-color: #fff; text-align: center; }
a:link { color:#0060BF; text-decoration: underline; }
a:visited { color:#0060BF; text-decoration: underline; }
a:active { color:#0060BF; text-decoration: underline; }
a:hover { color:#000000; text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { font-family: "Lucida Grande", "Lucida Sans Unicode", geneva, verdana, arial, helvetica, sans-serif; font-weight: bold; color: #666; }
h1 { font-size: 1.8em; margin: 0em 0em 0.6em 0em; color: #EC5800; }
h2 { font-size: 1.5em; margin: 1.2em 0em 0.4em 0em; }
h3 { font-size: 1.4em; margin: 1.2em 0em 0.4em 0em; color: #EC5800; }
h4 { font-size: 1.2em; margin: 1.2em 0em 0.4em 0em; }
h5 { font-size: 1.0em; margin: 1.2em 0em 0.4em 0em; }
h6 { font-size: 0.8em; margin: 1.2em 0em 0.4em 0em; }
img { border: 0px; }
p { font-size: 1.0em; line-height: 1.3em; margin: 1.2em 0em 1.2em 0em; }
li > p { margin-top: 0.2em; }
pre { font-family: monospace; font-size: 1.0em; }
strong, b { font-weight: bold; }
/* PAGE ELEMENTS */
/* Content */
#content { margin: 0em auto; width: 765px; padding: 10px 0 10px 0; text-align: left; /* Win IE5 */ }
.content { margin-left: 4.5em; margin-right: 4.5em; }
.content ol, .content ul, .content li { font-size: 1.0em; line-height: 1.3em; margin: 0.2em 0 0.1em 1.5em; }
.content ol.terms li { margin-bottom: 1em; }
/* Header */
#header { padding-bottom: 10em; }
#headerlogo { float: left; }
#headerlogo img { width: 188px; height: 83px; }
#headernav { float: right; }
label { font-weight: bold; }
#reminders label { font-weight: normal; }
table.tabbedtable { padding-left: 3em; }
table.tabbedtable td { padding-bottom: 5px; }
table.tabbedtable label { text-align: right; padding-right: 9px; }
.hiddenlabel { visibility: hidden; }
.largelink { border: 1px solid #cacaca; padding: 10px; background-color: #E8EEF7; font-size: 1.2em; font-weight: bold; }
.largelinkwrap { padding-top: 10px; padding-bottom: 10px; }
#signuptab {
float:left;
width:100%;
background:#fff url("bg.gif") repeat-x bottom;
font-size: 1.0em;
line-height: normal;
}
#signuptab ul {
margin:0;
padding: 0px 10px 0px 10px;
list-style:none;
}
#signuptab li {
float:left;
background:url("left_white.png") no-repeat left top;
margin:0;
padding:0 3px 0 9px;
border-bottom:1px solid #CACACA;
}
#signuptab a {
float:left;
display:block;
width:.1em;
background:url("right_white.png") no-repeat right top;
padding:2px 15px 0px 6px;
text-decoration:none;
font-weight:bold;
color:#fff;
white-space: nowrap;
}
#signuptab > ul a {width:auto;}
/* Commented Backslash Hack hides rule from IE5-Mac \*/
#signuptab a {float:none;}
/* End IE5-Mac hack */
#signuptab a:hover {
color:#333;
}
#signuptab #signupcurrent {
background-position:0 -150px;
border-width:0;
}
#signuptab #signupcurrent a {
background-position:100% -150px;
padding-bottom:1px;
color:#000;
}
#signuptab li:hover, #signuptab li:hover a {
background-position:0% -150px;
color:#000;
}
#signuptab li:hover a {
background-position:100% -150px;
}
/* Signup box */
#signupbox {
width: 100%;
text-align: center;
margin: 0em auto;
}
#signupwrap {
border: 1px solid #CACACA;
border-top: 0;
text-align: left;
padding: 35px 10px 20px 30px;
clear: both;
}
/* Unsupported browsers */
.orange_rbcontent { padding: 0.4em; }
.orange_rbroundbox { width: 100%; }
#unsupported {
font-weight: bold;
text-align: left;
}
/*#content {
padding-top: 15px;
}*/
/* Signup form */
#signupform table {
border-spacing: 0px;
border-collapse: collapse;
empty-cells: show;
}
#signupform .label {
padding-top: 2px;
padding-right: 8px;
vertical-align: top;
text-align: right;
width: 125px;
white-space: nowrap;
}
#signupform .field {
padding-bottom: 10px;
white-space: nowrap;
}
#signupform .status {
padding-top: 2px;
padding-left: 8px;
vertical-align: top;
width: 246px;
white-space: nowrap;
}
#signupform .textfield {
width: 150px;
}
#signupform label.error {
background:url("unchecked.gif") no-repeat 0px 0px;
padding-left: 16px;
padding-bottom: 2px;
font-weight: bold;
color: #EA5200;
}
#signupform label.checked {
background:url("checked.gif") no-repeat 0px 0px;
}
#signupform .success_msg {
font-weight: bold;
color: #0060BF;
margin-left: 19px;
}
#signupform #dateformatStatus, #signupform #termsStatus {
margin-left: 6px;
}
#signupform #dateformat_eu {
vertical-align: middle;
}
#signupform #ldateformat_eu {
font-weight: normal;
vertical-align: middle;
}
#signupform #dateformat_am {
vertical-align: middle;
}
#signupform #ldateformat_am {
font-weight: normal;
vertical-align: middle;
}
#signupform #termswrap {
float: left;
}
#signupform #terms {
vertical-align: middle;
float: left;
display: block;
margin-right: 5px;
}
#signupform #lterms {
font-weight: normal;
vertical-align: middle;
float: left;
display: block;
width: 350px;
white-space: normal;
}
#signupform #lsignupsubmit {
visibility: hidden;
}

View File

@@ -1,139 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery Validation Plugin Password Extension demo</title>
<link rel="stylesheet" type="text/css" media="screen" href="milk.css" />
<link rel="stylesheet" type="text/css" media="screen" href="../jquery.validate.password.css" />
<script type="text/javascript" src="../lib/jquery.js"></script>
<script type="text/javascript" src="../lib/jquery.validate.js"></script>
<script type="text/javascript" src="../jquery.validate.password.js"></script>
<script id="demo" type="text/javascript">
$(document).ready(function() {
// validate signup form on keyup and submit
var validator = $("#signupform").validate({
rules: {
username: {
required: true,
minlength: 2
},
password: {
password: "#username"
},
password_confirm: {
required: true,
equalTo: "#password"
}
},
messages: {
username: {
required: "Enter a username",
minlength: jQuery.format("Enter at least {0} characters")
},
password_confirm: {
required: "Repeat your password",
minlength: jQuery.format("Enter at least {0} characters"),
equalTo: "Enter the same password as above"
}
},
// the errorPlacement has to take the table layout into account
errorPlacement: function(error, element) {
error.prependTo( element.parent().next() );
},
// specifying a submitHandler prevents the default submit, good for the demo
submitHandler: function() {
alert("submitted!");
},
// set this class to error-labels to indicate valid fields
success: function(label) {
// set &nbsp; as text for IE
label.html("&nbsp;").addClass("checked");
}
});
// propose username by combining first- and lastname
$("#username").focus(function() {
var firstname = $("#firstname").val();
var lastname = $("#lastname").val();
if(firstname && lastname && !this.value) {
this.value = firstname + "." + lastname;
}
});
});
</script>
</head>
<body>
<div id="main">
<div id="content">
<div id="header">
<div id="headerlogo"><img src="milk.png" alt="Remember The Milk" /></div>
</div>
<div style="clear: both;"><div></div></div>
<div class="content">
<div id="signupbox">
<div id="signuptab">
<ul>
<li id="signupcurrent"><a href=" ">Signup</a></li>
</ul>
</div>
<div id="signupwrap">
<form id="signupform" autocomplete="off" method="get" action="">
<table>
<tr>
<td class="label"><label id="lusername" for="username">Username</label></td>
<td class="field"><input id="username" name="username" type="text" value="" maxlength="50" /></td>
<td class="status"></td>
</tr>
<tr>
<td class="label"><label id="lpassword" for="password">Password</label></td>
<td class="field"><input id="password" name="password" type="password" maxlength="50" value="" /></td>
<td class="status">
<div class="password-meter">
<div class="password-meter-message">&nbsp;</div>
<div class="password-meter-bg">
<div class="password-meter-bar"></div>
</div>
</div>
</td>
</tr>
<tr>
<td class="label"><label id="lpassword_confirm" for="password_confirm">Confirm Password</label></td>
<td class="field"><input id="password_confirm" name="password_confirm" type="password" maxlength="50" value="" /></td>
<td class="status"></td>
</tr>
<tr>
<td class="label"><label id="lsignupsubmit" for="signupsubmit">Signup</label></td>
<td class="field" colspan="2">
<input id="signupsubmit" name="signup" type="submit" value="Signup" />
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2623402-1";
urchinTracker();
</script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

View File

@@ -1,51 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>jQuery Validation Plugin Password Extension demo</title>
<link rel="stylesheet" type="text/css" media="screen" href="../jquery.validate.password.css" />
<script type="text/javascript" src="../lib/jquery.js"></script>
<script type="text/javascript" src="../lib/jquery.validate.js"></script>
<script type="text/javascript" src="../jquery.validate.password.js"></script>
<script id="demo" type="text/javascript">
$(document).ready(function() {
$("#register").validate();
$("#password").valid();
});
</script>
<style>
label, input { float: left; }
input { margin-left: 1em; }
label.error { display: none !important; }
.password-meter {
float: left;
}
</style>
</head>
<body>
<form id="register">
<label for="password">Password:</label>
<input class="password" name="password" id="password" />
<div class="password-meter">
<div class="password-meter-message">&nbsp;</div>
<div class="password-meter-bg">
<div class="password-meter-bar"></div>
</div>
</div>
</form>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2623402-1";
urchinTracker();
</script>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

View File

@@ -1,85 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Test for jQuery validate() plugin</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<style type="text/css">
.warning { color: red; }
</style>
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../lib/jquery.form.js" type="text/javascript"></script>
<script src="../jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(function() {
// show a simple loading indicator
var loader = jQuery('<div id="loader"><img src="images/loading.gif" alt="loading..." /></div>')
.css({position: "relative", top: "1em", left: "25em"})
.appendTo("body")
.hide();
jQuery().ajaxStart(function() {
loader.show();
}).ajaxStop(function() {
loader.hide();
}).ajaxError(function(a, b, e) {
throw e;
});
var v = jQuery("#form").validate({
submitHandler: function(form) {
jQuery(form).ajaxSubmit({
target: "#result"
});
}
});
jQuery("#reset").click(function() {
v.resetForm();
});
});
</script>
</head>
<body>
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
<div id="main">
<form method="post" class="cmxform" id="form" action="form.php">
<fieldset>
<legend>Login Form (Enter "foobar" as password)</legend>
<p>
<label for="user">Username</label>
<input id="user" name="user" title="Please enter your username (at least 3 characters)" class="required" minlength="3" />
</p>
<p>
<label for="pass">Password</label>
<input type="password" name="password" id="password" class="required" minlength"5" />
</p>
<p>
<input class="submit" type="submit" value="Login"/>
</p>
</fieldset>
</form>
<div id="result">Please login!</div>
<br/>
<button id="reset">Programmatically reset above form!</button>
<p>Backend file: <a href="form.phps">form.phps</a></p>
<a href="index.html">Back to main page</a>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2623402-1";
urchinTracker();
</script>
</body>
</html>

View File

@@ -1,27 +0,0 @@
$(function(){
$("#refreshimg").click(function(){
$.post('newsession.php');
$("#captchaimage").load('image_req.php');
return false;
});
$("#captchaform").validate({
rules: {
captcha: {
required: true,
remote: "process.php"
}
},
messages: {
captcha: "Correct captcha is required. Click the captcha to generate a new one"
},
submitHandler: function() {
alert("Correct captcha!");
},
success: function(label) {
label.addClass("valid").text("Valid captcha!")
},
onkeyup: false
});
});

View File

@@ -1,6 +0,0 @@
<?php
// Echo the image - timestamp appended to prevent caching
echo '<a href="index.php" onclick="refreshimg(); return false;" title="Click to refresh image"><img src="images/image.jpg?' . time() . '" width="132" height="46" alt="Captcha image" /></a>';
?>

View File

@@ -1 +0,0 @@
AddType application/x-httpd-php .jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,35 +0,0 @@
<?php
// Begin the session
session_start();
// If the session is not present, set the variable to an error message
if(!isset($_SESSION['captcha_id']))
$str = 'ERROR!';
// Else if it is present, set the variable to the session contents
else
$str = $_SESSION['captcha_id'];
// Set the content type
//header('Content-type: image/png');
header('Cache-control: no-cache');
// Create an image from button.png
$image = imagecreatefrompng('button.png');
// Set the font colour
$colour = imagecolorallocate($image, 183, 178, 152);
// Set the font
$font = '../fonts/Anorexia.ttf';
// Set a random integer for the rotation between -15 and 15 degrees
$rotate = rand(-15, 15);
// Create an image using our original image and adding the detail
imagettftext($image, 14, $rotate, 18, 30, $colour, $font, $str);
// Output the image as a png
imagepng($image);
?>

View File

@@ -1,66 +0,0 @@
<?php
// Make the page validate
ini_set('session.use_trans_sid', '0');
// Include the random string file
require 'rand.php';
// Begin the session
session_start();
// Set the session contents
$_SESSION['captcha_id'] = $str;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AJAX CAPTCHA</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="keywords" content="AJAX,JHR,PHP,CAPTCHA,download,PHP CAPTCHA,AJAX CAPTCHA,AJAX PHP CAPTCHA,download AJAX CAPTCHA,download AJAX PHP CAPTCHA" />
<meta name="description" content="An AJAX CAPTCHA script, written in PHP" />
<script type="text/javascript" src="../../lib/jquery.js"></script>
<script type="text/javascript" src="../../jquery.validate.js"></script>
<script type="text/javascript" src="captcha.js"></script>
<link rel="stylesheet" type="text/css" href="style.css" />
<style type="text/css">
img { border: 1px solid #eee; }
p#statusgreen { font-size: 1.2em; background-color: #fff; color: #0a0; }
p#statusred { font-size: 1.2em; background-color: #fff; color: #a00; }
fieldset label { display: block; }
fieldset div#captchaimage { float: left; margin-right: 15px; }
fieldset input#captcha { width: 25%; border: 1px solid #ddd; padding: 2px; }
fieldset input#submit { display: block; margin: 2% 0% 0% 0%; }
#captcha.success {
border: 1px solid #49c24f;
background: #bcffbf;
}
#captcha.error {
border: 1px solid #c24949;
background: #ffbcbc;
}
</style>
</head>
<body>
<h1><acronym title="Asynchronous JavaScript And XML">AJAX</acronym> <acronym title="Completely Automated Public Turing test to tell Computers and Humans Apart">CAPTCHA</acronym>, based on <a href="http://psyrens.com/captcha/">http://psyrens.com/captcha/</a></h1>
<form id="captchaform" action="">
<fieldset>
<div id="captchaimage"><a href="<?php echo $_SERVER['PHP_SELF']; ?>" id="refreshimg" title="Click to refresh image"><img src="images/image.php?<?php echo time(); ?>" width="132" height="46" alt="Captcha image" /></a></div>
<label for="captcha">Enter the characters as seen on the image above (case insensitive):</label>
<input type="text" maxlength="6" name="captcha" id="captcha" />
<input type="submit" name="submit" id="submit" value="Check" />
</fieldset>
</form>
<p>If you can&#39;t decipher the text on the image, click it to dynamically generate a new one.</p>
</body>
</html>

View File

@@ -1,12 +0,0 @@
<?php
// Include the random string file
require 'rand.php';
// Begin a new session
session_start();
// Set the session contents
$_SESSION['captcha_id'] = $str;
?>

View File

@@ -1,14 +0,0 @@
<?php
// Begin the session
session_start();
// To avoid case conflicts, make the input uppercase and check against the session value
// If it's correct, echo '1' as a string
if(strtoupper($_GET['captcha']) == $_SESSION['captcha_id'])
echo 'true';
// Else echo '0' as a string
else
echo 'false';
?>

View File

@@ -1,11 +0,0 @@
<?php
// Create a random string, leaving out 'o' to avoid confusion with '0'
$char = strtoupper(substr(str_shuffle('abcdefghjkmnpqrstuvwxyz'), 0, 4));
// Concatenate the random string onto the random numbers
// The font 'Anorexia' doesn't have a character for '8', so the numbers will only go up to 7
// '0' is left out to avoid confusion with 'O'
$str = rand(1, 7) . rand(1, 7) . $char;
?>

View File

@@ -1,140 +0,0 @@
body {
margin: 3% 5%;
padding: 0;
background-color: #fff;
color: #333;
font: 0.9em/1.3 Helvetica, Arial, Verdana, Sans-serif;
}
a:link, a:visited {
background-color: #fff;
color: #333;
text-decoration: underline;
}
a:hover, a:focus, a:active {
background-color: #ffb;
color: #454545;
text-decoration: underline;
}
h1 {
margin: 2% 0%;
padding: 1%;
border-bottom: 1px solid #ddd;
background-color: #f8f8f8;
color: #666;
font: normal 1.5em Helvetica, Arial, Verdana, Sans-serif;
}
h2 {
margin: 2% 0%;
padding: 1%;
border-bottom: 1px solid #ddd;
background-color: #f8f8f8;
color: #666;
font: normal 1.3em Helvetica, Arial, Verdana, Sans-serif;
}
h3 {
margin: 2% 0%;
padding: 1%;
border-bottom: 1px solid #ddd;
background-color: #f8f8f8;
color: #666;
font: normal 1.2em Helvetica, Arial, Verdana, Sans-serif;
}
table {
margin: 0;
padding: 0;
width: 100%;
}
table th {
border: 1px solid #ddd;
font-weight: bold;
text-align: left;
padding: 1%;
}
table td {
border: 1px solid #ddd;
padding: 1%;
}
dl, dt, dd {
margin: 0;
padding: 0;
}
form {
margin: 0;
padding: 0;
}
fieldset {
border: 1px solid #ddd;
margin: 0% 0% 2% 0%;
padding: 2%;
}
fieldset legend {
margin: 0;
padding: 0 4px;
background-color: inherit;
color: #333;
}
code {
font: 1em "Courier New", Courier, Monospace;
}
pre code {
font: 1.1em "Courier New", Courier, Monospace;
border-bottom: 1px solid #eee;
}
img {
border: 1px solid #eee;
}
p#statusgreen {
font-size: 1.2em;
background-color: #fff;
color: #0a0;
}
p#statusred {
font-size: 1.2em;
background-color: #fff;
color: #a00;
}
fieldset label {
display: block;
}
fieldset label.error {
color: red;
}
fieldset label.valid {
color: green;
}
fieldset div#captchaimage {
float: left;
margin-right: 15px;
}
fieldset input#captcha {
width: 25%;
border: 1px solid #ddd;
padding: 2px;
}
fieldset input#submit {
display: block;
margin: 2% 0% 0% 0%;
}

View File

@@ -1,15 +0,0 @@
.jscom, .mix htcom { color: #4040c2; }
.com { color: green; }
.regexp { color: maroon; }
.string { color: teal; }
.keywords { color: blue; }
.global { color: #008; }
.numbers { color: #880; }
.comm { color: green; }
.tag { color: blue; }
.entity { color: blue; }
.string { color: teal; }
.aname { color: maroon; }
.avalue { color: maroon; }
.jquery { color: #00a; }
.plugin { color: red; }

View File

@@ -1,46 +0,0 @@
/**********************************
Name: cmxform Styles
***********************************/
form.cmxform {
width: 370px;
font-size: 1.0em;
color: #333;
}
form.cmxform legend {
padding-left: 0;
}
form.cmxform legend, form.cmxform label {
color: #333;
}
form.cmxform fieldset {
border: none;
border-top: 1px solid #C9DCA6;
background: url(../images/cmxform-fieldset.gif) left bottom repeat-x;
background-color: #F8FDEF;
}
form.cmxform fieldset fieldset {
background: none;
}
form.cmxform fieldset p, form.cmxform fieldset fieldset {
padding: 5px 10px 7px;
background: url(../images/cmxform-divider.gif) left bottom repeat-x;
}
form.cmxform label.error, label.error {
/* remove the next line when you have trouble in IE6 with labels in list */
color: red;
font-style: italic
}
div.error { display: none; }
input { border: 1px solid black; }
input.checkbox { border: none }
input:focus { border: 1px dotted black; }
input.error { border: 1px dotted red; }
form.cmxform .gray * { color: gray; }

View File

@@ -1,55 +0,0 @@
/**********************************
Use: cmxform template
***********************************/
form.cmxform fieldset {
margin-bottom: 10px;
}
form.cmxform legend {
padding: 0 2px;
font-weight: bold;
_margin: 0 -7px; /* IE Win */
}
form.cmxform label {
display: inline-block;
line-height: 1.8;
vertical-align: top;
cursor: hand;
}
form.cmxform fieldset p {
list-style: none;
padding: 5px;
margin: 0;
}
form.cmxform fieldset fieldset {
border: none;
margin: 3px 0 0;
}
form.cmxform fieldset fieldset legend {
padding: 0 0 5px;
font-weight: normal;
}
form.cmxform fieldset fieldset label {
display: block;
width: auto;
}
form.cmxform label { width: 100px; } /* Width of labels */
form.cmxform fieldset fieldset label { margin-left: 103px; } /* Width plus 3 (html space) */
form.cmxform label.error {
margin-left: 103px;
width: 220px;
}
form.cmxform input.submit {
margin-left: 103px;
}
/*\*//*/ form.cmxform legend { display: inline-block; } /* IE Mac legend fix */

View File

@@ -1,21 +0,0 @@
body, div { font-family: 'lucida grande', helvetica, verdana, arial, sans-serif }
body { margin: 0; padding: 0; font-size: small; color: #333 }
h1, h2 { font-family: 'trebuchet ms', verdana, arial; padding: 10px; margin: 0 }
h1 { font-size: large }
#main { padding: 1em; }
#banner { padding: 15px; background-color: #06b; color: white; font-size: large; border-bottom: 1px solid #ccc;
background: url(../images/bg.gif) repeat-x; text-align: center }
#banner a { color: white; }
p { margin: 10px 0; }
li { margin-left: 10px; }
h3 { margin: 1em 0 0; }
h1 { font-size: 2em; }
h2 { font-size: 1.8em; }
h3 { font-size: 1.6em; }
h4 { font-size: 1.4em; }
h5 { font-size: 1.2em; }

View File

@@ -1,61 +0,0 @@
/**********************************
Use: Reset Styles for all browsers
***********************************/
body, p, blockquote {
margin: 0;
padding: 0;
}
a img, iframe { border: none; }
/* Headers
------------------------------*/
h1, h2, h3, h4, h5, h6 {
margin: 0;
padding: 0;
font-size: 100%;
}
/* Lists
------------------------------*/
ul, ol, dl, li, dt, dd {
margin: 0;
padding: 0;
}
/* Links
------------------------------*/
a, a:link {}
a:visited {}
a:hover {}
a:active {}
/* Forms
------------------------------*/
form, fieldset {
margin: 0;
padding: 0;
}
fieldset { border: 1px solid #000; }
legend {
padding: 0;
color: #000;
}
input, textarea, select {
margin: 0;
padding: 1px;
font-size: 100%;
font-family: inherit;
}
select { padding: 0; }

View File

@@ -1,11 +0,0 @@
/**********************************
Use: Main Screen Import
***********************************/
@import "reset.css";
@import "core.css";
@import "cmxformTemplate.css";
@import "cmxform.css";

View File

@@ -1,92 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>jQuery validation plug-in - comment form example</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../jquery.validate.js" type="text/javascript"></script>
<script src="../lib/jquery.metadata.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#commentForm").validate({meta: "validate"});
$("#commentForm2").validate();
$("#commentForm3").validate({
messages: {
email: {
required: 'Enter this!'
}
}
});
});
</script>
<style type="text/css">
form { width: 500px; }
form label { width: 250px; }
form label.error,
form input.submit { margin-left: 253px; }
</style>
</head>
<body>
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
<div id="main">
<p>Take a look at the source to see how messages can be customized with metadata.</p>
<!-- Custom messages with custom "meta" setting -->
<form class="cmxform" id="commentForm" method="post" action="">
<fieldset>
<legend>Please enter your email address</legend>
<p>
<label for="cemail">E-Mail *</label>
<input id="cemail" name="email" class="{validate:{required:true, email:true, messages:{required:'Please enter your email address', email:'Please enter a valid email address'}}}"/>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
<!-- Custom messages with default "meta" setting -->
<form class="cmxform" id="commentForm2" method="post" action="">
<fieldset>
<legend>Please enter your email address</legend>
<p>
<label for="cemail">E-Mail *</label>
<input id="cemail" name="email" class="{required:true, email:true, messages:{required:'Please enter your email address', email:'Please enter a valid email address'}}"/>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
<!-- Custom message for "required" in metadata is overriden by a validate option -->
<form class="cmxform" id="commentForm3" method="post" action="">
<fieldset>
<legend>Please enter your email address</legend>
<p>
<label for="cemail">E-Mail *</label>
<input id="cemail" name="email" class="{required:true, email:true, messages:{email:'Please enter a valid email address'}}"/>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
<a href="index.html">Back to main page</a>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
<script type="text/javascript">_uacct = "UA-2623402-1";urchinTracker();</script>
</body>
</html>

View File

@@ -1,122 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Test for jQuery validate() plugin</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
// extend the current rules with new groovy ones
// this one requires the text "buga", we define a default message, too
$.validator.addMethod("buga", function(value) {
return value == "buga";
}, 'Please enter "buga"!');
// this one requires the value to be the same as the first parameter
$.validator.methods.equal = function(value, element, param) {
return value == param;
};
$().ready(function() {
var validator = $("#texttests").bind("invalid-form.validate", function() {
$("#summary").html("Your form contains " + validator.numberOfInvalids() + " errors, see details below.");
}).validate({
debug: true,
errorElement: "em",
errorContainer: $("#warning, #summary"),
errorPlacement: function(error, element) {
error.appendTo( element.parent("td").next("td") );
},
success: function(label) {
label.text("ok!").addClass("success");
},
rules: {
number: {
required:true,
minlength:3,
maxlength:15,
number:true
},
secret: "buga",
math: {
equal: 11
}
}
});
});
</script>
<style type="text/css">
form.cmxform { width: 50em; }
em.error {
background:url("images/unchecked.gif") no-repeat 0px 0px;
padding-left: 16px;
}
em.success {
background:url("images/checked.gif") no-repeat 0px 0px;
padding-left: 16px;
}
form.cmxform label.error {
margin-left: auto;
width: 250px;
}
em.error { color: black; }
#warning { display: none; }
</style>
</head>
<body>
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
<div id="main">
<form class="cmxform" id="texttests" method="get" action="foo.html">
<h2 id="summary"></h2>
<fieldset>
<legend>Example with custom methods and heavily customized error display</legend>
<table>
<tr>
<td><label for="number">textarea</label></td>
<td><input id="number" name="number"
title="Please enter a number with at least 3 and max 15 characters!" />
</td>
<td></td>
</tr>
<tr>
<td><label for="secret">Secret</label></td>
<td><input name="secret" id="secret" /></td>
<td></td>
</tr>
<tr>
<td><label for="math">7 + 4 = </label></td>
<td><input id="math" name="math" title="Please enter the correct result!" /></td>
<td></td>
</tr>
</table>
<input class="submit" type="submit" value="Submit"/>
</fieldset>
</form>
<h3 id="warning">Your form contains tons of errors! Please try again.</h3>
<p><a href="index.html">Back to main page</a></p>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2623402-1";
urchinTracker();
</script>
</body>
</html>

View File

@@ -1,151 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>jQuery validation plug-in - dynamic forms demo</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
// only for demo purposes
$.validator.setDefaults({
submitHandler: function() {
alert("submitted!");
}
});
$.validator.messages.max = jQuery.format("Your totals musn't exceed {0}!");
$.validator.addMethod("quantity", function(value, element) {
return !this.optional(element) && !this.optional($(element).parent().prev().children("select")[0]);
}, "Please select both the item and its amount.");
$().ready(function() {
$("#orderform").validate({
errorPlacement: function(error, element) {
error.appendTo( element.parent().next() );
},
highlight: function(element, errorClass) {
$(element).addClass(errorClass).parent().prev().children("select").addClass(errorClass);
}
});
var template = jQuery.format($("#template").val());
function addRow() {
$(template(i++)).appendTo("#orderitems tbody");
}
var i = 1;
// start with one row
addRow();
// add more rows on click
$("#add").click(addRow);
// check keyup on quantity inputs to update totals field
$("#orderform").delegate("keyup", "input.quantity", function(event) {
var totals = 0;
$("#orderitems input.quantity").each(function() {
totals += +this.value;
});
$("#totals").attr("value", totals).valid();
});
});
</script>
<style type="text/css">
form.cmxform { width: 50em; }
em.error {
background:url("images/unchecked.gif") no-repeat 0px 0px;
padding-left: 16px;
}
em.success {
background:url("images/checked.gif") no-repeat 0px 0px;
padding-left: 16px;
}
form.cmxform label.error {
margin-left: auto;
width: 250px;
}
form.cmxform input.submit {
margin-left: 0;
}
em.error { color: black; }
#warning { display: none; }
select.error {
border: 1px dotted red;
}
</style>
</head>
<body>
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
<div id="main">
<textarea style="display:none" id="template">
<tr>
<td>
<label>{0}. Item</label>
</td>
<td class='type'>
<select name="item-type-{0}">
<option value="">Select...</option>
<option value="0">Learning jQuery</option>
<option value="1">jQuery Reference Guide</option>
<option value="2">jQuery Cookbook</option>
<option vlaue="3">jQuery In Action</option>
<option value="4">jQuery For Designers</option>
</select>
</td>
<td class='quantity'>
<input size='4' class="quantity" min="1" id="item-quantity-{0}" name="item-quantity-{0}" />
</td>
<td class='quantity-error'></td>
</tr>
</textarea>
<form id="orderform" class="cmxform" method="get" action="foo.html">
<h2 id="summary"></h2>
<fieldset>
<legend>Example with custom methods and heavily customized error display</legend>
<table id="orderitems">
<tbody>
</tbody>
<tfoot>
<tr>
<td colspan="2"><label>Totals (max 25)</label></td>
<td class="totals"><input id="totals" name="totals" value="0" max="25" readonly="readonly" size='4' /></td>
<td class="totals-error"></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td><input class="submit" type="submit" value="Submit"/></td>
</tr>
</tfoot>
</table>
</fieldset>
</form>
<button id="add">Add another input to the form</button>
<h1 id="warning">Your form contains tons of errors! Please try again.</h1>
<p><a href="index.html">Back to main page</a></p>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2623402-1";
urchinTracker();
</script>
</body>
</html>

View File

@@ -1,161 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Test for jQuery validate() plugin</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../lib/jquery.metadata.js" type="text/javascript"></script>
<script src="../jquery.validate.js" type="text/javascript"></script>
<style type="text/css">
.cmxform fieldset p.error label { color: red; }
div.container {
background-color: #eee;
border: 1px solid red;
margin: 5px;
padding: 5px;
}
div.container ol li {
list-style-type: disc;
margin-left: 20px;
}
div.container { display: none }
.container label.error {
display: inline;
}
form.cmxform { width: 30em; }
form.cmxform label.error {
display: block;
margin-left: 1em;
width: auto;
}
</style>
<script type="text/javascript">
// only for demo purposes
$.validator.setDefaults({
submitHandler: function() {
alert("submitted! (skipping validation for cancel button)");
}
});
$().ready(function() {
$("#form1").validate({
errorLabelContainer: $("#form1 div.error")
});
var container = $('div.container');
// validate the form when it is submitted
var validator = $("#form2").validate({
errorContainer: container,
errorLabelContainer: $("ol", container),
wrapper: 'li',
meta: "validate"
});
$(".cancel").click(function() {
validator.resetForm();
});
});
</script>
</head>
<body>
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
<div id="main">
<form method="get" class="cmxform" id="form1" action="">
<fieldset>
<legend>Login Form</legend>
<p>
<label>Username</label>
<input name="user" title="Please enter your username (at least 3 characters)" class="{required:true,minlength:3}" />
</p>
<p>
<label>Password</label>
<input type="password" maxlength="12" name="password" title="Please enter your password, between 5 and 12 characters" class="{required:true,minlength:5}" />
</p>
<div class="error">
</div>
<p>
<input class="submit" type="submit" value="Login"/>
</p>
</fieldset>
</form>
<!-- our error container -->
<div class="container">
<h4>There are serious errors in your form submission, please see below for details.</h4>
<ol>
<li><label for="email" class="error">Please enter your email address</label></li>
<li><label for="phone" class="error">Please enter your phone <b>number</b> (between 2 and 8 characters)</label></li>
<li><label for="address" class="error">Please enter your address (at least 3 characters)</label></li>
<li><label for="avatar" class="error">Please select an image (png, jpg, jpeg, gif)</label></li>
<li><label for="cv" class="error">Please select a document (doc, docx, txt, pdf)</label></li>
</ol>
</div>
<form class="cmxform" id="form2" method="get" action="">
<fieldset>
<legend>Validating a complete form</legend>
<p>
<label for="email">Email</label>
<input id="email" name="email" class="{validate:{required:true,email:true}}" />
</p>
<p>
<label for="agree">Favorite Color</label>
<select id="color" name="color" title="Please select your favorite color!" class="{validate:{required:true}}">
<option></option>
<option>Red</option>
<option>Blue</option>
<option>Yellow</option>
</select>
</p>
<p>
<label for="phone">Phone</label>
<input id="phone" name="phone" class="some styles {validate:{required:true,number:true, rangelength:[2,8]}}" />
</p>
<p>
<label for="address">Address</label>
<input id="address" name="address" class="some other styles {validate:{required:true,minlength:3}}" />
</p>
<p>
<label for="avatar">Avatar</label>
<input type="file" id="avatar" name="avatar" class="{validate:{required:true,accept:true}}" />
</p>
<p>
<label for="agree">Please agree to our policy</label>
<input type="checkbox" class="checkbox" id="agree" title="Please agree to our policy!" name="agree" class="{validate:{required:true}}" />
</p>
<p>
<label for="cv">CV</label>
<input type="file" id="cv" name="cv" class="{validate:{required:true,accept:'docx?|txt|pdf'}}" />
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
<input class="cancel" type="submit" value="Cancel"/>
</p>
</fieldset>
</form>
<div class="container">
<h4>There are serious errors in your form submission, please see details above the form!</h4>
</div>
<a href="index.html">Back to main page</a>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2623402-1";
urchinTracker();
</script>
</body>
</html>

View File

@@ -1,53 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>jQuery validation plug-in - comment form example</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$("#commentForm").validate();
});
</script>
<style type="text/css">
#commentForm { width: 500px; }
#commentForm label { width: 250px; }
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
</style>
</head>
<body>
<form class="cmxform" id="commentForm" method="post" action="">
<fieldset>
<legend>Please provide your name, email address (won't be published) and a comment</legend>
<p>
<label for="cname">Name (required, at least 2 characters)</label>
<input id="cname" name="name" class="required" minlength="2" />
</p>
<p>
<label for="cemail">E-Mail (required)</label>
<input id="cemail" name="email" class="required email" />
</p>
<p>
<label for="curl">URL (optional)</label>
<input id="curl" name="url" class="url" value="" />
</p>
<p>
<label for="ccomment">Your comment (required)</label>
<textarea id="ccomment" name="comment" class="required"></textarea>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
</body>
</html>

View File

@@ -1,10 +0,0 @@
<?php
// wait a second to simulate a some latency
usleep(500000);
$user = $_REQUEST['user'];
$pw = $_REQUEST['password'];
if($user && $pw && $pw == "foobar")
echo "Hi $user, welcome back.";
else
echo "Your password is wrong (must be foobar).";
?>

View File

@@ -1,10 +0,0 @@
<?php
// wait a second to simulate a some latency
usleep(500000);
$user = $_REQUEST['user'];
$pw = $_REQUEST['password'];
if($user && $pw && $pw == "foobar")
echo "Hi $user, welcome back.";
else
echo "Your password is wrong (must be foobar).";
?>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 418 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 B

View File

@@ -1,230 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>jQuery validation plug-in - main demo</title>
<link rel="stylesheet" type="text/css" media="screen" href="css/screen.css" />
<script src="../lib/jquery.js" type="text/javascript"></script>
<script src="../jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
$.validator.setDefaults({
submitHandler: function() { alert("submitted!"); }
});
$().ready(function() {
// validate the comment form when it is submitted
$("#commentForm").validate();
// validate signup form on keyup and submit
$("#signupForm").validate({
rules: {
firstname: "required",
lastname: "required",
username: {
required: true,
minlength: 2
},
password: {
required: true,
minlength: 5
},
confirm_password: {
required: true,
minlength: 5,
equalTo: "#password"
},
email: {
required: true,
email: true
},
topic: {
required: "#newsletter:checked",
minlength: 2
},
agree: "required"
},
messages: {
firstname: "Please enter your firstname",
lastname: "Please enter your lastname",
username: {
required: "Please enter a username",
minlength: "Your username must consist of at least 2 characters"
},
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
confirm_password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long",
equalTo: "Please enter the same password as above"
},
email: "Please enter a valid email address",
agree: "Please accept our policy"
}
});
// propose username by combining first- and lastname
$("#username").focus(function() {
var firstname = $("#firstname").val();
var lastname = $("#lastname").val();
if(firstname && lastname && !this.value) {
this.value = firstname + "." + lastname;
}
});
//code to hide topic selection, disable for demo
var newsletter = $("#newsletter");
// newsletter topics are optional, hide at first
var inital = newsletter.is(":checked");
var topics = $("#newsletter_topics")[inital ? "removeClass" : "addClass"]("gray");
var topicInputs = topics.find("input").attr("disabled", !inital);
// show when newsletter is checked
newsletter.click(function() {
topics[this.checked ? "removeClass" : "addClass"]("gray");
topicInputs.attr("disabled", !this.checked);
});
});
</script>
<style type="text/css">
#commentForm { width: 500px; }
#commentForm label { width: 250px; }
#commentForm label.error, #commentForm input.submit { margin-left: 253px; }
#signupForm { width: 670px; }
#signupForm label.error {
margin-left: 10px;
width: auto;
display: inline;
}
#newsletter_topics label.error {
display: none;
margin-left: 103px;
}
</style>
</head>
<body>
<h1 id="banner"><a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/">jQuery Validation Plugin</a> Demo</h1>
<div id="main">
<p>Default submitHandler is set to display an alert into of submitting the form</p>
<form class="cmxform" id="commentForm" method="get" action="">
<fieldset>
<legend>Please provide your name, email address (won't be published) and a comment</legend>
<p>
<label for="cname">Name (required, at least 2 characters)</label>
<input id="cname" name="name" class="required" minlength="2" />
<p>
<label for="cemail">E-Mail (required)</label>
<input id="cemail" name="email" class="required email" />
</p>
<p>
<label for="curl">URL (optional)</label>
<input id="curl" name="url" class="url" value="" />
</p>
<p>
<label for="ccomment">Your comment (required)</label>
<textarea id="ccomment" name="comment" class="required"></textarea>
</p>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
<form class="cmxform" id="signupForm" method="get" action="">
<fieldset>
<legend>Validating a complete form</legend>
<p>
<label for="firstname">Firstname</label>
<input id="firstname" name="firstname" />
</p>
<p>
<label for="lastname">Lastname</label>
<input id="lastname" name="lastname" />
</p>
<p>
<label for="username">Username</label>
<input id="username" name="username" />
</p>
<p>
<label for="password">Password</label>
<input id="password" name="password" type="password" />
</p>
<p>
<label for="confirm_password">Confirm password</label>
<input id="confirm_password" name="confirm_password" type="password" />
</p>
<p>
<label for="email">Email</label>
<input id="email" name="email" />
</p>
<p>
<label for="agree">Please agree to our policy</label>
<input type="checkbox" class="checkbox" id="agree" name="agree" />
</p>
<p>
<label for="newsletter">I'd like to receive the newsletter</label>
<input type="checkbox" class="checkbox" id="newsletter" name="newsletter" />
</p>
<fieldset id="newsletter_topics">
<legend>Topics (select at least two) - note: would be hidden when newsletter isn't selected, but is visible here for the demo</legend>
<label for="topic_marketflash">
<input type="checkbox" id="topic_marketflash" value="marketflash" name="topic" />
Marketflash
</label>
<label for="topic_fuzz">
<input type="checkbox" id="topic_fuzz" value="fuzz" name="topic" />
Latest fuzz
</label>
<label for="topic_digester">
<input type="checkbox" id="topic_digester" value="digester" name="topic" />
Mailing list digester
</label>
<label for="topic" class="error">Please select at least two topics you'd like to receive.</label>
</fieldset>
<p>
<input class="submit" type="submit" value="Submit"/>
</p>
</fieldset>
</form>
<h3>Syntetic examples</h3>
<ul>
<li><a href="errorcontainer-demo.html">Error message containers in action</a></li>
<li><a href="custom-messages-metadata-demo.html">Custom Messages as Metadata</a></li>
<li><a href="radio-checkbox-select-demo.html">Radio and checkbox buttons and selects</a></li>
<li><a href="ajaxSubmit-intergration-demo.html">Integration with Form Plugin (AJAX submit)</a></li>
<li><a href="custom-methods-demo.html">Custom methods and message display.</a></li>
<li><a href="dynamic-totals.html">Dynamic forms</a></li>
<li><a href="themerollered.html">Forms styled with jQuery UI Themeroller</a></li>
</ul>
<h3>Real-world examples</h3>
<ul>
<li><a href="milk/">Remember The Milk signup form</a></li>
<li><a href="marketo/">Marketo signup form</a></li>
<li><a href="multipart/">Buy and Sell a House multipart form</a></li>
<li><a href="captcha/">Remote captcha validation</a></li>
</ul>
<h3>Testsuite</h3>
<ul>
<li><a href="../test/">Validation Testsuite</a></li>
</ul>
</div>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-2623402-1";
urchinTracker();
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 442 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 664 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 121 B

View File

@@ -1,76 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Login Form with Email Password Link</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="screen" href="screen.css" />
<script type="text/javascript" src="../../lib/jquery.js"></script>
<script type="text/javascript" src="../../jquery.validate.js"></script>
<script type="text/javascript">
$(function() {
// highlight
var elements = $("input[type!='submit'], textarea, select");
elements.focus(function(){
$(this).parents('li').addClass('highlight');
});
elements.blur(function(){
$(this).parents('li').removeClass('highlight');
});
$("#forgotpassword").click(function() {
$("#password").removeClass("required");
$("#login").submit();
$("#password").addClass("required");
return false;
});
$("#login").validate()
});
</script>
</head>
<body>
<div id="page">
<div id="header">
<h1>Login</h1>
</div>
<div id="content">
<p id="status"></p>
<form action="" method="get" id="login">
<fieldset>
<legend>User details</legend>
<ul>
<li>
<label for="email"><span class="required">Email address</span></label>
<input id="email" name="email" class="text required email" type="text" />
<label for="email" class="error">This must be a valid email address</label>
</li>
<li>
<label for="password"><span class="required">Password</span></label>
<input name="password" type="password" class="text required" id="password" minlength="4" maxlength="20" />
</li>
<li>
<label class="centered info"><a id="forgotpassword" href="#">Email my password...</a></label>
</li>
</ul>
</fieldset>
<fieldset class="submit">
<input type="submit" class="button" value="Login..." />
</fieldset>
<div class="clear"></div>
</form>
</div>
</div>
</body>
</html>

View File

@@ -1,457 +0,0 @@
/*******************************************************************************
********************************************************************************
**
* - GENERAL
*
* - PAGE CONTAINERS
*
* - HEADER
*
* - CONTENT
**
********************************************************************************
******************************************************************************/
/* GENERAL ------------------------------------------------------------------ */
html
{
height: 100%;
}
/* Zero default margin & padding around common elements */
body, dd, dl, dt, form, h1, h2, h3, h4, h5, h6, ul, ol, li, p
{
margin: 0;
border: none;
padding: 0;
}
body
{
height: 100%;
background-color: #333333;
background-image: url(images/bg.gif);
background-position: 0% 0;
color: #000000;
line-height: 1.5;
font-family: Arial, Helvetica, sans-serif;
font-size: 62.5%;
text-align: center;
overflow:auto;
}
a:link
{
color: #003399;
}
a:visited
{
color: #B266B2;
}
a:hover
{
text-decoration: none;
}
/* PAGE CONTAINERS ---------------------------------------------------------- */
#page
{
width: 636px;
w\idth: 600px;
min-height: 100%;
margin: 17px auto;
padding: 0 18px;
background-image: url(images/page.gif);
background-repeat: repeat-y;
text-align: left;
}
* html #page
{
height: 100%;
}
/* HEADER ------------------------------------------------------------------- */
#header
{
height: 90px;
background-color: #B2DD32;
background-image: url(images/header1.jpg);
background-repeat: repeat-x;
}
h1
{
padding: 0 35px;
font-size: 2.2em;
font-weight: normal;
line-height: 82px;
}
/* CONTENT ------------------------------------------------------------------ */
#content
{
padding: 0 25px;
}
p
{
font-size:1.1em;
margin-top: 1.5em;
}
form
{
margin-top: 1.5em;
}
/*** MASTER FORM WIDTHS - CUSTOMIZE THIS TO CHANGE THE FORM LAYOUT ***/
/*
form width: 550px
left column: 190px / 180px + 10px padding
mid column: 200px
right column: 160px
*/
form{
width:550px !important;
}
fieldset.submit
{
padding-left: 190px !important;
}
form label{
padding:0px 10px;
width: 160px;
}
form label.error,
form input.submit
{
margin-left:180px !important;
}
form fieldset fieldset label.error
{
margin-left:0px !important;
width:200px !important;
}
form .centered{
margin-left:180px !important;
width:200px !important;
}
form .text,
form .button,
form .group,
form .control,
form .submit,
form textarea,
form select
{
width: 200px !important;
}
/*** FIELDSETS AND LEGENDS ***/
form{
width:550px;
margin-bottom:25px;
clear:both;
}
form fieldset
{
margin: 0 0 1.5em 0;
padding: 0 0 10px 0px;
border: 1px solid #BFBAB0;
background-color: #F2EFE9;
background-image: url(images/fieldset_gradient.jpg);
background-repeat: repeat-x;
background-color: #fff;
background-image: url(images/fieldset-gradient-02.jpg);
background-position:bottom;
float: left;
clear: both;
width: 100%;
}
form fieldset.submit
{
padding: 0px 10px 10px 190px;
border-style: none;
background-color: transparent;
background-image: none;
float: none;
width: auto;
}
form legend
{
color: #000000;
font-size:1.3em;
font-weight: bold;
font-variant:small-caps;
margin-left: 1em;
padding:0px 5px;
}
form fieldset p{
margin:10px 0px 0px 10px;
}
/*** FORM BLOCKS ***/
form ul
{
padding:5px 10px;
list-style: none;
}
form li
{
width: 100%;
padding:5px 0px 10px 0;
border-top:1px dotted #ccc;
display:block;
float: left;
clear: left;
}
form li:first-child
{
border:none;
}
/*** FORM BLOCK ELEMENTS ***/
form label
{
padding:0px 10px;
width: 160px;
float: left;
}
form .error{
color: #c00;
}
form label.error
{
color: #c00;
font-size: 100%;
font-weight: bold;
font-variant:small-caps;
width:308px;
display: none;
margin:8px 0px 0px 180px;
padding:3px 0px 0px 5px;
border-top:1px dotted #ccc;
clear:both;
}
form label.info{
font-size: 100%;
font-weight: bold;
font-variant:small-caps;
margin:8px 0px 0px 180px;
padding:3px 0px 0px 5px;
}
form fieldset fieldset,
form .group
{
width:200px;
margin: 0;
border:none;
background:none;
float:left;
clear: none;
}
form fieldset fieldset label
{
width:auto !important;
white-space:nowrap;
padding:0px;
margin:0px;
display:block;
clear:both;
}
form label label.error{
margin-left:0px;
}
form label.centered{
padding:0px 0px;
width:200px !important;
}
/* see also the error class at the foot of the page */
form fieldset fieldset label.spaced
{
margin-bottom:3px;
}
/*** FORM ELEMENT COLUMNS ***/
.col-1,
fieldset fieldset.col-1 label
{
width:100%;
}
.col-2,
fieldset fieldset.col-2 label
{
width:50%;
}
.col-3,
fieldset fieldset.col-3 label
{
width:33%;
}
.col-4,
fieldset fieldset.col-4 label
{
width:25%;
}
/*** FORM ELEMENTS ***/
form input.submit{
margin:10px 0px 10px 180px;
padding:0px 2px;
}
form input, textarea, select,
form label
{
font-size:1.1em;
line-height:1.6em;
}
form input, textarea, select
{
font-family: Verdana, Arial, Helvetica, sans-serif;
}
form .input[type="text"],
form textarea
{
padding:1px;
}
form .input[type="radio"],
form .input[type="checkbox"]
{
margin:0px;
padding:0px;
position:relative;
top:3px;
}
/*** SUPPORTING CLASSES ***/
form label.required{
background-image:url(images/required_star.gif);
background-position:right;
background-repeat:no-repeat;
}
form span.required{
padding-right:15px;
}
form .clean
{
border:none;
}
form .info{
padding-top:0.5em;
font-size:80%;
line-height:100%;
color:#aaa;
}
form .indent{
padding:2px 20px;
width:auto !important;
white-space:nowrap;
padding-left: 25px !important;
}
form label.disabled{
color:#aaa;
}
form .highlight{
background-color:#e2e2e2;
}
.off{
display:none !important;
}
.clear{
clear:both;
}

View File

@@ -1,10 +0,0 @@
<?php
$request = trim(strtolower($_REQUEST['email']));
$emails = array('glen@marketo.com', 'george@bush.gov', 'me@god.com', 'aboutface@cooper.com', 'steam@valve.com', 'bill@gates.com');
$valid = 'true';
foreach($emails as $email) {
if( strtolower($email) == $request )
$valid = 'false';
}
echo $valid;
?>

View File

@@ -1,10 +0,0 @@
<?php
$request = trim(strtolower($_REQUEST['value']));
$emails = array('glen@marketo.com', 'george@bush.gov', 'me@god.com', 'aboutface@cooper.com', 'steam@valve.com', 'bill@gates.com');
$valid = 'true';
foreach($emails as $email) {
if( strtolower($email) == $request )
$valid = 'false';
}
echo $valid;
?>

View File

@@ -1,35 +0,0 @@
img.png {
background-image: expression(
this.runtimeStyle.backgroundImage = "none",
this.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.src + "', sizingMethod='image')",
this.src = "images/blank.gif"
);
}
.hidden {
display:none
}
div.login { width: 120px;}
div.nav-global LI,
div.nav-global LI A { display:inline !important; zoom: 1;}
div.nav-global LI A:hover,
div.nav-left li a:hover { text-decoration: none;}
div.buttonSubmit { height: 36px;}
div.buttonSubmit input { position: absolute;}
div.offerHeader {margin-left: 3px;}
#col-left { height: 340px;}
span#cancellation {
position: relative;
top: 20px;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 793 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 845 B

Some files were not shown because too many files have changed in this diff Show More