當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BigTree::setPermissions方法代碼示例

本文整理匯總了PHP中BigTree::setPermissions方法的典型用法代碼示例。如果您正苦於以下問題:PHP BigTree::setPermissions方法的具體用法?PHP BigTree::setPermissions怎麽用?PHP BigTree::setPermissions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在BigTree的用法示例。


在下文中一共展示了BigTree::setPermissions方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createModule

 function createModule($name, $group, $class, $table, $permissions, $icon, $route = false)
 {
     // Find an available module route.
     $route = $route ? $route : BigTreeCMS::urlify($name);
     if (!ctype_alnum(str_replace("-", "", $route)) || strlen($route) > 127) {
         return false;
     }
     // Go through the hard coded modules
     $existing = array();
     $d = opendir(SERVER_ROOT . "core/admin/modules/");
     while ($f = readdir($d)) {
         if ($f != "." && $f != "..") {
             $existing[] = $f;
         }
     }
     // Go through the directories (really ajax, css, images, js)
     $d = opendir(SERVER_ROOT . "core/admin/");
     while ($f = readdir($d)) {
         if ($f != "." && $f != "..") {
             $existing[] = $f;
         }
     }
     // Go through the hard coded pages
     $d = opendir(SERVER_ROOT . "core/admin/pages/");
     while ($f = readdir($d)) {
         if ($f != "." && $f != "..") {
             // Drop the .php
             $existing[] = substr($f, 0, -4);
         }
     }
     // Go through already created modules
     $q = sqlquery("SELECT route FROM bigtree_modules");
     while ($f = sqlfetch($q)) {
         $existing[] = $f["route"];
     }
     // Get a unique route
     $x = 2;
     $oroute = $route;
     while (in_array($route, $existing)) {
         $route = $oroute . "-" . $x;
         $x++;
     }
     $name = sqlescape(BigTree::safeEncode($name));
     $route = sqlescape($route);
     $class = sqlescape($class);
     $group = $group ? "'" . sqlescape($group) . "'" : "NULL";
     $gbp = BigTree::json($permissions, true);
     $icon = sqlescape($icon);
     sqlquery("INSERT INTO bigtree_modules (`name`,`route`,`class`,`icon`,`group`,`gbp`) VALUES ('{$name}','{$route}','{$class}','{$icon}',{$group},'{$gbp}')");
     $id = sqlid();
     if ($class) {
         // Create class module.
         $f = fopen(SERVER_ROOT . "custom/inc/modules/{$route}.php", "w");
         fwrite($f, "<?\n");
         fwrite($f, "\tclass {$class} extends BigTreeModule {\n");
         fwrite($f, '		var $Table = "' . $table . '";' . "\n");
         fwrite($f, "\t}\n");
         fwrite($f, "?>\n");
         fclose($f);
         BigTree::setPermissions(SERVER_ROOT . "custom/inc/modules/{$route}.php");
         // Remove cached class list.
         unlink(SERVER_ROOT . "cache/bigtree-module-class-list.json");
     }
     $this->track("bigtree_modules", $id, "created");
     return $id;
 }
開發者ID:kurt-planet,項目名稱:BigTree-CMS,代碼行數:66,代碼來源:admin.php


注:本文中的BigTree::setPermissions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。