本文整理汇总了PHP中set函数的典型用法代码示例。如果您正苦于以下问题:PHP set函数的具体用法?PHP set怎么用?PHP set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_qos_setting
function check_qos_setting($path)
{
$enable = query($path . "/device/qos/enable");
$auto = query($path . "/device/qos/autobandwidth");
if ($enable == "1") {
if ($auto == "0") {
if (isdigit(query($path . "/inf/bandwidth/upstream")) == "0" || query($path . "/inf/bandwidth/upstream") > 102400 || query($path . "/inf/bandwidth/upstream") < 1) {
set_result("FAILED", $path . "/inf/bandwidth/upstream", i18n("The input uplink speed is invalid."));
return "FAILED";
} else {
// Remove the leading zeros.
$upstream_dec = strtoul(query($path . "/inf/bandwidth/upstream"), 10);
set($path . "/inf/bandwidth/upstream", $upstream_dec);
}
} else {
set($path . "/device/qos/autobandwidth", "1");
}
$type = query($path . "/inf/bandwidth/type");
if ($type == "AUTO" || $type == "ADSL" || $type == "CABLE") {
} else {
set_result("FAILED", $path . "/inf/bandwidth/type", i18n("Unsupported Connection type be assigned."));
return "FAILED";
}
} else {
set($path . "/device/qos/enable", "0");
}
return "OK";
}
示例2: before
function before()
{
layout('layouts/default.html.php');
/*set('header', '
<a href="'.url_for().'">Home</a>
<a href="'.url_for('people').'">Personen</a>
<a href="'.url_for('roles').'">Rollen</a>
<a href="'.url_for('access').'">Zugriff</a>
<a href="'.url_for('servers').'">Server</a>
<a href="'.url_for('daemons').'">Daemons</a>
');*/
set('header', '
<img id="header_img" src="img/aclmodel.png" width="850" height="83" usemap="#head_nav" alt="header_navigation">
<map name="head_nav">
<area id="daemons_nav" shape="rect" href="' . url_for('daemons') . '" coords="682,7,781,28" alt="daemons">
<area id="servers_nav" shape="rect" href="' . url_for('servers') . '" coords="516,7,635,28" alt="servers">
<area id="access_nav" shape="rect" href="' . url_for('access') . '" coords="391,7,478,28" alt="access">
<area id="roles_nav" shape="rect" href="' . url_for('roles') . '" coords="239,7,340,28" alt="roles">
<area id="people_nav" shape="rect" href="' . url_for('people') . '" coords="74,7,193,28" alt="people">
<area id="clients_nav" shape="rect" href="' . url_for('clients') . '" coords="2,55,98,76" alt="clients">
<area id="people_roles_nav" shape="rect" href="' . url_for('people_roles') . '" coords="176,54,267,75" alt="people_roles">
<area id="ports_nav" shape="rect" href="' . url_for('ports') . '" coords="748,55,849,76" alt="ports">
</map>
');
set('footer', '© 2011 - Florian Staudacher (Frontend), Alexander Philipp Lintenhofer (Backend)');
}
示例3: login
public static function login()
{
set('service', self::name);
set('hint', 'Please enter your twitter handle');
set('prepend', '@');
return render('ask_username.php');
}
示例4: indexAction
public function indexAction()
{
// Display the send_us_a_file.html page if the "Send us a file" feature is on and the user is not logged in.
if (fz_config_get('app', 'send_us_a_file_feature') && false == $this->getUser()) {
set('start_from', Zend_Date::now()->get(Zend_Date::DATE_SHORT));
$maxUploadSize = min(Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('upload_max_filesize')), Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('post_max_size')));
set('max_upload_size', $maxUploadSize);
return html('send_us_a_file.html');
}
$this->secure();
$user = $this->getUser();
$freeSpaceLeft = max(0, Fz_Db::getTable('File')->getRemainingSpaceForUser($user));
$maxUploadSize = min(Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('upload_max_filesize')), Fz_Db::getTable('File')->shorthandSizeToBytes(ini_get('post_max_size')), $freeSpaceLeft);
$progressMonitor = fz_config_get('app', 'progress_monitor');
$progressMonitor = new $progressMonitor();
set('upload_id', md5(uniqid(mt_rand(), true)));
set('start_from', Zend_Date::now()->get(Zend_Date::DATE_SHORT));
set('refresh_rate', 1200);
set('files', Fz_Db::getTable('File')->findByOwnerOrderByUploadDateDesc($user));
set('use_progress_bar', $progressMonitor->isInstalled());
set('upload_id_name', $progressMonitor->getUploadIdName());
set('free_space_left', $freeSpaceLeft);
set('max_upload_size', $maxUploadSize);
set('sharing_destinations', fz_config_get('app', 'sharing_destinations', array()));
set('disk_usage', array('space' => '<b id="disk-usage-value">' . bytesToShorthand(Fz_Db::getTable('File')->getTotalDiskSpaceByUser($user)) . '</b>', 'quota' => fz_config_get('app', 'user_quota')));
return html('main/index.php');
}
示例5: index
function index()
{
modTitle('Planit | Recheche');
if (!isCO()) {
setAlert('Veuillez vous connecter pour faire une recherche', 'warning');
}
loadModel('villes');
$k['villes'] = getAllVille();
set($k);
if (!empty($_POST)) {
$ok = 0;
foreach ($_POST as $post) {
if (!empty($post)) {
$ok = 1;
break;
}
}
if ($ok) {
loadModel('recherche');
$v['result'] = search_result($_POST);
if (empty($v['result'])) {
setAlert('Aucun resultat trouve', 'warning');
}
set($v);
} else {
setAlert('Remplir au moins un champs', 'danger');
}
}
render();
}
示例6: __construct
public function __construct($_path, $_index, Theme $_theme, Controller $_controller)
{
# Set Properties
$this->path = $_path;
$this->index = $_index;
$this->theme = $_theme;
$this->controller = $_controller;
# Load plugin config
$this->config();
# API Init
$this->api();
# Setup Plugin
if (path_contains('ga/')) {
# Setup theme
$this->theme->use_theme(plugin_dir() . '/' . self::_NAMESPACE . '/ui');
# Setup Controller
$this->controller->use_controller(plugin_dir() . '/' . self::_NAMESPACE . '/controller');
# Set Request Variables
set('ga.request', $this->request());
}
# Create an authorisation link if
# the current user is not authorised
if ($this->active == false) {
set('ga.auth_link', $this->api->auth->buildAuthUrl());
}
}
示例7: set_profile
function set_profile($phy)
{
if ($_GLOBALS["1xenable"] == "1") {
//eap=%s\n
} else {
set($phy . "/authtype", toupper($_GLOBALS["auth"]));
set($phy . "/encrtype", toupper($_GLOBALS["encr"]));
set($phy . "/wps/configured", "1");
if ($_GLOBALS["auth"] != "open" && $_GLOBALS["auth"] != "shared") {
set($phy . "/nwkey/psk/key", $_GLOBALS["key"]);
} else {
if ($_GLOBALS["encr"] == "WEP") {
set($phy . "/nwkey/wep/key", $_GLOBALS["key"]);
set($phy . "/nwkey/wep/defkey", $_GLOBALS["keyindex"]);
$key_len = strlen($_GLOBALS["key"]);
if ($key_len == "5" || $key_len == "13") {
set($phy . "/nwkey/wep/ascii", "1");
} else {
set($phy . "/nwkey/wep/ascii", "0");
set($phy . "/nwkey/wep/ascii", "0");
}
}
}
}
}
示例8: view
function view($id)
{
//$v['new'] = getOneNew($id);
$v['new'] = ['id' => 1, 'title' => 'Ma super new', 'content' => 'Trop cool la vie'];
set($v);
render('view');
}
示例9: PHYINF_setup
function PHYINF_setup($uid, $type, $inf)
{
$path = XNODE_getpathbytarget("/runtime", "phyinf", "uid", $uid, 1);
set($path . "/valid", "1");
set($path . "/type", $type);
set($path . "/name", $inf);
setattr($path . "/mtu", "get", "ip -f link link show dev " . $inf . " | scut -p mtu");
setattr($path . "/macaddr", "get", "ip -f link addr show dev " . $inf . " | scut -p link/ether");
setattr($path . "/ipv6/link/ipaddr", "get", devipv6addr($inf, "link", 1));
setattr($path . "/ipv6/link/prefix", "get", devipv6addr($inf, "link", 2));
setattr($path . "/ipv6/global/ipaddr", "get", devipv6addr($inf, "global", 1));
setattr($path . "/ipv6/global/prefix", "get", devipv6addr($inf, "global", 2));
setattr($path . "/stats/rx/bytes", "get", "cat /sys/class/net/" . $inf . "/statistics/rx_bytes");
setattr($path . "/stats/rx/packets", "get", "cat /sys/class/net/" . $inf . "/statistics/rx_packets");
setattr($path . "/stats/rx/multicast", "get", "cat /sys/class/net/" . $inf . "/statistics/multicast");
setattr($path . "/stats/rx/error", "get", "cat /sys/class/net/" . $inf . "/statistics/rx_errors");
setattr($path . "/stats/rx/drop", "get", "cat /sys/class/net/" . $inf . "/statistics/rx_dropped");
setattr($path . "/stats/tx/bytes", "get", "cat /sys/class/net/" . $inf . "/statistics/tx_bytes");
setattr($path . "/stats/tx/packets", "get", "cat /sys/class/net/" . $inf . "/statistics/tx_packets");
setattr($path . "/stats/tx/collision", "get", "cat /sys/class/net/" . $inf . "/statistics/collisions");
setattr($path . "/stats/tx/error", "get", "cat /sys/class/net/" . $inf . "/statistics/tx_errors");
setattr($path . "/stats/tx/drop", "get", "cat /sys/class/net/" . $inf . "/statistics/tx_dropped");
setattr($path . "/stats/reset", "set", "/etc/scripts/resetstats.sh " . $inf);
return $path;
}
示例10: daemons_servers_delete
function daemons_servers_delete()
{
$cfg = $GLOBALS['cfg'];
$db = $GLOBALS['db'];
$server_id = intval(params('server_id'));
$daemon_id = intval(params('daemon_id'));
$arrService = $db->select("SELECT id\n FROM {$cfg['tblService']}\n WHERE server_id='{$server_id}'\n AND daemon_id='{$daemon_id}'");
if (!$arrService) {
halt(SERVER_ERROR);
return;
}
$id = $arrService[0]['id'];
$result = $db->delete("DELETE FROM {$cfg['tblService']}\n WHERE id='{$id}'\n LIMIT 1");
$resultForeign = $db->delete("DELETE FROM {$cfg['tblAccess']}\n WHERE dienst_id='{$id}'");
if (!$result || !$resultForeign) {
halt(SERVER_ERROR);
return;
}
set('server', array('id' => $server_id));
set('daemon', array('id' => $daemon_id));
if (isAjaxRequest()) {
return js('daemons_servers/delete.js.php', null);
} else {
halt(HTTP_NOT_IMPLEMENTED);
}
}
示例11: setup_mdns
function setup_mdns($uid, $port, $srvname, $srvcfg)
{
$dirty = 0;
$stsp = XNODE_getpathbytarget("/runtime/services/mdnsresponder", "server", "uid", $uid, 0);
if ($stsp == "") {
if ($port != "0") {
$dirty++;
$stsp = XNODE_getpathbytarget("/runtime/services/mdnsresponder", "server", "uid", $uid, 1);
set($stsp . "/srvname", $srvname);
set($stsp . "/port", $port);
set($stsp . "/srvcfg", $srvcfg);
}
} else {
if ($port == "0") {
$dirty++;
del($stsp);
} else {
if (query($stsp . "/srvname") != $srvname) {
$dirty++;
set($stsp . "/srvname", $srvname);
}
if (query($stsp . "/port") != $port) {
$dirty++;
set($stsp . "/port", $port);
}
if (query($stsp . "/srvcfg") != $srvcfg) {
$dirty++;
set($stsp . "/srvcfg", $srvcfg);
}
}
}
return $dirty;
}
示例12: fatlady_phyinf
function fatlady_phyinf($prefix, $inf)
{
/* Check the interface setting */
if (query($prefix . "/inf/uid") != $inf) {
/* internet error, no i18n(). */
set_result("FAILED", $prefix . "/inf/uid", "INF UID mismatch");
return;
}
/* Check PHYINF */
$phy = query($prefix . "/inf/phyinf");
$phyp = XNODE_getpathbytarget($prefix, "phyinf", "uid", $phy, 0);
if ($phy == "" || $phyp == "") {
/* internet error, no i18n(). */
set_result("FAILED", $prefix . "/inf/phyinf", "Invalid phyinf");
return;
}
/* Check MACADDR */
$macaddr = query($phyp . "/macaddr");
if ($macaddr != "" && PHYINF_validmacaddr($macaddr) != "1") {
set_result("FAILED", $phyp . "/macaddr", i18n("Invalid MAC address"));
return;
}
$type = query($phyp . "/type");
if ($type == "eth") {
$media = query($phyp . "/media/linktype");
if ($media != "" && $media != "AUTO" && $media != "1000F" && $media != "1000H" && $media != "100F" && $media != "100H" && $media != "10F" && $media != "10H") {
set_result("FAILED", $phyp . "/media/linktype", i18n("Invalid media type"));
return;
}
}
/* We only validate the 'macaddr' & 'media' here,
* so be sure to save 'macaddr' & 'media' only at 'setcfg' */
set($prefix . "/valid", 1);
set_result("OK", "", "");
}
示例13: count_with
static function count_with($number)
{
$counter = new Counter();
$count = $counter->count_with($number);
set('count', $count);
return html('index.html.php');
}
示例14: page_add_bookmark
function page_add_bookmark()
{
$form = new Zebra_Form('form');
$form->clientside_validation(array('close_tips' => true, 'on_ready' => false, 'disable_upload_validation' => true, 'scroll_to_error' => false, 'tips_position' => 'right', 'validate_on_the_fly' => true, 'validate_all' => true));
$form->add('label', 'label_url', 'url', 'URL');
$url = $form->add('text', 'url', 'http://');
$url->set_rule(array('required' => array('url_error', 'URL musí být vyplněno.'), 'url' => array(true, 'url_error', 'Pole musí obsahovat platné URL (včetně protokolu).')));
$form->add('label', 'label_title', 'title', 'Název stránky');
$title = $form->add('text', 'title', '');
$title->set_rule(array('required' => array('title_error', 'Název musí být vyplněn.')));
$form->add('submit', 'submitbtn', 'Přidat');
if ($form->validate()) {
$ok = model_add($_POST['url'], $_POST['title'], array());
if ($ok) {
flash('info', 'Záložka byla vytvořena');
} else {
flash('error', 'Záložku se nepodařilo vytvořit.');
}
redirect_to('/');
}
// set('form', $form->render('views/add_form.php', true));
set('form', $form->render('', true));
set('title', 'Nová záložka');
return html('add.html.php');
}
示例15: fatlady_dhcps
function fatlady_dhcps($prefix, $svc)
{
$service = cut($svc, 0, ".");
$version = scut($service, 0, "DHCPS");
XNODE_set_var("FATLADY_DHCPS_PATH", $prefix);
XNODE_set_var("SERVICE_NAME", $svc);
$b = "/htdocs/phplib/fatlady/DHCPS";
if ($version == 4) {
dophp("load", $b . "/dhcps4.php");
} else {
if ($version == 6) {
dophp("load", $b . "/dhcps6.php");
} else {
$_GLOBALS["FATLADY_result"] = "FAILED";
$_GLOBALS["FATLADY_node"] = "";
$_GLOBALS["FATLADY_message"] = "Unsupported DHCP service : " . $svc;
/* internal error, no i18n(). */
}
}
XNODE_del_var("FATLADY_DHCPS_PATH");
XNODE_del_var("SERVICE_NAME");
if ($_GLOBALS["FATLADY_result"] == "OK") {
set($prefix . "/valid", 1);
}
}