本文整理汇总了PHP中permitted函数的典型用法代码示例。如果您正苦于以下问题:PHP permitted函数的具体用法?PHP permitted怎么用?PHP permitted使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了permitted函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: trigger_liveports
function trigger_liveports()
{
$breed = detectDeviceBreed(getBypassValue());
foreach (array('getportstatus', 'getmaclist') as $command) {
if (validBreedFunction($breed, $command) and permitted(NULL, 'liveports', $command)) {
return 'std';
}
}
return '';
}
开发者ID:rhysm,项目名称:racktables,代码行数:10,代码来源:triggers.php
示例2: renderConfigMainpage
function renderConfigMainpage()
{
global $pageno, $page;
echo '<ul>';
foreach ($page as $cpageno => $cpage) {
if (isset($cpage['parent']) and $cpage['parent'] == $pageno && permitted($cpageno)) {
echo "<li><a href='index.php?page={$cpageno}'>" . $cpage['title'] . "</li>\n";
}
}
echo '</ul>';
}
开发者ID:spartak-radchenko,项目名称:racktables,代码行数:11,代码来源:interface-config.php
示例3: must_allow
/**
* Checks current user's permissions against the given action, exiting if user
* isn't allowed to perform the given action
*/
function must_allow($action)
{
// Tell the renderer we've checked auth
global $renderer;
$renderer->authorize();
// Special case to allow for fully public pages
if ($action == NULL) {
return;
}
if (!permitted(get_user(), $action)) {
header("HTTP/1.0 403 Forbidden");
$renderer->render("forbidden");
exit;
}
}
开发者ID:uoregon-libraries,项目名称:pdf-to-chronam-admin,代码行数:19,代码来源:root.php
示例4: renderInterfacesStats
function renderInterfacesStats($object_id)
{
global $nextorder;
global $port_use_age;
addCSS("/* Live Interfaces */\n\t\t.text_green { color: #00cc00; }\n\t\t.text_yellow { color: #ff9900; }\n\t\t.text_red { color: #ff0000; }", TRUE);
startPortlet('Interfaces statistics');
//get data: show version
try {
$uptime = queryDevice($object_id, 'getuptime');
} catch (RackTablesError $e) {
}
echo "<table width='100%'><tr>";
if (permitted(NULL, NULL, 'get_link_status')) {
//get data: show interfaces
try {
$interfaces = queryDevice($object_id, 'getinterfaces');
} catch (RackTablesError $e) {
}
if (!empty($interfaces)) {
$last_reboot = time_convert($uptime);
echo "<td";
echo $last_reboot < $port_use_age ? " class='text_red'>" : $last_reboot > 262080 ? " class='text_green'>" : ">";
echo $uptime . "</tr>";
echo "<table width='80%' class='widetable' cellspacing=0 cellpadding='5px' align='center'><tr><th>Port<th>Link status<th>Last input<th>Last clear<th>Input packets<th>Output packets<th>Description</tr>";
$order = 'even';
foreach ($interfaces as $pn => $int) {
echo "<tr class='row_{$order}'>";
$order = $nextorder[$order];
echo '<td>' . $pn . '<td';
echo $int['status'] == "connected" ? " class='text_green'>" : ">";
echo $int['status'] . '<td';
echo time_convert($int['last']) > $port_use_age ? " class='text_yellow'>" : ">";
echo $int['last'] . '<td';
echo time_convert($int['clear']) > 0 ? time_convert($int['clear']) < $port_use_age ? " class='text_red'>" : ">" : ">";
echo $int['clear'];
echo '<td>' . $int['in_pkts'];
echo '<td>' . $int['out_pkts'];
echo '<td>' . $int['desc'];
echo '</tr>';
}
echo "</table></td>";
}
}
echo "</td></tr></table>";
finishPortlet();
}
开发者ID:cengn-tao,项目名称:racktables-contribs,代码行数:46,代码来源:liveinterfaces.php
示例5: content_5778b6e53bcf54_59272631
function content_5778b6e53bcf54_59272631($_smarty_tpl)
{
if (!is_callable('smarty_block_m')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/block.m.php';
}
?>
<div class="fldTitle"><?php
$_smarty_tpl->smarty->_tag_stack[] = array('m', array());
$_block_repeat = true;
echo smarty_block_m(array(), null, $_smarty_tpl, $_block_repeat);
while ($_block_repeat) {
ob_start();
?>
Fax<?php
$_block_content = ob_get_clean();
$_block_repeat = false;
echo smarty_block_m(array(), $_block_content, $_smarty_tpl, $_block_repeat);
}
array_pop($_smarty_tpl->smarty->_tag_stack);
?>
#</div>
<input type="text" readonly="readonly" style="width:90px" value="<?php
echo $_smarty_tpl->tpl_vars['value']->value;
?>
" />
<?php
if ($_smarty_tpl->tpl_vars['value']->value) {
?>
<a href="/leadsmail.php?cmd=compose&lead_id=<?php
echo $_smarty_tpl->tpl_vars['lead_id']->value;
?>
&fax=<?php
echo $_smarty_tpl->tpl_vars['value']->value;
?>
" <?php
if (!permitted('allowFax')) {
?>
onclick="alert('You must configure your Fax settings in your user profile page first before you can use this feature.');return false;"<?php
}
?>
>
<img style="vertical-align:middle" src="/assets/images/fax_icon.jpg" width="21" height="21" border="0"></a>
<?php
}
}
开发者ID:doronl456,项目名称:TestGit,代码行数:46,代码来源:2e094a0ff0fff7f7eb342352d9984666a3bbccfb.file.Fax.html.php
示例6: content_5778b6e52b7705_27809830
function content_5778b6e52b7705_27809830($_smarty_tpl)
{
?>
<div class="fldTitle"><?php
echo $_smarty_tpl->getSubTemplate('fields/req.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
echo $_smarty_tpl->tpl_vars['title']->value;
?>
<?php
if (permitted('confEnableCanada')) {
?>
(Postal Code)<?php
}
?>
</div>
<input type="text" readonly="readonly" class="inpWide" value="<?php
echo $_smarty_tpl->tpl_vars['value']->value;
?>
"/>
<?php
}
开发者ID:doronl456,项目名称:TestGit,代码行数:20,代码来源:cce2e75fe3d86cf3f9c006387a5cbc7473558135.file.TaxID.html.php
示例7: __construct
public function __construct()
{
$this->loader = new Twig_Loader_Filesystem(__DIR__ . '/../templates');
$this->twig = new Twig_Environment($this->loader, array("debug" => true));
$this->variables = array();
$this->twig->addExtension(new Twig_Extension_Debug());
$this->authorized = FALSE;
$this->add_function('permitted', function ($user, $action) {
return permitted($user, $action);
});
$this->add_function('can_give_role', function ($user, $role) {
return can_give_role($user, $role);
});
$this->add_function('iiif_page_top_url', 'iiif_page_top_url');
$this->add_function('iiif_page_bottom_url', 'iiif_page_bottom_url');
$this->add_function('iiif_info_url', 'iiif_info_url');
$this->twig->addGlobal("ROLE_ADMIN", ROLE_ADMIN);
$this->twig->addGlobal("ROLE_TITLE_MANAGER", ROLE_TITLE_MANAGER);
$this->twig->addGlobal("ROLE_ISSUE_CURATOR", ROLE_ISSUE_CURATOR);
$this->twig->addGlobal("ROLE_ISSUE_REVIEWER", ROLE_ISSUE_REVIEWER);
$this->twig->addGlobal("ROLE_USER_MANAGER", ROLE_USER_MANAGER);
$this->twig->addGlobal("ROLE_MOC_MANAGER", ROLE_MOC_MANAGER);
}
开发者ID:uoregon-libraries,项目名称:pdf-to-chronam-admin,代码行数:23,代码来源:render.php
示例8: content_5778b6e5271ea7_87612051
function content_5778b6e5271ea7_87612051($_smarty_tpl)
{
if (!is_callable('smarty_modifier_date')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.date.php';
}
?>
<div class="fldTitle"><?php
echo $_smarty_tpl->getSubTemplate('fields/req.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
echo $_smarty_tpl->tpl_vars['title']->value;
?>
<?php
if (permitted('confEnableCanada')) {
?>
(Postal Code)<?php
}
?>
</div>
<input type="text" readonly="readonly" class="inpWide" value="<?php
echo smarty_modifier_date($_smarty_tpl->tpl_vars['value']->value);
?>
"/>
<?php
}
开发者ID:doronl456,项目名称:TestGit,代码行数:23,代码来源:241de59f5dbcbcfdfc3f458df78c0506fd100f4d.file.DOB.html.php
示例9: content_5778b6e577b464_23448108
function content_5778b6e577b464_23448108($_smarty_tpl)
{
?>
<div class="d1" >
<div class="fldTitle"><?php
echo $_smarty_tpl->getSubTemplate('fields/req.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
echo $_smarty_tpl->tpl_vars['title']->value;
?>
<?php
if (permitted('confEnableCanada')) {
?>
(Postal Code)<?php
}
?>
</div>
<input name="<?php
echo $_smarty_tpl->tpl_vars['name']->value;
?>
" type="text" class="fieldInputZip" value="<?php
echo $_smarty_tpl->tpl_vars['value']->value;
?>
" maxlength="9" maxlength_="" />
<span class="fieldComments">(xxxxx) <?php
if (permitted('confEnableCanada')) {
?>
/ (xxx xxx)<?php
}
?>
</span>
<?php
echo $_smarty_tpl->getSubTemplate('fields/note.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
?>
</div>
<?php
}
开发者ID:doronl456,项目名称:TestGit,代码行数:36,代码来源:ad7eb660074a08731166162a145a733d84472c27.file.field_zip.html.php
示例10: formatPortReservation
function formatPortReservation($port)
{
$ret = array();
$ret[] = '<td class=tdleft>' . (strlen($port['reservation_comment']) ? formatLoggedSpan($port['last_log'], 'Reserved:', 'strong underline') : '') . '</td>';
$editable = permitted('object', 'ports', 'editPort') ? 'editable' : '';
$ret[] = '<td class=tdleft>' . formatLoggedSpan($port['last_log'], $port['reservation_comment'], "rsvtext {$editable} id-{$port['id']} op-upd-reservation-port") . '</td>';
return $ret;
}
开发者ID:xtha,项目名称:salt,代码行数:8,代码来源:interface.php
示例11: authorize8021QChangeRequests
function authorize8021QChangeRequests($before, $changes)
{
global $script_mode;
if (isset($script_mode) and $script_mode) {
return $changes;
}
$ret = array();
foreach ($changes as $pn => $change) {
foreach (array_diff($before[$pn]['allowed'], $change['allowed']) as $removed_id) {
if (!permitted(NULL, NULL, NULL, array(array('tag' => '$fromvlan_' . $removed_id), array('tag' => '$vlan_' . $removed_id)))) {
continue 2;
}
}
// next port
foreach (array_diff($change['allowed'], $before[$pn]['allowed']) as $added_id) {
if (!permitted(NULL, NULL, NULL, array(array('tag' => '$tovlan_' . $added_id), array('tag' => '$vlan_' . $added_id)))) {
continue 2;
}
}
// next port
$ret[$pn] = $change;
}
return $ret;
}
开发者ID:rhysm,项目名称:racktables,代码行数:24,代码来源:functions.php
示例12: content_5778b6e5db1a50_97898098
function content_5778b6e5db1a50_97898098($_smarty_tpl)
{
if (!is_callable('smarty_function_js_include')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/function.js_include.php';
}
if (!is_callable('smarty_function_js_data')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/function.js_data.php';
}
if (!is_callable('smarty_block_mybox')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/block.mybox.php';
}
if (!is_callable('smarty_modifier_cut')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.cut.php';
}
if (!is_callable('smarty_modifier_money')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.money.php';
}
if (!is_callable('smarty_function_html_options')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/function.html_options.php';
}
if (!is_callable('smarty_modifier_num')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.num.php';
}
if (!is_callable('smarty_function_my_call')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/function.my_call.php';
}
?>
<style>
.statBlock em {
color:blue;
}
.statBlock a {
font-weight:bold;
}
</style>
<!--add tehila -->
<?php
echo smarty_function_js_include(array('src' => '/js/form_validator.js'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/uploader/css/jquery.fileupload-ui.css'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/uploader/js/vendor/jquery.ui.widget.js'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/uploader/js/jquery.iframe-transport.js'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/uploader/js/jquery.fileupload.js'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/css/upload.css'), $_smarty_tpl);
?>
<!--end tehila -->
<?php
echo smarty_function_js_include(array('src' => '/js/lead.js'), $_smarty_tpl);
?>
<?php
echo $_smarty_tpl->getSubTemplate('calendar.html', $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array(), 0);
?>
<?php
echo smarty_function_js_include(array('src' => '/js/form_validator.js'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_data(array('approveValidationErr' => $_smarty_tpl->tpl_vars['approveValidationErr']->value, 'tab' => $_smarty_tpl->tpl_vars['tab']->value, 'jsFundingProduct' => $_smarty_tpl->tpl_vars['FundingProduct']->value, 'totalPerc' => $_smarty_tpl->tpl_vars['totalPerc']->value, 'cntLenders' => $_smarty_tpl->tpl_vars['cntLenders']->value, 'BusinessEmail' => $_smarty_tpl->tpl_vars['BusinessEmail']->value, 'cashadv_id' => $_smarty_tpl->tpl_vars['cashadv_id']->value, 'cntMissingDocs' => $_smarty_tpl->tpl_vars['cntMissingDocs']->value, 'permittedSA' => $_smarty_tpl->tpl_vars['permittedSA']->value), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/css/statusColorBox.css'), $_smarty_tpl);
?>
<style>
.notesTable .v1{color:#3282e6}
</style>
<style>
.inpMinimal{background:#DDFFFF}
input.decFld{width:95%}
.HLred{color:red;}
.HLgreen{color:green;}
//.........这里部分代码省略.........
开发者ID:doronl456,项目名称:TestGit,代码行数:101,代码来源:e1c35e93a771c0b3c46e65c7a6e3b729db0bdf04.file.cashadv_dba.html.php
示例13: handleNetworkStickerClear
function handleNetworkStickerClear()
{
global $sic, $pageno;
assertUIntArg('attr_id');
if (permitted(NULL, NULL, NULL, array(array('tag' => '$attr_' . $sic['attr_id'])))) {
commitUpdateAttrForNetwork(spotEntity($pageno === 'ipv4net' ? 'ipv4net' : 'ipv6net', getBypassValue()), $sic['attr_id']);
showSuccess("Attribute value cleared successfully");
} else {
$oldvalues = getAttrValues(getBypassValue());
showError('Permission denied, "' . $oldvalues[$sic['attr_id']]['name'] . '" left unchanged');
}
}
开发者ID:epx998,项目名称:racktables-contribs,代码行数:12,代码来源:network-attrs.php
示例14: getCommentsOfFriends
function getCommentsOfFriends()
{
$comments_of_friends = array();
$stmt = db_execute('SELECT * FROM comments ORDER BY created_at DESC LIMIT 1000');
while ($comment = $stmt->fetch()) {
if (!is_friend($comment['user_id'])) {
continue;
}
$entry = getEntry($comment['entry_id']);
$entry['is_private'] = $entry['private'] == 1;
if ($entry['is_private'] && !permitted($entry['user_id'])) {
continue;
}
$comments_of_friends[] = $comment;
if (sizeof($comments_of_friends) >= 10) {
break;
}
}
return $comments_of_friends;
}
开发者ID:kuma-san,项目名称:isucon5,代码行数:20,代码来源:index.php
示例15: content_5778af8a051997_20571009
function content_5778af8a051997_20571009($_smarty_tpl)
{
if (!is_callable('smarty_function_js_include')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/function.js_include.php';
}
if (!is_callable('smarty_block_mybox')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/block.mybox.php';
}
if (!is_callable('smarty_function_js_data')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/function.js_data.php';
}
if (!is_callable('smarty_function_cycle')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/function.cycle.php';
}
if (!is_callable('smarty_modifier_ucwords')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.ucwords.php';
}
if (!is_callable('smarty_modifier_money')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.money.php';
}
if (!is_callable('smarty_modifier_truncate')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.truncate.php';
}
if (!is_callable('smarty_modifier_date_format')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.date_format.php';
}
if (!is_callable('smarty_modifier_date')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.date.php';
}
echo smarty_function_js_include(array('src' => '/css/calendar.css'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/css/homepage.css'), $_smarty_tpl);
?>
<?php
echo '<script';
?>
language="javascript">
function statAppChange(){
var statApp=getCtrlValue('statApp');
el('tblAppProf').style.display= statApp=='Prof'?'':'none';
el('tblAppVol').style.display= statApp=='Vol'?'':'none';
el('tblAppNumtrans').style.display= statApp=='Numtrans'?'':'none';
var statAgent=getCtrlValue('statAgent');
el('tblAgentAccSub').style.display= statAgent=='AccSub'?'':'none';
el('tblAgentAcc').style.display= statAgent=='Acc'?'':'none';
el('tblAgentRes').style.display= statAgent=='Res'?'':'none';
el('tblAgentCom').style.display= statAgent=='Com'?'':'none';
var statMca=getCtrlValue('statMca');
el('tblMcaAmount').style.display= statMca=='Amount'?'':'none';
el('tblMcaBal').style.display= statMca=='Bal'?'':'none';
el('tblMcaProf').style.display= statMca=='Prof'?'':'none';
// top 10
var statTeamleader=getCtrlValue('statTeamleader');
el('tblTeamleaderLead').style.display= statTeamleader=='Lead'?'':'none';
el('tblTeamleaderAppt').style.display= statTeamleader=='Appt'?'':'none';
el('tblTeamleaderSold').style.display= statTeamleader=='Sold'?'':'none';
var statTm=getCtrlValue('statTm');
el('tblTmLead').style.display= statTm=='Lead'?'':'none';
el('tblTmAppt').style.display= statTm=='Appt'?'':'none';
el('tblTmSold').style.display= statTm=='Sold'?'':'none';
var statLeadcloser=getCtrlValue('statLeadcloser');
el('tblLeadcloserLead').style.display= statLeadcloser=='Lead'?'':'none';
el('tblLeadcloserAppt').style.display= statLeadcloser=='Appt'?'':'none';
el('tblLeadcloserSold').style.display= statLeadcloser=='Sold'?'':'none';
}
$(document).ready(function() {
});
<?php
echo '</script';
?>
>
<style>
</style>
<div class="mySortable HomePage">
<?php
if (permitted('HOME-DailyQuotes')) {
?>
<?php
$_smarty_tpl->smarty->_tag_stack[] = array('mybox', array('node' => 'HOME-DailyQuotes', 'title' => 'Daily Sales & Motivational Quotes', 'class' => 'box-one box-blue'));
//.........这里部分代码省略.........
开发者ID:doronl456,项目名称:TestGit,代码行数:101,代码来源:ed7b0d1e461f7d26ae87909f3b57800fa8d06b51.file.home.html.php
示例16: content_5778af8a1aae99_91151934
function content_5778af8a1aae99_91151934($_smarty_tpl)
{
if (!is_callable('smarty_function_func')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/function.func.php';
}
if (!is_callable('smarty_function_js_include')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/function.js_include.php';
}
if (!is_callable('smarty_modifier_money')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.money.php';
}
if (!is_callable('smarty_block_m')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/block.m.php';
}
if (!is_callable('smarty_modifier_date_format')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.date_format.php';
}
if (!is_callable('smarty_block_mybox')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/block.mybox.php';
}
if (!is_callable('smarty_modifier_date')) {
include '/homepages/37/d619410358/htdocs/developer/ext/smarty3/plugins/modifier.date.php';
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<HEAD>
<?php
echo '<script';
?>
type="text/javascript" src="/js/init.js"><?php
echo '</script';
?>
>
<?php
echo smarty_function_func(array('name' => 'TplData', 'var' => 'tpldata'), $_smarty_tpl);
?>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<TITLE><?php
echo $_smarty_tpl->tpl_vars['PAGETITLE']->value;
?>
</TITLE>
<?php
echo smarty_function_js_include(array('src' => '/css/style.css'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/corp/style_c.css'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/css/tpl_page_template.css'), $_smarty_tpl);
?>
<style>
<?php
if (!permitted('ADMIN-RIGHTS')) {
?>
.AdminOnlyVisibility {display:none}
<?php
}
?>
</style>
<style>
</style>
<?php
echo smarty_function_js_include(array('src' => '/js/functions.js'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/js/main.js'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/js/jquery-1.9.1.min.js'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/js/jquery-ui-1.11.2/jquery-ui.css'), $_smarty_tpl);
?>
<?php
echo smarty_function_js_include(array('src' => '/js/jquery-ui-1.11.2/jquery-ui.min.js'), $_smarty_tpl);
?>
<?php
//.........这里部分代码省略.........
开发者ID:doronl456,项目名称:TestGit,代码行数:101,代码来源:532955d3cba76b80d5e349460deb997db5f60176.file.page_template.html.php
示例17: linkmgmt_tabhandler
function linkmgmt_tabhandler($object_id)
{
global $lm_cache;
$target = makeHrefProcess(portlist::urlparams('op', 'update'));
addJS('js/jquery.jeditable.mini.js');
/* TODO if (permitted (NULL, 'ports', 'set_reserve_comment')) */
/* TODO Link / unlink permissions */
$lm_cache['allowcomment'] = permitted(NULL, NULL, 'set_reserve_comment');
/* RackCode {$op_set_reserve_comment} */
$lm_cache['allowlink'] = permitted(NULL, NULL, 'set_link');
/* RackCode {$op_set_link} */
$lm_cache['allowbacklink'] = permitted(NULL, NULL, 'set_backlink');
/* RackCode {$op_set_backlink} */
//portlist::var_dump_html($lm_cache);
/* init jeditable fields/tags */
if ($lm_cache['allowcomment']) {
addJS('$(document).ready(function() { $(".editcmt").editable("' . $target . '",{placeholder : "add comment"}); });', TRUE);
}
if ($lm_cache['allowlink']) {
addJS('$(document).ready(function() { $(".editcable").editable("' . $target . '",{placeholder : "edit cableID"}); });', TRUE);
}
/* linkmgmt for current object */
linkmgmt_renderObjectLinks($object_id);
/* linkmgmt for every child */
//$parents = getEntityRelatives ('parents', 'object', $object_id);
$children = getEntityRelatives('children', 'object', $object_id);
//'entity_id'
foreach ($children as $child) {
$childobj = spotEntity($child['entity_type'], $child['entity_id']);
echo '<h1>Links for Child: ' . $childobj['name'] . '</h1>';
linkmgmt_renderObjectLinks($child['entity_id']);
unset($childobj);
}
return;
}
开发者ID:dot-Sean,项目名称:racktables-contribs,代码行数:35,代码来源:linkmgmt.php
示例18: setPortVLAN
function setPortVLAN()
{
assertUIntArg('portcount');
try {
$data = getSwitchVLANs($_REQUEST['object_id']);
} catch (RTGatewayError $re) {
return showFuncMessage(__FUNCTION__, 'ERR', array($re->getMessage()));
}
list($vlanlist, $portlist) = $data;
// Here we just build up 1 set command for the gateway with all of the ports
// included. The gateway is expected to filter unnecessary changes silently
// and to provide a list of responses with either error or success message
// for each of the rest.
$nports = $_REQUEST['portcount'];
$prefix = 'set ';
$setcmd = '';
for ($i = 0; $i < $nports; $i++) {
genericAssertion('portname_' . $i, 'string');
genericAssertion('vlanid_' . $i, 'string');
if ($_REQUEST['portname_' . $i] != $portlist[$i]['portname']) {
throw new InvalidRequestArgException('portname_' . $i, $_REQUEST['portname_' . $i], 'expected to be ' . $portlist[$i]['portname']);
}
if ($_REQUEST['vlanid_' . $i] == $portlist[$i]['vlanid'] || $portlist[$i]['vlanid'] == 'TRUNK') {
continue;
}
$portname = $_REQUEST['portname_' . $i];
$oldvlanid = $portlist[$i]['vlanid'];
$newvlanid = $_REQUEST['vlanid_' . $i];
if (!permitted(NULL, NULL, NULL, array(array('tag' => '$fromvlan_' . $oldvlanid), array('tag' => '$vlan_' . $oldvlanid))) or !permitted(NULL, NULL, NULL, array(array('tag' => '$tovlan_' . $newvlanid), array('tag' => '$vlan_' . $newvlanid)))) {
showOneLiner(159, array($portname, $oldvlanid, $newvlanid));
continue;
}
$setcmd .= $prefix . $portname . '=' . $newvlanid;
$prefix = ';';
}
// Feed the gateway and interpret its (non)response.
if ($setcmd == '') {
showOneLiner(201);
} else {
try {
setSwitchVLANs($_REQUEST['object_id'], $setcmd);
// shows messages by itself
} catch (RTGatewayError $e) {
showFuncMessage(__FUNCTION__, 'ERR', array($e->getMessage()));
}
}
}
开发者ID:rhysm,项目名称:racktables,代码行数:47,代码来源:ophandlers.php
示例19: copyLotOfObjects
//.........这里部分代码省略.........
$object_name = $name_or_csv;
}
try {
$object_id = commitAddObject($object_name, $label, $global_type_id, $asset_no, $taglist);
if (!$object_id) {
throw new RTDatabaseError("could not create {$object_name}");
}
$info = spotEntity('object', $object_id);
amplifyCell($info);
foreach ($source_object['ports'] as $source_port) {
$update_port = 0;
foreach ($info['ports'] as $new_port) {
if ($new_port['name'] == $source_port['name']) {
commitUpdatePort($object_id, $new_port['id'], $new_port['name'], $new_port['oif_id'], $source_port['label'], "");
$update_port = 1;
}
}
if ($update_port) {
true;
} else {
commitAddPort($object_id, $source_port['name'], sprintf("%s-%s", $source_port['iif_id'], $source_port['oif_id']), $source_port['label'], "");
}
}
// Copy Backendlinks only start if we ghave function linkmgmt_linkPorts from linkmgmt.php
if (function_exists('amplifyCell_object_Backend_Port') && function_exists('linkmgmt_linkPorts')) {
$info = spotEntity('object', $object_id);
amplifyCell($info);
amplifyCell_object_Backend_Port($info);
/* showError( '<div align="left"><pre>\n===== Source Object ======\n\n' .
varDumpToString ( $source_object ) .
'\n\n===== New Object ======\n\n' .
varDumpToString ( $info ) . '</pre></div>' );
*/
$name_by_id = array();
foreach ($info['BackendPorts'] as $new_be_port) {
$name_by_id[$new_be_port['name']] = $new_be_port['id'];
}
$linked_ports = array();
foreach ($source_object['BackendPorts'] as $source_be_port) {
if ($source_be_port['object_id'] == $source_be_port['remote_object_id']) {
// We have a Port that has the own object as remote object we want to copy this type of Linko
// We have backend Links
$new_be_port_a = $name_by_id[$source_be_port['name']];
$new_be_port_b = $name_by_id[$source_be_port['remote_name']];
if ($new_be_port_a && $new_be_port_b && !array_key_exists($new_be_port_a, $linked_ports) && !array_key_exists($new_be_port_b, $linked_ports)) {
// error_log ( sprintf ('new_be_port_a %s // new_be_port_b %s // cableid %s', $new_be_port_a , $new_be_port_b, $source_be_port['cableid'] ));
$ret_val = linkmgmt_linkPorts($new_be_port_a, $new_be_port_b, 'back', $source_be_port['cableid']);
// error_log ( sprintf (' linkmgmt_linkPorts ret val: "%s" ', $ret_val)) ;
if ($ret_val) {
throw new RTDatabaseError("could not copy Backend Links for {$object_name} because: {$ret_val}");
} else {
$linked_ports[$new_be_port_a] = True;
$linked_ports[$new_be_port_b] = True;
}
}
}
}
}
// Copy attributes
foreach (getAttrValues($source_object_id) as $record) {
$value = $record['value'];
switch ($record['type']) {
case 'uint':
case 'float':
case 'string':
$value = $record['value'];
break;
case 'dict':
$value = $record['key'];
break;
default:
}
if (permitted(NULL, NULL, NULL, array(array('tag' => '$attr_' . $record['id'])))) {
if (empty($value)) {
commitUpdateAttrValue($object_id, $record['id']);
} else {
commitUpdateAttrValue($object_id, $record['id'], $value);
}
} else {
showError('Permission denied, "' . $record['name'] . '" can not be set');
}
}
//$log = mergeLogs ($log, oneLiner (5, array ('<a href="' .
// makeHref (array ('page' => 'object', 'tab' => 'default', 'object_id' => $object_id)) .
// '">' . $info['dname'] . '</a>'))
//);
showSuccess(sprintf("Copied Object %s ; new Object: %s", $source_object['name'], formatPortLink($object_id, $info['dname'], 1, '', '')));
} catch (RTDatabaseError $e) {
error_log("rolling back DB");
$dbrollback = 1;
$dbxlink->rollBack();
$log = mergeLogs($log, oneLiner(147, array($object_name)));
throw new RTDatabaseError($e->getMessage() . sprintf(' (%s)', $name_or_csv));
}
}
if (!$dbrollback) {
$dbxlink->commit();
}
// return buildWideRedirectURL ($log);
}
开发者ID:epx998,项目名称:racktables-contribs,代码行数:101,代码来源:local_copy_object.php
示例20: function
$app->post('/diary/entry', function () use($app) {
authenticated();
$query = 'INSERT INTO entries (user_id, private, body) VALUES (?,?,?)';
$params = $app->request->params();
$body = ($params['title'] ?: "タイトルなし") . "\n" . $params['content'];
db_execute($query, array(current_user()['id'], $params['private'] ? '1' : '0', $body));
$app->redirect('/diary/entries/' . current_user()['account_name']);
});
$app->post('/diary/comment/:entry_id', function ($entry_id) use($app) {
authenticated();
$entry = db_execute('SELECT * FROM entries WHERE id = ?', array($entry_id))->fetch();
if (!$entry) {
abort_content_not_found();
}
$entry['is_private'] = $entry['private'] == 1;
if ($entry['is_private'] && !permitted($entry['user_id'])) {
abort_permission_denied();
}
$query = 'INSERT INTO comments (entry_id, user_id, comment) VALUES (?,?,?)';
$params = $app->request->params();
db_execute($query, array($entry['id'], current_user()['id'], $params['comment']));
$app->redirect('/diary/entry/' . $entry['id']);
});
$app->get('/footprints', function () use($app) {
authenticated();
$query = <<<SQL
SELECT user_id, owner_id, DATE(created_at) AS date, MAX(created_at) as updated
FROM footprints
WHERE user_id = ?
GROUP BY user_id, owner_id, DATE(created_at)
ORDER BY updated DESC
开发者ID:kstm-su,项目名称:ISUCON5,代码行数:31,代码来源:index.php
注:本文中的permitted函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论