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


PHP object_2_array函数代码示例

本文整理汇总了PHP中object_2_array函数的典型用法代码示例。如果您正苦于以下问题:PHP object_2_array函数的具体用法?PHP object_2_array怎么用?PHP object_2_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了object_2_array函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: multibox_admin_showpage

function multibox_admin_showpage()
{
    global $main_smarty, $the_template, $db;
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        define('pagename', 'multibox_admin');
        $main_smarty->assign('pagename', pagename);
        define('modulename', 'multibox_admin');
        $main_smarty->assign('modulename', modulename);
        $navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
        $navwhere['link1'] = getmyurl('admin', '');
        $main_smarty->display(multibox_admin_tpl_path . '/blank.tpl');
        $main_smarty = do_sidebar($main_smarty);
        $sql = "SELECT * FROM " . table_totals;
        $results = $db->get_results($sql);
        $main_smarty->assign('results', object_2_array($results));
        if (isset($_REQUEST['action'])) {
            $main_smarty->assign('action', $_REQUEST['action']);
            totals_regenerate();
            $sql = "SELECT * FROM " . table_totals;
            $results = $db->get_results($sql);
            $main_smarty->assign('new_results', object_2_array($results));
        }
        $main_smarty->assign('navbar_where', $navwhere);
        $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
        $main_smarty->assign('tpl_center', multibox_admin_tpl_path . 'multibox_main');
        $main_smarty->display($template_dir . '/admin/admin.tpl');
    } else {
        echo "Page Forbidden";
    }
}
开发者ID:pantofla,项目名称:waterfan,代码行数:33,代码来源:multibox_admin_main.php

示例2: object_2_array

function object_2_array($result)
{
    $array = array();
    foreach ($result as $key => $value) {
        if (is_object($value)) {
            $array[$key] = object_2_array($value);
        } elseif (is_array($value)) {
            $array[$key] = object_2_array($value);
        } else {
            $array[$key] = $value;
        }
    }
    return $array;
}
开发者ID:nilamdoc,项目名称:HitarthOM,代码行数:14,代码来源:MainFile.php

示例3: friends_activity

function friends_activity(&$vars)
{
    global $db, $main_smarty;
    $author_id = $vars['author_id'];
    $linkid = $vars['link_id'];
    //for friends voting activity
    include_once mnminclude . 'friend.php';
    $friend = new Friend();
    $sql = 'SELECT ' . table_votes . '.*, ' . table_users . '.user_id FROM ' . table_votes . ' INNER JOIN ' . table_users . ' ON ' . table_votes . '.vote_user_id = ' . table_users . '.user_id WHERE (((' . table_votes . '.vote_value)>0) AND ((' . table_votes . '.vote_link_id)=' . $linkid . ') AND (' . table_votes . '.vote_type= "links"));';
    $voters = $db->get_results($sql);
    $voters = object_2_array($voters);
    foreach ($voters as $key => $val) {
        $voteduserid = $val['user_id'];
        if ($voteduserid == $friend->get_friend_status($author_id)) {
            $vars['value'] = true;
        }
        $main_smarty->assign('friendvoted', $friendvoted);
    }
}
开发者ID:pantofla,项目名称:waterfan,代码行数:19,代码来源:friends_activity_main.php

示例4: akismet_showpage

function akismet_showpage()
{
    global $main_smarty, $the_template, $current_user, $db;
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('god');
    if ($canIhaveAccess == 1) {
        if (phpnum() >= 5) {
            include_once akismet_lib_path . 'Akismet.class_5.php';
        } else {
            include_once akismet_lib_path . 'Akismet.class_4.php';
        }
        $navwhere['text1'] = 'Akismet';
        $navwhere['link1'] = URL_akismet;
        define('pagename', 'akismet');
        $main_smarty->assign('pagename', pagename);
        define('modulename', 'akismet');
        $main_smarty->assign('modulename', modulename);
        if (isset($_REQUEST['view'])) {
            $view = sanitize($_REQUEST['view'], 3);
        } else {
            $view = '';
        }
        if ($view == '') {
            $wordpress_key = get_misc_data('wordpress_key');
            if ($wordpress_key == '') {
                header('Location: ' . URL_akismet . '&view=manageKey');
            }
            $spam_links = get_misc_data('spam_links');
            if ($spam_links != '') {
                $spam_links = unserialize(get_misc_data('spam_links'));
            } else {
                $spam_links = array();
            }
            $main_smarty->assign('spam_links', $spam_links);
            $main_smarty->assign('spam_links_count', count($spam_links));
            $spam_comments = get_misc_data('spam_comments');
            if ($spam_comments != '') {
                $spam_comments = unserialize(get_misc_data('spam_comments'));
            } else {
                $spam_comments = array();
            }
            $main_smarty->assign('spam_comments', $spam_comments);
            $main_smarty->assign('spam_comments_count', count($spam_comments));
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'main');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageKey') {
            $wordpress_key = get_misc_data('wordpress_key');
            $main_smarty->assign('wordpress_key', $wordpress_key);
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageKey');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'updateKey') {
            if (isset($_REQUEST['key'])) {
                $wordpress_key = sanitize($_REQUEST['key'], 3);
            } else {
                $wordpress_key = '';
            }
            misc_data_update('wordpress_key', $wordpress_key);
            header('Location: ' . URL_akismet);
        }
        if ($view == 'manageSpam') {
            $spam_links = get_misc_data('spam_links');
            if ($spam_links != '') {
                $spam_links = unserialize(get_misc_data('spam_links'));
            } else {
                $spam_links = array();
            }
            if (count($spam_links) > 0) {
                $sql = "SELECT " . table_links . ".* FROM " . table_links . " WHERE ";
                $sql .= 'link_id IN (' . implode(',', $spam_links) . ')';
                $link_data = $db->get_results($sql);
                $main_smarty->assign('link_data', object_2_array($link_data));
            } else {
                header('Location: ' . URL_akismet);
            }
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSpam');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageSettings') {
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSettings');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        /*
        if($view == 'isSpam'){
        	if(isset($_REQUEST['link_id'])){$link_id = sanitize($_REQUEST['link_id'], 3);}else{$link_id='';}
        
        	$spam_links = get_misc_data('spam_links');
        	$spam_links = unserialize(get_misc_data('spam_links'));
        
        	unset($spam_links[$link_id]);
//.........这里部分代码省略.........
开发者ID:pantofla,项目名称:waterfan,代码行数:101,代码来源:akismet_main.php

示例5: category_display

function category_display()
{
    global $db;
    $maincategory = $db->get_results("select * from " . table_categories . "");
    $maincategory = object_2_array($maincategory);
    foreach ($maincategory as $id => $rs) {
        $maincategory[$id]['safename'] = $rs['category_safe_name'];
        $maincategory[$id]['id'] = $rs['category_id'];
        $maincategory[$id]['parent'] = $rs['category_parent'];
        $maincategory[$id]['order'] = $rs['category_order'];
        $childcategory = $db->get_results("select * from " . table_categories . " where category_parent =" . $rs['category_id']);
        //echo "select * from ".table_categories." where category_parent =".$rs['category_id'];
        $childcategory = object_2_array($childcategory);
        foreach ($childcategory as $id => $rc) {
            $childcategory[$id]['safename'] = $rc['category_safe_name'];
            $childcategory[$id]['id'] = $rc['category_id'];
            $childcategory[$id]['parent'] = $rc['category_parent'];
        }
    }
    return $maincategory;
}
开发者ID:pantofla,项目名称:waterfan,代码行数:21,代码来源:html1.php

示例6: show_profile

function show_profile()
{
    global $user, $main_smarty, $the_template, $CSRF, $db;
    $CSRF->create('profile_change', true, true);
    // assign avatar source to smarty
    $main_smarty->assign('UseAvatars', do_we_use_avatars());
    $main_smarty->assign('Avatar', $avatars = get_avatar('all', '', $user->username, $user->email));
    $main_smarty->assign('Avatar_ImgLarge', $avatars['large']);
    $main_smarty->assign('Avatar_ImgSmall', $avatars['small']);
    // module system hook
    $vars = '';
    check_actions('profile_show', $vars);
    // assign profile information to smarty
    $main_smarty->assign('user_id', $user->id);
    $main_smarty->assign('user_email', $user->email);
    $main_smarty->assign('user_login', $user->username);
    $main_smarty->assign('user_names', $user->names);
    $main_smarty->assign('user_username', $user->username);
    $main_smarty->assign('userlevel', $user->level);
    $main_smarty->assign('user_url', $user->url);
    $main_smarty->assign('user_publicemail', $user->public_email);
    $main_smarty->assign('user_location', $user->location);
    $main_smarty->assign('user_occupation', $user->occupation);
    $main_smarty->assign('user_facebook', $user->facebook);
    $main_smarty->assign('user_twitter', $user->twitter);
    $main_smarty->assign('user_linkedin', $user->linkedin);
    $main_smarty->assign('user_googleplus', $user->googleplus);
    $main_smarty->assign('user_skype', $user->skype);
    $main_smarty->assign('user_pinterest', $user->pinterest);
    $main_smarty->assign('user_karma', $user->karma);
    $main_smarty->assign('user_joined', get_date($user->date));
    $main_smarty->assign('user_avatar_source', $user->avatar_source);
    $user->all_stats();
    $main_smarty->assign('user_total_links', $user->total_links);
    $main_smarty->assign('user_published_links', $user->published_links);
    $main_smarty->assign('user_total_comments', $user->total_comments);
    $main_smarty->assign('user_total_votes', $user->total_votes);
    $main_smarty->assign('user_published_votes', $user->published_votes);
    // If the user language setting is NULL, present the site's default language file
    $main_smarty->assign('user_language', !empty($user->language) ? $user->language : pligg_language);
    $languages = array();
    $files = glob("languages/*.conf");
    foreach ($files as $file) {
        if (preg_match('/lang_(.+?)\\.conf/', $file, $m)) {
            $languages[] = $m[1];
        }
    }
    $main_smarty->assign('languages', $languages);
    // pagename
    define('pagename', 'user_edit');
    $main_smarty->assign('pagename', pagename);
    $main_smarty->assign('form_action', $_SERVER["PHP_SELF"]);
    // User Settings
    $user_categories = explode(",", $user->extra_field['user_categories']);
    $categorysql = "SELECT * FROM " . table_categories . " where category__auto_id!='0' ";
    $results = $db->get_results($categorysql);
    $results = object_2_array($results);
    $category = array();
    foreach ($results as $key => $val) {
        $category[] = $val['category_name'];
    }
    #	$sor = $_GET['err'];
    #	if($sor == 1)
    #	{
    #		$err = "You have to select at least 1 category";
    #		$main_smarty->assign('err', $err);
    #	}
    $main_smarty->assign('category', $results);
    $main_smarty->assign('user_category', $user_categories);
    $main_smarty->assign('view_href', 'submitted');
    if (Allow_User_Change_Templates) {
        $dir = "templates";
        $templates = array();
        foreach (scandir($dir) as $file) {
            if (strstr($file, ".") !== 0 && file_exists("{$dir}/{$file}/header.tpl")) {
                $templates[] = $file;
            }
        }
        $main_smarty->assign('templates', $templates);
        $main_smarty->assign('current_template', sanitize($_COOKIE['template'], 3));
        $main_smarty->assign('Allow_User_Change_Templates', Allow_User_Change_Templates);
    }
    // show the template
    $main_smarty->assign('tpl_center', $the_template . '/user_settings_center');
    $main_smarty->display($the_template . '/pligg.tpl');
}
开发者ID:hyrmedia,项目名称:pligg-cms,代码行数:86,代码来源:profile.php

示例7: where

    $main_smarty->assign('view_href', '');
    $main_smarty->assign('nav_mg', 4);
} else {
    $main_smarty->assign('nav_mg', 3);
}
$main_smarty->assign('page_header', $page_header);
$main_smarty->assign('posttitle', $post_title);
/*** view for Search Users ***/
if ($view == 'search') {
    if (isset($_REQUEST['keyword'])) {
        $keyword = $db->escape(sanitize(trim($_REQUEST['keyword']), 3));
    }
    if ($keyword) {
        $searchsql = "SELECT * FROM " . table_users . " where (user_login LIKE '%" . $keyword . "%' OR public_email LIKE '%" . $keyword . "%') AND user_level!='Spammer' ";
        $results = $db->get_results($searchsql);
        $results = object_2_array($results);
        foreach ($results as $key => $val) {
            if ($val['user_login'] != 'anonymous' || $val['user_lastip'] > 0) {
                $results[$key]['Avatar'] = get_avatar('large', "", $val['user_login'], $val['user_email']);
                $results[$key]['add_friend'] = getmyurl('user_add_remove', $val['user_login'], 'addfriend');
                $results[$key]['remove_friend'] = getmyurl('user_add_remove', $val['user_login'], 'removefriend');
                $results[$key]['status'] = $friend->get_friend_status($val['user_id']);
            } else {
                unset($results[$key]);
            }
        }
        $main_smarty->assign('userlist', $results);
    }
    $main_smarty->assign('search', $keyword);
    $main_smarty->assign('page_header', $user->username);
    $navwhere['text3'] = $main_smarty->get_config_vars('PLIGG_Visual_Search_SearchResults') . ' ' . $keyword;
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:31,代码来源:user.php

示例8: akismet_showpage

function akismet_showpage()
{
    global $main_smarty, $the_template, $current_user, $db;
    force_authentication();
    $canIhaveAccess = 0;
    $canIhaveAccess = $canIhaveAccess + checklevel('admin');
    if ($canIhaveAccess == 1) {
        $navwhere['text1'] = 'Akismet';
        $navwhere['link1'] = URL_akismet;
        define('pagename', 'akismet');
        $main_smarty->assign('pagename', pagename);
        define('modulename', 'akismet');
        $main_smarty->assign('modulename', modulename);
        if (isset($_REQUEST['view'])) {
            $view = sanitize($_REQUEST['view'], 3);
        } else {
            $view = '';
        }
        if ($view == '') {
            $wordpress_key = get_misc_data('wordpress_key');
            if ($wordpress_key == '') {
                header('Location: ' . URL_akismet . '&view=manageKey');
                die;
            }
            $main_smarty->assign('spam_links_count', akismet_get_link_count());
            $main_smarty->assign('spam_comments_count', akismet_get_comment_count());
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'main');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'updateKey') {
            if ($_REQUEST['key']) {
                $wordpress_key = sanitize($_REQUEST['key'], 3);
                // Verify key before save
                if (phpnum() >= 5) {
                    include akismet_lib_path . 'Akismet.class_5.php';
                    $akismet = new Akismet(my_base_url . my_pligg_base, $wordpress_key);
                    if (!$akismet->isKeyValid()) {
                        $main_smarty->assign('error', 1);
                    } else {
                        misc_data_update('wordpress_key', $wordpress_key);
                    }
                } else {
                    include akismet_lib_path . 'Akismet.class_4.php';
                    $akismet = new Akismet(my_base_url . my_pligg_base, $wordpress_key);
                    if (!$akismet->_isValidApiKey($wordpress_key)) {
                        $main_smarty->assign('error', 1);
                    } else {
                        misc_data_update('wordpress_key', $wordpress_key);
                    }
                }
            } else {
                $wordpress_key = '';
                misc_data_update('wordpress_key', $wordpress_key);
            }
            $view = 'manageKey';
        }
        if ($view == 'manageKey') {
            $wordpress_key = get_misc_data('wordpress_key');
            $main_smarty->assign('wordpress_key', $wordpress_key);
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageKey');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageSpam') {
            $sql = "SELECT " . table_links . ".*, " . table_users . ".user_login FROM " . table_links . " \r\n\t\t\t\t\tLEFT JOIN " . table_users . " ON link_author=user_id \r\n\t\t\t\t\tLEFT JOIN " . table_prefix . "spam_links ON linkid=link_id\r\n\t\t\t\t\tWHERE !ISNULL(linkid)";
            $link_data = $db->get_results($sql);
            if (sizeof($link_data)) {
                $main_smarty->assign('link_data', object_2_array($link_data));
            } else {
                header("Location: " . my_pligg_base . "/admin/admin_index.php");
                //				header('Location: ' . URL_akismet);
                die;
            }
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSpam');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageSettings') {
            $main_smarty = do_sidebar($main_smarty, $navwhere);
            $main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
            $main_smarty->assign('tpl_center', akismet_tpl_path . 'manageSettings');
            $main_smarty->display($template_dir . '/admin/admin.tpl');
        }
        if ($view == 'manageSpamcomments') {
            $sql = "SELECT * FROM " . table_prefix . "spam_comments ";
            $link_data = $db->get_results($sql);
            if (sizeof($link_data)) {
                $user_cmt = new User();
                $user_cmt_link = new Link();
                $spam_output .= ' <form name="bulk_moderate" action="' . URL_akismet_isSpamcomment . '&action=bulkmod" method="post">';
                $spam_output .= '<table class="table table-bordered table-striped">';
                $spam_output .= "<thead>\r\n\t\t\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t\t\t<th>Author</th>\r\n\t\t\t\t\t\t\t\t\t\t<th>Content</th>\r\n\t\t\t\t\t\t\t\t\t\t<th style='width:65px;text-align:center;'><input type='checkbox' name='all1' onclick='mark_all_spam();' style='display:none;'><a onclick='mark_all_spam();' style='cursor:pointer;text-decoration:none;'>Spam</a></th>\r\n\t\t\t\t\t\t\t\t\t\t<th style='width:80px;text-align:center;'><input type='checkbox' name='all2' onclick='mark_all_notspam();' style='display:none;'><a onclick='mark_all_notspam();' style='cursor:pointer;text-decoration:none;'>Not Spam</a></th>\r\n\t\t\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t\t\t<tbody>";
                foreach ($link_data as $spam_cmts) {
                    $user_cmt->id = $spam_cmts->userid;
                    $user_cmt->read();
                    $user_name = $user_cmt->username;
//.........这里部分代码省略.........
开发者ID:hyrmedia,项目名称:pligg-cms,代码行数:101,代码来源:akismet_main.php

示例9: object_2_array

function object_2_array($result, $cur_depth = 0, $depth_limit = 1000)
{
    // $cur_depth and $depth_limit is used for php 4 only
    // prevents the function from doing extra checking to see if
    // it should 'explore' the object further. saves a few cpu cycles
    // using this because (array)$user will not work in php 4
    $array = array();
    if (isset($result)) {
        foreach ($result as $key => $value) {
            if ($cur_depth < $depth_limit && is_object($value)) {
                $array[$key] = object_2_array($value, $cur_depth + 1, $depth_limit);
            } elseif ($cur_depth < $depth_limit && is_array($value)) {
                $array[$key] = object_2_array($value, $cur_depth + 1, $depth_limit);
            } else {
                $array[$key] = $value;
            }
        }
    }
    return $array;
}
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:20,代码来源:utils.php

示例10: read

 function read()
 {
     global $db, $current_user;
     $id = $this->id;
     if ($this->id > 0) {
         $where = "user_id = {$id}";
     } else {
         if (!empty($this->username)) {
             $where = "user_login='" . $db->escape($this->username) . "'";
         }
     }
     if (!empty($where) && ($user = $db->get_row("SELECT * FROM " . table_users . " WHERE {$where}"))) {
         $this->id = $user->user_id;
         $this->username = $user->user_login;
         $this->level = $user->user_level;
         $date = $user->user_date;
         $this->date = unixtimestamp($date);
         $date = $user->user_modification;
         $this->modification = unixtimestamp($date);
         $this->pass = $user->user_pass;
         $this->email = $user->user_email;
         $this->names = $user->user_names;
         $this->lang = $user->user_lang;
         $this->karma = $user->user_karma;
         $this->public_email = $user->public_email;
         $this->location = $user->user_location;
         $this->occupation = $user->user_occupation;
         $this->url = $user->user_url;
         $this->aim = $user->user_aim;
         $this->msn = $user->user_msn;
         $this->yahoo = $user->user_yahoo;
         $this->gtalk = $user->user_gtalk;
         $this->skype = $user->user_skype;
         $this->irc = $user->user_irc;
         $this->avatar_source = $user->user_avatar_source;
         $this->read = true;
         //$this->extra_field = (array)$user; (does this work in php4 ?!?)
         $this->extra_field = object_2_array($user);
         return true;
     }
     $this->read = false;
     return false;
 }
开发者ID:holsinger,项目名称:openfloor,代码行数:43,代码来源:user.php

示例11: read

 function read($data = "long")
 {
     // $data = long -- return all user data
     // $data = short -- return just basic info
     global $db, $current_user, $cached_users;
     if ($this->id > 0) {
         $where = "user_id = {$this->id}";
     } else {
         if (!empty($this->username)) {
             $where = "user_login='" . $db->escape($this->username) . "'";
             // if we only know the users login, check the cache to see if it's
             // already in there and set $this->id so the code below can find it in the cache.
             foreach ($cached_users as $user) {
                 if ($user->user_login == $this->username) {
                     $this->id = $user->user_id;
                 }
             }
         }
     }
     if (!empty($where)) {
         // this is a simple cache type system
         // when we lookup a user from the DB, store the results in memory
         // in case we need to lookup that user information again
         // good for sites where the content is submitted by the same group of people
         if (isset($cached_users[$this->id])) {
             $user = $cached_users[$this->id];
         } else {
             if (!($user = $db->get_row("SELECT  *  FROM " . table_users . " WHERE {$where}"))) {
                 return false;
             }
             if ($this->id > 0) {
                 //only cache when the id is provided.
                 $cached_users[$this->id] = $user;
             }
         }
         $this->id = $user->user_id;
         $this->username = $user->user_login;
         $this->level = $user->user_level;
         $this->email = $user->user_email;
         $this->avatar_source = $user->user_avatar_source;
         // if short, then stop here
         if ($data == 'short') {
             return true;
         }
         $this->names = $user->user_names;
         $date = $user->user_date;
         $this->date = unixtimestamp($date);
         $date = $user->user_modification;
         $this->modification = unixtimestamp($date);
         $this->pass = $user->user_pass;
         $this->karma = $user->user_karma;
         $this->public_email = $user->public_email;
         $this->location = $user->user_location;
         $this->occupation = $user->user_occupation;
         $this->url = $user->user_url;
         $this->aim = $user->user_aim;
         $this->msn = $user->user_msn;
         $this->yahoo = $user->user_yahoo;
         $this->gtalk = $user->user_gtalk;
         $this->skype = $user->user_skype;
         $this->irc = $user->user_irc;
         $this->read = true;
         $this->extra_field = object_2_array($user, 0, 0);
         return true;
     }
     $this->read = false;
     return false;
 }
开发者ID:pantofla,项目名称:waterfan,代码行数:68,代码来源:user.php

示例12: object_2_array

<?php

include '../../config.php';
$id = $_REQUEST['id'];
$sql = "SELECT featured_image FROM " . table_prefix . "featured WHERE featured_id=" . $id . "";
$news = $db->get_results($sql);
$news = object_2_array($news);
ob_end_clean();
ob_start();
header("Content-type: image/jpeg");
echo $news[0]['featured_image'];
ob_end_flush();
exit;
开发者ID:hyrmedia,项目名称:modules,代码行数:13,代码来源:featured.php

示例13: featured_getdata

function featured_getdata(&$vars)
{
    global $db, $main_smarty, $the_template;
    $featured_sql = "SELECT featured_id, featured_link_id, featured_enabled FROM " . table_prefix . "featured WHERE featured_enabled='Yes' ORDER BY featured_id ASC";
    $featured = $db->get_results($featured_sql);
    $featured = object_2_array($featured);
    for ($i = 0; $i < count($featured); $i++) {
        $news = null;
        $sql_news = "SELECT link_id, link_url, link_title, link_title_url, link_summary, link_date, link_votes, link_comments FROM " . table_prefix . "links WHERE link_id=" . $featured[$i]['featured_link_id'];
        $news = $db->get_results($sql_news);
        foreach ($news as $dblink) {
            $featured[$i]['link_summary'] = str_replace("\n", "<br />", $dblink->link_summary);
            $featured[$i]['link_summary'] = str_replace("’", "'", $featured[$i]['link_summary']);
            $featured[$i]['link_summary'] = str_replace("–", "-", $featured[$i]['link_summary']);
            $featured[$i]['link_summary'] = str_replace("—", "-", $featured[$i]['link_summary']);
            $featured[$i]['link_summary'] = str_replace("“", "\"", $featured[$i]['link_summary']);
            $featured[$i]['link_summary'] = str_replace("”", "\"", $featured[$i]['link_summary']);
            $featured[$i]['link_title'] = $dblink->link_title;
            $featured[$i]['link_date'] = $dblink->link_date;
            $featured[$i]['link_votes'] = $dblink->link_votes;
            $featured[$i]['link_comments'] = $dblink->link_comments;
        }
        $featured[$i]['link_url'] = my_pligg_base . "/story.php?title=" . $dblink->link_title_url;
        $sql = "SELECT * FROM " . table_prefix . "featured ORDER BY featured_id ASC";
        $news = $db->get_results($sql);
        $news = object_2_array($news);
        $main_smarty->assign('news', $news);
    }
    $main_smarty->assign('featured', $featured);
    $var = $main_smarty->fetch(featured_tpl_path . 'featured.tpl');
    $main_smarty->assign('featured', $var);
}
开发者ID:hyrmedia,项目名称:modules,代码行数:32,代码来源:featured_main.php


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