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

PHP xn函数代码示例

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

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



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

示例1: doIndex

 /**
  * login page and post 
  */
 public function doIndex()
 {
     global $MONGO;
     $password = trim(xn("password"));
     $this->username = trim(xn("username"));
     $this->db = trim(xn("db"));
     $this->hostIndex = xi("host");
     $this->languages = rock_load_languages();
     $this->expires = array(3 => "3 " . rock_lang("hours"), 720 => "1 " . rock_lang("month"));
     $this->moreOptions = xi("more");
     if ($this->isPost()) {
         //server exists?
         if (!isset($MONGO["servers"][$this->hostIndex])) {
             $this->message = "Server does not exist";
             return;
         }
         //authenticate
         $server = MServer::serverWithIndex($this->hostIndex);
         if (!$server->auth($this->username, $password, $this->db)) {
             $this->message = rock_lang("can_not_auth");
             $this->display();
             return;
         }
         //remember user
         import("models.MUser");
         MUser::login($this->username, $password, $this->hostIndex, $this->db, xi("expire") * 3600);
         //remember lang
         setcookie("ROCK_LANG", x("lang"), time() + 365 * 86400);
         //jump to admin page
         $this->redirect("admin.index", array("host" => $this->hostIndex));
     } else {
         $this->display();
     }
 }
开发者ID:abhilashlohar,项目名称:Housingmatters,代码行数:37,代码来源:login.php


示例2: doCreateIndex

 function doCreateIndex()
 {
     $fields = xn("field");
     if (!is_array($fields)) {
         $this->_outputJson(array("code" => 300, "message" => "Index contains one field at least."));
     }
     $orders = xn("order");
     $attrs = array();
     foreach ($fields as $index => $field) {
         $field = trim($field);
         if (!empty($field)) {
             $attrs[$field] = $orders[$index] == "asc" ? 1 : -1;
         }
     }
     if (empty($attrs)) {
         $this->_outputJson(array("code" => 300, "message" => "Index contains one field at least."));
     }
     //if is unique
     $options = array();
     if (x("is_unique")) {
         $options["unique"] = 1;
         if (x("drop_duplicate")) {
             $options["dropDups"] = 1;
         }
     }
     $options["background"] = 1;
     $options["safe"] = 1;
     //name
     $name = trim(xn("name"));
     if (!empty($name)) {
         $options["name"] = $name;
     }
     //check name
     $collection = $this->_mongodb->selectCollection($this->collection);
     $indexes = $collection->getIndexInfo();
     foreach ($indexes as $index) {
         if ($index["name"] == $name) {
             $this->_outputJson(array("code" => 300, "message" => "The name \"{$name}\" is token by other index."));
             break;
         }
         if ($attrs === $index["key"]) {
             $this->_outputJson(array("code" => 300, "message" => "The key on same fields already exists."));
             break;
         }
     }
     $ret = null;
     try {
         $ret = $collection->ensureIndex($attrs, $options);
     } catch (Exception $e) {
         $this->_outputJson(array("code" => 300, "message" => $e->getMessage()));
     }
     if ($ret["ok"]) {
         $this->_outputJson(array("code" => 200));
     } else {
         $this->_outputJson(array("code" => 300, "message" => $ret["err"]));
     }
 }
开发者ID:boosen,项目名称:rockmongo,代码行数:57,代码来源:field.php


示例3: doDropDatabase

 /** drop database **/
 public function doDropDatabase()
 {
     $this->db = xn("db");
     if (!x("confirm")) {
         $this->display();
         return;
     }
     $ret = $this->_mongo->dropDB($this->db);
     $this->ret = $this->_highlight($ret, "json");
     $this->display("dropDatabaseResult");
 }
开发者ID:boosen,项目名称:rockmongo,代码行数:12,代码来源:db.php


示例4: doCollectionImport

 /** import a collection **/
 public function doCollectionImport()
 {
     $this->redirect("db.dbImport", array("db" => xn("db")));
 }
开发者ID:abhilashlohar,项目名称:Housingmatters,代码行数:5,代码来源:collection.php


示例5: render_collection_menu

/**
 * Render collection operations
 *
 * @param string $dbName database name
 * @param string $collectionName collection name
 * @since 1.1.0
 */
function render_collection_menu($dbName, $collectionName)
{
    $params = xn();
    $exportParams = $params;
    $exportParams["can_download"] = 1;
    $menuItems = array(array("action" => "collection.createRow", "params" => $params, "name" => rock_lang("insert")), array("action" => "collection.clearRows", "params" => $params, "name" => rock_lang("clear"), "attr.onclick" => "return window.confirm('Are you sure to delete all records in collection \\'" . $collectionName . "\\'?');"), array("action" => "#", "params" => array(), "name" => rock_lang("new_field"), "attr.onclick" => "fieldOpNew();return false;"), array("action" => "collection.collectionStats", "params" => $params, "name" => rock_lang("statistics")), array("action" => "collection.collectionExport", "params" => $exportParams, "name" => rock_lang("export")), array("action" => "collection.collectionImport", "params" => $params, "name" => rock_lang("import")), array("action" => "collection.collectionProps", "params" => $params, "name" => rock_lang("properties")), array("action" => "collection.collectionIndexes", "params" => $params, "name" => rock_lang("indexes")), array("action" => "collection.collectionRename", "params" => $params, "name" => rock_lang("rename")), array("action" => "collection.collectionDuplicate", "params" => $params, "name" => rock_lang("duplicate")), array("action" => "collection.collectionTransfer", "params" => $params, "name" => rock_lang("transfer")), array("action" => "collection.collectionValidate", "params" => $params, "name" => rock_lang("validate")), array("action" => "collection.removeCollection", "params" => $params, "name" => rock_lang("drop"), "attr.onclick" => "return window.confirm('Are you sure to drop collection \\'" . $collectionName . "\\'?')"));
    //plugin
    if (class_exists("RFilter")) {
        RFilter::apply("COLLECTION_MENU_FILTER", $menuItems, array("dbName" => $dbName, "collectionName" => $collectionName));
    }
    $displayCount = 6;
    $hasMore = false;
    $string = "";
    $count = count($menuItems);
    foreach ($menuItems as $index => $op) {
        if ($index >= $displayCount && !$hasMore) {
            $hasMore = true;
            $string .= "<a href=\"#\" onclick=\"showMoreMenus(this);return false;\">" . rock_lang("more") . " &raquo;</a>";
            $string .= "<div class=\"menu\">";
        }
        if (!empty($op["action"])) {
            $string .= '<a href="' . url($op["action"], isset($op["params"]) ? $op["params"] : array()) . '"';
            if (__CONTROLLER__ . "." . __ACTION__ == $op["action"]) {
                $string .= ' class="current"';
            }
            foreach ($op as $attrName => $attrValue) {
                if (preg_match("/^attr\\.(\\w+)/", $attrName, $match)) {
                    $string .= " " . $match[1] . "=\"" . $attrValue . "\"";
                }
            }
            $string .= ">" . $op["name"] . "</a>";
        } else {
            if (!empty($op["url"])) {
                $string .= "<a href=\"" . $op["url"] . "\" target=\"_blank\">";
            }
            $string .= $op["name"];
            if (!empty($op["url"])) {
                $string .= "</a>";
            }
        }
        if ($hasMore) {
            $string .= "<br/>";
        } else {
            if ($index < $count - 1) {
                $string .= " | ";
            }
        }
    }
    if ($hasMore) {
        $string .= "</div>";
    }
    echo $string;
}
开发者ID:tolsasha,项目名称:Forum_PO,代码行数:60,代码来源:render.php


示例6: hm

>modify</option>
			</select>
		</td>
	</tr>
	<tr>
		<td colspan="2"><input type="submit" value="<?php 
hm("submit_query");
?>
"/> <input type="button" value="<?php 
hm("explain");
?>
" onclick="explainQuery(this.form)" /> <input type="button" value="<?php 
hm("clear_conditions");
?>
" onclick="window.location='<?php 
h(url("collection.index", array("db" => $db, "collection" => $collection, "format" => xn("format"))));
?>
'"/>
			<?php 
if (isset($cost)) {
    ?>
Cost <?php 
    h(round($cost, 6));
    ?>
s<?php 
}
?>
			<?php 
if (isset($message)) {
    ?>
<p class="error"><?php 
开发者ID:buraka1,项目名称:mlazarov-rockmongo,代码行数:31,代码来源:index.php


示例7: hm

}
?>
</div>
<?php 
hm("db");
?>
:
<select name="db">
<?php 
foreach ($dbs as $value) {
    ?>
<option value="<?php 
    h($value["name"]);
    ?>
" <?php 
    if (xn("db") == $value["name"]) {
        ?>
selected="selected"<?php 
    }
    ?>
><?php 
    h($value["name"]);
    ?>
</option>
<?php 
}
?>
</select> <?php 
hm("argument");
?>
:<input type="button" onclick="addArgument()" value="<?php 
开发者ID:boosen,项目名称:rockmongo,代码行数:31,代码来源:execute.php


示例8: setAutoQuery

 /**
  * 开启自动构造查询条件功能
  *
  * @param boolean $bool 是否开启该功能
  * @param string|array $except 要去除的参数名
  * @param string|array $only 限制的参数名
  * @return RPage
  * @since 1.0.3
  */
 function setAutoQuery($bool = true, $except = "", $only = "")
 {
     if (!is_array($except)) {
         $except = preg_split("/\\s+,\\s+/", $except);
     }
     if (!is_array($only) && strlen($only) > 0) {
         $only = preg_split("/\\s+,\\s+/", $only);
     }
     if ($bool) {
         $x = xn();
         foreach ($x as $name => $value) {
             if ($except && in_array($name, $except)) {
                 unset($x[$name]);
             }
             if ($only && !in_array($name, $only)) {
                 unset($x[$name]);
             }
         }
         $this->setQuery($x);
     }
     return $this;
 }
开发者ID:kotarac,项目名称:rockmongo,代码行数:31,代码来源:RPage.php


示例9: doCreateDatabase

 /** create databse **/
 public function doCreateDatabase()
 {
     if ($this->isPost()) {
         $name = trim(xn("name"));
         if (empty($name)) {
             $this->error = "Please input a valid database name.";
             $this->display();
             return;
         }
         $this->message = "New database created.";
         $this->_mongo->selectDb($name)->execute("function(){}");
     }
     $this->display();
 }
开发者ID:myurasov,项目名称:rockmongo,代码行数:15,代码来源:server.php


示例10: h_escape

    ?>
selected="selected"<?php 
}
?>
>JSON</option>
</select><br/>
_id:<br/>
<input type="text" readonly value="<?php 
h_escape($row["_id"]);
?>
" size="72"/>
<br/>
<?php 
hm("data");
?>
:<br/>
<textarea rows="35" cols="70" name="data" id="row_data"><?php 
h($data);
?>
</textarea><br/>
<input type="submit" value="<?php 
hm("save");
?>
"/> <input type="button" value="<?php 
hm("back");
?>
" onclick="window.location='<?php 
h(xn("uri"));
?>
'"/>
</form>
开发者ID:buraka1,项目名称:mlazarov-rockmongo,代码行数:31,代码来源:modifyRow.php


示例11: setAutoQuery

 /**
  * 开启自动构造查询条件功能
  *
  * @param boolean $bool 是否开启该功能
  * @param string|array $except 要去除的参数名
  * @param string|array $only 限制的参数名
  * @return RPage
  * @since 1.0.3
  */
 function setAutoQuery($bool = true, $except = "", $only = "")
 {
     if ($bool) {
         $x = xn();
         foreach ($x as $name => $value) {
             if ($except && if_in_array($name, $except)) {
                 unset($x[$name]);
             }
             if ($only && !if_in_array($name, $only)) {
                 unset($x[$name]);
             }
         }
         $this->setQuery($x);
     }
     return $this;
 }
开发者ID:buraka1,项目名称:mlazarov-rockmongo,代码行数:25,代码来源:RPage.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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