本文整理汇总了PHP中unknown::get_var方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown::get_var方法的具体用法?PHP unknown::get_var怎么用?PHP unknown::get_var使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown
的用法示例。
在下文中一共展示了unknown::get_var方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smarty_function_links
/**
*
*
* @param unknown $params
* @param unknown $bBlog (reference)
* @return unknown
*/
function smarty_function_links($params, &$bBlog)
{
$markedlinks = '';
if (!isset($params['sep'])) {
$sep = "<br />";
} else {
$sep = $params['sep'];
}
if (isset($params['presep'])) {
$presep = $params['presep'];
}
// use this for lists
if (isset($params['desc'])) {
$asde = "DESC";
} else {
$asde = "";
}
if (isset($params['ord'])) {
$order = $params['ord'];
} else {
$order = "position";
}
if (isset($params['num'])) {
$max = $params['num'];
} else {
$max = "20";
}
if (isset($params['cat'])) {
$cat = $bBlog->get_var("select categoryid from " . T_CATEGORIES . " where name='" . $params['cat'] . "'");
}
if (isset($params['notcat'])) {
$notcat = $bBlog->get_var("select categoryid from " . T_CATEGORIES . " where name='" . $params['notcat'] . "'");
}
if ($cat) {
$links = $bBlog->get_results("select * from " . T_LINKS . " where category='" . $cat . "' order by " . $order . " " . $asde . " limit " . $max);
} elseif ($notcat) {
$links = $bBlog->get_results("select * from " . T_LINKS . " where category !='" . $notcat . "' order by " . $order . " " . $asde . " limit " . $max);
} else {
$links = $bBlog->get_results("select * from " . T_LINKS . " order by " . $order . " " . $asde . " limit " . $max);
}
if (!empty($links)) {
foreach ($links as $link) {
$url = $link->url;
$nicename = $link->nicename;
$markedlinks .= $presep . '<a href="' . $url . '">' . $nicename . '</a>' . $sep;
}
}
return $markedlinks;
}
示例2: deleteComment
/**
*
*
* @param unknown $bBlog (reference)
* @param unknown $id
*/
function deleteComment(&$bBlog, $id)
{
$id = intval($id);
$postid = $bBlog->get_var('select postid from ' . T_COMMENTS . ' where commentid="' . $id . '"');
$childcount = $bBlog->get_var('select count(*) as c from ' . T_COMMENTS . ' where parentid="' . $id . '" group by commentid');
if ($childcount > 0) {
// there are replies to the comment so we can't delete it.
$bBlog->query('update ' . T_COMMENTS . ' set deleted="true", postername="", posteremail="", posterwebsite="", pubemail=0, pubwebsite=0, commenttext="Deleted Comment" where commentid="' . $val . '"');
} else {
// just delete the comment
$bBlog->query('delete from ' . T_COMMENTS . ' where commentid="' . $id . '"');
}
$newnumcomments = $bBlog->get_var('SELECT count(*) as c FROM ' . T_COMMENTS . ' WHERE postid="' . $postid . '" and deleted="false" group by postid');
$bBlog->query('update ' . T_POSTS . ' set commentcount="' . $newnumcomments . '" where postid="' . $postid . '"');
$bBlog->modifiednow();
}
示例3: admin_plugin_links_run
/**
*
*
* @param unknown $bBlog (reference)
*/
function admin_plugin_links_run(&$bBlog)
{
if (isset($_GET['linkdo'])) {
$linkdo = $_GET['linkdo'];
} elseif (isset($_POST['linkdo'])) {
$linkdo = $_POST['linkdo'];
} else {
$linkdo = '';
}
switch ($linkdo) {
case "New":
// add new link
$maxposition = $bBlog->get_var("select position from " . T_LINKS . " order by position desc limit 0,1");
$position = $maxposition + 10;
$bBlog->query("insert into " . T_LINKS . "\n set nicename='" . my_addslashes($_POST['nicename']) . "',\n url='" . my_addslashes($_POST['url']) . "',\n category='" . my_addslashes($_POST['category']) . "',\n\t position='{$position}'");
break;
case "Delete":
// delete link
$bBlog->query("delete from " . T_LINKS . " where linkid=" . $_POST['linkid']);
break;
case "Save":
// update an existing link
$bBlog->query("update " . T_LINKS . "\n set nicename='" . my_addslashes($_POST['nicename']) . "',\n url='" . my_addslashes($_POST['url']) . "',\n category='" . my_addslashes($_POST['category']) . "'\n where linkid=" . $_POST['linkid']);
break;
case "Up":
$bBlog->query("update " . T_LINKS . " set position=position-15 where linkid=" . $_POST['linkid']);
reorder_links();
break;
case "Down":
$bBlog->query("update " . T_LINKS . " set position=position+15 where linkid=" . $_POST['linkid']);
reorder_links();
break;
default:
// show form
break;
}
if (isset($_GET['catdo'])) {
$catdo = $_GET['catdo'];
} elseif (isset($_POST['catdo'])) {
$catdo = $_POST['catdo'];
} else {
$catdo = '';
}
switch ($catdo) {
case "New":
// add new category
$bBlog->query("insert into " . T_CATEGORIES . "\n set name='" . my_addslashes($_POST['name']) . "'");
break;
case "Delete":
// delete category
// have to remove all references to the category in the links
$bBlog->query("update " . T_LINKS . "\n set linkid=0 where linkid=" . $_POST['categoryid']);
// delete the category
$bBlog->query("delete from " . T_CATEGORIES . " where categoryid=" . $_POST['categoryid']);
break;
case "Save":
// update an existing category
$bBlog->query("update " . T_CATEGORIES . "\n set name='" . my_addslashes($_POST['name']) . "'\n where categoryid=" . $_POST['categoryid']);
break;
default:
// show form
break;
}
$bBlog->assign('ecategories', $bBlog->get_results("select * from " . T_CATEGORIES));
$bBlog->assign('elinks', $bBlog->get_results("select * from " . T_LINKS . " order by position"));
}