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


PHP iif函数代码示例

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


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

示例1: search_gallery

function search_gallery($items, $conn)
{
    global $set, $db, $apx, $user;
    require_once BASEDIR . getmodulepath('gallery') . 'functions.php';
    //Suchstring generieren
    $tagmatches = gallery_match_tags($items);
    foreach ($items as $item) {
        $tagmatch = array_shift($tagmatches);
        $search1[] = "caption LIKE '" . addslashes_like($item) . "'";
        $search2[] = " ( " . iif($tagmatch, " id IN (" . implode(',', $tagmatch) . ") OR ") . " title LIKE '%" . addslashes_like($item) . "%' OR description LIKE '%" . addslashes_like($item) . "%' ) ";
    }
    $searchstring1 = implode($conn, $search1);
    $searchstring2 = implode($conn, $search2);
    //Bilder durchsuchen
    $data = $db->fetch("SELECT galid FROM " . PRE . "_gallery_pics WHERE ( active='1' AND ( " . $searchstring1 . " ) ) GROUP BY galid");
    $galids = get_ids($data, 'galid');
    if (count($galids)) {
        $picres = " id IN (" . @implode(',', $galids) . ") OR ";
    }
    //Ergebnisse
    $data = $db->fetch("SELECT id,title FROM " . PRE . "_gallery WHERE ( searchable='1' AND '" . time() . "' BETWEEN starttime AND endtime " . section_filter() . " AND ( " . $picres . " ( " . $searchstring2 . " ) ) ) ORDER BY title ASC");
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            $result[$i]['TITLE'] = strip_tags($res['title']);
            $result[$i]['LINK'] = mklink('gallery.php?id=' . $res['id'], 'gallery,list' . $res['id'] . ',1' . urlformat($res['title']) . '.html');
        }
    }
    return $result;
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:30,代码来源:search.php

示例2: misc_productsfeed

function misc_productsfeed()
{
    global $set, $db, $apx;
    $apx->tmpl->loaddesign('blank');
    header('Content-type: application/rss+xml');
    $apx->lang->drop('types', 'products');
    $type = $_REQUEST['type'];
    $alltypes = array('normal', 'game', 'software', 'hardware', 'music', 'movie', 'book');
    if (!in_array($type, $alltypes)) {
        $type = '';
    }
    $data = $db->fetch("SELECT * FROM " . PRE . "_products WHERE active='1' " . iif($type, " AND type='" . $type . "'") . " ORDER BY addtime DESC LIMIT 20");
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            //Link
            $link = mklink('products.php?id=' . $res['id'], 'products,id' . $res['id'] . urlformat($res['title']) . '.html');
            $tabledata[$i]['ID'] = $res['id'];
            $tabledata[$i]['TITLE'] = rss_replace($res['title']);
            $tabledata[$i]['TIME'] = date('r', $res['starttime']);
            //Kein TIMEDIFF weil Zeitverschiebung mit angegeben!
            $tabledata[$i]['TEXT'] = rss_replace(preg_replace('#{IMAGE\\(([0-9]+)\\)}#s', '', $res['text']));
            $tabledata[$i]['TYPE'] = $res['type'];
            $tabledata[$i]['LINK'] = HTTP_HOST . $link;
        }
    }
    $apx->tmpl->assign('WEBSITENAME', $set['main']['websitename']);
    $apx->tmpl->assign('PRODUCT', $tabledata);
    $apx->tmpl->parse('rss', 'products');
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:30,代码来源:misc.php

示例3: toparea_cmp

 function toparea_cmp($a, $b)
 {
     if ($a['forumid'] == -1) {
         return -1;
     }
     return iif($a['total'] > $b['total'], -1, iif($a['total'] < $b['total'], 1, iif($a['count'] > $b['count'], -1, iif($a['count'] < $b['count'], 1, 0))));
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:7,代码来源:hook_kbank_tops.php

示例4: get_product_list

function get_product_list($select = 0, $ignore = 0)
{
    global $apx, $db, $set;
    $select = (int) $select;
    //Leeres Feld
    $list = '<option value=""></option>';
    //Sprachplatzhalter dropen
    $apx->lang->drop('type', 'products');
    //Auslesen
    $lasttype = '';
    $data = $db->fetch("SELECT id,type,title FROM " . PRE . "_products WHERE active='1' ORDER BY type ASC,title ASC");
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            if ($ignore == $res['id']) {
                continue;
            }
            //Gruppieren
            if ($res['type'] != $lasttype) {
                if ($lasttype) {
                    $list .= '</optgroup>';
                }
                $list .= '<optgroup label="' . $apx->lang->get('PRODTYPE_' . strtoupper($res['type'])) . '">';
            }
            $list .= '<option value="' . $res['id'] . '"' . iif($res['id'] == $select, ' selected="selected"') . '>' . replace($res['title']) . '</option>';
            $lasttype = $res['type'];
        }
        if ($lasttype) {
            $list .= '</optgroup>';
        }
    }
    return $list;
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:33,代码来源:admin_system.php

示例5: cache_award_cats

function cache_award_cats($award_cat_id = -1, $depth = 0, $display_award_cat_id = 0)
{
    // returns an array of award cats with correct parenting and depth information
    // see makeforumchooser for an example of usage
    global $db, $award_cat_cache, $count;
    static $fcache, $i;
    if (!is_array($fcache)) {
        // check to see if we have already got the results from the database
        $fcache = array();
        $award_cats = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "award_cat\n\t\t" . iif($display_award_cat_id, "WHERE award_cat_id = {$display_award_cat_id}", '') . "\n\t\t\tORDER BY award_cat_displayorder\n\t\t");
        while ($award_cat = $db->fetch_array($award_cats)) {
            if ($display_award_cat_id) {
                $award_cat[award_cat_parentid] = -1;
            }
            $fcache["{$award_cat['award_cat_parentid']}"]["{$award_cat['award_cat_displayorder']}"]["{$award_cat['award_cat_id']}"] = $award_cat;
        }
    }
    // database has already been queried
    if (is_array($fcache["{$award_cat_id}"])) {
        foreach ($fcache["{$award_cat_id}"] as $holder) {
            foreach ($holder as $award_cat) {
                $award_cat_cache["{$award_cat['award_cat_id']}"] = $award_cat;
                $award_cat_cache["{$award_cat['award_cat_id']}"]['depth'] = $depth;
                unset($fcache["{$award_cat_id}"]);
                cache_award_cats($award_cat['award_cat_id'], $depth + 1, $display_award_cat_id);
            }
            // end foreach ($val1 AS $key2 => $forum)
        }
        // end foreach ($fcache["$forumid"] AS $key1 => $val1)
    }
    // end if (found $fcache["$forumid"])
}
开发者ID:0hyeah,项目名称:yurivn,代码行数:32,代码来源:awards.php

示例6: get_catlist

 function get_catlist($selected = null)
 {
     global $set, $db, $apx;
     if (is_null($selected)) {
         $selected = $_POST['catid'];
     }
     $catlist = '<option></option>';
     if ($set['news']['subcats']) {
         $data = $this->cat->getTree(array('title', 'open', 'forgroup'));
     } else {
         $data = $db->fetch("SELECT id,title,open,forgroup FROM " . PRE . "_news_cat ORDER BY title ASC");
     }
     if (!count($data)) {
         return '';
     }
     foreach ($data as $res) {
         $allowed = unserialize($res['forgroup']);
         if ($res['level']) {
             $space = str_repeat('&nbsp;&nbsp;', $res['level'] - 1);
         }
         if ($res['open'] && ($res['forgroup'] == 'all' || is_array($allowed) && in_array($apx->user->info['groupid'], $allowed))) {
             $catlist .= '<option value="' . $res['id'] . '" ' . iif($selected == $res['id'], ' selected="selected"') . ' style="color:green;">' . $space . replace($res['title']) . '</option>';
         } else {
             $catlist .= '<option value="" disabled="disabled">' . $space . replace($res['title']) . '</option>';
         }
     }
     return $catlist;
 }
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:28,代码来源:admin_extend.php

示例7: forum_threads_updated

function forum_threads_updated($count = 5, $inforumid = 0, $notforumid = 0, $template = 'updated')
{
    require_once BASEDIR . getmodulepath('forum') . 'functions.php';
    global $set, $apx, $db;
    $count = (int) $count;
    //Erlaubte Foren
    if (is_int($forumid)) {
        $inforum = array($inforumid);
    } else {
        $inforum = intlist($inforumid);
    }
    if (is_int($notforumid)) {
        $notforum = array($notforumid);
    } else {
        $notforum = intlist($notforumid);
    }
    $forumids = forum_allowed_forums($inforum, $notforum);
    //Daten auslesen
    $fields = implode(',', array('threadid', 'prefix', 'title', 'opener_userid', 'opener', 'opentime', 'lastposter_userid', 'lastposter', 'lastposttime', 'posts', 'views'));
    if (count($forumids)) {
        $data = $db->fetch("SELECT " . $fields . " FROM " . PRE . "_forum_threads WHERE ( del=0 AND moved=0 AND forumid IN (" . implode(',', $forumids) . ") ) ORDER BY lastposttime DESC " . iif($count, "LIMIT " . $count));
    } else {
        $data = array();
    }
    forum_threads_print($data, $template, 'lastposttime');
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:26,代码来源:tfunctions.php

示例8: contact

 private function contact()
 {
     $isSent = Request::get(0, VAR_URI) == 'send';
     $options = array('name' => array(Validator::MESSAGE => 'Der Name muss mindestens 5 und darf maximal 150 Zeichen lang sein.', Validator::MIN_LENGTH => 5, Validator::MAX_LENGTH => 150), 'email' => array(Validator::MESSAGE => 'Die E-Mail-Adresse ist nicht korrekt.', Validator::CALLBACK => Validator::CB_MAIL), 'message' => array(Validator::MESSAGE => 'Die Nachricht entspricht nicht den Vorgaben (mindestens 10 Zeichen, maximal 1000 Zeichen).', Validator::MIN_LENGTH => 10, Validator::MAX_LENGTH => 1000), 'title' => array(Validator::MESSAGE => 'Der Titel entspricht nicht den Vorgaben (mindestens 5 Zeichen, maximal 100 Zeichen).', Validator::MIN_LENGTH => 5, Validator::MAX_LENGTH => 100));
     $this->enableClientFormValidation($options);
     // Don't validate the captcha via ajax as the session would end
     if (Config::get('captcha.enable')) {
         Core::loadClass('Core.Security.ReCaptcha');
         $options['recaptcha_response_field'] = array(Validator::MESSAGE => 'Der Sicherheitscode wurde nicht korrekt eingegeben.', Validator::CALLBACK => 'cb_captcha_check');
     }
     $data = array_fill_keys(array_keys($options), '');
     $data['name'] = iif(Me::get()->loggedIn(), Me::get()->getName());
     $data['email'] = iif(Me::get()->loggedIn(), Me::get()->getEmail());
     $this->breadcrumb->add('Kontakt');
     $this->header();
     if ($isSent) {
         extract(Validator::checkRequest($options));
         if (count($error) > 0) {
             CmsPage::error($error);
         } else {
             CmsTools::sendMail(Config::get('general.email'), $data['title'], $data['message'], $data['email'], $data['name']);
             CmsPage::ok('Die Anfrage wurde erfolgreich verschickt. Vielen Dank!');
             $data['title'] = '';
             $data['message'] = '';
         }
     }
     $tpl = Response::getObject()->appendTemplate('Cms/contact/contact');
     $tpl->assign('data', $data);
     if (Config::get('captcha.enable')) {
         $tpl->assign('captcha', recaptcha_get_html(Config::get('captcha.public_key')), false);
     }
     $tpl->output();
     $this->footer();
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:34,代码来源:class.ContactPages.php

示例9: get_gallery_list

function get_gallery_list($selected = 0)
{
    global $set, $db, $apx;
    $list = '<option value=""></option>';
    if ($set['gallery']['subgals']) {
        require_once BASEDIR . 'lib/class.recursivetree.php';
        $tree = new RecursiveTree(PRE . '_gallery', 'id');
        $data = $tree->getTree(array('title'), null, "'" . time() . "' BETWEEN starttime AND endtime " . section_filter(true, 'secid'));
        if (!count($data)) {
            return '';
        }
        foreach ($data as $res) {
            $list .= '<option value="' . $res['id'] . '"' . iif($selected == $res['id'], ' selected="selected"') . '>' . str_repeat('&nbsp;&nbsp;', $res['level'] - 1) . replace(strip_tags($res['title'])) . '</option>';
        }
    } else {
        $data = $db->fetch("SELECT id,title FROM " . PRE . "_gallery WHERE '" . time() . "' BETWEEN starttime AND endtime " . section_filter(true, 'secid') . " ORDER BY title ASC");
        if (!count($data)) {
            return '';
        }
        foreach ($data as $res) {
            $list .= '<option value="' . $res['id'] . '"' . iif($selected == $res['id'], ' selected="selected"') . '>' . replace(strip_tags($res['title'])) . '</option>';
        }
    }
    return $list;
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:25,代码来源:admin_system.php

示例10: current

 function current()
 {
     $temp = parent::current();
     $temp['posticon'] = @$temp['posticon'] != '' ? iif(file_exists(BB_BASE_DIR . '/tmp/upload/posticons/' . @$temp['posticon']), @$temp['posticon'], 'clear.gif') : 'clear.gif';
     if ($temp['poster_id'] > 0) {
         $user = $this->dba->getRow("SELECT " . $this->qp['user'] . $this->qp['userinfo'] . " FROM " . K4USERS . " u LEFT JOIN " . K4USERINFO . " ui ON u.id=ui.user_id WHERE u.id=" . intval($temp['poster_id']));
         $group = get_user_max_group($user, $this->groups);
         $user['group_color'] = !isset($group['color']) || $group['color'] == '' ? '000000' : $group['color'];
         $user['group_nicename'] = $group['nicename'];
         $user['group_avatar'] = $group['avatar'];
         foreach ($user as $key => $val) {
             $temp['post_user_' . $key] = $val;
         }
         /* This array holds all of the userinfo for users that post to this topic */
         $this->users[$user['id']] = $user;
     }
     /* Do we have any replies? */
     //$num_replies					= @(($temp['row_right'] - $temp['row_left'] - 1) / 2);
     //$bbcode							= &new BBCodex($this->dba, $this->user, $temp['body_text'], $temp['forum_id'], TRUE, TRUE, TRUE, TRUE);
     if ($temp['num_replies'] > 0) {
         $temp['replies'] =& new RepliesReviewIterator($this->result, $this->qp, $this->dba, $this->users, $this->groups, $this->user, $this->url, $this->poll_text);
     }
     //$temp['reverted_body_text']		= $bbcode->revert();
     if ($temp['is_poll'] == 1) {
         do_post_poll_urls($temp['reverted_body_text'], $this->dba, $this->url, $this->poll_text);
     }
     do_post_polls($temp, $this->dba, $this->url, $this->poll_text);
     unset($user, $group);
     return $temp;
 }
开发者ID:BackupTheBerlios,项目名称:k4bb-svn,代码行数:30,代码来源:topic_review.class.php

示例11: user_assign_visitors

function user_assign_visitors($object, $id, &$tmpl)
{
    global $apx, $set, $db, $user;
    $userdata = array();
    $data = $db->fetch("SELECT u.userid,u.username,u.groupid,u.realname,u.gender,u.city,u.plz,u.country,u.city,u.lastactive,u.pub_invisible,u.avatar,u.avatar_title,u.custom1,u.custom2,u.custom3,u.custom4,u.custom5,u.custom6,u.custom7,u.custom8,u.custom9,u.custom10 FROM " . PRE . "_user_visits AS v LEFT JOIN " . PRE . "_user AS u USING(userid) WHERE v.object='" . addslashes($object) . "' AND v.id='" . intval($id) . "' AND v.time>='" . (time() - 24 * 3600) . "' ORDER BY u.username ASC");
    if (count($data)) {
        foreach ($data as $res) {
            ++$i;
            $userdata[$i]['ID'] = $res['userid'];
            $userdata[$i]['USERID'] = $res['userid'];
            $userdata[$i]['USERNAME'] = replace($res['username']);
            $userdata[$i]['GROUPID'] = $res['groupid'];
            $userdata[$i]['ONLINE'] = iif(!$res['pub_invisible'] && $res['lastactive'] + $set['user']['timeout'] * 60 >= time(), 1, 0);
            $userdata[$i]['REALNAME'] = replace($res['realname']);
            $userdata[$i]['GENDER'] = $res['gender'];
            $userdata[$i]['CITY'] = replace($res['city']);
            $userdata[$i]['PLZ'] = replace($res['plz']);
            $userdata[$i]['COUNTRY'] = $res['country'];
            $userdata[$i]['LASTACTIVE'] = $res['lastactive'];
            $userdata[$i]['AVATAR'] = $user->mkavatar($res);
            $userdata[$i]['AVATAR_TITLE'] = $user->mkavtitle($res);
            //Custom-Felder
            for ($ii = 1; $ii <= 10; $ii++) {
                $tabledata[$i]['CUSTOM' . $ii . '_NAME'] = $set['user']['cusfield_names'][$ii - 1];
                $tabledata[$i]['CUSTOM' . $ii] = compatible_hsc($res['custom' . $ii]);
            }
        }
    }
    $tmpl->assign('VISITOR', $userdata);
}
开发者ID:bigfraggle,项目名称:open-apexx,代码行数:30,代码来源:functions.php

示例12: init

 function init($dir = null)
 {
     if ($dir != null) {
         $this->setdir($dir);
     }
     $this->group('settings');
     $this->group('global');
     $this->group('modules');
     $this->group('custom');
     @ini_set('default_charset', '');
     if (!headers_sent()) {
         viscacha_header('Content-type: text/html; charset=' . $this->charset());
     }
     global $slog;
     if (isset($slog) && is_object($slog) && method_exists($slog, 'setlang')) {
         $slog->setlang($this->phrase('fallback_no_username'), $this->phrase('timezone_summer'));
     }
     global $config, $breadcrumb;
     if (isset($breadcrumb)) {
         $isforum = array('addreply', 'attachments', 'edit', 'forum', 'manageforum', 'managetopic', 'misc', 'newtopic', 'pdf', 'search', 'showforum', 'showtopic');
         if ($config['indexpage'] != 'forum' && in_array(SCRIPTNAME, $isforum)) {
             $breadcrumb->Add($this->phrase('forumname'), iif(SCRIPTNAME != 'forum', 'forum.php'));
         }
     }
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:25,代码来源:class.language.php

示例13: getItemTypeExtraInfo

 function getItemTypeExtraInfo($itemtypedata)
 {
     global $vbphrase;
     $return = array();
     $itemtypes = array();
     $itemtypeids = explode(',', $itemtypedata['options']['itemtypeids']);
     if (count($itemtypeids)) {
         foreach ($itemtypeids as $itemtypeid) {
             if (!isset($itemtypes[$itemtypeid])) {
                 $itemtypes[$itemtypeid] = array('itemtype' => newItemType($itemtypeid), 'count' => 1);
             } else {
                 $itemtypes[$itemtypeid]['count']++;
             }
         }
         foreach ($itemtypes as $itemtypeid => $info) {
             $itemtype_obj =& $info['itemtype'];
             if ($itemtype_obj) {
                 $itemtype_obj->getExtraInfo();
                 $itemtype = $itemtype_obj->data;
                 $return[] = "<strong>{$itemtype['name']}</strong>" . iif($info['count'] > 1, " x<strong style=\"color:red;\">{$info['count']}</strong>") . iif($itemtype['options_processed_list'], "<ul>{$itemtype['options_processed_list']}</ul>");
             }
         }
     }
     return $return;
 }
开发者ID:0hyeah,项目名称:yurivn,代码行数:25,代码来源:pack.kbank.php

示例14: slog

 /**
  * Constructor for this class.
  *
  * This class manages the user-permissions, login and logout.
  * This function does some initial work: caching search engine user agents, detects the spiders and gets the ip of the user.
  */
 function slog()
 {
     global $config, $scache;
     $this->statusdata = array();
     $this->ip = getip();
     $this->user_agent = iif(isset($_SERVER['HTTP_USER_AGENT']), $_SERVER['HTTP_USER_AGENT'], getenv('HTTP_USER_AGENT'));
     $spiders = $scache->load('spiders');
     $this->bots = $spiders->get();
     $this->sid = '';
     $this->cookies = false;
     $this->cookiedata = array(0, '');
     $this->cookielastvisit = 0;
     $this->defineGID();
     $this->gFields = array('downloadfiles', 'forum', 'posttopics', 'postreplies', 'addvotes', 'attachments', 'edit', 'voting', 'admin', 'gmod', 'guest', 'members', 'profile', 'pdf', 'pm', 'wwo', 'search', 'team', 'usepic', 'useabout', 'usesignature', 'docs');
     $this->fFields = array('f_downloadfiles', 'f_forum', 'f_posttopics', 'f_postreplies', 'f_addvotes', 'f_attachments', 'f_edit', 'f_voting');
     $this->minFields = array('flood');
     $this->maxFields = array();
     $this->groups = array();
     $this->permissions = array();
     $this->querysid = true;
     $this->positive = array();
     $this->negative = array();
     $this->boards = array();
     $this->sidload = false;
 }
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:31,代码来源:class.permissions.php

示例15: print_moderator_forum_chooser

/**
* Prints a row containing a <select> showing forums the user has permission to moderate
*
* @param	string	name for the <select>
* @param	mixed	selected <option>
* @param	string	text given to the -1 option
* @param	string	title for the row
* @param	boolean	Display the -1 option or not
* @param	boolean	Allow a multiple <select> or not
* @param	boolean	Display a 'select forum' option or not
* @param	string	If specified, check this permission for each forum
*/
function print_moderator_forum_chooser($name = 'forumid', $selectedid = -1, $topname = NULL, $title = NULL, $displaytop = true, $multiple = false, $displayselectforum = false, $permcheck = '')
{
    if ($title === NULL) {
        $title = $vbphrase['parent_forum'];
    }
    $select_options = fetch_moderator_forum_options($topname, $displaytop, $displayselectforum, $permcheck);
    print_select_row($title, $name, $select_options, $selectedid, 0, iif($multiple, 10, 0), $multiple);
}
开发者ID:holandacz,项目名称:nb4,代码行数:20,代码来源:modfunctions.php


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