本文整理汇总了PHP中db::assoc方法的典型用法代码示例。如果您正苦于以下问题:PHP db::assoc方法的具体用法?PHP db::assoc怎么用?PHP db::assoc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类db
的用法示例。
在下文中一共展示了db::assoc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit
function edit()
{
events::observe('save', 'news', 'save');
events::observer();
admin::components('validator', 'redactor');
db::table('news');
db::where('news_id', admin::get('id'));
$row = db::assoc();
f::set($row);
}
示例2: getFile
function getFile()
{
$file_id = params::get('file');
$dir = FILES_ROOT . 'pages/';
db::table('pages_files');
db::where('file_id', $file_id);
$file = db::assoc();
$link = $dir . $file_id . '.' . $file['file_type'];
files::downloadFile($link, $file['file_name'] . '.' . $file['file_type']);
}
示例3: download
function download()
{
$file_id = params::get('file');
db::table('files');
db::where('file_id', $file_id);
$file = db::assoc();
if (db::rows() == 0) {
web::error404();
}
$file_link = FILES_ROOT . 'all/' . $file_id . '.' . $file['file_type'];
files::downloadFile($file_link);
}
示例4: show
function show()
{
$dir = IMAGES_PATH . 'index/';
db::table('images');
db::where('img_set', '1');
db::orderByRand();
$img = db::assoc();
if (db::rows() != 0) {
$file = $dir . $img['img_id'] . '.jpg';
buffer::set('<img src="' . $file . '" width="700" height="360" alt="" />');
}
}
示例5: showOne
function showOne()
{
$news_id = web::getThis();
db::table('news');
db::where('news_pub', '1');
$news = db::assoc();
if (db::rows() == 0) {
web::error404();
}
$news['news_date'] = dt::date2print('%d %F %Y', $news['news_date']);
s::set('page_title', $news['news_title']);
s::set('page_header', $news['news_title']);
s::set($news);
}
示例6: restore
function restore()
{
db::table('admin_log_trash');
db::where('log_id', params::get('log_id'));
$date = date('Y-m-d H:i:s');
db::update('log_restored', $date);
db::table('admin_log_trash');
db::where('log_id', params::get('log_id'));
$row = db::assoc();
if ($row['log_tmpl'] == '1') {
trash::restore(params::get('log_id'), SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/');
} else {
trash::restore(params::get('log_id'));
}
buffer::set(dt::date2print('%H:%i:%s<br />%d %F %y', $date));
}
示例7: load
function load($user_id)
{
if (self::$user) {
return true;
}
db::table('admin_users');
db::where('user_id', $user_id);
db::where('user_pub', 1);
db::limit(1);
self::$user = db::assoc();
if (db::rows() == 0) {
admin::logout();
}
define("ADMIN_USER_ID", $user_id);
define("ADMIN_USER_SITE_ID", self::get('site_id'));
define("ADMIN_USER_GROUP_ID", self::get('group_id'));
s::set('ADMIN_USER_LOGIN', self::get('user_login'));
s::set('ADMIN_USER_ID', $user_id);
return true;
}
示例8: restoreVersion
function restoreVersion($app, $tmpl_file, $version_id)
{
db::table('templates_versions');
db::where('version_id', $version_id);
$row = db::assoc();
$rows = db::rows();
$code = stripslashes($row['version_code']);
$file = SYS_ROOT . 'tmpls/' . ADMIN_SITE . '/' . $app . '/' . $tmpl_file;
header("Content-Type: text/plain; charset=UTF-8");
files::write($file, $code);
if ($rows != 0) {
self::deleteVersion($version_id);
}
router::delQs('restore');
headers::selfQs();
}
示例9: observerMemory
function observerMemory()
{
$cookie = cookie::get(self::$auth_cookie_name);
if ($cookie) {
$err = false;
list($username, $userid, $hash) = explode(',', $cookie);
$userid = intval($userid);
db::table('admin_users');
db::where('user_id', $userid);
$row = db::assoc();
$word = 'legenda';
if (md5($row['user_login'] . $word) != $hash) {
$err = true;
}
if (db::rows() == 0) {
$err = true;
}
if ($err) {
self::logout();
} else {
$_SESSION['ADMIN_AUTH'] = 1;
$_SESSION['ADMIN_USER_ID'] = $userid;
headers::self();
}
}
}
示例10: editsection
function editsection()
{
admin::components('validator');
events::observe('save', 'info', '_savesection');
events::observer();
db::table('info_sections');
db::where('section_id', admin::get('id'));
$section = db::assoc();
f::set($section);
}
示例11: edit
function edit()
{
events::observe('save', 'menus', '_save');
events::observer();
admin::components('tabs', 'validator');
appPages::getPagesSelect(ADMIN_SITE_ID);
appMenus::getMenus(ADMIN_SITE_ID);
$menu_id = admin::get('id');
$pages_in = conf::getPagesIn('menus', $menu_id);
$pages_out = conf::getPagesOut('menus', $menu_id);
if (conf::testPages($pages_in) && conf::testPages($pages_out)) {
f::set('allPages', 1);
f::set('allPagesOut', 0);
} else {
if (conf::testPages($pages_in) && !conf::testPages($pages_out)) {
f::set('allPages', 0);
f::set('allPagesOut', 1);
f::set('pages', $pages_out);
} else {
if (!conf::testPages($pages_in) && !conf::testPages($pages_out)) {
f::set('allPages', 0);
f::set('allPagesOut', 0);
f::set('pages', $pages_in);
} else {
if (!conf::testPages($pages_in) && conf::testPages($pages_out)) {
f::set('allPages', 0);
f::set('allPagesOut', 0);
f::set('pages', $pages_in);
}
}
}
}
db::table('menus');
db::where('menu_id', $menu_id);
$row = db::assoc();
f::set($row);
}
示例12: observerMemory
function observerMemory()
{
$cookie = cookie::get(md5(SERVER));
if ($cookie) {
$err = false;
list($username, $userid, $hash) = explode(',', $cookie);
$userid = intval($userid);
db::table('users');
db::where('user_id', $userid);
$row = db::assoc();
$word = 'legenda';
if (md5($row['user_login'] . $word) != $hash) {
$err = true;
}
if (db::rows() == 0) {
$err = true;
}
if ($err) {
unset($_SESSION['WEB_AUTH']);
$_SESSION['WEB_NO_AUTH'] = 1;
headers::self();
} else {
webUser::setAuth($userid);
headers::self();
}
} else {
$_SESSION['WEB_NO_AUTH'] = 1;
}
}
示例13: edit
function edit()
{
events::observe('save', 'system', 'users', '_save');
events::observer();
admin::components('validator');
$array = ini::parse(SYS_ROOT . 'conf/admin/groups.ini');
foreach ($array as $k => $v) {
s::roll('admin_groups', array('group_name' => $v['name'], 'group_id' => $k));
}
db::table('admin_users');
db::where('user_id', admin::get('id'));
$row = db::assoc();
f::set($row);
}
示例14: getInfoByLogin
function getInfoByLogin($user_login, $name = false)
{
db::table('users');
db::where('user_pub', '1');
db::where('user_login', $user_login);
$user = db::assoc();
if (db::rows() == 0) {
return false;
} else {
if ($name === false) {
return $user;
} else {
if (isset($user[$name])) {
return $user[$name];
} else {
return false;
}
}
}
}
示例15: showSection
function showSection()
{
$section_id = web::getThis();
$item_id = web::getEvent();
if ($item_id !== false) {
buffer::setTmpl('card.html');
self::showCard($item_id, $section_id);
return false;
}
$dir = IMAGES_ROOT . 'sections/';
$dir_path = IMAGES_PATH . 'sections/';
db::table('catalog_sections');
db::where('section_id', $section_id);
$section = db::assoc();
if (db::rows() == 0) {
web::error404();
}
s::set($section);
s::set('page_title', $section['section_name']);
s::set('page_header', $section['section_name']);
$file = $dir . $section['section_id'] . '.jpg';
if (file_exists($file)) {
s::set('section_img', '<img src="' . $dir_path . $section['section_id'] . '.jpg' . '" />');
}
db::table('catalog_items');
db::where('section_id', $section_id);
$r = db::select('item_name', 'item_id', 'item_desc');
$i = 0;
while ($a = mysql_fetch_assoc($r)) {
$i++;
if ($i % 2) {
s::roll('items1', $a);
} else {
s::roll('items2', $a);
}
}
}