• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP n函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_children

 /**
  * Получение ID подкатегорий, если необходимо
  * @param array $curcats массив выбранных категорий
  * @return null
  */
 protected function get_children(&$curcats)
 {
     if (!$this->settings['check_children']) {
         return;
     }
     /* @var $cats categories */
     $cats = n("categories");
     foreach ($curcats as $name => $cat) {
         $cat = explode('|', $cat);
         $c = count($cat);
         $ids = array();
         for ($i = 0; $i < $c; $i++) {
             $ic = longval($cat[$i]);
             if (!$ic || !$cats->get($ic)) {
                 continue;
             }
             $ids[] = $ic;
             $cats->get_children_ids($ic, $ids);
         }
         if (!$ids) {
             unset($curcats[$name]);
             continue;
         }
         $ids = array_unique($ids);
         $curcats[$name] = implode('|', $ids);
     }
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:32,代码来源:torrents.php


示例2: save

 /**
  * Сохранение бота
  * @param array $data массив данных
  * @return null
  * @throws EngineException 
  */
 public function save($data)
 {
     $admin_file = globals::g('admin_file');
     $cols = array('id', 'name', 'firstip', 'lastip', 'agent');
     extract(rex($data, $cols));
     $id = (int) $id;
     /* @var $etc etc */
     $etc = n("etc");
     $etc->get_ips($firstip, $lastip, true);
     if (!$name) {
         throw new EngineException('bots_empty_name');
     }
     if (!$firstip && !$lastip && !$agent) {
         throw new EngineException('bots_empty_data');
     }
     $update = array('name' => $name, 'firstip' => $firstip, 'lastip' => $lastip, 'agent' => $agent);
     try {
         plugins::o()->pass_data(array("update" => &$update, "id" => $id), true)->run_hook('admin_bots_save');
     } catch (PReturn $e) {
         return $e->r();
     }
     if (!$id) {
         db::o()->insert($update, 'bots');
         log_add('added_bot', 'admin');
     } else {
         db::o()->p($id)->update($update, 'bots', 'WHERE id=? LIMIT 1');
         log_add('changed_bot', 'admin', $id);
     }
     furl::o()->location($admin_file);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:36,代码来源:bots.php


示例3: init

 /**
  * Инициализация управления вложениями
  * @return null
  */
 public function init()
 {
     /* @var $attach attachments */
     $attach = n("attachments");
     $act = $_GET["act"];
     switch ($act) {
         case "upload":
             $type = $_GET["type"];
             $toid = $_GET["toid"];
             $ret = $attach->change_type($type)->upload($toid);
             ok(true);
             print $ret;
             break;
         case "download":
             $attach_id = (int) $_GET["id"];
             $preview = (int) $_GET["preview"];
             $attach->download($attach_id, $preview);
             break;
         case "delete":
             $attach_id = $_POST["id"];
             $ret = $attach->delete($attach_id);
             if (!$ret) {
                 throw new Exception();
             }
             ok();
             break;
     }
     die;
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:33,代码来源:attach_manage.php


示例4: get_product_by_id

function get_product_by_id($productid)
{
    $s = q("select * from product where productid = '" . clean_query($productid) . "' limit 1;");
    if (n($s) > 0) {
        return f($s);
    }
    return false;
}
开发者ID:mwcs01,项目名称:openpantry,代码行数:8,代码来源:inventory.lib.php


示例5: get_bag_by_name

function get_bag_by_name($name)
{
    $s = q("select * from bag where bag.name = '" . clean_query($name) . "';");
    if (n($s) > 0) {
        return f($s);
    }
    return false;
}
开发者ID:mwcs01,项目名称:openpantry,代码行数:8,代码来源:bag.lib.php


示例6: get_user_by_username

function get_user_by_username($username)
{
    $s = q("select * from user where user.username = '" . clean_query($username) . "' limit 1;");
    if (n($s) > 0) {
        return f($s);
    }
    return null;
}
开发者ID:mwcs01,项目名称:openpantry,代码行数:8,代码来源:user.lib.php


示例7: get_family_by_id

function get_family_by_id($clientid)
{
    $s = q("select * from family, client where client.clientid = family.clientid and family.clientid = '" . clean_query($clientid) . "';");
    if (n($s) > 0) {
        return f($s);
    }
    return null;
}
开发者ID:mwcs01,项目名称:openpantry,代码行数:8,代码来源:client.lib.php


示例8: init

 /**
  * Функция вызова captcha
  * @return null
  */
 public function init()
 {
     $background = 'include/backgrounds/' . $this->bckgrnds[rand(0, count($this->bckgrnds) - 1)];
     $code = mb_strtoupper(users::o()->generate_salt(6));
     if (!$_SESSION['captcha_key']) {
         $_SESSION['captcha_key'] = array();
     }
     array_unshift($_SESSION['captcha_key'], $code);
     unset($_SESSION['captcha_key'][self::capacity]);
     /* @var $uploader uploader */
     $uploader = n("uploader");
     $uploader->watermark($background, $code, 'auto', false, '', 'cc', true, false);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:17,代码来源:class.captcha.php


示例9: baz

function baz($d)
{
    $x = new D1();
    $x = new D2();
    $x = new D3();
    $x = new D4();
    $x = new D5();
    $x = new D6();
    $x = n($d . '1');
    $x = n($d . '2');
    $x = n($d . '3');
    $x = n($d . '4');
    $x = n($d . '5');
    $x = n($d . '6');
    $x = n('B1');
}
开发者ID:badlamer,项目名称:hhvm,代码行数:16,代码来源:1570.php


示例10: build

 /**
  * Построение плагина
  * @param array $data массив данных
  * @return null 
  * @throws EngineException
  */
 public function build($data)
 {
     lang::o()->get('admin/plugins');
     $data_params = array("plugin", "version", "author", "name", "descr", "comp", "comp_min", "comp_max");
     extract(rex($data, $data_params));
     if (!validword($plugin)) {
         throw new EngineException("plugins_invalid_name");
     }
     $settings = modsettings::o()->make($data);
     $defaults = modsettings::o()->save(modsettings::nocache_id, $data);
     $vars = array($plugin, var_export((string) $version, true), var_export((string) $author, true), var_export((string) $name, true), var_export((string) $descr, true), var_export((string) $comp, true), var_export((string) $comp_min, true), var_export((string) $comp_max, true), var_export((array) $settings, true), $plugin, var_export((array) $defaults, true));
     $contents = @file_get_contents(ROOT . self::plugin_template);
     $contents = vsprintf($contents, $vars);
     /* @var $uploader uploader */
     $uploader = n("uploader");
     $uploader->download_headers($contents, 'plugin.' . $plugin . '.php', 'text/plain');
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:23,代码来源:plugins.php


示例11: init

 /**
  * Инициализация Ajax-части нижнего блока
  * @return null
  */
 public function init()
 {
     lang::o()->get("blocks/downm");
     switch ($_GET["act"]) {
         case "content":
             users::o()->check_perms("content", 1, 2);
             $sticky = isset($_GET["sticky"]) ? (bool) $_GET["sticky"] : true;
             $this->show_content($sticky);
             break;
         case "comments":
             users::o()->check_perms('comment', 1, 2);
             /* @var $comments comments */
             $comments = n("comments");
             $comments->usertable();
             break;
         default:
             users::o()->check_perms('profile', 1, 2);
             $this->show_online();
             break;
     }
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:25,代码来源:downm.php


示例12: init

 /**
  * Инициализация рейтинга
  * @return null
  */
 public function init()
 {
     $act = $_GET['act'];
     $type = $_POST['type'];
     $toid = $_POST['toid'];
     $this->rating = n("rating");
     switch ($act) {
         case "vote":
             $value = $_POST['value'];
             $stype = $_POST['stype'];
             $stoid = $_POST['stoid'];
             $this->vote_to($type, $toid, $value, $stoid, $stype);
             break;
         case "get":
             $this->get($type, $toid);
             break;
         default:
             break;
     }
     ok();
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:25,代码来源:rating_manage.php


示例13: start_session_tracking

function start_session_tracking()
{
    session_start();
    return true;
    clean_session_db();
    error_reporting(E_ALL);
    $sessionhash = md5(get_session_id());
    $idhash = md5($_SERVER['HTTP_USER_AGENT'] . $_SERVER['REMOTE_ADDR']);
    // see: mysql.lib.php
    $s = q("select * from `session` where `hash` = '" . clean_query($sessionhash) . "' limit 1;");
    if (n($s) == 0) {
        $s = q("insert into `session` values('', '0', '" . clean_query($sessionhash) . "', '" . clean_query($idhash) . "', '" . clean_query(time()) . "');");
        if (a() == 1) {
            // success
            return true;
        } else {
            // failure
            return false;
        }
    } else {
        while ($r = f($s)) {
            //4c5b06225553e12bed914e6836ff4859
            if ($r["identity"] != $idhash) {
                return false;
            }
            $s = q("update `session` set `activity` = '" . clean_query(time()) . "' where `hash` = '" . clean_query($sessionhash) . "' limit 1;");
            return true;
            /*if (a() == 1) {
            			// success
            			return true;
            		} else {
            			// failure
            			return false;
            		}*/
        }
    }
    return false;
}
开发者ID:mwcs01,项目名称:openpantry,代码行数:38,代码来源:session.lib.php


示例14: init

 /**
  * Инициализация управления комментариями
  * @return null
  */
 public function init()
 {
     $act = $_GET['act'];
     $this->comments = n("comments");
     switch ($act) {
         case "edit":
             $id = longval($_POST['id']);
             $this->edit_form($id);
             break;
         case "add":
         case "edit_save":
             $content = $_POST['body'];
             $resid = longval($_POST['resid']);
             $type = $_POST['type'];
             $id = longval($_POST['id']);
             $this->save($content, $resid, $type, $id);
             ok();
             break;
         case "show":
             $resid = longval($_POST['resid']);
             $type = $_POST['type'];
             $this->show($resid, $type);
             break;
         case "del":
             $id = (int) $_POST["id"];
             $this->delete($id);
             ok();
             break;
         case "quote":
             $id = (int) $_POST["id"];
             $this->quote($id);
             die;
         default:
             break;
     }
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:40,代码来源:comments_manage.php


示例15: __construct

 /**
  * Конструктор
  * @return null
  */
 public function __construct()
 {
     $this->cats = n("categories");
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:8,代码来源:cats.php


示例16: show_PDF

 /**
  * Show for PDF the current applicatif
  *
  * @param $pdf object for the output
  **/
 function show_PDF($pdf)
 {
     global $DB;
     $pdf->setColumnsSize(50, 50);
     $col1 = '<b>' . sprintf(__('%1$s %2$s'), __('ID'), $this->fields['id']) . '</b>';
     if (isset($this->fields["date_mod"])) {
         $col2 = sprintf(__('%1$s: %2$s'), __('Last update'), Html::convDateTime($this->fields["date_mod"]));
     } else {
         $col2 = '';
     }
     $pdf->displayTitle($col1, $col2);
     $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Name') . '</i></b>', $this->fields['name']), sprintf(__('%1$s: %2$s'), '<b><i>' . -n('Status', 'Statuses', 1) . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_states', $this->fields['states_id']))));
     $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Location') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_locations', $this->fields['locations_id']))), sprintf(__('%1$s: %2$s'), '<b><i>' . __('Type') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_plugin_appliances_appliancetypes', $this->fields['plugin_appliances_appliancetypes_id']))));
     $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Technician in charge of the hardware') . '</i></b>', getUserName($this->fields['users_id_tech'])), sprintf(__('%1$s: %2$s'), '<b><i>' . __('Environment', 'appliances') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_plugin_appliances_environments', $this->fields['plugin_appliances_environments_id']))));
     $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Group in charge of the hardware') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_groups', $this->fields['groups_id_tech']))), sprintf(__('%1$s: %2$s'), '<b><i>' . __('Serial number') . '</i></b>', $this->fields['serial']));
     $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('User') . '</i></b>', getUserName($this->fields['users_id'])), sprintf(__('%1$s: %2$s'), '<b><i>' . __('Inventory number') . '</i></b>', $this->fields['otherserial']));
     $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Group') . '</i></b>', Html::clean(Dropdown::getDropdownName('glpi_groups', $this->fields['groups_id']))), '');
     $pdf->displayLine(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Associable to a ticket') . '</i></b>', Dropdown::getYesNo($this->fields['is_helpdesk_visible'])), sprintf(__('%1$s: %2$s'), '<b><i>' . __('Item to link') . '</i></b>', Html::clean(PluginAppliancesRelation::getTypeName($this->fields['relationtype']))));
     $pdf->displayText(sprintf(__('%1$s: %2$s'), '<b><i>' . __('Comments') . '</i></b>', $this->fields['comment']));
     $pdf->displaySpace();
 }
开发者ID:geldarr,项目名称:hack-space,代码行数:26,代码来源:appliance.class.php


示例17: print_settle_group_list_html

function print_settle_group_list_html($settle_array)
{
    //printr($settle_array);
    //printr($memberlist);
    foreach ($settle_array as $key => $value) {
        $pay_array[$value['pay_uid']][] = array("pay_name" => $value['pay_name'], "get_uid" => $value['get_uid'], "get_name" => $value['get_name'], "sum" => $value['sum']);
    }
    /* foreach($events as $key => $value) {
       $listhtml .= n(8) . "<li class=\"textbox\">" . $value['event_name']  . " (".  $value['date']  . ")</li>\n";
       } */
    // $array = array_sort($array, 'balance', $order);
    // $count = count($array);
    //for ($i = 0; $i < $count; $i++) {
    // printr($pay_array);
    $listhtml = "";
    foreach ($pay_array as $pay_uid => $get_array) {
        $listhtml .= n(6) . "<ul class=\"pageitem\">\n";
        $listhtml .= n(8) . "<li class=\"textbox\"><span class=\"header\">" . $get_array[0]['pay_name'] . " pays:</span></li>\n";
        $get_array = array_sort($get_array, 'sum', SORT_DESC);
        foreach ($get_array as $key => $value) {
            $listhtml .= n(8) . "<li class=\"menu\">\n";
            $listhtml .= n(10) . "<span class=\"name\">" . $value['get_name'] . "</span>\n";
            $listhtml .= n(10) . "<span class=\"balance\">\n";
            $listhtml .= n(12) . "<span class=\"price_neg\">" . number_format($value['sum'], DECIMALS, DSEP, TSEP) . "</span>\n";
            $listhtml .= n(12) . "<span class=\"euro_neg\">&euro;</span>\n";
            $listhtml .= n(10) . "</span>\n";
            $listhtml .= n(8) . "</li>\n";
        }
        $listhtml .= n(6) . "</ul>";
    }
    echo $listhtml;
}
开发者ID:Whiskey24,项目名称:GoingDutchApi,代码行数:32,代码来源:functions.php


示例18: conf

</p>

<a name="fee"></a>
<h2>FOSS Factory's fee</h2>

<p>
FOSS Factory deducts a <?php 
echo conf("commission");
?>
% transaction fee from
all bounty payments.  This fee is separate from the community deduction.
</p>

<a name="disputes"></a>
<h1><?php 
n();
?>
Disputes</h1>

<p>
Any registered member can file a complaint regarding the management
of a project.  When a complaint is filed, the project lead is notified,
and must respond to the complaint.  If the project lead responds by posting a
counter-argument, then the plaintiff is notified and must follow up.
The dispute can continue back and forth between the plaintiff and
the project lead until one of the following occurs:
</p>
<ol>
<li>The plaintiff opts to cancel the dispute; or</li>
<li>On their turn, one or the other party chooses to finalize the discussion.
In so doing, they forfeit their final opportunity to comment, thus granting
开发者ID:lobolabs,项目名称:fossfactory,代码行数:31,代码来源:overview.php


示例19: converted_login

 /**
  * Вход для конвертированного пользователя
  * @param array $data массив переменных
  * @return null
  * @throws PReturn
  */
 public function converted_login($data)
 {
     $login = $data['login'];
     $password = $data['password'];
     $error =& $data['error'];
     $id =& $data['id'];
     /* @var $etc etc */
     $etc = n("etc");
     $u = $etc->select_user(null, $login, 'id,password,salt,converted');
     if (!$u['converted']) {
         return;
     }
     $salt = $u['salt'];
     if ($u['password'] != md5($salt . $password . $salt)) {
         $error = lang::o()->v('login_false_signin');
         return;
     }
     $id = $u['id'];
     $salt = users::o()->generate_salt(32);
     $password = users::o()->generate_pwd_hash($password, $salt);
     db::o()->p($id)->update(array('salt' => $salt, 'password' => $password, 'converted' => '0'), 'users', 'WHERE id = ? LIMIT 1');
     throw new PReturn($password);
 }
开发者ID:SjayLiFe,项目名称:CTRev,代码行数:29,代码来源:plugin.convert_cyberhype.php


示例20: n

$r .= n(116);
$r .= e();
// Row 23 (top of tail)
$r .= n(51);
$r .= a(5, 13, 0);
$r .= n(51);
$r .= e();
// Row 24
$r .= n(53);
$r .= a(5, 14, 23);
$r .= n(53);
$r .= e();
// Row (bottom of tail)
$r .= n(55);
$r .= a(5, 29, 24);
$r .= n(55);
$r .= '}' . PHP_EOL . '}';
echo $r;
function n($count)
{
    $r = '';
    $e = '{-1,-1}, ';
    for ($i = 0; $i < $count; $i++) {
        $r .= $e;
    }
    return $r;
}
function a($pin, $start, $end)
{
    $r = '';
    if ($start > $end) {
开发者ID:TomShea,项目名称:signB,代码行数:31,代码来源:generatePixelMap.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP n2_函数代码示例发布时间:2022-05-15
下一篇:
PHP mysqlresult函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap