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


PHP protect函数代码示例

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


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

示例1: nvweb_plugins_load

function nvweb_plugins_load()
{
    // load all webget plugins and exclude the DISABLED
    global $plugins;
    global $DB;
    global $website;
    $plugin_list = glob(NAVIGATE_PATH . '/plugins/*', GLOB_ONLYDIR);
    $plugins = array();
    if (is_array($plugin_list)) {
        // read the database to find the disabled plugins
        $DB->query('SELECT extension, enabled
                      FROM nv_extensions
                     WHERE website = ' . protect($website->id) . '
                       AND enabled = 0');
        $plugins_disabled = $DB->result('extension');
        foreach ($plugin_list as $plugin_path) {
            $plugin_name = basename($plugin_path);
            if (in_array($plugin_name, $plugins_disabled)) {
                continue;
            }
            if (file_exists($plugin_path . '/' . $plugin_name . '.php')) {
                @(include_once $plugin_path . '/' . $plugin_name . '.php');
            }
            $plugins[] = $plugin_name;
        }
    }
}
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:27,代码来源:nvweb_plugins.php

示例2: register

 public function register(Container $c)
 {
     $c['database.manager'] = protect(new Capsule());
     $capsule = $c['database.manager'];
     // Extract database settings from dsn
     if (!isset($_ENV['DATABASE_URL'])) {
         throw new Exception('You must provide a database DSN in the DATABASE_URL environment variable');
     }
     $db = array('charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => '');
     $db = array_merge($db, parse_url($_ENV['DATABASE_URL']));
     $db['driver'] = $db['scheme'] == 'postgres' ? 'pgsql' : $db['scheme'];
     $db['database'] = trim($db['path'], '/');
     $db['username'] = isset($db['user']) ? $db['user'] : '';
     $db['password'] = isset($db['pass']) ? $db['pass'] : '';
     $capsule->addConnection($db);
     $capsule->setAsGlobal();
     // Set the event dispatcher used by Eloquent models
     $capsule->setEventDispatcher(new IDispatcher(new IContainer()));
     // Set the cache manager instance used by connections... (optional)
     // No need for that now, let's keep it minimal
     //$capsule->setCacheManager(...);
     $capsule->bootEloquent();
     $c['db'] = function ($c) {
         return $c['database.manager']->getDatabaseManager();
     };
     \Illuminate\Support\Facades\Schema::setFacadeApplication($c);
 }
开发者ID:kiasaki,项目名称:vexillum,代码行数:27,代码来源:DatabaseProvider.php

示例3: lista

function lista($user)
{
    global $dateformat;
    $user = protect($user);
    requirelogin();
    $title = "Mensagens de {$user}";
    include "libs/accounts.php";
    // listar todas as mensagens de $user onde hidden = 'n' (para outro user ver)
    $output = menu($user) . url("message/send/{$user}", "[enviar mensagem]") . "<br>\n";
    $usr = resolveuser($user);
    $qry = mysql_query("SELECT `from`,`content`,`data` FROM messages WHERE `to`='{$usr}' AND `hidden`='n' ORDER BY id DESC LIMIT 30");
    if (mysql_numrows($qry) == 0) {
        $output .= 'Nenhuma mensagem!';
    } else {
        while ($row = mysql_fetch_array($qry)) {
            $user = mysql_query("SELECT login,foto FROM accounts WHERE id='{$row['from']}'");
            $user = mysql_fetch_array($user);
            $output .= '<p class="row">' . t("De") . ': ' . url("user/profile/{$user['login']}", $user['login']) . '<br/>';
            $output .= '<blockquote>
                 ' . bbcode($row['content']) . '
                  </blockquote>
                  <hr size="1"><i>' . date($dateformat, $row['data']) . '</i>
                  </p>';
        }
    }
    section($output, $title);
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:27,代码来源:message.php

示例4: nvweb_votes

function nvweb_votes($vars = array())
{
    global $website;
    global $DB;
    global $current;
    global $webuser;
    switch ($vars['mode']) {
        case 'score':
            $out = nvweb_votes_calc($current['object'], $vars['round'], $vars['half'], $vars['min'], $vars['max']);
            break;
        case 'votes':
            $out = $current['object']->votes;
            break;
        case 'webuser':
            $score = NULL;
            if (!empty($webuser->id)) {
                $score = $DB->query_single('value', 'nv_webuser_votes', ' website = ' . protect($website->id) . '
					  AND webuser = ' . protect($webuser->id) . '
					  AND object = ' . protect($current['type']) . '
					  AND object_id = ' . protect($current['id']));
            }
            $out = empty($score) ? '0' : $score;
            break;
    }
    return $out;
}
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:26,代码来源:votes.php

示例5: del

function del($id)
{
    onlyadmin();
    $id = protect($id);
    mysql_query("DELETE FROM shoutbox WHERE `id`='{$id}'");
    redir("shoutbox");
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:7,代码来源:shoutbox.php

示例6: testProtect

 public function testProtect()
 {
     $uniqueVar = '987654';
     $protectedValue = protect($uniqueVar);
     $this->assertTrue(is_callable($protectedValue));
     $this->assertEquals($uniqueVar, $protectedValue());
 }
开发者ID:kiasaki,项目名称:vexillum,代码行数:7,代码来源:FunctionsTest.php

示例7: setUpContainer

 protected function setUpContainer()
 {
     $this->container = new Container();
     $this->container['app'] = protect($this);
     $this->container['request'] = protect(new Request());
     $this->container['response'] = protect(new FakeResponseThatDoesNothing());
 }
开发者ID:kiasaki,项目名称:vexillum,代码行数:7,代码来源:ApplicationTest.php

示例8: deleteroom

function deleteroom($id)
{
    onlyadmin();
    $id = protect($id);
    mysql_query("DELETE FROM chat_rooms WHERE `id`='{$id}'");
    mysql_query("DELETE FROM chat WHERE `room`='{$id}'");
    redir("chat/admin");
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:8,代码来源:chat.php

示例9: remove

function remove($id)
{
    requirelogin();
    $id = protect($id);
    $owner = $_SESSION['id'];
    mysql_query("DELETE FROM videos WHERE `id`='{$id}' AND `owner`='{$owner}'");
    infobox("Vídeo excluído com sucesso!");
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:8,代码来源:videos.php

示例10: resolvegroup

function resolvegroup($group)
{
    $group = protect($group);
    $qry = mysql_query("SELECT * FROM groups WHERE `url`='{$group}'");
    if (mysql_numrows($qry) != 0) {
        return mysql_fetch_array($qry);
    } else {
        infobox(t("Grupo inexistente."), true, true);
    }
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:10,代码来源:funcs.php

示例11: __construct

 function __construct()
 {
     /* Prevent guests if the admin hasn't enabled public profiles. */
     if (!parent::getOption('profile-public-enable')) {
         protect('*');
     }
     /* If the admin requires users to update their password. */
     if (!empty($_SESSION['jigowatt']['forcePwUpdate'])) {
         $msg = "<div class='alert alert-warning'>" . _('<strong>Alert</strong>: The administrator has requested all users to update their passwords.') . "</div>";
     }
     // Save the username
     $this->username = !empty($_SESSION['jigowatt']['username']) ? $_SESSION['jigowatt']['username'] : _('Guest');
     $this->use_emails = parent::getOption('email-as-username-enable');
     $this->username_type = $this->use_emails ? 'email' : 'username';
     /* Check if the user is a guest to this profile. */
     $this->determineGuest();
     // Upload avatar
     if (!empty($_FILES['uploadAvatar'])) {
         $k = getimagesize($_FILES['uploadAvatar']['tmp_name']);
         if (empty($k)) {
             $this->error = sprintf('<div class="alert alert-warning">%s</div>', _('Sorry, that file is not accepted.'));
         } else {
             $uploaddir = dirname(dirname(__FILE__)) . '/assets/uploads/avatar/';
             $uploadfile = $uploaddir . md5($_SESSION['jigowatt']['user_id'] . $_SESSION['jigowatt']['email']) . '.' . pathinfo($_FILES['uploadAvatar']['name'], PATHINFO_EXTENSION);
             if (move_uploaded_file($_FILES['uploadAvatar']['tmp_name'], $uploadfile)) {
                 $this->error = sprintf('<div class="alert alert-success">%s</div>', _('Avatar change success!'));
                 $_SESSION['jigowatt']['gravatar'] = parent::get_gravatar($_SESSION['jigowatt']['email'], true, 26);
             } else {
                 $this->error = sprintf('<div class="alert alert-warning">%s</div>', _('Sorry, that file is not accepted.'));
             }
         }
     }
     if (!$this->guest && !empty($_POST)) {
         $this->retrieveFields();
         foreach ($_POST as $field => $value) {
             $this->settings[$field] = parent::secure($value);
         }
         // Validate fields
         $this->validate();
         // Process form
         if (empty($this->error)) {
             $this->process();
         }
     }
     $this->retrieveFields();
     if (!$this->guest && isset($_GET['key']) && strlen($_GET['key']) == 32) {
         $this->key = parent::secure($_GET['key']);
         $this->updateEmailorPw();
         $this->retrieveFields();
     }
     if (!empty($this->error) || !empty($msg)) {
         parent::displayMessage(!empty($this->error) ? $this->error : (!empty($msg) ? $msg : ''), false);
     }
 }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:54,代码来源:profile.class.php

示例12: remove

function remove($fid)
{
    requirelogin();
    $id = protect($fid);
    if (is_admin()) {
        mysql_query("DELETE FROM notes WHERE `id`='{$id}'");
    } else {
        $account = $_SESSION['id'];
        mysql_query("DELETE FROM notes WHERE `account`='{$account}' AND `id`='{$id}'");
    }
    redir("dashboard");
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:12,代码来源:dashboard.php

示例13: youtube

function youtube($videourl)
{
    $ret = array();
    $video = explode("=", $videourl);
    $video = $video[1];
    $video = explode("&", $video);
    $video = $video[0];
    $video = str_replace("?v=", null, $video);
    $ret['code'] = '<object width="320" height="180"><param name="movie" value="http://www.youtube.com/v/' . $video . '&amp;hl=pt_BR&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $video . '&amp;hl=pt_BR&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="180"></embed></object>';
    $meta = get_meta_tags($videourl);
    $ret['title'] = protect($meta['title']);
    $ret['desc'] = protect($meta['description']);
    return $ret;
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:14,代码来源:video.php

示例14: view

function view($id)
{
    global $site_id, $site, $url, $home;
    $id = protect($id);
    // não requer login (ou softwares não funcionarão)
    // id = md5 ( user_id . site_id )
    $qry = mysql_query("SELECT * FROM accounts");
    while ($row = mysql_fetch_array($qry)) {
        if (md5($row['id'] . $site_id) === $id) {
            $user = $row['id'];
            $usr_login = $row['login'];
            //break;
        }
    }
    if ($user) {
        echo '<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>' . $site['site_name'] . '</title>
    <link>' . $url . '</link>
    <description>' . t("Notificações de") . ' ' . $usr_login . '</description>
    ';
        $friends = mysql_query("SELECT `id1` FROM friends WHERE `id2`='{$user}'");
        if (mysql_numrows($friends) != 0) {
            while ($f = mysql_fetch_array($friends)) {
                $receive[] = $f['id1'];
            }
        }
        if (sizeof($receive) != 0) {
            $receive = implode(",", $receive);
            $qry = mysql_query("SELECT a.login AS login, n.content AS content, n.account AS id, n.id AS fid FROM notes n LEFT JOIN accounts a ON n.account=a.id WHERE n.account IN ({$receive}) ORDER BY n.id DESC LIMIT 30");
            if (mysql_numrows($qry) != 0) {
                while ($row = mysql_fetch_array($qry)) {
                    echo '<item>
                <title>' . $row['login'] . '</title>
                <link>' . $home . 'user/profile/' . $row['login'] . '</link>
                <description>' . $row['content'] . '</description>
                </item>';
                }
            }
        }
        echo '</channel>
</rss>';
    }
    die;
    // para não exibir front-end
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:47,代码来源:rss.php

示例15: load

 /**
  * Load the translations dictionary of the Navigate CMS interface
  *
  * @param string $code Language code (2 letters)
  */
 public function load($code = 'en')
 {
     global $DB;
     $DB->query('SELECT * FROM nv_languages WHERE code = ' . protect($code));
     $data = $DB->first();
     $this->id = $data->id;
     $this->code = $data->code;
     $this->name = $data->name;
     $this->file = $data->nv_dictionary;
     $this->lang = array();
     $xliff = simplexml_load_file(NAVIGATE_PATH . '/' . $this->file);
     if (empty($xliff)) {
         // just use the default language (English)
         return;
     }
     foreach ($xliff->file[0]->body[0]->{"trans-unit"} as $unit) {
         $lid = intval($unit->attributes()->id);
         $this->lang[$lid] = (string) $unit->target;
         $this->lang[$lid] = str_replace("\n", "", $this->lang[$lid]);
     }
 }
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:26,代码来源:language.class.php


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