コード例 #1
0
 /**
  * @param $recipients array
  * @param $subject string
  * @param $body string
  */
 public static function sendEmail($recipients, $subject, $body)
 {
     \ipinga\email::$host = \ipinga\options::get('email_host');
     \ipinga\email::$port = (int) \ipinga\options::get('email_port');
     \ipinga\log::debug('option email_auth = [' . \ipinga\options::get('email_auth') . ']');
     if (strtolower(\ipinga\options::get('email_auth')) == 'yes') {
         \ipinga\email::$auth = true;
         \ipinga\email::$username = \ipinga\options::get('email_username');
         \ipinga\email::$password = \ipinga\options::get('email_password');
     } else {
         \ipinga\email::$auth = false;
         \ipinga\email::$username = '';
         \ipinga\email::$password = '';
     }
     \ipinga\email::$localhost = \ipinga\options::get('email_localhost');
     \ipinga\email::$timeout = (int) \ipinga\options::get('email_timeout');
     \ipinga\email::$debug = false;
     \ipinga\email::$from = \ipinga\options::get('email_from');
     \ipinga\email::$recipients = $recipients;
     // \ipinga\email::$bcc[] = '*****@*****.**';
     \ipinga\email::$subject = $subject;
     \ipinga\email::$textBody = $body;
     // \ipinga\email::$htmlBody = '';
     $success = \ipinga\email::send();
     if ($success === true) {
         \ipinga\log::info('(services.sendEmail) success!');
     } else {
         \ipinga\log::warning('(services.sendEmail) failed to send email to ' . var_export($recipients, true));
     }
 }
コード例 #2
0
 public function __construct()
 {
     parent::__construct();
     \ipinga\acl::$userTableName = 'users';
     \ipinga\acl::$usernameFieldName = 'email';
     $mgr = \ipinga\ipinga::getInstance()->manager;
     $mgr->userIsLoggedIn(false);
     // determine if the user is logged in or not
     $this->template->logo_url = \ipinga\options::get('logo_url');
     $this->template->showLoginFormInTopBanner = false;
     $u = new \ipinga\table('users');
     if ($mgr->isLoggedIn == true) {
         $u->loadById($mgr->loggedInDetails['USER_ID']);
         $mgr->update($u->id);
     }
     $this->template->loggedInUser = $u;
     // will be a bunch of null data if the user isn't logged in
     $this->template->manager = $mgr;
     $this->template->menuHtml = '';
     if (\ipinga\cookie::keyExists('message_for_next_screen') == true) {
         $this->template->message_for_next_screen = \ipinga\cookie::keyValue('message_for_next_screen');
         \ipinga\cookie::drop('message_for_next_screen');
     }
     $this->template->title = \ipinga\options::get('site_title');
     $this->template->activePanel = 0;
     $this->template->skin = \ipinga\options::get('skin');
 }
コード例 #3
0
 public static function isGoodCaptcha($recaptchaResponse)
 {
     $r = \data::curlPost(\ipinga\options::get('recaptcha_siteverify_url'), array(), array('secret' => \ipinga\options::get('recaptcha_secret_key'), 'response' => $recaptchaResponse, 'remoteip' => $_SERVER['REMOTE_ADDR']));
     \ipinga\log::info('reCaptcha $recaptchaResponse == ' . $recaptchaResponse);
     \ipinga\log::info('reCaptcha remoteip == ' . $_SERVER['REMOTE_ADDR']);
     \ipinga\log::info('reCaptcha siteverify response == ' . var_export($r, true));
     \ipinga\log::notice('reCaptcha ' . ($r['success'] ? ' Success!' : ' Failure'));
     return $r['success'];
 }
コード例 #4
0
 public function linkData($link)
 {
     $results = array();
     $contents = \ipinga\crypto::printableDecrypt($link);
     if (is_array($contents) == true) {
         $linkUserId = $contents['u'];
         $linkTime = (double) $contents['t'];
         $t = \ipinga\options::get('password_link_timeout');
         if (empty($t) == true) {
             $timeout = 10;
         } else {
             $timeout = (double) $t;
         }
         $now = (double) microtime(true);
         $elapsedMinutes = ($now - $linkTime) / 60;
         if ($elapsedMinutes > $timeout) {
             $results['error'] = 1;
             $results['message'] = 'Password reset link has expired';
         } else {
             $results['error'] = 0;
             $results['message'] = 'No error.  Link is good.';
             $u = new \ipinga\userTable('users');
             $u->loadById($linkUserId);
             $results['user'] = $u;
         }
     } else {
         $results['error'] = 2;
         $results['message'] = 'Password reset link is invalid';
     }
     return $results;
 }
コード例 #5
0
ファイル: index.php プロジェクト: vernsix/iPinga-Starter-App
define('__VERN', true);
$iPinga = new \ipinga\ipinga(array_merge(array('manager.expired_url' => '/login', 'manager.ip_changed_url' => '/login', 'manager.login_url' => '/login', 'manager.max_minutes' => 10), config()));
if (isset($_SERVER['WEBSITE_ENVIRONMENT']) == true) {
    \ipinga\options::$environment = $_SERVER['WEBSITE_ENVIRONMENT'];
}
// define all the routes...
if (isset($_SERVER['REQUEST_METHOD']) == true && $_SERVER['REQUEST_METHOD'] == 'GET') {
    $iPinga->addRoute('login', 'login', 'index', null, '1');
} else {
    $iPinga->addRoute('login', 'login', 'post', null, '2');
}
if (isset($_SERVER['REQUEST_METHOD']) == true && $_SERVER['REQUEST_METHOD'] == 'GET') {
    $iPinga->addRoute('password/change', 'password', 'change', 'mustBeLoggedIn', '3');
} else {
    $iPinga->addRoute('password/change', 'password', 'post_change', 'mustBeLoggedIn', '4');
}
if (isset($_SERVER['REQUEST_METHOD']) == true && $_SERVER['REQUEST_METHOD'] == 'GET') {
    $iPinga->addRoute('password/forgot', 'password', 'forgot', null, '5');
} else {
    $iPinga->addRoute('password/forgot', 'password', 'post_forgot', null, '6');
}
if (isset($_SERVER['REQUEST_METHOD']) == true && $_SERVER['REQUEST_METHOD'] == 'GET') {
    $iPinga->addRoute('password_reset/$1', 'password', 'reset', null, '7');
} else {
    $iPinga->addRoute('password_reset', 'password', 'reset_new', null, '8');
}
$iPinga->addRoute('logout', 'logout', 'index', null, '9');
$iPinga->addRoute('', 'default', 'index', 'mustBeLoggedIn', '10');
$iPinga->defaultRoute('default', 'error404');
\ipinga\log::setThreshold((int) \ipinga\options::get('log_level'));
$iPinga->run();
コード例 #6
0
<?php

$watermark = \ipinga\options::get('environment_watermark');
if (empty($watermark) == false) {
    ?>

    <!-- TOP RIGHT RIBBON: START COPYING HERE -->
    <div class="github-fork-ribbon-wrapper right">
        <div class="github-fork-ribbon">
            <a href="http://iPinga.com"><?php 
    echo $watermark;
    ?>
</a>
        </div>
    </div>
    <!-- TOP RIGHT RIBBON: END COPYING HERE -->

    <!-- TOP LEFT RIBBON: START COPYING HERE -->
    <div class="github-fork-ribbon-wrapper left">
        <div class="github-fork-ribbon">
            <a href="http://iPinga.com"><?php 
    echo $watermark;
    ?>
</a>
        </div>
    </div>

    <?php 
}
?>
コード例 #7
0
            <ul>
                <li><a href="/">Home</a></li>
            </ul>
        </li>


        <li><h3><a>Account</a></h3>
            <ul>
                <li><a href="/password/change">Change Password</a></li>
                <li><a href="/logout">Logout</a></li>
            </ul>
        </li>


        <?php 
$emailsToShowTestingMenu = explode(',', \ipinga\options::get('show_testing_menu'));
if (in_array($loggedInUser->email, $emailsToShowTestingMenu) == true) {
    ?>
            <li><h3><a>Vern Testing</a></h3>
                <ul>
                    <li><a href="/vern/showinfo">PHP Info</a></li>
                </ul>
            </li>
            <?php 
}
?>


    </ul>

コード例 #8
0
<?php

defined('__VERN') or die('Restricted access');
/**
 * @var $this \ipinga\template
 */
?>
<div class="clear"></div>
<div id="bottom-banner">
    <div class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all small-text"
         style="padding: .5em; text-align:center;">
        <div style="text-align: center;">
            &copy; 2015-<?php 
echo date("Y");
?>
 by <?php 
echo \ipinga\options::get('copyright_holder');
?>
. All rights reserved.
        </div>
    </div>
</div>
<br/><br/>

コード例 #9
0
ファイル: header.php プロジェクト: vernsix/iPinga-Starter-App
// show an error message panel?
if (isset($message) == true && empty($message) == false) {
    ?>
            $("#error-message").html('<?php 
    echo $message;
    ?>
');
            $("#error-panel").removeClass("hidden");
            <?php 
}
?>

        });
    </script>


    <?php 
if (strtolower(\ipinga\options::get('use_recaptcha')) == 'yes') {
    ?>
            <script src='https://www.google.com/recaptcha/api.js'></script>
    <?php 
}
?>

    <link rel="stylesheet" href="/css/gh-fork-ribbon.css">
    <!--[if lt IE 9]>
    <link rel="stylesheet" href="/css/gh-fork-ribbon.ie.css">
    <![endif]-->

</head>