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


PHP e107::getDb方法代码示例

本文整理汇总了PHP中e107::getDb方法的典型用法代码示例。如果您正苦于以下问题:PHP e107::getDb方法的具体用法?PHP e107::getDb怎么用?PHP e107::getDb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在e107的用法示例。


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

示例1: chapterIdByTitle

 /**
  * chapter/index and book/index by name callback
  * @param eRequest $request
  */
 public function chapterIdByTitle(eRequest $request)
 {
     $name = $request->getRequestParam('name');
     if ($id = $request->getRequestParam('id')) {
         $request->setRequestParam('name', $id);
         return;
     } elseif (!$name || is_numeric($name)) {
         if (ADMIN) {
             e107::getMessage()->addError("One of your page-chapters is missing a SEF URL value");
         }
         return;
     }
     $sql = e107::getDb('url');
     $name = e107::getParser()->toDB($name);
     if ($sql->select('page_chapters', 'chapter_id', "chapter_sef='{$name}'")) {
         $name = $sql->fetch();
         $request->setRequestParam('id', $name['chapter_id']);
         $request->setRequestParam('type', 'bk');
         e107::getMessage()->addDebug("Set CHAPTER ID =  '" . $name['chapter_id'] . "'");
     } elseif ($sql->select('page', 'page_id', "page_sef='{$name}'")) {
         $name = $sql->fetch();
         $request->setRequestParam('id', $name['page_id']);
         $request->setRequestParam('type', 'id');
         e107::getMessage()->addDebug("Set PAGE ID =  '" . $name['page_id'] . "'");
     } else {
         if (ADMIN) {
             e107::getMessage()->addError("Couldn't find a book, chapter or page with a SEF URL value of '" . $name . "'");
         }
         $request->setRequestParam('id', 0);
     }
 }
开发者ID:armpit,项目名称:e107,代码行数:35,代码来源:sef_chapters_url.php

示例2: sc_newscomments

 function sc_newscomments($parm = null)
 {
     $pref = e107::getPref();
     $sql = e107::getDb();
     if ($this->commentsDisabled || $this->commentsEngine != 'e107') {
         return '';
     }
     $news_item = $this->news_item;
     $param = $this->param;
     if ($param['current_action'] == 'extend') {
         return LAN_NEWS_99 . ' (' . $news_item['news_comment_total'] . ')';
     }
     if (vartrue($pref['multilanguage'])) {
         // Can have multilanguage news table, monlingual comment table. If the comment table is multilingual, it'll only count entries in the current language
         $news_item['news_comment_total'] = $sql->count("comments", "(*)", "WHERE comment_item_id='" . $news_item['news_id'] . "' AND comment_type='0' ");
     }
     //XXX - ??? - another query? We should cache it in news table.
     if ($pref['comments_icon'] && $news_item['news_comment_total']) {
         $sql->select('comments', 'comment_datestamp', "comment_item_id='" . intval($news_item['news_id']) . "' AND comment_type='0' ORDER BY comment_datestamp DESC LIMIT 0,1");
         list($comments['comment_datestamp']) = $sql->fetch();
         $latest_comment = $comments['comment_datestamp'];
         if ($latest_comment > USERLV) {
             $NEWIMAGE = $param['image_new_small'];
         } else {
             $NEWIMAGE = $param['image_nonew_small'];
         }
     } else {
         $NEWIMAGE = $param['image_nonew_small'];
     }
     if (deftrue('BOOTSTRAP')) {
         $NEWIMAGE = "";
     }
     return !$news_item['news_allow_comments'] ? '' . ($pref['comments_icon'] ? $NEWIMAGE . ' ' : '') . "<a title='Comments' href='" . e107::getUrl()->create('news/view/item', $news_item) . "'>" . $param['commentlink'] . intval($news_item['news_comment_total']) . '</a>' : vartrue($param['commentoffstring'], 'Disabled');
 }
开发者ID:gitye,项目名称:e107,代码行数:34,代码来源:news_shortcodes.php

示例3: getListData

 function getListData()
 {
     $sql = e107::getDb();
     $tp = e107::getParser();
     $list_caption = $this->parent->settings['caption'];
     $list_display = $this->parent->settings['open'] ? "" : "none";
     if ($this->parent->mode == "new_page" || $this->parent->mode == "new_menu") {
         $lvisit = $this->parent->getlvisit();
         $qry = "cb_datestamp>" . $lvisit;
     } else {
         $qry = "cb_id != '0' ";
     }
     $qry .= " ORDER BY cb_datestamp DESC LIMIT 0," . intval($this->parent->settings['amount']);
     $bullet = $this->parent->getBullet($this->parent->settings['icon']);
     if (!($chatbox_posts = $this->parent->e107->sql->gen("SELECT * FROM #chatbox WHERE " . $qry))) {
         $list_data = LIST_CHATBOX_2;
     } else {
         while ($row = $this->parent->e107->sql->fetch()) {
             $cb_id = substr($row['cb_nick'], 0, strpos($row['cb_nick'], "."));
             $cb_nick = substr($row['cb_nick'], strpos($row['cb_nick'], ".") + 1);
             $cb_message = $row['cb_blocked'] ? CHATBOX_L6 : str_replace("<br />", " ", $tp->toHTML($row['cb_message']));
             $rowheading = $this->parent->parse_heading($cb_message);
             $record['icon'] = $bullet;
             $record['heading'] = $rowheading;
             $record['author'] = $this->parent->settings['author'] ? $cb_id != 0 ? "<a href='" . e_BASE . "user.php?id.{$cb_id}'>" . $cb_nick . "</a>" : $cb_nick : "";
             $record['category'] = "";
             $record['date'] = $this->parent->settings['date'] ? $row['cb_datestamp'] ? $this->parent->getListDate($row['cb_datestamp']) : "" : "";
             $record['info'] = "";
             $list_data[] = $record;
         }
     }
     //return array with 'records', (global)'caption', 'display'
     return array('records' => $list_data, 'caption' => $list_caption, 'display' => $list_display);
 }
开发者ID:armpit,项目名称:e107,代码行数:34,代码来源:e_list.php

示例4: getHookImages

function getHookImages($hook, $count)
{
    $sql = e107::getDb();
    $pref = e107::pref('imggregator');
    $count = isset($count) ? $count : $pref['imagesToFetch'];
    $tokens = explode(';', $sql->retrieve('hooks', 'hook_tokens', 'hook_name="' . $hook . '"'));
    if ($hook == 'instagram') {
        $user_id = explode(':', $tokens[0]);
        $access_token = explode(':', $tokens[1]);
        $url = fetchData('https://api.instagram.com/v1/users/' . $user_id[1] . '/media/recent/?access_token=' . $access_token[1] . '&count=' . $count);
        $result = json_decode($url);
        $i = 0;
        foreach ($result->data as $image) {
            copy($image->images->standard_resolution->url, 'images/instagram' . $i . '.jpg');
            $i++;
            //$images[] = $image->images->standard_resolution->url;
        }
    } else {
        if ($hook == 'flickr') {
            $user_id = explode(':', $tokens[0]);
            $api_key = explode(':', $tokens[1]);
            $xml = simplexml_load_file('https://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=' . $api_key[1] . '&user_id=' . urlencode($user_id[1]) . '&format=rest');
            $i = 0;
            foreach ($xml->photos->photo as $photo) {
                if ($photo['ispublic'] == 1) {
                    copy('https://farm' . $photo['farm'] . '.staticflickr.com/' . $photo['server'] . '/' . $photo['id'] . '_' . $photo['secret'] . '.jpg', 'images/flickr' . $i . '.jpg');
                    $i++;
                    //$images[] .= 'https://farm'.$photo['farm'].'.staticflickr.com/'.$photo['server'].'/'.$photo['id'].'_'.$photo['secret'].'.jpg';
                }
            }
        }
    }
    return $images;
}
开发者ID:septor,项目名称:imggregator,代码行数:34,代码来源:_class.php

示例5: forum_thread_moderate

function forum_thread_moderate($p)
{
    $e107 = e107::getInstance();
    $sql = e107::getDb();
    foreach ($p as $key => $val) {
        if (preg_match("#(.*?)_(\\d+)_x#", $key, $matches)) {
            $act = $matches[1];
            $id = (int) $matches[2];
            switch ($act) {
                case 'lock':
                    $sql->update('forum_thread', 'thread_active=0 WHERE thread_id=' . $id);
                    return LAN_FORUM_CLOSE;
                    break;
                case 'unlock':
                    $sql->update('forum_thread', 'thread_active=1 WHERE thread_id=' . $id);
                    return LAN_FORUM_OPEN;
                    break;
                case 'stick':
                    $sql->update('forum_thread', 'thread_sticky=1 WHERE thread_id=' . $id);
                    return LAN_FORUM_STICK;
                    break;
                case 'unstick':
                    $sql->update('forum_thread', 'thread_sticky=0 WHERE thread_id=' . $id);
                    return LAN_FORUM_UNSTICK;
                    break;
                case 'deleteThread':
                    return forumDeleteThread($id);
                    break;
                case 'deletePost':
                    return forumDeletePost($id);
                    break;
            }
        }
    }
}
开发者ID:armpit,项目名称:e107,代码行数:35,代码来源:forum_mod.php

示例6: config

 /**
  * Configuration Fields.
  * @return array
  */
 public function config($menu = '')
 {
     $fields = array();
     $categories = array();
     $tmp = e107::getDb()->retrieve('news_category', 'category_id,category_name', null, true);
     foreach ($tmp as $val) {
         $id = $val['category_id'];
         $categories[$id] = $val['category_name'];
     }
     switch ($menu) {
         case "latestnews":
             $fields['caption'] = array('title' => LAN_CAPTION, 'type' => 'text', 'multilan' => true, 'writeParms' => array('size' => 'xxlarge'));
             $fields['count'] = array('title' => LAN_LIMIT, 'type' => 'text', 'writeParms' => array('pattern' => '[0-9]*', 'size' => 'mini'));
             $fields['category'] = array('title' => LAN_CATEGORY, 'type' => 'dropdown', 'writeParms' => array('optArray' => $categories, 'default' => 'blank'));
             break;
         case "news_categories":
             $fields['caption'] = array('title' => LAN_CAPTION, 'type' => 'text', 'multilan' => true, 'writeParms' => array('size' => 'xxlarge'));
             $fields['count'] = array('title' => LAN_LIMIT, 'type' => 'text', 'writeParms' => array('pattern' => '[0-9]*'));
             break;
         case "news_months":
             $fields['showarchive'] = array('title' => "Display Archive Link", 'type' => 'boolean');
             $fields['year'] = array('title' => "Year", 'type' => 'text', 'writeParms' => array('pattern' => '[0-9]*', 'size' => 'mini'));
             break;
         case "other_news":
         case "other_news2":
             $fields['caption'] = array('title' => LAN_CAPTION, 'type' => 'text', 'multilan' => true, 'writeParms' => array('size' => 'xxlarge'));
             break;
     }
     return $fields;
 }
开发者ID:KonzolozZ,项目名称:e107,代码行数:34,代码来源:e_menu.php

示例7: install_post

 /**
  * For inserting default database content during install after table has been created by the test_sql.php file. 
  */
 function install_post($var)
 {
     $sql = e107::getDb();
     $mes = e107::getMessage();
     /*
     		$e107_test = array(
     			'test_id'				=>'1',
     			'test_icon'			=>'{e_PLUGIN}test/images/test_32.png',
     			'test_type'			=>'type_1',
     			'test_name'			=>'My Name',
     			'test_folder'			=>'Folder Value',
     			'test_version'			=>'1',
     			'test_author'			=>'bill',
     			'test_authorURL'		=>'http://e107.org',
     			'test_date'			=>'1352871240',
     			'test_compatibility'	=>'2',
     			'test_url'				=>'http://e107.org'
     		);
     		
     		if($sql->insert('test',$e107_test))
     		{
     			$mes->add("Custom - Install Message.", E_MESSAGE_SUCCESS);
     		}
     		else
     		{
     			$mes->add("Custom - Failed to add default table data.", E_MESSAGE_ERROR);	
     		}*/
 }
开发者ID:Janvrensburg,项目名称:jobtest,代码行数:31,代码来源:test_setup.php

示例8: iconpicker_shortcode

function iconpicker_shortcode($parm)
{
    $parms = array();
    parse_str($parm, $parms);
    $name = varset($parms['id']);
    $sql = e107::getDb();
    $frm = e107::getForm();
    $tp = e107::getParser();
    // $sc_parameters is currently being used to select the media-category.
    $qry = "SELECT * FROM `#core_media` WHERE media_userclass IN (" . USERCLASS_LIST . ") ";
    $qry .= vartrue($sc_parameters) ? " AND media_category = '" . $sc_parameters . "' " : " AND `media_category` REGEXP '_icon_16|_icon_32|_icon_48|_icon_64' ";
    $qry .= "ORDER BY media_category,media_name";
    $str = "";
    $size_section = array();
    $lastsize = "16";
    if ($sql->db_Select_gen($qry)) {
        while ($row = $sql->db_Fetch()) {
            list($tmp, $tmp2, $size) = explode("_", $row['media_category']);
            if ($str != '' && $size != $lastsize) {
                $size_section[] = $str;
                $str = "";
            }
            $str .= "<a href='#" . $row['media_url'] . "' title='{$filepath}' onclick=\"e107Helper.insertText('{$row['media_url']}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='" . $tp->replaceConstants($row['media_url'], 'abs') . "' alt='{$row['media_name']}' /></a>";
            $lastsize = $size;
        }
        return '<div id="' . $name . '-iconpicker-ajax"><div class="field-spacer iconpicker">' . str_replace('%%size%%', '', implode('</div><div class="field-spacer iconpicker">', $size_section)) . '</div></div>';
    }
}
开发者ID:armpit,项目名称:e107,代码行数:28,代码来源:iconpicker.php

示例9: renderBanner

 public function renderBanner($row)
 {
     $sql = e107::getDb('banner');
     $tp = e107::getParser();
     if (!$row['banner_image']) {
         return "<a href='" . e_HTTP . 'banner.php?' . $row['banner_id'] . "' rel='external'>no image assigned to this banner</a>";
     }
     $fileext1 = substr(strrchr($row['banner_image'], '.'), 1);
     $sql->update('banner', 'banner_impressions=banner_impressions+1 WHERE banner_id=' . (int) $row['banner_id']);
     switch ($fileext1) {
         case 'swf':
             return "\n\t\t\t\t\t<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"468\" height=\"60\">\n\n\t\t\t\t\t<param name=\"movie\" value=\"" . e_IMAGE_ABS . "banners/" . $row['banner_image'] . "\">\n\n\t\t\t\t\t<param name=\"quality\" value=\"high\">\n\n\t\t\t\t\t<param name=\"SCALE\" value=\"noborder\">\n\n\t\t\t\t\t<embed src=\"" . e_IMAGE_ABS . "banners/" . $row['banner_image'] . "\" width=\"468\" height=\"60\" scale=\"noborder\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\"></embed>\n\t\t\t\t\t</object>\n\t\t\t\t\t";
             break;
         case 'html':
         case 'js':
         case 'php':
             // Code - may 'echo' text, or may return it as a value
             $file_data = file_get_contents(e_IMAGE . 'banners/' . $row['banner_image']);
             return $file_data;
             break;
         default:
             $src = $row['banner_image'][0] == '{' ? $tp->thumbUrl($row['banner_image']) : e_IMAGE_ABS . 'banners/' . $row['banner_image'];
             $ban_ret = "<img class='e-banner img-responsive' src='" . $src . "' alt='" . $row['banner_clickurl'] . "' style='border:0' />";
             break;
     }
     return "<a class='e-tip' href='" . e_HTTP . 'banner.php?' . $row['banner_id'] . "' rel='external' title=\"" . $tp->toAttribute($row['banner_description']) . "\">" . $ban_ret . '</a>';
 }
开发者ID:gitter-badger,项目名称:e107,代码行数:27,代码来源:e_shortcode.php

示例10: unanswered

 function unanswered()
 {
     $sql = e107::getDb();
     $tp = e107::getParser();
     $limit = 25;
     $count = $sql->retrieve('faqs', 'faq_id', "faq_answer=''  ", true);
     $existing = $sql->retrieve('faqs', 'faq_id,faq_question,faq_datestamp', "faq_answer=''  ORDER BY faq_datestamp DESC LIMIT " . $limit, true);
     if (empty($existing)) {
         return;
     }
     $questions = array();
     foreach ($existing as $row) {
         $questions[] = "<i>" . $row['faq_question'] . "</i><br /><small>" . $tp->toDate($row['faq_datestamp'], 'short') . "</small>\n";
         //	$questions[] = $row['faq_question'];
     }
     //
     //	$questions = array( "<i>Test Question</i><br /><small>".$tp->toDate(time(),'short')."</small>");
     $name = SITENAME . " Automation";
     $email = e107::pref('core', 'siteadminemail');
     $name = e107::pref('core', 'siteadmin');
     $link = $tp->replaceConstants("{e_PLUGIN}faqs/admin_config.php?mode=main&action=list&filter=pending", 'full');
     $body = "<h2>" . count($count) . " Unuanswered Questions at " . SITENAME . "</h2>To answer these questions, please login to " . SITENAME . " and then <a href='{$link}'>click here</a>.<br />\n\t\t\tThe " . $limit . " most recent questions are displayed below.\n\t\t\t<ul><li>" . implode("</li><li>", $questions) . "</li></ul>";
     $eml = array('subject' => count($count) . " Unuanswered Question as of " . date('d-M-Y') . " ", 'sender_name' => SITENAME . " Automation", 'html' => true, 'template' => 'default', 'body' => $body);
     e107::getEmail()->sendEmail($email, $name, $eml);
 }
开发者ID:armpit,项目名称:e107,代码行数:25,代码来源:e_cron.php

示例11: data

 /**
  * Compile RSS Data
  * @param $parms array	url, limit, id 
  * @return array
  */
 function data($parms = '')
 {
     $sql = e107::getDb();
     $rss = array();
     $i = 0;
     if ($items = $sql->select('chatbox', "*", "cb_blocked=0 ORDER BY cb_datestamp DESC LIMIT 0," . $parms['limit'])) {
         while ($row = $sql->fetch()) {
             $tmp = explode(".", $row['cb_nick']);
             $rss[$i]['author'] = $tmp[1];
             $rss[$i]['author_email'] = '';
             $rss[$i]['link'] = "chatbox_menu/chat.php?" . $row['cb_id'];
             $rss[$i]['linkid'] = $row['cb_id'];
             $rss[$i]['title'] = '';
             $rss[$i]['description'] = $row['cb_message'];
             $rss[$i]['category_name'] = '';
             $rss[$i]['category_link'] = '';
             $rss[$i]['datestamp'] = $row['cb_datestamp'];
             $rss[$i]['enc_url'] = "";
             $rss[$i]['enc_leng'] = "";
             $rss[$i]['enc_type'] = "";
             $i++;
         }
     }
     return $rss;
 }
开发者ID:armpit,项目名称:e107,代码行数:30,代码来源:e_rss.php

示例12: getlinks

 function getlinks($cat = 1)
 {
     $this->eLinkList = array();
     // clear the array in case getlinks is called 2x on the same page.
     $sql = e107::getDb('sqlSiteLinks');
     $ins = $cat > 0 ? "link_category = " . intval($cat) . " AND " : "";
     $query = "SELECT * FROM #links WHERE " . $ins . "  link_class IN (" . USERCLASS_LIST . ") ORDER BY link_order ASC";
     if ($sql->db_Select_gen($query)) {
         while ($row = $sql->db_Fetch()) {
             if ($row['link_sefurl']) {
                 $this->sefList[$row['link_sefurl']] = $row['link_url'];
             }
             //	if (substr($row['link_name'], 0, 8) == 'submenu.'){
             //		$tmp=explode('.', $row['link_name'], 3);
             //		$this->eLinkList[$tmp[1]][]=$row;
             if (isset($row['link_parent']) && $row['link_parent'] != 0) {
                 $this->eLinkList['sub_' . $row['link_parent']][] = $row;
             } else {
                 $this->eLinkList['head_menu'][] = $row;
                 if (vartrue($row['link_function'])) {
                     list($path, $method) = explode("::", $row['link_function']);
                     if (include_once e_PLUGIN . $path . "/e_sitelink.php") {
                         $class = $path . "_sitelinks";
                         $sublinkArray = e107::callMethod($class, $method);
                         //TODO Cache it.
                         if (vartrue($sublinkArray)) {
                             $this->eLinkList['sub_' . $row['link_id']] = $sublinkArray;
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:notzen,项目名称:e107,代码行数:34,代码来源:sitelinks_class.php

示例13: colorizeLine

function colorizeLine($line)
{
    $starPlayers = e107::getDb()->retrieve('starPlayers', '*', '', true);
    $words = explode(" ", $line);
    if (!empty($starPlayers[0])) {
        foreach ($starPlayers as $player) {
            $usernames = explode(',', $player['usernames']);
            $colorIt = false;
            foreach ($usernames as $username) {
                if (strpos($words[0], $username) !== false) {
                    $colorIt = true;
                }
            }
            if ($colorIt) {
                $newLine = '<span style="color:' . $player['hexcolor'] . ';">' . $line . '</span>';
                break;
            } else {
                $newLine = $line;
            }
        }
        $output = $newLine;
    } else {
        $output = $line;
    }
    return $output;
}
开发者ID:septor,项目名称:urkQuotes,代码行数:26,代码来源:_class.php

示例14: sc_oneliner

 function sc_oneliner($parm = '')
 {
     $sql = e107::getDb();
     $icon = $this->var['current']['icon'];
     $oneliners = $sql->retrieve('forecasty_oneliners', '*', "`condition`='" . $icon . "' AND `vulgarity`='" . e107::pref('forecasty', 'vulgarity') . "'", true);
     return $oneliners[array_rand($oneliners)]['line'];
 }
开发者ID:gitter-badger,项目名称:forecasty,代码行数:7,代码来源:forecasty_shortcodes.php

示例15: install_post

 function install_post($var)
 {
     e107::includeLan(e_PLUGIN . 'featurebox/languages/' . e_LANGUAGE . '_admin_featurebox.php');
     $mes = e107::getMessage();
     $query = array();
     $query['fb_category_id'] = 0;
     $query['fb_category_title'] = 'General';
     $query['fb_category_template'] = 'default';
     $query['fb_category_random'] = 0;
     $query['fb_category_class'] = e_UC_PUBLIC;
     $query['fb_category_limit'] = 1;
     $inserted = e107::getDb()->db_Insert('featurebox_category', $query);
     $status = $inserted ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
     $mes->add(FBLAN_INSTALL_01, $status);
     if ($inserted) {
         $query = array();
         $query['fb_id'] = 0;
         $query['fb_category'] = $inserted;
         $query['fb_title'] = 'Default Title';
         $query['fb_text'] = 'Default Message';
         $query['fb_mode'] = 0;
         $query['fb_class'] = e_UC_PUBLIC;
         $query['fb_rendertype'] = 0;
         $query['fb_template'] = 'default';
         $query['fb_order'] = 0;
         $query['fb_image'] = '';
         $query['fb_imageurl'] = '';
         $status = e107::getDb('sql2')->db_Insert('featurebox', $query) ? E_MESSAGE_SUCCESS : E_MESSAGE_ERROR;
     } else {
         $status = E_MESSAGE_ERROR;
     }
     $mes->add(FBLAN_INSTALL_02, $status);
 }
开发者ID:notzen,项目名称:e107,代码行数:33,代码来源:featurebox_setup.php


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