File indexing completed on 2024-12-29 05:24:37

0001 <?php
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 
0023 $helperNewUsers = new Default_View_Helper_NewUsers();
0024 $users = $helperNewUsers->newUsers($limit = 216,'created_at','DESC');
0025 $buildMemberUrl = new Default_View_Helper_BuildMemberUrl();
0026 $helperImage = new Default_View_Helper_Image();
0027 $this->headMeta()->setName('robots', 'noindex, nofollow');
0028 ?>
0029 
0030 <script language="javascript">
0031     
0032 function test(data) {
0033     $(document).ready(function(){
0034         $('#ipv4').val(data['ip']);
0035     });
0036 
0037 }
0038 
0039 function test6(data) {
0040     $(document).ready(function(){
0041         $('#ipv6').val(data['ip']);
0042     });
0043 
0044 }
0045  
0046 </script>
0047 
0048 <script type="application/javascript" src="https://ipify6.pling.com?format=jsonp&callback=test6"></script>
0049 <script type="application/javascript" src="https://ipify4.pling.com?format=jsonp&callback=test"></script>
0050 
0051 
0052   <!-- new code -->
0053     <main id="reg-page">
0054 
0055         <section class="wrapper" id="register-wrap">
0056             <div id="register" class="col-lg-12 col-md-12 col-sm-12 col-xs-12 clearfix">
0057                 <div id="register-box" class="col-lg-8 col-md-8 col-sm-8 col-xs-8">
0058 
0059                     <?= $this->render('authorization/partials/registerForm.phtml') ?>
0060 
0061                 </div>
0062                 <!-- END #register-box -->
0063                 <div id="social-register" class="col-lg-4 col-md-4 col-sm-4 col-xs-4">
0064                     <h3></h3>
0065 
0066                     <div id="social-login-elements">
0067                         <?php /*
0068                         <div class="register-facebook">
0069                             <p class="small center light greylight">Register with</p>
0070                             <a  href="/login/github/" class="btn btn-block btn-social btn-github" rel="nofollow">
0071                                 <span class="fa fa-github"></span>
0072                                 <span class="small">Github</span>
0073                             </a>
0074                         </div>
0075                         */ ?>
0076                         <div class="bottom margin-top-15">
0077                             <div id="show-login-description" class="small light lightgrey">Already have an account?</div>
0078                             <div class="login2">
0079                                 <a href="/login/" id="show-login-form" class="btn btn-native btn-min-width" rel="nofollow">
0080                                     <i class="icon-white icon-lock"></i>
0081                                     Login
0082                                 </a>
0083                             </div>
0084                         </div>
0085                     </div>
0086                 </div>
0087             </div>
0088         </section>
0089 
0090         <section id="thumbs">
0091 
0092           <?php foreach ($users as $key => $user) { ?>
0093 
0094                 <div class="thumb">
0095                     <a href="<?php echo $buildMemberUrl->buildMemberUrl($user['username']); ?>">
0096                         <span></span>
0097                         <img src="<?php echo $helperImage->Image($user['profile_image_url'],array('width' => 110, 'height' => 110, 'crop' => 2)); ?>"/>
0098                     </a>
0099                 </div>
0100 
0101             <?php } ?>
0102         
0103 
0104         </section>
0105 
0106     </main>
0107     <!-- /new code -->
0108 
0109 <script>
0110 $('document').ready(function(){
0111 
0112     var ValidateAjax = {
0113         isClean: {},
0114         initialize: function (formid, endpoint) {
0115             end_url = endpoint;
0116             form_id = '#'+formid;
0117 
0118             $(form_id +' input[id=username],input[id=mail]').
0119             blur(function () {
0120                 var formElementID = $(this).attr('id');
0121                 var formElementValue = $(this).val();
0122                 ValidateAjax.doValidate(formElementID, formElementValue);
0123                 return false;
0124             });
0125             $(form_id).on('submit', function(e){
0126                 var target = $(this).attr("data-target");
0127                 var loadState = $(this).attr('data-load-state');
0128 
0129                 $(target).find(loadState).prop('disabled', true);
0130                 $(target).find(loadState).find('i').removeClass('hidden');
0131 
0132                 var validateValues = ValidateAjax.isClean;
0133                 for (var k in validateValues){
0134                     if (validateValues.hasOwnProperty(k)) {
0135                         if (!validateValues[k]) {
0136                             e.preventDefault();
0137                             return false;
0138                         }
0139                     }
0140                 }
0141                 return true;
0142             });
0143         },
0144 
0145         doValidate: function (id, value) {
0146             $.fn.capitalize = function () {
0147                 $.each(this, function () {
0148                     var caps = this.value;
0149                     caps = caps.charAt(0).toUpperCase() + caps.slice(1);
0150                     this.value = caps;
0151                 });
0152                 return this;
0153             };
0154             
0155             var url = end_url;
0156             var data = {'name' : id, 'value': value};
0157             $.post(url, data, function (response) {
0158                 $('#'+id).parent().find('.form-control-feedback').remove();
0159                 $('#'+id).parent().removeClass('has-error');
0160                 
0161                 if (!response['status']) {
0162                     ValidateAjax.isClean[id] = false;
0163                     $('#login').attr("disabled","disabled");
0164                     
0165                     $('#'+id).parent().addClass('has-error');
0166                     if (response[id]) {
0167                         $('#'+id).parent().append('<i class="glyphicon glyphicon-remove form-control-feedback"></i>');
0168                         $('#'+id).parent().find('.errors').remove();
0169                         
0170                         $msgArray = response[id];
0171                         $msgString = "";
0172                         $msgString += '<ul class="errors" style="text-align: left;">';
0173                         if(id == 'mail') {
0174                             $msgString += '<li class="errors">Email is invalid or already taken</li>';
0175                         } else {
0176                             $.each($msgArray, function( key, value ) {
0177                                 if(key == 'regexNotMatch') {
0178                                     $msgString += '<li class="errors">Username may only contain lower case alphanumeric characters or single hyphens, and cannot begin or end with a hyphen</li>';
0179                                 } else {
0180                                     $msgString += '<li class="errors">' + value + '</li>';
0181                                 }
0182                             });
0183                             
0184                         }
0185                         $msgString += '</ul>';
0186                             $('#'+id).parent().append($msgString);
0187                         if($msgString == '<ul class="errors" style="text-align: left;"></ul>') {
0188                             $('#'+id).parent().append('<ul class="errors" style="text-align: left;"><li class="errors">This '+id+' is already taken</li></ul>');
0189                         }
0190                     }
0191                 } else {
0192                     ValidateAjax.isClean[id] = true;
0193                     $('#login').removeAttr("disabled");
0194                     $('#'+id).parent().addClass('has-success');
0195                     $('#'+id).parent().append('<i class="glyphicon glyphicon-ok form-control-feedback"></i>');
0196                     $('#'+id).parent().find('.errors').remove();
0197                     $('#'+id).parent().append('<ul class="errors" style="visibility: hidden;"><li></li></ul>');
0198                 }
0199             },'json');
0200 
0201         },
0202         getHTML: function (errArray) {
0203             var o = '<ul class="errors">';
0204             $.each(errArray,function(key,value){
0205                 o += '<li>'+ value+'</li>';
0206             });
0207             o+='</ul>';
0208 
0209             return o;
0210         }
0211     };
0212 
0213     ValidateAjax.initialize('<?= $this->formRegister->getAttrib('id') ?>', '/register/validate');
0214 });
0215 </script>
0216 
0217 <?php $this->inlineScript()->appendScript(
0218     '    $(document).ready(function(){
0219             // PartialJson.setup();
0220         });
0221     ');