本文整理汇总了PHP中get_item_info函数的典型用法代码示例。如果您正苦于以下问题:PHP get_item_info函数的具体用法?PHP get_item_info怎么用?PHP get_item_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_item_info函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execAction
function execAction($dir)
{
// delete files/dirs
if (($GLOBALS["permissions"] & 01) != 01) {
ext_Result::sendResult('delete', false, $GLOBALS["error_msg"]["accessfunc"]);
}
// CSRF Security Check
if (!ext_checkToken($GLOBALS['__POST']["token"])) {
ext_Result::sendResult('tokencheck', false, 'Request failed: Security Token not valid.');
}
$cnt = count($GLOBALS['__POST']["selitems"]);
$err = false;
// delete files & check for errors
for ($i = 0; $i < $cnt; ++$i) {
$items[$i] = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
if (ext_isFTPMode()) {
$abs = get_item_info($dir, $items[$i]);
} else {
$abs = get_abs_item($dir, $items[$i]);
}
if (!@$GLOBALS['ext_File']->file_exists($abs)) {
$error[$i] = $GLOBALS["error_msg"]["itemexist"];
$err = true;
continue;
}
if (!get_show_item($dir, $items[$i])) {
$error[$i] = $GLOBALS["error_msg"]["accessitem"];
$err = true;
continue;
}
// Delete
if (ext_isFTPMode()) {
$abs = str_replace('\\', '/', get_abs_item($dir, $abs));
}
$ok = $GLOBALS['ext_File']->remove($abs);
if ($ok === false || PEAR::isError($ok)) {
$error[$i] = $GLOBALS["error_msg"]["delitem"];
if (PEAR::isError($ok)) {
$error[$i] .= ' [' . $ok->getMessage() . ']';
}
$err = true;
continue;
}
$error[$i] = NULL;
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; ++$i) {
if ($error[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $error[$i] . ".\n";
}
ext_Result::sendResult('delete', false, $err_msg);
}
ext_Result::sendResult('delete', true, $GLOBALS['messages']['success_delete_file']);
}
示例2: del_items
function del_items($dir)
{
$mainframe =& JFactory::getApplication();
// delete files/dirs
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
$cnt = count($GLOBALS['__POST']["selitems"]);
$err = false;
// delete files & check for errors
for ($i = 0; $i < $cnt; ++$i) {
$items[$i] = stripslashes($GLOBALS['__POST']["selitems"][$i]);
if (nx_isFTPMode()) {
$abs = get_item_info($dir, $items[$i]);
} else {
$abs = get_abs_item($dir, $items[$i]);
}
if (!@$GLOBALS['nx_File']->file_exists($abs)) {
$error[$i] = $GLOBALS["error_msg"]["itemexist"];
$err = true;
continue;
}
if (!get_show_item($dir, $items[$i])) {
$error[$i] = $GLOBALS["error_msg"]["accessitem"];
$err = true;
continue;
}
// Delete
if (nx_isFTPMode()) {
$abs = get_abs_item($dir, $abs);
}
$ok = $GLOBALS['nx_File']->remove($abs);
if ($ok === false || PEAR::isError($ok)) {
$error[$i] = $GLOBALS["error_msg"]["delitem"];
if (PEAR::isError($ok)) {
$error[$i] .= ' [' . $ok->getMessage() . ']';
}
$err = true;
continue;
}
$error[$i] = NULL;
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; ++$i) {
if ($error[$i] == NULL) {
continue;
}
$err_msg .= $items[$i] . " : " . $error[$i] . "<br/>\n";
}
show_error($err_msg);
}
$mainframe->redirect(make_link("list", $dir, null), $GLOBALS['messages']['success_delete_file']);
}
示例3: rename_item
function rename_item($dir, $item)
{
// rename directory or file
$mainframe =& JFactory::getApplication();
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
$newitemname = $GLOBALS['__POST']["newitemname"];
$newitemname = trim(basename(stripslashes($newitemname)));
if ($newitemname == '') {
show_error($GLOBALS["error_msg"]["miscnoname"]);
}
if (!nx_isFTPMode()) {
$abs_old = get_abs_item($dir, $item);
$abs_new = get_abs_item($dir, $newitemname);
} else {
$abs_old = get_item_info($dir, $item);
$abs_new = get_item_info($dir, $newitemname);
}
if (@$GLOBALS['nx_File']->file_exists($abs_new)) {
show_error($newitemname . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
}
$perms_old = $GLOBALS['nx_File']->fileperms($abs_old);
$ok = $GLOBALS['nx_File']->rename(get_abs_item($dir, $item), get_abs_item($dir, $newitemname));
if (nx_isFTPMode()) {
$abs_new = get_item_info($dir, $newitemname);
}
$GLOBALS['nx_File']->chmod($abs_new, $perms_old);
if ($ok === false || PEAR::isError($ok)) {
show_error('Could not rename ' . $item . ' to ' . $newitemname);
}
$msg = sprintf($GLOBALS['messages']['success_rename_file'], $item, $newitemname);
$mainframe->redirect(make_link("list", $dir, null), $msg);
}
show_header($GLOBALS['messages']['rename_file']);
// Form
echo '<br /><form method="post" action="';
echo make_link("rename", $dir, $item) . "\">\n";
echo "<input type=\"hidden\" name=\"confirm\" value=\"true\" />\n";
echo "<input type=\"hidden\" name=\"item\" value=\"" . stripslashes($GLOBALS['__GET']["item"]) . "\" />\n";
// Submit / Cancel
echo "<table>\n<tr><tr><td colspan=\"2\">\n";
echo "<label for=\"newitemname\">" . $GLOBALS["messages"]["newname"] . ":</label> <input name=\"newitemname\" id=\"newitemname\" type=\"text\" size=\"60\" value=\"" . stripslashes($_GET['item']) . "\" /><br /><br /><br /></td></tr>\n";
echo "<tr><tr><td>\n<input type=\"submit\" value=\"" . $GLOBALS["messages"]["btnchange"];
echo "\"></td>\n<td><input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
echo "\" onclick=\"javascript:location='" . make_link("list", $dir, NULL) . "';\">\n</td></tr></form></table><br />\n";
}
示例4: recalculate_shopping_cart
function recalculate_shopping_cart()
{
$shopping_cart = get_session("shopping_cart");
if (is_array($shopping_cart) && sizeof($shopping_cart) > 0) {
foreach ($shopping_cart as $cart_id => $item) {
get_item_info($item);
$shopping_cart[$cart_id] = $item;
}
set_session("shopping_cart", $shopping_cart);
}
}
示例5: is_writable
function is_writable($file)
{
global $isWindows;
if (ext_isFTPMode()) {
if ($isWindows) {
return true;
}
if (!is_array($file)) {
$file = get_item_info(dirname($file), basename($file));
}
if (empty($file['rights'])) {
return true;
}
$perms = $file['rights'];
if ($_SESSION['ftp_login'] == $file['user']) {
// FTP user is owner of the file
return $perms[1] == 'w';
}
$fileinfo = posix_getpwnam($file['user']);
$userinfo = posix_getpwnam($_SESSION['ftp_login']);
if ($fileinfo['gid'] == $userinfo['gid']) {
return $perms[4] == 'w';
} else {
return $perms[7] == 'w';
}
} else {
return is_writable($file);
}
}
示例6: chmod_item
function chmod_item($dir, $item)
{
// change permissions
if (($GLOBALS["permissions"] & 01) != 01) {
show_error($GLOBALS["error_msg"]["accessfunc"]);
}
if (!empty($GLOBALS['__POST']["selitems"])) {
$cnt = count($GLOBALS['__POST']["selitems"]);
} else {
$GLOBALS['__POST']["selitems"][] = $item;
$cnt = 1;
}
if (!empty($GLOBALS['__POST']['do_recurse'])) {
$do_recurse = true;
} else {
$do_recurse = false;
}
// Execute
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
$bin = '';
for ($i = 0; $i < 3; $i++) {
for ($j = 0; $j < 3; $j++) {
$tmp = "r_" . $i . $j;
if (isset($GLOBALS['__POST'][$tmp]) && $GLOBALS['__POST'][$tmp] == "1") {
$bin .= '1';
} else {
$bin .= '0';
}
}
}
if ($bin == '0') {
// Changing permissions to "none" is not allowed
show_error($item . ": " . $GLOBALS["error_msg"]["permchange"]);
}
$old_bin = $bin;
for ($i = 0; $i < $cnt; ++$i) {
if (jx_isFTPMode()) {
$mode = decoct(bindec($bin));
} else {
$mode = bindec($bin);
}
$item = $GLOBALS['__POST']["selitems"][$i];
if (jx_isFTPMode()) {
$abs_item = get_item_info($dir, $item);
} else {
$abs_item = get_abs_item($dir, $item);
}
if (!$GLOBALS['jx_File']->file_exists($abs_item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item)) {
show_error($item . ": " . $GLOBALS["error_msg"]["accessfile"]);
}
if ($do_recurse) {
$ok = $GLOBALS['jx_File']->chmodRecursive($abs_item, $mode);
} else {
if (get_is_dir($abs_item)) {
// when we chmod a directory we must care for the permissions
// to prevent that the directory becomes not readable (when the "execute bits" are removed)
$bin = substr_replace($bin, '1', 2, 1);
// set 1st x bit to 1
$bin = substr_replace($bin, '1', 5, 1);
// set 2nd x bit to 1
$bin = substr_replace($bin, '1', 8, 1);
// set 3rd x bit to 1
if (jx_isFTPMode()) {
$mode = decoct(bindec($bin));
} else {
$mode = bindec($bin);
}
}
$ok = @$GLOBALS['jx_File']->chmod($abs_item, $mode);
}
$bin = $old_bin;
}
if (!$ok || PEAR::isError($ok)) {
show_error($abs_item . ": " . $GLOBALS["error_msg"]["permchange"]);
}
header("Location: " . make_link("link", $dir, NULL));
return;
}
if (jx_isFTPMode()) {
$abs_item = get_item_info($dir, $GLOBALS['__POST']["selitems"][0]);
} else {
$abs_item = get_abs_item($dir, $GLOBALS['__POST']["selitems"][0]);
}
$mode = parse_file_perms(get_file_perms($abs_item));
if ($mode === false) {
show_error($GLOBALS['__POST']["selitems"][0] . ": " . $GLOBALS["error_msg"]["permread"]);
}
$pos = "rwx";
$text = "";
for ($i = 0; $i < $cnt; ++$i) {
$s_item = get_rel_item($dir, $GLOBALS['__POST']["selitems"][$i]);
if (strlen($s_item) > 50) {
$s_item = "..." . substr($s_item, -47);
}
$text .= ", " . $s_item;
}
show_header($GLOBALS["messages"]["actperms"]);
//.........这里部分代码省略.........
示例7: execAction
function execAction($dir, $item)
{
// change permissions
if (($GLOBALS["permissions"] & 01) != 01) {
ext_Result::sendResult('chmod', false, $GLOBALS["error_msg"]["accessfunc"]);
}
if (!empty($GLOBALS['__POST']["selitems"])) {
$cnt = count($GLOBALS['__POST']["selitems"]);
} else {
$GLOBALS['__POST']["selitems"][] = $item;
$cnt = 1;
}
if (!empty($GLOBALS['__POST']['do_recurse'])) {
$do_recurse = true;
} else {
$do_recurse = false;
}
// Execute
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
$bin = '';
for ($i = 0; $i < 3; $i++) {
for ($j = 0; $j < 3; $j++) {
$tmp = "r_" . $i . $j;
if (!empty($GLOBALS['__POST'][$tmp])) {
$bin .= '1';
} else {
$bin .= '0';
}
}
}
if ($bin == '0') {
// Changing permissions to "none" is not allowed
ext_Result::sendResult('chmod', false, $item . ": " . ext_Lang::err('chmod_none_not_allowed'));
}
$old_bin = $bin;
for ($i = 0; $i < $cnt; ++$i) {
if (ext_isFTPMode()) {
$mode = decoct(bindec($bin));
} else {
$mode = bindec($bin);
}
$item = $GLOBALS['__POST']["selitems"][$i];
if (ext_isFTPMode()) {
$abs_item = get_item_info($dir, $item);
} else {
$abs_item = get_abs_item($dir, $item);
}
if (!$GLOBALS['ext_File']->file_exists($abs_item)) {
ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["fileexist"]);
}
if (!get_show_item($dir, $item)) {
ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["accessfile"]);
}
if ($do_recurse) {
$ok = $GLOBALS['ext_File']->chmodRecursive($abs_item, $mode);
} else {
if (get_is_dir($abs_item)) {
// when we chmod a directory we must care for the permissions
// to prevent that the directory becomes not readable (when the "execute bits" are removed)
$bin = substr_replace($bin, '1', 2, 1);
// set 1st x bit to 1
$bin = substr_replace($bin, '1', 5, 1);
// set 2nd x bit to 1
$bin = substr_replace($bin, '1', 8, 1);
// set 3rd x bit to 1
if (ext_isFTPMode()) {
$mode = decoct(bindec($bin));
} else {
$mode = bindec($bin);
}
}
//ext_Result::sendResult('chmod', false, $GLOBALS['FTPCONNECTION']->pwd());
$ok = @$GLOBALS['ext_File']->chmod($abs_item, $mode);
}
$bin = $old_bin;
}
if ($ok === false || PEAR::isError($ok)) {
$msg = $item . ": " . $GLOBALS["error_msg"]["permchange"];
$msg .= PEAR::isError($ok) ? ' [' . $ok->getMessage() . ']' : '';
ext_Result::sendResult('chmod', false, $msg);
}
ext_Result::sendResult('chmod', true, ext_Lang::msg('permchange'));
return;
}
if (ext_isFTPMode()) {
$abs_item = get_item_info($dir, $GLOBALS['__POST']["selitems"][0]);
} else {
$abs_item = get_abs_item($dir, $GLOBALS['__POST']["selitems"][0]);
$abs_item = utf8_decode($abs_item);
}
$mode = parse_file_perms(get_file_perms($abs_item));
if ($mode === false) {
ext_Result::sendResult('chmod', false, $item . ": " . $GLOBALS["error_msg"]["permread"]);
}
$pos = "rwx";
$text = "";
for ($i = 0; $i < $cnt; ++$i) {
$s_item = get_rel_item($dir, $GLOBALS['__POST']["selitems"][$i]);
if (strlen($s_item) > 50) {
$s_item = "..." . substr($s_item, -47);
//.........这里部分代码省略.........
示例8: copy_move_items
/**
* File/Directory Copy & Move Functions
*/
function copy_move_items($dir)
{
// copy/move file/dir
$action = extGetParam($_REQUEST, 'action');
if (($GLOBALS["permissions"] & 01) != 01) {
ext_Result::sendResult($action, false, $GLOBALS["error_msg"]["accessfunc"]);
}
// Vars
$first = extGetParam($GLOBALS['__POST'], 'first');
if ($first == "y") {
$new_dir = $dir;
} else {
$new_dir = stripslashes($GLOBALS['__POST']["new_dir"]);
}
if ($new_dir == ".") {
$new_dir = "";
}
$cnt = count($GLOBALS['__POST']["selitems"]);
// DO COPY/MOVE
// ALL OK?
if (!@$GLOBALS['ext_File']->file_exists(get_abs_dir($new_dir))) {
ext_Result::sendResult($action, false, get_abs_dir($new_dir) . ": " . $GLOBALS["error_msg"]["targetexist"]);
}
if (!get_show_item($new_dir, "")) {
ext_Result::sendResult($action, false, $new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
}
if (!down_home(get_abs_dir($new_dir))) {
ext_Result::sendResult($action, false, $new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
}
// copy / move files
$err = false;
for ($i = 0; $i < $cnt; ++$i) {
$tmp = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
$new = basename(stripslashes($GLOBALS['__POST']["selitems"][$i]));
if (ext_isFTPMode()) {
$abs_item = get_item_info($dir, $tmp);
$abs_new_item = get_item_info('/' . $new_dir, $new);
} else {
$abs_item = get_abs_item($dir, $tmp);
$abs_new_item = get_abs_item($new_dir, $new);
}
$items[$i] = $tmp;
// Check
if ($new == "") {
$error[$i] = $GLOBALS["error_msg"]["miscnoname"];
$err = true;
continue;
}
if (!@$GLOBALS['ext_File']->file_exists($abs_item)) {
$error[$i] = $GLOBALS["error_msg"]["itemexist"];
$err = true;
continue;
}
if (!get_show_item($dir, $tmp)) {
$error[$i] = $GLOBALS["error_msg"]["accessitem"];
$err = true;
continue;
}
if (@$GLOBALS['ext_File']->file_exists($abs_new_item)) {
$error[$i] = $GLOBALS["error_msg"]["targetdoesexist"];
$err = true;
continue;
}
// Copy / Move
if ($action == "copy") {
if (@is_link($abs_item) || get_is_file($abs_item)) {
// check file-exists to avoid error with 0-size files (PHP 4.3.0)
if (ext_isFTPMode()) {
$abs_item = '/' . $dir . '/' . $abs_item['name'];
}
$ok = @$GLOBALS['ext_File']->copy($abs_item, $abs_new_item);
//||@file_exists($abs_new_item);
} elseif (@get_is_dir($abs_item)) {
$copy_dir = ext_isFTPMode() ? '/' . $dir . '/' . $abs_item['name'] . '/' : $abs_item;
if (ext_isFTPMode()) {
$abs_new_item .= '/';
}
$ok = $GLOBALS['ext_File']->copy_dir($copy_dir, $abs_new_item);
}
} else {
$ok = $GLOBALS['ext_File']->rename($abs_item, $abs_new_item);
}
if ($ok === false || PEAR::isError($ok)) {
$error[$i] = $action == "copy" ? $GLOBALS["error_msg"]["copyitem"] : $GLOBALS["error_msg"]["moveitem"];
if (PEAR::isError($ok)) {
$error[$i] .= ' [' . $ok->getMessage() . ']';
}
$err = true;
continue;
}
$error[$i] = NULL;
}
if ($err) {
// there were errors
$err_msg = "";
for ($i = 0; $i < $cnt; ++$i) {
if ($error[$i] == NULL) {
//.........这里部分代码省略.........
示例9: while
</th>
<th>
<textarea name="tcomments" rows=1 cols=20 ></textarea>
<input type="image" height=35 width=35 src="imgs/add.png" />
</th>
</tr>
</form>
</thead>
<tbody>
<?php
$mysql_q = "\n\t\t\t\t\t\t\t\tSELECT p_trans_id, date, item_id, vendor_id, invoice_id, uprice, qty, comments, timestamp\n\t\t\t\t\t\t\t\tFROM purchase_transactions\n\t\t\t\t\t\t\t\tORDER BY p_trans_id DESC\n\t\t\t\t\t\t\t\t";
$query_res = $dbhi->query($mysql_q);
while ($row = $query_res->fetch_assoc()) {
$item_info = get_item_info($row['item_id'], $dbhi);
$row_style = 'style="color:#d00000"';
if (!empty($row['invoice_id'])) {
$inv_no = get_vendor_invoice($row['invoice_id'], $dbhi);
$invoice_html = "\t<a name='a_invid[]' href='javascript:;'>\n\t\t\t\t\t\t\t\t\t\t\t\t{$inv_no}\n\t\t\t\t\t\t\t\t\t\t\t\t<input type='hidden' name='val_invid[]' value='" . $row['invoice_id'] . "' />\n\t\t\t\t\t\t\t\t\t\t\t</a>";
} else {
$invoice_html = "N/A";
}
echo "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . $row['date'] . "</td>\n\n\t\t\t\t\t\t\t\t<td {$row_style}>\n\t\t\t\t\t\t\t\t\t<a href='transactions.php?iid=" . $row['item_id'] . "'>\n\t\t\t\t\t\t\t\t\t\t" . $item_info['name'] . "\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>\n\t\t\t\t\t\t\t\t\t<a href='vendors.php?vendorid=" . $row['vendor_id'] . "'>\n\t\t\t\t\t\t\t\t\t\t" . get_vendorname($row['vendor_id'], $dbhi) . "\n\t\t\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>{$invoice_html}</td>\n\t\t\t\t\t\t\t\t<td {$row_style} title='" . clean_num($row['uprice']) . "'>" . price2code(clean_num($row['uprice'])) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>" . clean_num($row['qty']) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style} title='" . clean_num($row['uprice'] * $row['qty']) . "'>" . price2code(clean_num($row['uprice'] * $row['qty'])) . "</td>\n\t\t\t\t\t\t\t\t<td {$row_style}>\n\t\t\t\t\t\t\t\t\t<pre style='display:inline;'>" . $row['comments'] . "</pre>\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
}
?>
</tbody>
</table>
</center>
示例10: product_status
function product_status($id)
{
if (!is_admin()) {
header("Location: ?mode=login");
} else {
global $connection;
$status = get_item_info($id)['status'];
$product_owner = get_item_info($id)['seller_ID'];
if ($status == 1) {
$sql = "UPDATE 10153316_item SET status='0' WHERE item_ID='" . sanitize_for_db($connection, $id) . "'";
$result = mysqli_query($connection, $sql);
return "Successfully suspended";
} else {
if ($status == 2) {
$sql = "UPDATE 10153316_item SET status='0' WHERE item_ID='" . sanitize_for_db($connection, $id) . "'";
$result = mysqli_query($connection, $sql);
$del_sell_requests = "UPDATE 10153316_request SET status='6' WHERE status='2' AND sellitem_ID IN (SELECT item_ID FROM 10153316_item WHERE seller_ID = '" . sanitize_for_db($connection, $product_owner) . "')";
$del_sell = mysqli_query($connection, $del_sell_requests);
$del_buy_requests = "UPDATE 10153316_request SET status='6' WHERE status='2' AND buyitem_ID IN (SELECT item_ID FROM 10153316_item WHERE seller_ID = '" . sanitize_for_db($connection, $product_owner) . "')";
$del_buy = mysqli_query($connection, $del_buy_requests);
return "Successfully suspended & deleted";
} else {
if ($status == 0) {
$sql = "UPDATE 10153316_item SET status='1' WHERE item_ID='" . sanitize_for_db($connection, $id) . "'";
$result = mysqli_query($connection, $sql);
return "Successfully un-suspended";
}
}
}
return "No changes!";
}
}
示例11: execAction
function execAction($dir, $item)
{
// rename directory or file
if (($GLOBALS["permissions"] & 01) != 01) {
ext_Result::sendResult('rename', false, $GLOBALS["error_msg"]["accessfunc"]);
}
if (isset($GLOBALS['__POST']["confirm"]) && $GLOBALS['__POST']["confirm"] == "true") {
$newitemname = $GLOBALS['__POST']["newitemname"];
$newitemname = trim(basename(stripslashes($newitemname)));
if ($newitemname == '') {
ext_Result::sendResult('rename', false, $GLOBALS["error_msg"]["miscnoname"]);
}
if (!ext_isFTPMode()) {
$abs_old = get_abs_item($dir, $item);
$abs_new = get_abs_item($dir, $newitemname);
} else {
$abs_old = get_item_info($dir, $item);
$abs_new = get_item_info($dir, $newitemname);
}
if (@$GLOBALS['ext_File']->file_exists($abs_new)) {
ext_Result::sendResult('rename', false, $newitemname . ": " . $GLOBALS["error_msg"]["itemdoesexist"]);
}
$perms_old = $GLOBALS['ext_File']->fileperms($abs_old);
$ok = $GLOBALS['ext_File']->rename(get_abs_item($dir, $item), get_abs_item($dir, $newitemname));
if (ext_isFTPMode()) {
$abs_new = get_item_info($dir, $newitemname);
}
$GLOBALS['ext_File']->chmod($abs_new, $perms_old);
if ($ok === false || PEAR::isError($ok)) {
ext_Result::sendResult('rename', false, 'Could not rename ' . $dir . '/' . $item . ' to ' . $newitemname);
}
$msg = sprintf($GLOBALS['messages']['success_rename_file'], $item, $newitemname);
ext_Result::sendResult('rename', true, $msg);
}
$is_dir = get_is_dir(ext_isFTPMode() ? get_item_info($dir, $item) : get_abs_item($dir, $item));
?>
<div style="width:auto;">
<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>
<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc">
<h3 style="margin-bottom:5px;"><?php
echo $GLOBALS['messages']['rename_file'];
?>
</h3>
<div id="adminForm">
</div>
</div></div></div>
<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>
</div>
<script type="text/javascript">
var simple = new Ext.form.Form({
labelWidth: 75, // label settings here cascade unless overridden
url:'<?php
echo basename($GLOBALS['script_name']);
?>
'
});
simple.add(
new Ext.form.TextField({
fieldLabel: '<?php
echo ext_Lang::msg('newname', true);
?>
',
name: 'newitemname',
value: '<?php
echo str_replace("'", "\\'", stripslashes($item));
?>
',
width:175,
allowBlank:false
})
);
simple.addButton('<?php
echo ext_Lang::msg('btnsave', true);
?>
', function() {
statusBarMessage( 'Please wait...', true );
simple.submit({
//reset: true,
reset: false,
success: function(form, action) {
<?php
if ($is_dir) {
?>
parentDir = dirTree.getSelectionModel().getSelectedNode().parentNode;
parentDir.reload();
parentDir.select();
<?php
} else {
?>
datastore.reload();
<?php
}
?>
statusBarMessage( action.result.message, false, true );
dialog.destroy();
},
failure: function(form, action) {
//.........这里部分代码省略.........
示例12: get_item_info
<div class="product-content">
<?php
$item = get_item_info();
if (!empty($item['item_ID'])) {
global $connection;
$buyitem = mysqli_real_escape_string($connection, $item['item_ID']);
$change_status = "UPDATE 10153316_item SET views = views+1 WHERE item_ID = {$buyitem}";
$res = mysqli_query($connection, $change_status);
}
echo '<div class="container">
<div class="row">
<section class="content">
<div class="col-md-8 col-md-offset-2">
<div class="panel panel-default">
<div class="panel-body">
<div class="table-container">
<img style ="margin: auto" class="img-responsive" src="' . $item['thumbnail'] . '" alt="' . $item['name'] . '">
<div class="caption">
<h4>' . $item['name'] . '</h4>
<p>' . $item['description'] . '</p>
<p>Condition: ' . $item['cond'] . '</p>
<p>Quantity: ' . $item['quantity'] . ' ' . $item['unit'] . '</p>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>';
if (isset($_SESSION['username'])) {
示例13: foreach
</table>
<br>
<table cellspacing=0 id='invoice_p' >
<tr>
<th>#</th>
<th>Item</th>
<th>Unit</th>
<th>Qty</th>
<th>Total</th>
</tr>
<?php
$counter = 1;
$grand_total = 0;
foreach ($transaction_rows as $row_num => $row_value) {
$item_info = get_item_info($row_value['item_id'], $dbhi);
$row_total = $row_value['uprice'] * $row_value['qty'];
$grand_total = $grand_total + $row_total;
echo "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t{$counter}\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td class='itembox'>\n\t\t\t\t\t\t\t\t\t(" . $row_value['item_id'] . ")\n\t\t\t\t\t\t\t\t\t" . $item_info['name'] . "\n\t\t\t\t\t\t";
if (!empty($row_value['comments'])) {
echo "\n\t\t\t\t\t\t\t\t\t<br />\n\t\t\t\t\t\t\t\t\t<span style='font-size:0.8em'>" . $row_value['comments'] . "</span>\n\t\t\t\t\t\t";
}
echo "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t<td>" . clean_num($row_value['uprice']) . "</td>\n\t\t\t\t\t\t\t\t<td>" . clean_num($row_value['qty']) . "</td>\n\t\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t\t\t{$Currency} " . clean_num($row_total) . "\n\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t";
$counter = $counter + 1;
}
?>
</table>
<br>
<table id="invoice_p_foot" border="0">
<tr>
示例14: die
<?php
if (!isset($_GET['iid'])) {
die("_GET[iid] not found");
}
include_once 'config.php';
// MYSQL Connection and Database Selection
$dbhi = new mysqli($mysql_host, $mysql_user, $mysql_pass, $mysql_database);
if (mysqli_connect_errno()) {
die('Could not connect to mysql: ' . mysqli_connect_errno());
}
// ItemID from GET
$current_itemid = $_GET['iid'];
$current_iteminfo = get_item_info($current_itemid, $dbhi);
$current_itemname = $current_iteminfo['name'];
$current_itemsaleprice = $current_iteminfo['sale_price'];
$current_itemdetail = $current_iteminfo['detail'];
$current_stockinfo = get_stock_info($current_itemid, $dbhi);
$current_totalsale = $current_stockinfo['total_sale'];
$current_totalpurchase = $current_stockinfo['total_purchase'];
// If addform is posted, insert values in database
if (!empty($_POST['t_date_val']) && (!empty($_POST['tinvoiceno']) || $_POST['trans_t'] == 'Purchase') && $_POST['tuprice'] > 0 && $_POST['tqty'] > 0) {
echo 'hellooo';
if ($_POST['trans_t'] == 'Sale') {
$sql_q = "INSERT INTO sale_transactions\n\t\t\t\t\t\t\t\t( sale_trans_id, date, item_id, invoice_no, uprice, qty, amount_received, comments, timestamp )\n\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t'" . $_POST['t_date_val'] . "',\n\t\t\t\t\t\t\t\t'" . $_POST['iid'] . "',\n\t\t\t\t\t\t\t\t'" . $_POST['tinvoiceno'] . "',\n\t\t\t\t\t\t\t\t'" . $_POST['tuprice'] . "',\n\t\t\t\t\t\t\t\t'" . $_POST['tqty'] . "',\n\t\t\t\t\t\t\t\t'" . $_POST['tuprice'] * $_POST['tqty'] . "',\n\t\t\t\t\t\t\t\t'" . $_POST['tcomments'] . "',\n\t\t\t\t\t\t\t\t'" . time() . "'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t";
} elseif ($_POST['trans_t'] == 'Purchase') {
$sql_q = "INSERT INTO purchase_transactions\n\t\t\t\t\t\t\t\t( p_trans_id, date, item_id, vendor_id, invoice_id, uprice, qty, comments, timestamp )\n\t\t\t\t\t\tVALUES\t(\n\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t'" . $_POST['t_date_val'] . "',\n\t\t\t\t\t\t\t\t'" . $_POST['iid'] . "',\n\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t'',\n\t\t\t\t\t\t\t\t'" . $_POST['tuprice'] . "',\n\t\t\t\t\t\t\t\t'" . $_POST['tqty'] . "',\n\t\t\t\t\t\t\t\t'" . $_POST['tcomments'] . "',\n\t\t\t\t\t\t\t\t'" . time() . "'\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t";
}
$dbhi->query($sql_q) or die($dbhi->error);
if ($dbhi->affected_rows == 1) {
header("Location: " . $_SERVER['PHP_SELF'] . "?iid=" . $_POST['iid'] . "&submit_success=yes&message=" . $_POST['trans_t'] . " Added");
示例15: copy_move_items
//.........这里部分代码省略.........
echo "<input type=\"hidden\" name=\"selitems[]\" value=\"";
echo $selitem . "\"> " . $s_item . " ";
// New Name
echo "</td><td><input type=\"text\" size=\"25\" name=\"newitems[]\" value=\"";
echo $newitem . "\"></td></tr>\n";
}
// Submit & Cancel
echo "</table><br /><table><tr>\n<td>";
echo "<input type=\"submit\" value=\"";
echo $action != "move" ? $GLOBALS["messages"]["btncopy"] : $GLOBALS["messages"]["btnmove"];
echo "\" onclick=\"javascript:Execute();\"></td>\n<td>";
echo "<input type=\"button\" value=\"" . $GLOBALS["messages"]["btncancel"];
echo "\" onclick=\"javascript:location='" . make_link("list", $dir, NULL);
echo "';\"></td>\n</tr></table><br /></form>\n";
return;
}
// DO COPY/MOVE
// ALL OK?
if (!@$GLOBALS['nx_File']->file_exists(get_abs_dir($new_dir))) {
show_error(get_abs_dir($new_dir) . ": " . $GLOBALS["error_msg"]["targetexist"]);
}
if (!get_show_item($new_dir, "")) {
show_error($new_dir . ": " . $GLOBALS["error_msg"]["accesstarget"]);
}
if (!down_home(get_abs_dir($new_dir))) {
show_error($new_dir . ": " . $GLOBALS["error_msg"]["targetabovehome"]);
}
// copy / move files
$err = false;
for ($i = 0; $i < $cnt; ++$i) {
$tmp = stripslashes($GLOBALS['__POST']["selitems"][$i]);
$new = basename(stripslashes($GLOBALS['__POST']["newitems"][$i]));
if (nx_isFTPMode()) {
$abs_item = get_item_info($dir, $tmp);
$abs_new_item = get_item_info('/' . $new_dir, $new);
} else {
$abs_item = get_abs_item($dir, $tmp);
$abs_new_item = get_abs_item($new_dir, $new);
}
$items[$i] = $tmp;
// Check
if ($new == "") {
$error[$i] = $GLOBALS["error_msg"]["miscnoname"];
$err = true;
continue;
}
if (!@$GLOBALS['nx_File']->file_exists($abs_item)) {
$error[$i] = $GLOBALS["error_msg"]["itemexist"];
$err = true;
continue;
}
if (!get_show_item($dir, $tmp)) {
$error[$i] = $GLOBALS["error_msg"]["accessitem"];
$err = true;
continue;
}
if (@$GLOBALS['nx_File']->file_exists($abs_new_item)) {
$error[$i] = $GLOBALS["error_msg"]["targetdoesexist"];
$err = true;
continue;
}
// Copy / Move
if ($action == "copy") {
if (@is_link($abs_item) || get_is_file($abs_item)) {
// check file-exists to avoid error with 0-size files (PHP 4.3.0)
if (nx_isFTPMode()) {