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


PHP unknown::get_var方法代码示例

本文整理汇总了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;
}
开发者ID:escherlat,项目名称:loquacity,代码行数:56,代码来源:function.links.php

示例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();
}
开发者ID:escherlat,项目名称:loquacity,代码行数:22,代码来源:admin.comments.php

示例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"));
}
开发者ID:escherlat,项目名称:loquacity,代码行数:71,代码来源:admin.links.php


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