本文整理汇总了PHP中site_status类的典型用法代码示例。如果您正苦于以下问题:PHP site_status类的具体用法?PHP site_status怎么用?PHP site_status使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了site_status类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: check_index
/**
* @return string An error message suitable for inclusion in the task log
*/
static function check_index()
{
list($remaining) = search::stats();
if ($remaining) {
site_status::warning(t('Your search index needs to be updated. <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/search_task::update_index?csrf=__CSRF__")))), "search_index_out_of_date");
}
}
开发者ID:viosca,项目名称:gallery3,代码行数:10,代码来源:search.php
示例2: index
public function index()
{
// require_once(MODPATH . "aws_s3/lib/s3.php");
$form = $this->_get_s3_form();
if (request::method() == "post") {
access::verify_csrf();
if ($form->validate()) {
module::set_var("aws_s3", "enabled", isset($_POST['enabled']) ? true : false);
module::set_var("aws_s3", "access_key", $_POST['access_key']);
module::set_var("aws_s3", "secret_key", $_POST['secret_key']);
module::set_var("aws_s3", "bucket_name", $_POST['bucket_name']);
module::set_var("aws_s3", "g3id", $_POST['g3id']);
module::set_var("aws_s3", "url_str", $_POST['url_str']);
module::set_var("aws_s3", "sig_exp", $_POST['sig_exp']);
module::set_var("aws_s3", "use_ssl", isset($_POST['use_ssl']) ? true : false);
if (module::get_var("aws_s3", "enabled") && !module::get_var("aws_s3", "synced", false)) {
site_status::warning(t('Your site has not yet been syncronised with your Amazon S3 bucket. Content will not appear correctly until you perform syncronisation. <a href="%url" class="g-dialog-link">Fix this now</a>', array("url" => html::mark_clean(url::site("admin/maintenance/start/aws_s3_task::sync?csrf=__CSRF__")))), "aws_s3_not_synced");
}
message::success(t("Settings have been saved"));
url::redirect("admin/aws_s3");
} else {
message::error(t("There was a problem with the submitted form. Please check your values and try again."));
}
}
$v = new Admin_View("admin.html");
$v->page_title = t("Amazon S3 Configuration");
$v->content = new View("admin_aws_s3.html");
$v->content->form = $form;
$v->content->end = "";
echo $v;
}
开发者ID:Retroguy,项目名称:gallery3-contrib,代码行数:31,代码来源:admin_aws_s3.php
示例3: uninstall
static function uninstall()
{
$db = Database::instance();
$db->query("DROP TABLE `search_records`");
site_status::clear("search_index_out_of_date");
module::delete("search");
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:7,代码来源:search_installer.php
示例4: confirm
public function confirm($hash)
{
$pending_user = ORM::factory("pending_user")->where("hash", "=", $hash)->where("state", "=", 0)->find();
if ($pending_user->loaded()) {
// @todo add a request date to the pending user table and check that it hasn't expired
$policy = module::get_var("registration", "policy");
$pending_user->state = 1;
$pending_user->save();
if ($policy == "vistor") {
$user = register::create_new_user($pending_user->id);
message::success(t("Your registration request has been approved"));
auth::login($user);
Session::instance()->set("registration_first_usage", true);
$pending_user->delete();
} else {
site_status::warning(t("There are pending user registration. <a href=\"%url\">Review now!</a>", array("url" => html::mark_clean(url::site("admin/register")), "locale" => module::get_var("gallery", "default_locale"))), "pending_user_registrations");
message::success(t("Your registration request is awaiting administrator approval"));
// added by Shad Laws, v2
if (module::get_var("registration", "admin_notify") == 1) {
register::send_admin_notify($pending_user);
}
}
} else {
message::error(t("Your registration request is no longer valid, Please re-register."));
}
url::redirect(item::root()->abs_url());
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:27,代码来源:register.php
示例5: saveprefs
public function saveprefs()
{
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Save Settings.
module::set_var("ratings", "showunderphoto", Input::instance()->post("showunderphoto"));
module::set_var("ratings", "showinsidebar", Input::instance()->post("showinsidebar"));
module::set_var("ratings", "imageword", Input::instance()->post("imageword"));
module::set_var("ratings", "votestring", Input::instance()->post("votestring"));
module::set_var("ratings", "castyourvotestring", Input::instance()->post("castyourvotestring"));
# module::set_var("ratings", "bgcolor", Input::instance()->post("bgcolor"));
module::set_var("ratings", "fillcolor", Input::instance()->post("fillcolor"));
module::set_var("ratings", "votedcolor", Input::instance()->post("votedcolor"));
module::set_var("ratings", "hovercolor", Input::instance()->post("hovercolor"));
module::set_var("ratings", "textcolor", Input::instance()->post("textcolor"));
module::set_var("ratings", "regonly", Input::instance()->post("regonly"));
$iconset = Input::instance()->post("iconset");
$iconset = preg_replace("/\\/index\\.php/", "", $iconset);
module::set_var("ratings", "iconset", $iconset);
message::success(t("Your Settings Have Been Saved."));
site_status::clear("ratings_configuration");
// Load Admin page.
$view = new Admin_View("admin.html");
$view->content = new View("admin_ratings.html");
$view->content->ratings_form = $this->_get_admin_form();
print $view;
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:27,代码来源:admin_ratings.php
示例6: update_index
static function update_index($task)
{
try {
$completed = $task->get("completed", 0);
$start = microtime(true);
foreach (ORM::factory("item")->join("exif_records", "items.id", "exif_records.item_id", "left")->where("type", "photo")->open_paren()->where("exif_records.item_id", null)->orwhere("exif_records.dirty", 1)->close_paren()->find_all() as $item) {
if (microtime(true) - $start > 1.5) {
break;
}
$completed++;
exif::extract($item);
}
list($remaining, $total, $percent) = exif::stats();
$task->set("completed", $completed);
if ($remaining == 0 || !($remaining + $completed)) {
$task->done = true;
$task->state = "success";
site_status::clear("exif_index_out_of_date");
$task->percent_complete = 100;
} else {
$task->percent_complete = round(100 * $completed / ($remaining + $completed));
}
$task->status = t2("one record updated, index is %percent% up-to-date", "%count records updated, index is %percent% up-to-date", $completed, array("percent" => $percent));
} catch (Exception $e) {
$task->done = true;
$task->state = "error";
$task->status = $e->getMessage();
$task->log($e->__toString());
}
}
开发者ID:shai,项目名称:gallery3,代码行数:30,代码来源:exif_task.php
示例7: update_index
static function update_index($task)
{
try {
$completed = $task->get("completed", 0);
$start = microtime(true);
foreach (ORM::factory("item")->join("exif_records", "items.id", "exif_records.item_id", "left")->where("type", "=", "photo")->and_open()->where("exif_records.item_id", "IS", null)->or_where("exif_records.dirty", "=", 1)->close()->find_all() as $item) {
// The query above can take a long time, so start the timer after its done
// to give ourselves a little time to actually process rows.
if (!isset($start)) {
$start = microtime(true);
}
exif::extract($item);
$completed++;
if (microtime(true) - $start > 1.5) {
break;
}
}
list($remaining, $total, $percent) = exif::stats();
$task->set("completed", $completed);
if ($remaining == 0 || !($remaining + $completed)) {
$task->done = true;
$task->state = "success";
site_status::clear("exif_index_out_of_date");
$task->percent_complete = 100;
} else {
$task->percent_complete = round(100 * $completed / ($remaining + $completed));
}
$task->status = t2("one record updated, index is %percent% up-to-date", "%count records updated, index is %percent% up-to-date", $completed, array("percent" => $percent));
} catch (Exception $e) {
$task->done = true;
$task->state = "error";
$task->status = $e->getMessage();
$task->log((string) $e);
}
}
开发者ID:andyst,项目名称:gallery3,代码行数:35,代码来源:exif_task.php
示例8: upgrade
static function upgrade($version)
{
log::info("aws_s3", "Commencing module upgrade (" . $version . ")");
switch ($version) {
case 0:
log::info("aws_s3", "Installing version 1");
@mkdir(VARPATH . "modules/aws_s3");
@mkdir(VARPATH . "modules/aws_s3/log");
// installation's unique identifier - allows multiple g3's pointing to the same s3 bucket.
if (!module::get_var("aws_s3", "g3id")) {
module::set_var("aws_s3", "g3id", md5(time()));
}
module::set_var("aws_s3", "synced", false);
module::set_var("aws_s3", "enabled", false);
module::set_var("aws_s3", "access_key", "");
module::set_var("aws_s3", "secret_key", "");
module::set_var("aws_s3", "bucket_name", "");
module::set_version("aws_s3", 1);
case 1:
log::info("aws_s3", "Upgrading to version 2");
$db = Database::instance();
$db->query("CREATE TABLE {aws_s3_meta} (\n `item_id` int(9) NOT NULL,\n `item_hash` varchar(32) NOT NULL DEFAULT '',\n `thumb_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `resize_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `fullsize_uploaded` smallint(1) NOT NULL DEFAULT 0,\n `local_deleted` smallint(1) NOT NULL DEFAULT 0,\n PRIMARY KEY (`item_id`)\n ) DEFAULT CHARSET=utf8;");
module::set_var("aws_s3", "upload_thumbs", true);
module::set_var("aws_s3", "upload_resizes", true);
module::set_var("aws_s3", "upload_fullsizes", true);
module::set_var("aws_s3", "s3_storage_only", false);
if (module::get_var("aws_s3", "synced")) {
// v1 has already synced this installation to s3. mark all the items with the relevant meta data
$items = ORM::factory("item")->find_all();
foreach ($items as $item) {
aws_s3::log("Updating S3 meta for item ID: " . $item->id);
$item->s3_thumb_uploaded = true;
if (!$item->is_album()) {
$item->s3_resize_uploaded = true;
$item->s3_fullsize_uploaded = true;
}
$item->s3_local_deleted = false;
$item->s3_item_hash = md5($item->relative_path());
$item->save_s3_meta();
}
} else {
// check various states after upgrade from v1..
if (module::get_var("aws_s3", "access_key") != "" && module::get_var("aws_s3", "secret_key") != "" && module::get_var("aws_s3", "bucket_name") != "" && aws_s3::validate_access_details(module::get_var("aws_s3", "access_key"), module::get_var("aws_s3", "secret_key"), module::get_var("aws_s3", "bucket_name"))) {
// details are correct but hasn't been synced.
if (aws_s3::can_schedule()) {
// i can schedule this task
aws_s3::schedule_full_sync2();
site_status::warning("Your site has been scheduled for full Amazon S3 re-synchronisation. This message will clear when this has been completed.", "aws_s3_not_synced");
} else {
// i CAN'T schedule it..
site_status::warning(t('Your site has not been synchronised to Amazon S3. Until it has, your server will continue to serve image content to your visitors.<br />Click <a href="%url" class="g-dialog-link">here</a> to start the synchronisation task.', array("url" => html::mark_clean(url::site("admin/maintenance/start/aws_s3_task::manual_sync?csrf=__CSRF__")))), "aws_s3_not_synced");
}
} else {
site_status::warning(t('Amazon S3 module needs configuration. Click <a href="%url">here</a> to go to the configuration page.', array("url" => html::mark_clean(url::site("admin/aws_s3")))), "aws_s3_not_configured");
}
}
module::set_version("aws_s3", 2);
}
log::info("aws_s3", "Module upgrade complete");
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:60,代码来源:aws_s3_installer.php
示例9: rebuild_dirty_images
/**
* Task that rebuilds all dirty images.
* @param Task_Model the task
*/
static function rebuild_dirty_images($task)
{
$result = graphics::find_dirty_images_query();
$remaining = $result->count();
$completed = $task->get("completed", 0);
$i = 0;
foreach ($result as $row) {
$item = ORM::factory("item", $row->id);
if ($item->loaded) {
graphics::generate($item);
}
$completed++;
$remaining--;
if (++$i == 2) {
break;
}
}
$task->status = t2("Updated: 1 image. Total: %total_count.", "Updated: %count images. Total: %total_count.", $completed, array("total_count" => $remaining + $completed));
if ($completed + $remaining > 0) {
$task->percent_complete = (int) (100 * $completed / ($completed + $remaining));
} else {
$task->percent_complete = 100;
}
$task->set("completed", $completed);
if ($remaining == 0) {
$task->done = true;
$task->state = "success";
site_status::clear("graphics_dirty");
}
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:34,代码来源:core_task.php
示例10: activate
public function activate()
{
access::verify_csrf();
$post = new Validation($_POST);
$post->add_rules("activate_users", "required");
$post->add_rules("activate", "alpha_numeric");
if ($post->validate()) {
$names = array();
if (!empty($post->activate)) {
foreach ($post->activate as $id) {
$user = register::create_new_user($id);
$names[] = $user->name;
}
message::success(t("Activated %users.", array("users" => implode(", ", $names))));
}
$count = ORM::factory("pending_user")->where("state", "!=", 2)->count_all();
if ($count == 0) {
site_status::clear("pending_user_registrations");
}
url::redirect("admin/register");
}
list($form, $errors) = $this->_get_form();
$form = array_merge($form, $post->as_array());
$errors = array_merge($errors, $post->errors());
print $this->_get_admin_view($form, $errors);
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:26,代码来源:admin_register.php
示例11: rebuild_dirty_images
/**
* Task that rebuilds all dirty images.
* @param Task_Model the task
*/
static function rebuild_dirty_images($task)
{
$errors = array();
try {
$result = graphics::find_dirty_images_query()->select("id")->execute();
$total_count = $task->get("total_count", $result->count());
$mode = $task->get("mode", "init");
if ($mode == "init") {
$task->set("total_count", $total_count);
$task->set("mode", "process");
batch::start();
}
$completed = $task->get("completed", 0);
$ignored = $task->get("ignored", array());
$i = 0;
foreach ($result as $row) {
if (array_key_exists($row->id, $ignored)) {
continue;
}
$item = ORM::factory("item", $row->id);
if ($item->loaded()) {
try {
graphics::generate($item);
$completed++;
$errors[] = t("Successfully rebuilt images for '%title'", array("title" => html::purify($item->title)));
} catch (Exception $e) {
$errors[] = t("Unable to rebuild images for '%title'", array("title" => html::purify($item->title)));
$errors[] = (string) $e;
$ignored[$item->id] = 1;
}
}
if (++$i == 2) {
break;
}
}
$task->status = t2("Updated: 1 image. Total: %total_count.", "Updated: %count images. Total: %total_count.", $completed, array("total_count" => $total_count));
if ($completed < $total_count) {
$task->percent_complete = (int) (100 * ($completed + count($ignored)) / $total_count);
} else {
$task->percent_complete = 100;
}
$task->set("completed", $completed);
$task->set("ignored", $ignored);
if ($task->percent_complete == 100) {
$task->done = true;
$task->state = "success";
batch::stop();
site_status::clear("graphics_dirty");
}
} catch (Exception $e) {
Kohana_Log::add("error", (string) $e);
$task->done = true;
$task->state = "error";
$task->status = $e->getMessage();
$errors[] = (string) $e;
}
if ($errors) {
$task->log($errors);
}
}
开发者ID:andyst,项目名称:gallery3,代码行数:64,代码来源:gallery_task.php
示例12: upgrade
static function upgrade($version)
{
if ($version < 4) {
// No longer necessary, make sure that it's cleared.
site_status::clear("organize_needs_rest");
module::set_version("organize", $version = 4);
}
}
开发者ID:HarriLu,项目名称:gallery3,代码行数:8,代码来源:organize_installer.php
示例13: module_change
static function module_change($changes)
{
if (!module::is_active("tag") || in_array("tag", $changes->deactivate)) {
site_status::warning(t("The DisplayTags module requires the Tags module. <a href=\"%url\">Activate the Tags module now</a>", array("url" => html::mark_clean(url::site("admin/modules")))), "displaytags_needs_tag");
} else {
site_status::clear("displaytags_needs_tag");
}
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:8,代码来源:displaytags_event.php
示例14: report_ppm_support
static function report_ppm_support($toolkit_id)
{
if (array_key_exists($toolkit_id, rawphoto_graphics::get_supported_toolkits())) {
site_status::clear("rawphoto_needs_ppm_support");
} else {
site_status::warning(t('The <em>Raw Photos</em> module requires a supporting graphics toolkit. ' . '<a href="%activate_url">Activate</a> either ImageMagick or GraphicsMagick.', array("activate_url" => url::site("admin/graphics"))), "rawphoto_needs_ppm_support");
}
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:8,代码来源:rawphoto_graphics.php
示例15: update_overlays
static function update_overlays($task)
{
$errors = array();
try {
$mode = $task->get('mode', 'init');
switch ($mode) {
case 'init':
$q = emboss::find_dirty();
foreach ($q as $item) {
$ids[] = array('id' => $item->id, 'image_id' => $item->image_id, 'overlay_id' => $item->best_overlay_id);
}
$count = count($ids);
if ($count > 0) {
$task->set('ids', $ids);
$task->set('count', $count);
$task->set('current', 0);
$task->set('mode', 'continue');
} else {
$task->done = true;
$task->state = 'success';
$task->percent_complete = 100;
site_status::clear('emboss_dirty');
return;
}
break;
case 'continue':
$ids = $task->get('ids');
$count = $task->get('count');
$current = $task->get('current');
break;
}
$i = 1 * $current;
$id = $ids[$i];
$current++;
$task->set('current', $current);
emboss_task::do_embossing($id['id'], $id['image_id'], $id['overlay_id']);
if ($current >= $count) {
$task->done = true;
$task->state = 'success';
$task->percent_complete = 100;
$task->status = 'Complete';
site_status::clear('emboss_dirty');
} else {
$task->percent_complete = $current / $count * 100;
$task->status = t("Reembossed {$current} of {$count} photos");
}
} catch (Exception $e) {
Kohana_Log::add('error', (string) $e);
$task->done = true;
$task->state = 'error';
$task->status = $e->getMessage();
$errors[] = (string) $e;
}
if ($errors) {
$task->log($errors);
}
}
开发者ID:webmatter,项目名称:gallery3-contrib,代码行数:57,代码来源:emboss_task.php
示例16: load_themes
/**
* Load the active theme. This is called at bootstrap time. We will only ever have one theme
* active for any given request.
*/
static function load_themes()
{
$input = Input::instance();
$path = $input->server("PATH_INFO");
if (empty($path)) {
$path = "/" . $input->get("kohana_uri");
}
$config = Kohana_Config::instance();
$modules = $config->get("core.modules");
// Normally Router::find_uri() strips off the url suffix for us, but we're working off of the
// PATH_INFO here so we need to strip it off manually
if ($suffix = Kohana::config("core.url_suffix")) {
$path = preg_replace("#" . preg_quote($suffix) . "\$#u", "", $path);
}
self::$is_admin = $path == "/admin" || !strncmp($path, "/admin/", 7);
self::$site_theme_name = module::get_var("gallery", "active_site_theme");
// If the site theme doesn't exist, fall back to wind.
if (!file_exists(THEMEPATH . self::$site_theme_name . "/theme.info")) {
site_status::error(t("Theme '%name' is missing. Falling back to the Wind theme.", array("name" => self::$site_theme_name)), "missing_site_theme");
module::set_var("gallery", "active_site_theme", self::$site_theme_name = "wind");
}
if (self::$is_admin) {
// Load the admin theme
self::$admin_theme_name = module::get_var("gallery", "active_admin_theme");
// If the admin theme doesn't exist, fall back to admin_wind.
if (!file_exists(THEMEPATH . self::$admin_theme_name . "/theme.info")) {
site_status::error(t("Admin theme '%name' is missing! Falling back to the Wind theme.", array("name" => self::$admin_theme_name)), "missing_admin_theme");
module::set_var("gallery", "active_admin_theme", self::$admin_theme_name = "admin_wind");
}
array_unshift($modules, THEMEPATH . self::$admin_theme_name);
// If the site theme has an admin subdir, load that as a module so that
// themes can provide their own code.
if (file_exists(THEMEPATH . self::$site_theme_name . "/admin")) {
array_unshift($modules, THEMEPATH . self::$site_theme_name . "/admin");
}
// Admins can override the site theme, temporarily. This lets us preview themes.
if (identity::active_user()->admin && ($override = $input->get("theme"))) {
if (file_exists(THEMEPATH . $override)) {
self::$admin_theme_name = $override;
array_unshift($modules, THEMEPATH . self::$admin_theme_name);
} else {
Kohana_Log::add("error", "Missing override admin theme: '{$override}'");
}
}
} else {
// Admins can override the site theme, temporarily. This lets us preview themes.
if (identity::active_user()->admin && ($override = $input->get("theme"))) {
if (file_exists(THEMEPATH . $override)) {
self::$site_theme_name = $override;
} else {
Kohana_Log::add("error", "Missing override site theme: '{$override}'");
}
}
array_unshift($modules, THEMEPATH . self::$site_theme_name);
}
$config->set("core.modules", $modules);
}
开发者ID:JasonWiki,项目名称:docs,代码行数:61,代码来源:theme.php
示例17: module_change
static function module_change($changes)
{
// Gallery version must be >= 32
if (module::get_version("gallery") < 32) {
site_status::warning(t("The module 'Module Order' requires Gallery core version of 32 or higher."), "moduleorder_needs_higherversion");
} else {
site_status::clear("moduleorder_needs_higherversion");
}
}
开发者ID:Glooper,项目名称:gallery3-contrib,代码行数:9,代码来源:moduleorder_event.php
示例18: module_change
static function module_change($changes)
{
// If EXIF is deactivated, display a warning that it is required for this module to function properly.
if (!module::is_active("exif") || in_array("exif", $changes->deactivate)) {
site_status::warning(t("The EXIF_GPS module requires the EXIF module. " . "<a href=\"%url\">Activate the EXIF module now</a>", array("url" => html::mark_clean(url::site("admin/modules")))), "exif_gps_needs_exif");
} else {
site_status::clear("exif_gps_needs_exif");
}
}
开发者ID:Weerwolf,项目名称:gallery3-contrib,代码行数:9,代码来源:exif_gps_event.php
示例19: module_change
static function module_change($changes)
{
// Display a warning message if the RSS module is not installed.
if (!module::is_active("rss") || in_array("rss", $changes->deactivate)) {
site_status::warning(t("The MiniSlide Show module requires the RSS module. " . "<a href=\"%url\">Activate the RSS module now</a>", array("url" => url::site("admin/modules"))), "minislideshow_needs_rss");
} else {
site_status::clear("minislideshow_needs_rss");
}
}
开发者ID:ChrisRut,项目名称:gallery3-contrib,代码行数:9,代码来源:minislideshow_event.php
示例20: check_config
static function check_config()
{
$public_key = module::get_var("recaptcha", "public_key");
$private_key = module::get_var("recaptcha", "private_key");
if (empty($public_key) || empty($private_key)) {
site_status::warning(t("reCAPTCHA is not quite ready! Please configure the <a href=\"%url\">reCAPTCHA Keys</a>", array("url" => html::mark_clean(url::site("admin/recaptcha")))), "recaptcha_config");
} else {
site_status::clear("recaptcha_config");
}
}
开发者ID:brocki,项目名称:gallery3,代码行数:10,代码来源:recaptcha.php
注:本文中的site_status类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论