本文整理汇总了PHP中Log::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::set方法的具体用法?PHP Log::set怎么用?PHP Log::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($file, $firstLine = true)
{
$this->file = $file;
$this->db = array();
$this->dbBackup = array();
$this->firstLine = $firstLine;
if (file_exists($file)) {
// Read JSON file.
$lines = file($file);
// Remove the first line, the first line is for security reasons.
if ($firstLine) {
unset($lines[0]);
}
// Regenerate the JSON file.
$implode = implode($lines);
// Unserialize, JSON to Array.
$array = $this->unserialize($implode);
if (empty($array)) {
Log::set(__METHOD__ . LOG_SEP . 'Invalid JSON file: ' . $file . ', cannot be decoded. Check the file content.');
} else {
$this->db = $array;
$this->dbBackup = $array;
}
} else {
Log::set(__METHOD__ . LOG_SEP . 'File ' . $file . ' does not exists');
}
}
示例2: deleteUser
function deleteUser($args, $deleteContent = false)
{
global $dbUsers;
global $dbPosts;
global $Language;
global $Login;
// The user admin cannot be deleted.
if ($args['username'] == 'admin') {
return false;
}
// The editors cannot delete users.
if ($Login->role() !== 'admin') {
return false;
}
if ($deleteContent) {
$dbPosts->deletePostsByUser($args['username']);
} else {
$dbPosts->linkPostsToUser($args['username'], 'admin');
}
if ($dbUsers->delete($args['username'])) {
Alert::set($Language->g('User deleted'));
} else {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to delete the user.');
}
}
示例3: updateBludit
function updateBludit()
{
global $Site;
global $dbPosts;
// Check if Bludit need to be update.
if ($Site->currentBuild() < BLUDIT_BUILD || isset($_GET['update'])) {
// --- Update dates ---
foreach ($dbPosts->db as $key => $post) {
$date = Date::format($post['date'], 'Y-m-d H:i', DB_DATE_FORMAT);
if ($date !== false) {
$dbPosts->setPostDb($key, 'date', $date);
}
}
$dbPosts->save();
// --- Update directories ---
$directories = array(PATH_POSTS, PATH_PAGES, PATH_PLUGINS_DATABASES, PATH_UPLOADS_PROFILES, PATH_UPLOADS_THUMBNAILS, PATH_TMP);
foreach ($directories as $dir) {
// Check if the directory is already created.
if (!file_exists($dir)) {
// Create the directory recursive.
mkdir($dir, DIR_PERMISSIONS, true);
}
}
// Set and save the database.
$Site->set(array('currentBuild' => BLUDIT_BUILD));
Log::set('updateBludit' . LOG_SEP . 'System updated');
}
}
示例4: addUser
function addUser($args)
{
global $dbUsers;
global $Language;
// Check if the username already exist in db.
if (Text::isEmpty($args['username'])) {
Alert::set($Language->g('username-field-is-empty'));
return false;
}
if ($dbUsers->userExists($args['username'])) {
Alert::set($Language->g('username-already-exists'));
return false;
}
// Validate password.
if ($args['password'] != $args['confirm-password'] || Text::isEmpty($args['password'])) {
Alert::set($Language->g('The password and confirmation password do not match'));
return false;
}
// Add the user.
if ($dbUsers->add($args)) {
Alert::set($Language->g('user-has-been-added-successfully'));
return true;
} else {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to create the account.');
return false;
}
}
示例5: __construct
public function __construct($form = null)
{
Log::set('Initialize Model class');
if ($form !== false) {
$this->_form = $form;
}
$this->setKeys();
}
示例6: __construct
/**
* Constructor
*
* @access public
*/
public function __construct($props = [])
{
if (count($props) > 0) {
$this->initialize($props);
}
Log::set('Initialize Upload class');
// log_message('debug', "Upload Class Initialized");
}
示例7: destroy
public static function destroy()
{
session_destroy();
unset($_SESSION);
self::$started = false;
Log::set(__METHOD__ . LOG_SEP . 'Session destroyed.');
return !isset($_SESSION);
}
示例8: updateBludit
function updateBludit()
{
global $Site;
global $dbPosts;
global $dbPages;
// Check if Bludit need to be update.
if ($Site->currentBuild() < BLUDIT_BUILD || isset($_GET['update'])) {
// LOG
Log::set('UPDATE SYSTEM - Starting...');
// LOG
Log::set('UPDATE SYSTEM - Checking posts.');
// Update posts
foreach ($dbPosts->db as $key => $post) {
// Dates
$date = Date::format($post['date'], 'Y-m-d H:i', DB_DATE_FORMAT);
if ($date !== false) {
$dbPosts->setPostDb($key, 'date', $date);
}
// Checksum
if (empty($post['md5file'])) {
$checksum = md5_file(PATH_POSTS . $key . DS . FILENAME);
$dbPosts->setPostDb($key, 'md5file', $checksum);
}
}
$dbPosts->save();
// LOG
Log::set('UPDATE SYSTEM - Checking pages.');
// Update pages
foreach ($dbPages->db as $key => $page) {
$date = Date::format($page['date'], 'Y-m-d H:i', DB_DATE_FORMAT);
if ($date !== false) {
$dbPages->setPageDb($key, 'date', $date);
}
// Checksum
if (empty($post['md5file'])) {
$checksum = md5_file(PATH_PAGES . $key . DS . FILENAME);
$dbPages->setPageDb($key, 'md5file', $checksum);
}
}
$dbPages->save();
// LOG
Log::set('UPDATE SYSTEM - Checking directories.');
// --- Update directories ---
$directories = array(PATH_POSTS, PATH_PAGES, PATH_PLUGINS_DATABASES, PATH_UPLOADS_PROFILES, PATH_UPLOADS_THUMBNAILS, PATH_TMP);
foreach ($directories as $dir) {
// Check if the directory is already created.
if (!file_exists($dir)) {
// Create the directory recursive.
mkdir($dir, DIR_PERMISSIONS, true);
}
}
// Set and save the database.
$Site->set(array('currentBuild' => BLUDIT_BUILD));
// LOG
Log::set('UPDATE SYSTEM - Updated...');
}
}
示例9: __construct
public function __construct()
{
Log::set('Initialize Debug class');
if (ENVIRONMENT == 'development') {
if ((!isset($_SERVER['HTTP_X_REQUESTED_WITH']) or $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest') && !CMD_MODE) {
$this->displayDebugger();
}
}
}
示例10: ping
private function ping()
{
if ($this->getDbField('ping')) {
// Get the authentication key
$authKey = $this->getDbField('authKey');
// Just a request HTTP with the website URL
Log::set(file_get_contents('https://www.bludit.com/api.php?authKey=' . $authKey));
}
}
示例11: addLoginFail
public function addLoginFail()
{
$ip = $this->getUserIp();
// Save the database
$this->db[$ip] = (int) $this->db[$ip] + 1;
if ($this->save() === false) {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to save the database file.');
return false;
}
return true;
}
示例12: deletePage
function deletePage($key)
{
global $dbPages;
global $Language;
if ($dbPages->delete($key)) {
Alert::set($Language->g('The page has been deleted successfully'));
Redirect::page('admin', 'manage-pages');
} else {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to delete the page.');
}
}
示例13: __construct
public function __construct()
{
Log::set('Initialize Input class');
$this->input = ['cookie' => $_COOKIE, 'get' => $_GET, 'post' => $_POST, 'request' => $_REQUEST, 'files' => $_FILES, 'server' => $_SERVER, 'env' => $_ENV];
if ($this->cookie('session_id')) {
session_id($this->cookie('session_id'));
}
if (Brightery::SuperInstance()->Config->get('Config.enable_session')) {
$this->activateSession();
}
array_walk_recursive($this->input, 'self::InputFilter');
}
示例14: addPage
function addPage($args)
{
global $dbPages;
global $Language;
// Add the page.
if ($dbPages->add($args)) {
Alert::set($Language->g('Page added successfully'));
Redirect::page('admin', 'manage-pages');
} else {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to create the page.');
}
}
示例15: deletePost
function deletePost($key)
{
global $dbPosts;
global $Language;
if ($dbPosts->delete($key)) {
// Reindex tags, this function is in 70.posts.php
reIndexTagsPosts();
Alert::set($Language->g('The post has been deleted successfully'));
Redirect::page('admin', 'manage-posts');
} else {
Log::set(__METHOD__ . LOG_SEP . 'Error occurred when trying to delete the post.');
}
}