• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP is_true函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中is_true函数的典型用法代码示例。如果您正苦于以下问题:PHP is_true函数的具体用法?PHP is_true怎么用?PHP is_true使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: execute

 public function execute()
 {
     if (isset($_SERVER["hide_ss"]) == false) {
         $_SERVER["hide_ss"] = true;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST" && $_POST["submit_button"] == "hidess") {
         $_SERVER["hide_ss"] = is_true($_POST["hide_ss"]);
     }
     $this->output->add_css("banshee/filter.css");
     $filter = new filter($this->db, $this->output, $this->user);
     $filter->to_output($this->model->table, false);
     if (($count = $this->model->count_events($filter->webserver, $_SERVER["hide_ss"])) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $paging = new pagination($this->output, "events", $this->settings->event_page_size, $count);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $paging->reset();
     }
     if (($events = $this->model->get_events($paging->offset, $paging->size, $filter->webserver, $_SERVER["hide_ss"])) === false) {
         $this->output->add_tag("result", "Database error.");
         return;
     }
     $this->output->open_tag("events", array("hide_ss" => show_boolean($_SERVER["hide_ss"])));
     foreach ($events as $event) {
         $event["timestamp"] = date("j F Y, H:i:s", $event["timestamp"]);
         $event["event"] = $this->output->secure_string($event["event"], "_");
         $this->output->record($event, "event");
     }
     $paging->show_browse_links();
     $this->output->close_tag();
 }
开发者ID:Wabuo,项目名称:monitor,代码行数:32,代码来源:events.php


示例2: execute

 public function execute()
 {
     header("Status: 401");
     $this->output->description = "Login";
     $this->output->keywords = "login";
     $this->output->title = "Login";
     $this->output->add_javascript("banshee/login.js");
     $this->output->open_tag("login", array("password" => show_boolean(module_exists("password")), "register" => show_boolean(module_exists("register"))));
     $this->output->add_tag("url", $_SERVER["REQUEST_URI"]);
     if ($_SERVER["REQUEST_METHOD"] != "POST") {
         $this->output->add_tag("bind");
     } else {
         $this->output->add_tag("username", $_POST["username"]);
         if (is_true($_POST["bind_ip"])) {
             $this->output->add_tag("bind");
         }
     }
     $this->output->add_tag("remote_addr", $_SERVER["REMOTE_ADDR"]);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (strpos($_POST["username"], "'") !== false) {
             $this->output->add_message("Sorry, this application does not support SQL injection.");
             header("X-Hiawatha-Monitor: exploit_attempt");
         } else {
             $this->output->add_message("Login incorrect");
         }
     }
     $this->output->close_tag();
 }
开发者ID:shannara,项目名称:banshee,代码行数:28,代码来源:login.php


示例3: execute

 public function execute()
 {
     header("Status: 401");
     $this->output->description = "Login";
     $this->output->keywords = "login";
     $this->output->title = "Login";
     $this->output->add_javascript("banshee/" . PASSWORD_HASH . ".js");
     $this->output->add_javascript("banshee/login.js");
     $this->output->run_javascript("set_focus(); hash = window['" . PASSWORD_HASH . "'];");
     $this->output->open_tag("login");
     $this->output->add_tag("url", $_SERVER["REQUEST_URI"]);
     if ($_SERVER["REQUEST_METHOD"] != "POST") {
         $this->output->add_tag("bind");
     } else {
         $this->output->add_tag("username", $_POST["username"]);
         if (is_true($_POST["bind_ip"])) {
             $this->output->add_tag("bind");
         }
     }
     $this->output->add_tag("remote_addr", $_SERVER["REMOTE_ADDR"]);
     $this->output->add_tag("challenge", $_SESSION["challenge"]);
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (strpos($_POST["username"], "'") !== false) {
             $this->output->add_message("Sorry, this application does not support SQL injection.");
             header("X-Hiawatha-Monitor: exploit_attempt");
         } else {
             $this->output->add_message("Login incorrect");
         }
     }
     $this->output->close_tag();
 }
开发者ID:Wabuo,项目名称:monitor,代码行数:31,代码来源:login.php


示例4: execute

 public function execute()
 {
     if (($page = $this->model->get_page($this->page->url)) == false) {
         $this->output->add_tag("website_error", 500);
         return;
     }
     /* Page header
      */
     if (trim($page["description"]) != "") {
         $this->output->description = $page["description"];
     }
     if (trim($page["keywords"]) != "") {
         $this->output->keywords = $page["keywords"];
     }
     $this->output->title = $page["title"];
     if ($page["style"] != null) {
         $this->output->inline_css = $page["style"];
     }
     $this->output->language = $page["language"];
     $this->output->set_layout($page["layout"]);
     $this->output->allow_hiawatha_cache();
     /* Page content
      */
     $this->output->open_tag("page");
     $this->output->add_tag("title", $page["title"]);
     $page["content"] = $this->output->secure_string($page["content"]);
     $this->output->add_tag("content", $page["content"]);
     if (is_true($page["back"])) {
         $parts = explode("/", $this->page->page);
         array_pop($parts);
         $this->output->add_tag("back", implode("/", $parts));
     }
     $this->output->close_tag();
 }
开发者ID:shannara,项目名称:banshee,代码行数:34,代码来源:page.php


示例5: fire

 public function fire()
 {
     $options = $this->option();
     $this->seed_path = storage_path('seeder');
     Asset::setFromSeed(true);
     // -------------------------------------
     if (is_true($options['reset'])) {
         if (Config::getEnvironment() == 'production') {
             $really = $this->confirm('This is the *** PRODUCTION *** server are you sure!? [yes|no]');
             if (!$really) {
                 $this->info("**** Exiting ****");
                 exit;
             }
         }
         if (!File::exists($this->seed_path)) {
             File::makeDirectory($this->seed_path);
             $n = 50;
             for ($i = 1; $i <= $n; $i++) {
                 $gender_types = ['men', 'women'];
                 foreach ($gender_types as $gender) {
                     $user_photo_url = "http://api.randomuser.me/portraits/{$gender}/{$i}.jpg";
                     File::put($this->seed_path . "/{$gender}_{$i}.jpg", file_get_contents($user_photo_url));
                 }
                 $this->info("Cache user seed image - {$i}");
             }
         }
         if ($this->confirm('Do you really want to delete the tables? [yes|no]')) {
             // first delete all assets
             if (Schema::hasTable('assets')) {
                 foreach (Asset::all() as $asset) {
                     $asset->delete();
                 }
             }
             $name = $this->call('migrate');
             $name = $this->call('migrate:reset');
             File::deleteDirectory(public_path('assets/content/users'));
             $this->info('--- Halp has been reset ---');
         }
         Auth::logout();
         $this->setupDatabases();
         return;
     }
     // -------------------------------------
     if (is_true($options['setup'])) {
         $this->setupDatabases();
     }
     // -------------------------------------
     if ($options['seed'] == 'all') {
         $this->seed();
     }
     if ($options['seed'] == 'users') {
         $this->seedUsers();
     }
     if ($options['seed'] == 'tasks') {
         $this->seedTasks();
     }
     if ($options['seed'] == 'projects') {
         $this->seedProjects();
     }
 }
开发者ID:vanderlin,项目名称:halp,代码行数:60,代码来源:SetupSite.php


示例6: fire

 public function fire()
 {
     $options = $this->option();
     $users = User::all();
     $this->repository = new AwardsRepository();
     $this->repository->setListener($this);
     $this->comment("// -------------------------------------");
     $this->comment("           Individual Awards            ");
     $this->comment("// -------------------------------------");
     // user based awards
     foreach ($users as $user) {
         $this->info("Checking awards for: " . $user->getName());
         $this->info($this->repository->checkAwardForUser($user));
     }
     $this->comment("// -------------------------------------");
     $this->comment("             Site Wide Awards           ");
     $this->comment("// -------------------------------------");
     // site wide awards - time based
     if (is_true($options['full'])) {
         $start = Task::orderBy('created_at')->first()->created_at;
         $end = Carbon::now();
         $date = clone $start;
         for ($i = $start->weekOfYear; $i <= $end->weekOfYear; $i++) {
             $this->info("Checking for week of " . $date->toDateString());
             $this->info($this->repository->checkForAwards($date));
             $date->addWeek();
         }
     } else {
         $this->info($this->repository->checkForAwards());
     }
 }
开发者ID:vanderlin,项目名称:halp,代码行数:31,代码来源:AwardsCommand.php


示例7: execute

 public function execute()
 {
     if ($this->user->logged_in == false) {
         unset($this->sections["mail"]);
     }
     if (isset($_SESSION["search"]) == false) {
         $_SESSION["search"] = array();
         foreach ($this->sections as $section => $label) {
             $_SESSION["search"][$section] = true;
         }
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $this->log_search_query($_POST["query"]);
         foreach ($this->sections as $section => $label) {
             $_SESSION["search"][$section] = is_true($_POST[$section]);
         }
     }
     $this->output->add_css("banshee/js_pagination.css");
     $this->output->add_javascript("banshee/pagination.js");
     $this->output->add_javascript("search.js");
     $this->output->run_javascript("document.getElementById('query').focus()");
     $this->output->add_tag("query", $_POST["query"]);
     $this->output->open_tag("sections");
     foreach ($this->sections as $section => $label) {
         $params = array("label" => $label, "checked" => show_boolean($_SESSION["search"][$section]));
         $this->output->add_tag("section", $section, $params);
     }
     $this->output->close_tag();
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (strlen(trim($_POST["query"])) < 3) {
             $this->output->add_tag("result", "Search query too short.");
         } else {
             if (($result = $this->model->search($_POST, $this->sections)) === false) {
                 /* Error
                  */
                 $this->output->add_tag("result", "Search error.");
             } else {
                 if (count($result) == 0) {
                     $this->output->add_tag("result", "No matches found.");
                 } else {
                     /* Results
                      */
                     foreach ($result as $section => $hits) {
                         $this->output->open_tag("section", array("section" => $section, "label" => $this->sections[$section]));
                         foreach ($hits as $hit) {
                             $hit["text"] = strip_tags($hit["text"]);
                             $hit["content"] = strip_tags($hit["content"]);
                             $hit["content"] = preg_replace('/\\[.*?\\]/', "", $hit["content"]);
                             $hit["content"] = truncate_text($hit["content"], 400);
                             $this->output->record($hit, "hit");
                         }
                         $this->output->close_tag();
                     }
                 }
             }
         }
     }
 }
开发者ID:shannara,项目名称:banshee,代码行数:58,代码来源:search.php


示例8: is_boolean

function is_boolean()
{
    $params = func_get_args();
    $count = func_num_args();
    $value = null;
    if (_get_value($params, $count, $value)) {
        if (!is_true($value) && !is_false($value)) {
            return false;
        }
        return true;
    }
    return false;
}
开发者ID:spd010273,项目名称:rms,代码行数:13,代码来源:validate_lib.php


示例9: update_profile

 public function update_profile($profile)
 {
     $profile["status"] = USER_STATUS_ACTIVE;
     $keys = array("email", "notification_key", "notification_method", "daily_report");
     if ($profile["password"] != "") {
         array_push($keys, "password");
         array_push($keys, "status");
         if (is_false($profile["password_hashed"])) {
             $profile["password"] = hash(PASSWORD_HASH, $profile["password"] . hash(PASSWORD_HASH, $this->user->username));
         }
     }
     $profile["daily_report"] = is_true($profile["daily_report"]) ? YES : NO;
     return $this->db->update("users", $this->user->id, $profile, $keys) !== false;
 }
开发者ID:Wabuo,项目名称:monitor,代码行数:14,代码来源:profile.php


示例10: __construct

 public function __construct($db, $settings, $user)
 {
     $this->db = $db;
     $this->settings = $settings;
     $this->user = $user;
     /* AJAX request
      */
     if ($_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest" || $_GET["output"] == "ajax") {
         $this->ajax_request = true;
     }
     /* Select module
      */
     if (is_true(ENFORCE_HTTPS) && $_SERVER["HTTPS"] != "on") {
         header(sprintf("Location: https://%s%s", $_SERVER["HTTP_HOST"], $_SERVER["REQUEST_URI"]));
         header("Strict-Transport-Security: max-age=31536000");
         $this->module = ERROR_MODULE;
         $this->http_code = 301;
     } else {
         if (is_false(WEBSITE_ONLINE) && $_SERVER["REMOTE_ADDR"] != WEBSITE_ONLINE) {
             $this->module = "banshee/offline";
         } else {
             if ($this->db->connected == false) {
                 if (module_exists("setup") && is_true(DEBUG_MODE)) {
                     $this->module = "setup";
                 } else {
                     $this->module = ERROR_MODULE;
                     $this->http_code = 500;
                 }
             } else {
                 list($this->url) = explode("?", $_SERVER["REQUEST_URI"], 2);
                 $path = trim($this->url, "/");
                 if ($path == "") {
                     $page = $this->settings->start_page;
                 } else {
                     if (valid_input($path, VALIDATE_URL, VALIDATE_NONEMPTY)) {
                         $page = $path;
                     } else {
                         $this->module = ERROR_MODULE;
                         $this->http_code = 404;
                     }
                 }
                 $this->pathinfo = explode("/", $page);
             }
         }
     }
     if ($this->module === null) {
         $this->select_module($page);
     }
 }
开发者ID:shannara,项目名称:banshee,代码行数:49,代码来源:page.php


示例11: show_item_form

 protected function show_item_form($item)
 {
     if (is_true(DEBUG_MODE) == false && isset($item["id"])) {
         if (($current = $this->model->get_item($item["id"])) === false) {
             $this->output->add_tag("result", "Database error.");
             return false;
         }
         $this->output->add_javascript("cms/settings.js");
         $this->output->open_tag("label");
         $this->output->add_tag("key", $current["key"]);
         $this->output->add_tag("type", $current["type"]);
         $this->output->close_tag();
     }
     parent::show_item_form($item);
 }
开发者ID:shannara,项目名称:banshee,代码行数:15,代码来源:settings.php


示例12: execute

 public function execute()
 {
     $menu = array("Authentication & authorization" => array("Users" => array("cms/user", "users.png"), "Roles" => array("cms/role", "roles.png"), "Organisations" => array("cms/organisation", "organisations.png"), "Access" => array("cms/access", "access.png"), "Flags" => array("cms/flag", "flags.png"), "User switch" => array("cms/switch", "switch.png")), "Content" => array("Agenda" => array("cms/agenda", "agenda.png"), "Dictionary" => array("cms/dictionary", "dictionary.png"), "F.A.Q." => array("cms/faq", "faq.png"), "Files" => array("cms/file", "file.png"), "Forum" => array("cms/forum", "forum.png"), "Guestbook" => array("cms/guestbook", "guestbook.png"), "Languages" => array("cms/language", "language.png"), "Links" => array("cms/links", "links.png"), "Menu" => array("cms/menu", "menu.png"), "News" => array("cms/news", "news.png"), "Pages" => array("cms/page", "page.png"), "Polls" => array("cms/poll", "poll.png"), "Weblog" => array("cms/weblog", "weblog.png")), "Photo album" => array("Albums" => array("cms/album", "album.png"), "Collections" => array("cms/collection", "collection.png"), "Photos" => array("cms/photo", "photo.png")), "Newsletter" => array("Newsletter" => array("cms/newsletter", "newsletter.png"), "Subscriptions" => array("cms/subscriptions", "subscriptions.png")), "System" => array("Logging" => array("cms/logging", "logging.png"), "Action log" => array("cms/action", "action.png"), "Settings" => array("cms/settings", "settings.png"), "API test" => array("cms/apitest", "apitest.png")));
     /* Show warnings
      */
     if ($this->user->is_admin) {
         if (module_exists("setup")) {
             $this->output->add_system_warning("The setup module is still available. Remove it from settings/public_modules.conf.");
         }
         if ($this->user->id == 1 && $this->user->password == "c10b391ff5e75af6ee8469539e6a5428f09eff7e693d6a8c4de0e5525cd9b287") {
             $this->output->add_system_warning("Don't forget to change the password of the admin account!");
         }
         if ($this->settings->secret_website_code == "CHANGE_ME_INTO_A_RANDOM_STRING") {
             $this->output->add_system_warning("Don't forget to change the secret_website_code setting.");
         }
         if (is_true(DEBUG_MODE)) {
             $this->output->add_system_warning("Website is running in debug mode. Set DEBUG_MODE in settings/website.conf to 'no'.");
         }
     }
     if ($this->page->pathinfo[1] != null) {
         $this->output->add_system_warning("The administration module '%s' does not exist.", $this->page->pathinfo[1]);
     }
     /* Show icons
      */
     if (is_false(MULTILINGUAL)) {
         unset($menu["Content"]["Languages"]);
     }
     $access_list = page_access_list($this->db, $this->user);
     $private_modules = config_file("private_modules");
     $this->output->open_tag("menu");
     foreach ($menu as $text => $section) {
         $this->output->open_tag("section", array("text" => $text, "class" => strtr(strtolower($text), " &", "__")));
         foreach ($section as $text => $info) {
             list($module, $icon) = $info;
             if (in_array($module, $private_modules) == false) {
                 continue;
             }
             if (isset($access_list[$module])) {
                 $access = $access_list[$module] > 0;
             } else {
                 $access = true;
             }
             $this->output->add_tag("entry", $module, array("text" => $text, "access" => show_boolean($access), "icon" => $icon));
         }
         $this->output->close_tag();
     }
     $this->output->close_tag();
 }
开发者ID:shannara,项目名称:banshee,代码行数:48,代码来源:cms.php


示例13: fire

 public function fire()
 {
     $options = $this->option();
     $debug = is_true($options['debug']);
     if ($options['job'] == 'expired_tasks') {
         $this->info("Looking for expired tasks...");
         $tasks = Task::unClaimed()->get()->filter(function ($task) {
             if ($task->notifications()->forEvent(Notification::NOTIFICATION_TASK_EXPIRED)->get()->count() == 0 && $task->isExpired()) {
                 return $task;
             }
         });
         foreach ($tasks as $task) {
             $ago = $task->date->diffForHumans();
             $this->info("({$task->id}) {$task->title} Expired - {$ago}");
             $n = $task->notifications()->forEvent(Notification::NOTIFICATION_TASK_EXPIRED)->get()->count();
             if ($n == 0) {
                 Notification::fire($task, Notification::NOTIFICATION_TASK_EXPIRED);
                 $this->info("\tNotification Created " . $task->id);
             } else {
                 $this->info("*** Notification not sent");
             }
         }
         if ($tasks->count() == 0) {
             $this->info("*** No expired tasks found ***");
         }
         return;
     }
     if ($options['job'] == 'notifications') {
         // first get all users that want to receive notifications
         $users = User::where('notifications', '=', 1)->get();
         // get all notifications that have not been sent out
         $notifications = Notification::whereNull('sent_at')->get();
         if ($notifications->count() == 0) {
             $this->info("*** No New Notification ***");
             return;
         }
         $results = [];
         foreach ($notifications as $notice) {
             $this->info("Notification: " . $notice->getTitle() . " : " . $notice->event);
             $status = $notice->send($debug);
             $this->info("\t status: " . strbool($status));
         }
         return $results;
     }
 }
开发者ID:vanderlin,项目名称:halp,代码行数:45,代码来源:CronCommand.php


示例14: execute

 public function execute()
 {
     $menu = array("Authentication, authorization & system" => array("Users" => array("cms/user", "users.png"), "Roles" => array("cms/role", "roles.png"), "Organisations" => array("cms/organisation", "organisations.png"), "Access" => array("cms/access", "access.png"), "User switch" => array("cms/switch", "switch.png"), "Action log" => array("cms/action", "action.png"), "Settings" => array("cms/settings", "settings.png")), "Content" => array("Files" => array("cms/file", "file.png"), "Hostnames" => array("cms/hostname", "hostname.gif"), "Menu" => array("cms/menu", "menu.png"), "Pages" => array("cms/page", "page.png"), "Webservers" => array("cms/webserver", "webserver.png")));
     /* Show warnings
      */
     if ($this->user->is_admin) {
         if ($this->user->id == 1 && $this->user->password == "610706e9a48f85476e04d270bd6dc7492cdcd9ad7e91878007dff629ab11f195") {
             $this->output->add_system_warning("Don't forget to change the password of the admin account!");
         }
         if ($this->settings->secret_website_code == "CHANGE_ME_INTO_A_RANDOM_STRING") {
             $this->output->add_system_warning("Don't forget to change the secret_website_code setting.");
         }
         if (is_true(DEBUG_MODE)) {
             $this->output->add_system_warning("Website is running in debug mode. Set DEBUG_MODE in settings/website.conf to 'no'.");
         }
     }
     if ($this->page->pathinfo[1] != null) {
         $this->output->add_system_warning("The administration module '%s' does not exist.", $this->page->pathinfo[1]);
     }
     /* Show icons
      */
     if (is_false(MULTILINGUAL)) {
         unset($menu["Content"]["Languages"]);
     }
     $access_list = page_access_list($this->db, $this->user);
     $private_pages = config_file("private_pages");
     $this->output->open_tag("menu");
     foreach ($menu as $text => $section) {
         $this->output->open_tag("section", array("text" => $text, "class" => strtr(strtolower($text), " &", "__")));
         foreach ($section as $text => $info) {
             list($page, $icon) = $info;
             if (in_array($page, $private_pages) == false) {
                 continue;
             }
             if (isset($access_list[$page])) {
                 $access = $access_list[$page] > 0;
             } else {
                 $access = true;
             }
             $this->output->add_tag("entry", $page, array("text" => $text, "access" => show_boolean($access), "icon" => $icon));
         }
         $this->output->close_tag();
     }
     $this->output->close_tag();
 }
开发者ID:Wabuo,项目名称:monitor,代码行数:45,代码来源:cms.php


示例15: __get

 public function __get($key)
 {
     if ($this->valid_key($key) == false) {
         return null;
     }
     if (isset($this->cache[$key])) {
         return $this->cache[$key];
     }
     if ($this->db === null) {
         return null;
     } else {
         if ($this->db->connected == false) {
             return null;
         }
     }
     $query = "select * from settings where %S=%s";
     if (($setting = $this->db->execute($query, "key", $key)) === false) {
         return null;
     } else {
         if (count($setting) == 0) {
             printf("Unknown setting: %s\n", $key);
             return null;
         }
     }
     $value = $setting[0]["value"];
     switch ($setting[0]["type"]) {
         case "boolean":
             $value = is_true($value);
             break;
         case "float":
             $value = (double) $value;
             break;
         case "integer":
             $value = (int) $value;
             break;
     }
     $this->cache[$key] = $value;
     return $value;
 }
开发者ID:shannara,项目名称:banshee,代码行数:39,代码来源:settings.php


示例16: update_weblog

 public function update_weblog($weblog)
 {
     if ($this->get_weblog($weblog["id"]) == false) {
         return false;
     }
     $keys = array("title", "content", "visible");
     $weblog["visible"] = is_true($weblog["visible"]) ? YES : NO;
     if ($this->db->query("begin") === false) {
         return false;
     } else {
         if ($this->db->update("weblogs", $weblog["id"], $weblog, $keys) === false) {
             $this->db->query("rollback");
             return false;
         } else {
             if ($this->handle_tags($weblog["id"], $weblog) == false) {
                 $this->db->query("rollback");
                 return false;
             }
         }
     }
     /* Delete comments
      */
     if (is_array($weblog["comment"])) {
         foreach ($weblog["comment"] as $comment_id) {
             if ($this->db->delete("weblog_comments", $comment_id) === false) {
                 $this->db->query("rollback");
                 return false;
             }
         }
     }
     return $this->db->query("commit") != false;
 }
开发者ID:shannara,项目名称:banshee,代码行数:32,代码来源:weblog.php


示例17: add_search_filter

 protected function add_search_filter(&$query, &$args, $search)
 {
     $filter = array();
     foreach ($this->elements as $key => $element) {
         switch ($element["type"]) {
             case "boolean":
                 if (in_array(strtolower($search), array("yes", "no"))) {
                     array_push($filter, "%S=%d");
                     array_push($args, $key, is_true($search) ? YES : NO);
                 }
                 break;
             case "date":
                 array_push($filter, "DATE_FORMAT(%S.%S, %s) like %s");
                 array_push($args, $this->table, $key, "%W %d %M %Y", "%" . $search . "%");
                 break;
             case "foreignkey":
                 if (is_array($element["column"]) == false) {
                     array_push($filter, "%S.%S like %s");
                     array_push($args, $element["table"], $element["column"], "%" . $search . "%");
                 } else {
                     $concat = array();
                     foreach ($element["column"] as $column) {
                         array_push($concat, "%S.%S");
                         array_push($args, $element["table"], $column);
                     }
                     array_push($filter, "concat(" . implode(", ", $concat) . ") like %s");
                     array_push($args, "%" . $search . "%");
                 }
                 break;
             case "timestamp":
                 array_push($filter, "DATE_FORMAT(%S.%S, %s) like %s");
                 array_push($args, $this->table, $key, "%W %d %M %Y %T", "%" . $search . "%");
                 break;
             default:
                 array_push($filter, "%S.%S like %s");
                 array_push($args, $this->table, $key, "%" . $search . "%");
         }
     }
     $query .= " (" . implode(" or ", $filter) . ")";
 }
开发者ID:shannara,项目名称:banshee,代码行数:40,代码来源:tablemanager_model.php


示例18: update_user

 public function update_user($user)
 {
     $keys = array("username", "fullname", "email", "cert_serial", "daily_report");
     if ($user["password"] != "") {
         array_push($keys, "password");
     }
     if ($this->user->is_admin) {
         array_push($keys, "organisation_id");
     }
     if (is_array($user["roles"]) == false) {
         $user["roles"] = array();
     }
     if ($this->user->id != $user["id"]) {
         array_push($keys, "status");
     } else {
         if (($current = $this->get_user($user["id"])) == false) {
             return false;
         } else {
             if (in_array(ADMIN_ROLE_ID, $current["roles"]) && in_array(ADMIN_ROLE_ID, $user["roles"]) == false) {
                 array_unshift($user["roles"], ADMIN_ROLE_ID);
             }
         }
     }
     if ($user["cert_serial"] == "") {
         $user["cert_serial"] = null;
     }
     $user["daily_report"] = is_true($user["daily_report"]) ? YES : NO;
     if ($this->db->query("begin") == false) {
         return false;
     }
     if ($this->db->update("users", $user["id"], $user, $keys) === false) {
         $this->db->query("rollback");
         return false;
     }
     if ($this->assign_roles_to_user($user) == false) {
         $this->db->query("rollback");
         return false;
     }
     if ($this->assign_webservers_to_user($user) === false) {
         $this->db->query("rollback");
         return false;
     }
     return $this->db->query("commit") != false;
 }
开发者ID:Wabuo,项目名称:monitor,代码行数:44,代码来源:user.php


示例19: update_webserver

 public function update_webserver($webserver)
 {
     $keys = array("name", "ip_address", "port", "tls", "active");
     $webserver["tls"] = is_true($webserver["tls"]) ? YES : NO;
     $webserver["active"] = is_true($webserver["active"]) ? YES : NO;
     if ($this->db->query("begin") === false) {
         return false;
     }
     if ($this->db->update("webservers", $webserver["id"], $webserver, $keys) === false) {
         $this->db->query("rollback");
         return false;
     }
     if ($this->assign_users_to_webserver($webserver) == false) {
         $this->db->query("rollback");
         return false;
     }
     return $this->db->query("commit") !== false;
 }
开发者ID:Wabuo,项目名称:monitor,代码行数:18,代码来源:webserver.php


示例20: NOT_TRUE

 protected static function NOT_TRUE($var1)
 {
     return !is_true($var1) ? true : false;
 }
开发者ID:aidenfoxx,项目名称:foxxmvc,代码行数:4,代码来源:validation.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP is_true_val函数代码示例发布时间:2022-05-15
下一篇:
PHP is_trackback函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap