当前位置: 首页>>代码示例>>PHP>>正文


PHP Setting::getSettings方法代码示例

本文整理汇总了PHP中Setting::getSettings方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::getSettings方法的具体用法?PHP Setting::getSettings怎么用?PHP Setting::getSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Setting的用法示例。


在下文中一共展示了Setting::getSettings方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createUserFromLdap

 /**
  * Create user from LDAP attributes
  *
  * @param $ldapatttibutes
  * @return array|bool
  */
 function createUserFromLdap($ldapatttibutes)
 {
     //Get LDAP attribute config
     $ldap_result_username = Setting::getSettings()->ldap_username_field;
     $ldap_result_emp_num = Setting::getSettings()->ldap_emp_num;
     $ldap_result_last_name = Setting::getSettings()->ldap_lname_field;
     $ldap_result_first_name = Setting::getSettings()->ldap_fname_field;
     $ldap_result_email = Setting::getSettings()->ldap_email;
     //Get LDAP user data
     $item = array();
     $item["username"] = isset($ldapatttibutes[$ldap_result_username][0]) ? $ldapatttibutes[$ldap_result_username][0] : "";
     $item["employee_number"] = isset($ldapatttibutes[$ldap_result_emp_num][0]) ? $ldapatttibutes[$ldap_result_emp_num][0] : "";
     $item["lastname"] = isset($ldapatttibutes[$ldap_result_last_name][0]) ? $ldapatttibutes[$ldap_result_last_name][0] : "";
     $item["firstname"] = isset($ldapatttibutes[$ldap_result_first_name][0]) ? $ldapatttibutes[$ldap_result_first_name][0] : "";
     $item["email"] = isset($ldapatttibutes[$ldap_result_email][0]) ? $ldapatttibutes[$ldap_result_email][0] : "";
     //create user
     if (!empty($item["username"]) && !empty($item['email'])) {
         $pass = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 10);
         $newuser = array('first_name' => $item["firstname"], 'last_name' => $item["lastname"], 'username' => $item["username"], 'email' => $item["email"], 'employee_num' => $item["employee_number"], 'password' => $pass, 'activated' => 1, 'location_id' => null, 'permissions' => '{"user":1}', 'notes' => 'Imported from LDAP');
         DB::table('users')->insert($newuser);
         $updateuser = Sentry::findUserByLogin($item["username"]);
         // Update the user details
         $updateuser->password = $pass;
         // Update the user
         $updateuser->save();
     } else {
         throw new Cartalyst\Sentry\Users\UserNotFoundException();
     }
     //$item["note"] = "<strong>created</strong>";
     $credentials = array('username' => $item["username"], 'password' => $pass);
     return $credentials;
 }
开发者ID:chromahoen,项目名称:snipe-it,代码行数:38,代码来源:AuthController.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $expiring_assets = Asset::getExpiringWarrantee(60);
     $data['count'] = count($expiring_assets);
     $data['email_content'] = '';
     foreach ($expiring_assets as $asset) {
         $now = date("Y-m-d");
         $expires = $asset->warrantee_expires();
         $difference = round(abs(strtotime($expires) - strtotime($now)) / 86400);
         if ($difference > 30) {
             $data['email_content'] .= '<tr style="background-color: #fcffa3;">';
         } else {
             $data['email_content'] .= '<tr style="background-color:#d9534f;">';
         }
         $data['email_content'] .= '<td><a href="' . Config::get('app.url') . '/hardware/' . $asset->id . '/view">';
         $data['email_content'] .= $asset->name . '</a></td><td>' . $asset->asset_tag . '</td>';
         $data['email_content'] .= '<td>' . $asset->warrantee_expires() . '</td>';
         $data['email_content'] .= '<td>' . $difference . ' days</td>';
         $data['email_content'] .= '</tr>';
     }
     if (Setting::getSettings()->alert_email != '' && Setting::getSettings()->alerts_enabled == 1) {
         if (count($expiring_assets) > 0) {
             Mail::send('emails.expiring-report', $data, function ($m) {
                 $m->to(Setting::getSettings()->alert_email, Setting::getSettings()->site_name);
                 $m->subject('Expiring Assets Report');
             });
         }
     } else {
         if (Setting::getSettings()->alert_email == '') {
             echo "Could not send email. No alert email configured in settings. \n";
         } elseif (Setting::getSettings()->alerts_enabled != 1) {
             echo "Alerts are disabled in the settings. No mail will be sent. \n";
         }
     }
 }
开发者ID:naiwungmusic,项目名称:snipe-it,代码行数:40,代码来源:SendExpirationAlerts.php

示例3: show_custom_css

 public function show_custom_css()
 {
     $custom_css = Setting::getSettings()->custom_css;
     $custom_css = e($custom_css);
     // Needed for modifying the bootstrap nav :(
     $custom_css = str_ireplace('script', 'SCRIPTS-NOT-ALLOWED-HERE', $custom_css);
     $custom_css = str_replace('&gt;', '>', $custom_css);
     return $custom_css;
 }
开发者ID:lutherpros,项目名称:snipe-it,代码行数:9,代码来源:Setting.php

示例4: getDefaultEula

 public static function getDefaultEula()
 {
     $Parsedown = new Parsedown();
     if (Setting::getSettings()->default_eula_text) {
         return $Parsedown->text(e(Setting::getSettings()->default_eula_text));
     } else {
         return null;
     }
 }
开发者ID:naiwungmusic,项目名称:snipe-it,代码行数:9,代码来源:Setting.php

示例5: isFullMultipleCompanySupportEnabled

 private static function isFullMultipleCompanySupportEnabled()
 {
     $settings = Setting::getSettings();
     // NOTE: this can happen when seeding the database
     if (is_null($settings)) {
         return FALSE;
     } else {
         return $settings->full_multiple_companies_support == 1;
     }
 }
开发者ID:cralle,项目名称:snipe-it,代码行数:10,代码来源:Company.php

示例6: getEula

 public function getEula()
 {
     $Parsedown = new Parsedown();
     if ($this->category->eula_text) {
         return $Parsedown->text(e($this->category->eula_text));
     } elseif (Setting::getSettings()->default_eula_text && $this->category->use_default_eula == '1') {
         return $Parsedown->text(e(Setting::getSettings()->default_eula_text));
     } else {
         return null;
     }
 }
开发者ID:lutherpros,项目名称:snipe-it,代码行数:11,代码来源:Consumable.php

示例7: array

<?php

return array('table' => array('class' => 'table table-bordered', 'id' => '', 'options' => array("pagingType" => "full_numbers", 'processing' => true, 'language' => array('processing' => '<i class="fa fa-spinner fa-spin"></i> Loading...'), 'deferRender' => true, 'stateSave' => true, 'paging' => true, 'pageLength' => Setting::getSettings()->per_page, 'lengthMenu' => array(array(10, 25, 50, 75, 100, 125, 150, -1), array(10, 25, 50, 75, 100, 125, 150, 'All')), 'tableTools' => array('sSwfPath' => Config::get('app.url') . '/assets/swf/copy_csv_xls_pdf.swf', 'aButtons' => array(array('sExtends' => 'copy', 'sButtonText' => 'Copy', 'mColumns' => 'visible', 'bFooter' => false), array('sExtends' => 'print', 'sButtonText' => 'Print', 'mColumns' => 'visible', 'bShowAll' => true), array('sExtends' => 'collection', 'sButtonText' => 'Export', 'aButtons' => array(array('sExtends' => 'csv', 'sButtonText' => 'csv', 'mColumns' => 'visible', 'bFooter' => false), array('sExtends' => 'xls', 'sButtonText' => 'XLS', 'mColumns' => 'visible', 'bFooter' => false), array('sExtends' => 'pdf', 'sButtonText' => 'PDF', 'mColumns' => 'visible', 'bFooter' => false)))))), 'callbacks' => array("stateSaveCallback" => "function (oSettings, oData) {\n                    localStorage.setItem('DataTables_'+window.location.pathname, JSON.stringify(oData));\n                }", "stateLoadCallback" => "function (oSettings) {\n                    return JSON.parse(localStorage.getItem('DataTables_'+window.location.pathname));\n                }"), 'noScript' => false, 'table_view' => 'datatable::template', 'script_view' => 'datatable::javascript'), 'engine' => array('exactWordSearch' => false, 'enableDisplayAll' => false, 'defaultDisplayLength' => 10));
开发者ID:chromahoen,项目名称:snipe-it,代码行数:3,代码来源:config.php

示例8: foreach

		<a class='selected' href="editsetting.php"></a>
	</div>
	<div id='logoff'>
		<a href="index.php?logoff=1"></a>
	</div>
</div>
<ul>
	<li><a href="view.php">view</a></li>
	<li><a href="edit.php">edit</a></li>
</ul>

</div>
<div class="hline"></div>
<div class="admin-content">
<div class="admin-nav"><?php 
$records = Setting::getSettings();
if ($records) {
    echo "<h3>available settings:</h3>\n<table>\n";
    $firsttime = true;
    foreach ($records as $setting) {
        echo "<tr><td class='label'>\n<a href='" . $_SERVER['PHP_SELF'] . "?id=" . $setting[0] . "'>" . $setting[1] . "</a></td>\n</tr>\n";
    }
    echo "</table>\n";
}
?>
</div>
<div class="admin-content-edit">
<?php 
if ($id) {
    ?>
<h2><?php 
开发者ID:standup75,项目名称:standupweb-cms,代码行数:31,代码来源:editsetting.php

示例9: postSignin

 /**
  * Account sign in form processing.
  *
  * @return Redirect
  */
 public function postSignin()
 {
     // Declare the rules for the form validation
     $rules = array('username' => 'required', 'password' => 'required');
     // Create a new validator instance from our validation rules
     $validator = Validator::make(Input::all(), $rules);
     // If validation fails, we'll exit the operation now.
     if ($validator->fails()) {
         // Ooops.. something went wrong
         return Redirect::back()->withInput()->withErrors($validator);
     }
     try {
         // Should we even check for LDAP users?
         if (Setting::getSettings()->ldap_enabled == '1') {
             LOG::debug("LDAP is enabled.");
             // Check if the user exists in the database
             $user = User::where('username', '=', Input::get('username'))->whereNull('deleted_at')->first();
             LOG::debug("Sentry lookup complete");
             // The user does not exist in the database. Try to get them from LDAP.
             // If user does not exist and authenticates sucessfully with LDAP we
             // will create it on the fly and sign in with default permissions
             if (!$user) {
                 LOG::debug("Local user " . Input::get('username') . " does not exist");
                 if ($userattr = $this->ldap(Input::get('username'), Input::get('password'), true)) {
                     LOG::debug("Creating local user from authenticated LDAP user.");
                     $credentials = $this->createUserFromLdap($userattr);
                 } else {
                     LOG::debug("User did not authenticate correctly against LDAP. No local user was created.");
                 }
                 // If the user exists and they were imported from LDAP already
             } else {
                 LOG::debug("Local user " . Input::get('username') . " exists in database. Authenticating existing user against LDAP.");
                 if ($this->ldap(Input::get('username'), Input::get('password'))) {
                     LOG::debug("Valid LDAP login. Updating the local data.");
                     $sentryuser = Sentry::findUserById($user->id);
                     //need the Sentry object, not the Eloquent object, to access critical password hashing functions
                     $sentryuser->password = Input::get('password');
                     $sentryuser->save();
                 } else {
                     LOG::debug("User did not authenticate correctly against LDAP. Local user was not updated.");
                 }
                 // End LDAP auth
             }
             // End if(!user)
             // NO LDAP enabled - just try to login the user normally
         }
         LOG::debug("Authenticating user against database.");
         // Try to log the user in
         if (!Sentry::authenticate(Input::only('username', 'password'), Input::get('remember-me', 0))) {
             LOG::debug("Local authentication failed.");
             throw new Cartalyst\Sentry\Users\UserNotFoundException();
         }
         // Get the page we were before
         $redirect = Session::get('loginRedirect', 'account');
         // Unset the page we were before from the session
         Session::forget('loginRedirect');
         // Redirect to the users page
         return Redirect::to($redirect)->with('success', Lang::get('auth/message.signin.success'));
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         LOG::debug("Local authentication: User " . Input::get('username') . " not found");
         $this->messageBag->add('username', Lang::get('auth/message.account_not_found'));
     } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) {
         LOG::debug("Local authentication: Password for " . Input::get('username') . " is incorrect.");
         $this->messageBag->add('username', Lang::get('auth/message.account_not_found'));
     } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         LOG::debug("Local authentication: User not activated");
         $this->messageBag->add('username', Lang::get('auth/message.account_not_activated'));
     } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) {
         LOG::debug("Local authentication: Account suspended");
         $this->messageBag->add('username', Lang::get('auth/message.account_suspended'));
     } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) {
         LOG::debug("Local authentication: Account banned.");
         $this->messageBag->add('username', Lang::get('auth/message.account_banned'));
     }
     // Ooops.. something went wrong
     return Redirect::back()->withInput()->withErrors($this->messageBag);
 }
开发者ID:rrsc,项目名称:snipe-it,代码行数:82,代码来源:AuthController.php


注:本文中的Setting::getSettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。