<?php 
/**
 * Ahead WebSoft Technologies Pvt Ltd.
 * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
 * @license    https://www.socialengine.com/policies
*/
?>

<?php if(($settings->telegram_enable == 1 && $settings->telegram_username && $settings->telegram_token) || ($settings->core_facebook_enable == 'login' && $settings->core_facebook_appid && $settings->core_facebook_secret) || ($settings->core_twitter_enable == 'login' && $settings->core_twitter_key && $settings->core_twitter_secret)  || ($settings->core_google_enable == 'login' && $settings->core_google_clientid && $settings->core_google_clientsecret) || ($settings->core_linkedin_enable == 'login' && $settings->core_linkedin_access && $settings->core_linkedin_secret)) { ?>

  <div class="form-wrapper" id="sociallinks-wrapper">
    
    <?php if($settings->core_facebook_enable == 'login' && $settings->core_facebook_appid && $settings->core_facebook_secret) { ?>
      <?php $href = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'user', 'controller' => 'auth', 'action' => 'facebook'), 'default', true); ?>
      <div id="facebook-element" class="form-element">
        <a href="<?php echo $href ?>" class="social_login_btn facebook_login_btn ajaxPrevent">
          <i><svg xmlns="http://www.w3.org/2000/svg" fill="#fff" x="0px" y="0px" width="32" height="32" viewBox="0 0 50 50">
          <path d="M32,11h5c0.552,0,1-0.448,1-1V3.263c0-0.524-0.403-0.96-0.925-0.997C35.484,2.153,32.376,2,30.141,2C24,2,20,5.68,20,12.368 V19h-7c-0.552,0-1,0.448-1,1v7c0,0.552,0.448,1,1,1h7v19c0,0.552,0.448,1,1,1h7c0.552,0,1-0.448,1-1V28h7.222 c0.51,0,0.938-0.383,0.994-0.89l0.778-7C38.06,19.518,37.596,19,37,19h-8v-5C29,12.343,30.343,11,32,11z"></path></svg></i><span><?php echo $this->translate("Login with Facebook"); ?></span>
        </a>
      </div>
    <?php } ?>

    
    <?php if($settings->core_twitter_enable == 'login' && $settings->core_twitter_key && $settings->core_twitter_secret) { ?>
      <?php $href = Zend_Controller_Front::getInstance()->getRouter() ->assemble(array('module' => 'user', 'controller' => 'auth', 'action' => 'twitter'), 'default', true); ?>
      <div id="twitter-element" class="form-element">
        <a href="<?php echo $href ?>" class="social_login_btn twitter_login_btn ajaxPrevent">
          <i><svg xmlns="http://www.w3.org/2000/svg" fill="#fff" x="0px" y="0px" width="32" height="32" viewBox="0 0 50 50">
          <path d="M 5.9199219 6 L 20.582031 27.375 L 6.2304688 44 L 9.4101562 44 L 21.986328 29.421875 L 31.986328 44 L 44 44 L 28.681641 21.669922 L 42.199219 6 L 39.029297 6 L 27.275391 19.617188 L 17.933594 6 L 5.9199219 6 z M 9.7167969 8 L 16.880859 8 L 40.203125 42 L 33.039062 42 L 9.7167969 8 z"></path></svg></i><span><?php echo $this->translate("Login with X"); ?></span>
        </a>
      </div>
    <?php } ?>

    <?php if($settings->core_google_enable == 'login' && $settings->core_google_clientid && $settings->core_google_clientsecret) { ?>
      <?php $href = Zend_Controller_Front::getInstance()->getRouter() ->assemble(array('module' => 'user', 'controller' => 'auth', 'action' => 'google'), 'default', true); ?>
      <div id="google-element" class="form-element">
        <a href="<?php echo $href ?>" class="social_login_btn google_login_btn ajaxPrevent">
          <i><svg viewBox="0 0 256 262" id="google"><path fill="#4285F4" d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027"></path><path fill="#34A853" d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1"></path><path fill="#FBBC05" d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782"></path><path fill="#EB4335" d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251"></path></svg></i><span><?php echo $this->translate("Login with Google"); ?></span>
        </a>
      </div>
    <?php } ?>

    <?php if($settings->core_linkedin_enable == 'login' && $settings->core_linkedin_access && $settings->core_linkedin_secret) { ?>
      <?php $href = Zend_Controller_Front::getInstance()->getRouter()->assemble(array('module' => 'user', 'controller' => 'auth', 'action' => 'linkedin'), 'default', true); ?>
      <div id="linkedin-element" class="form-element">
        <a href="<?php echo $href ?>" class="social_login_btn linkedin_login_btn ajaxPrevent"><i><svg viewBox="0 0 448 512" fill="#fff"><path d="M100.3 448H7.4V148.9h92.9zM53.8 108.1C24.1 108.1 0 83.5 0 53.8a53.8 53.8 0 0 1 107.6 0c0 29.7-24.1 54.3-53.8 54.3zM447.9 448h-92.7V302.4c0-34.7-.7-79.2-48.3-79.2-48.3 0-55.7 37.7-55.7 76.7V448h-92.8V148.9h89.1v40.8h1.3c12.4-23.5 42.7-48.3 87.9-48.3 94 0 111.3 61.9 111.3 142.3V448z"/></svg></i><span><?php echo $this->translate("Login with Linkedin"); ?></span>
        </a>
      </div>
    <?php } ?>

    <?php  if($settings->telegram_enable == 1 && $settings->telegram_username && $settings->telegram_token) { ?>
      <?php $dataTelegram = Engine_Api::_()->user()->telegramEnable(); ?>
      <div id="telegram-element" class="form-element">
        <a>
          <script async src="https://telegram.org/js/telegram-widget.js?15" data-telegram-login="'.$dataTelegram['username'].'" data-size="large" data-onauth="onTelegramLogin(user)" data-request-access="write"></script>
        </a>
        <script>
          function onTelegramLogin(user){
            scriptJquery.post(en4.core.baseUrl+"user/auth/telegram",user,function(response){
              var data = JSON.parse(response);
              if(data.status == 1){
                window.location.href = en4.core.baseUrl+"signup";
              }else if(data.status == 2){
                window.location.href = data.url ? data.url : en4.core.baseUrl;
              }else{
                alert(data.message ?? data.error);
              }
            })
          }
        </script>
      </div>
    <?php } ?>
  </div>

	<div class="lp2_sep">
		<p class=""><?php echo $this->translate('OR'); ?></p>
	</div>
<?php } ?>