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


PHP USER::get方法代码示例

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


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

示例1: prefered

 public static function prefered($type, $name, $identifier = 0)
 {
     $prefered = '';
     if (USER::is_logged()) {
         $identifier = $identifier == 0 ? USER::get('id') : $identifier;
         $check = OPTIONS::get($type, $name, $identifier);
         if ($check === false) {
             $prefered = OPTIONS::get($type, $name);
         } else {
             $prefered = $check;
         }
     } else {
         $prefered = OPTIONS::get($type, $name);
     }
     return $prefered;
 }
开发者ID:double-web,项目名称:drawline,代码行数:16,代码来源:include_options.php

示例2: check

 public static function check($permission_name, $user_id = 0)
 {
     // get user id
     $user_id = $user_id == 0 ? USER::get('id') : $user_id;
     if ($user_id === false) {
         return false;
     }
     // get user groups
     $user_groups = USER::get("user_groups", $user_id);
     // is is grand administrator
     if ($user_groups == 1) {
         return true;
     }
     // if user has no groups assigned
     if ($user_groups == '') {
         return false;
     }
     // select all permissions of user
     $user_permissions = array();
     global $db;
     $sel = $db->query("SELECT group_permissions FROM dl_users_groups WHERE group_id IN ({$user_groups})");
     while ($row = $db->fetch_array($sel)) {
         if (trim($row['group_permissions']) == '') {
             continue;
         }
         $p = explode(",", trim($row['group_permissions']));
         foreach ($p as $k) {
             if (!in_array($k, $user_permissions)) {
                 $user_permissions[] = $k;
             }
         }
     }
     // check if have grand permission
     if (isset($user_permissions[0]) && $user_permissions[0] == '*') {
         return true;
     }
     $user_permissions = implode(",", $user_permissions);
     $chk = $db->query(" SELECT count(*) as tot \n                                FROM dl_users_permissions \n                                WHERE   permission_value = '{$permission_name}' AND \n                                        permission_id IN ({$user_permissions})");
     $chk = $db->fetch_array($chk);
     // return result
     return $chk['tot'] == 1 ? true : false;
 }
开发者ID:double-web,项目名称:drawline,代码行数:42,代码来源:include_permissions.php

示例3: replace_cards

     }
     TPL::assign("maintenance_mode", OPTIONS::website("maintenance_mode"));
     TPL::render("v_settings/settings_maintenance");
     break;
 case "backend":
     if (isset($_POST['new_background'])) {
         // change image
         $new_image = replace_cards($_POST['new_background'], array(), true);
         OPTIONS::set('admin', 'background', $new_image, USER::get('id'));
         // return result
         die('ok');
     }
     if (isset($_POST['new_color'])) {
         // change color scheme
         $color_scheme = substr(substr($_POST['new_color'], 5), 0, -1);
         OPTIONS::set('admin', 'color_scheme', $color_scheme, USER::get('id'));
         // return result
         die('ok');
     }
     // get backgrounds list ----------------------------------------
     $backgrounds = array();
     foreach (glob(FOLDER_ADMIN . "template/assets/backgrounds/*.{jpg,png}", GLOB_BRACE) as $bg) {
         $infos = array("link" => str_replace(array(FOLDER_BASE, DS), array(BASE_URL, "/"), $bg), "img" => basename($bg), "thumb" => str_replace(array(FOLDER_BASE, DS), array(BASE_URL, "/"), $bg));
         $infos['current'] = $infos['link'] == admin_get_background(true) ? true : false;
         $backgrounds[] = $infos;
     }
     TPL::assign("backgrounds", $backgrounds);
     // -------------------------------------------------------------
     // set render
     TPL::render("v_settings/settings_backend");
     break;
开发者ID:double-web,项目名称:drawline,代码行数:31,代码来源:controller_settings.php

示例4: _user

function _user($some, $identifier = 0, $return_result = false)
{
    $output = '';
    // GET USER ACCOUNT DETAILS
    $r = USER::get($some, $identifier);
    if ($r === false) {
        // GET USER PREFERENCE
        $output = OPTIONS::get('user', $some, $identifier);
    } else {
        $output = $r;
    }
    // RETURN OR ECHO THE RESULT
    if ($return_result == true) {
        return $output;
    } else {
        echo $output;
    }
}
开发者ID:double-web,项目名称:drawline,代码行数:18,代码来源:include_fastfunc.php

示例5: isset

 case "add":
     $type = isset($_GET['type']) && trim($_GET['type']) != "" ? $_GET['type'] : '';
     if ($type == '') {
         // assign results
         TPL::assign("page_types", CONTENT::get_page_types());
         // set render
         TPL::render('v_pages/pages_add_type');
     } else {
         EVENTS::add_action("add_page_page_text", function () {
             if (isset($_POST['btn_submit'])) {
                 // filter
                 $page['content_type'] = strip_tags($_GET['type']);
                 $page['content_title'] = strip_tags($_POST['page_title']);
                 $page['content_text'] = $_POST['page_content'];
                 $page['content_category'] = $_POST['page_category'];
                 $page['content_author'] = USER::get('id');
                 $page['content_slug'] = $_POST['page_slug'] == '' ? slugify($_POST['page_title']) : $_POST['page_slug'];
                 $page['content_visible'] = $_POST['page_visible'];
                 // insert content
                 $page_id = CONTENT::set_content($page);
                 if ($page_id !== false) {
                     // show success message
                     TPL::message('Continutul a fost inserat cu succes!', 'success');
                     // redirect to edit page
                     redirect(LINKS::get("admin_pages_edit", $page_id), 2);
                 }
             }
             // assign data
             TPL::assign('categories', CONTENT::get_categories());
             // set render
             TPL::render('v_pages/page_types/page_text');
开发者ID:double-web,项目名称:drawline,代码行数:31,代码来源:controller_pages.php

示例6: set_content

 public static function set_content($options, $content_id = 0)
 {
     // include database
     global $db;
     // get columns and values
     $columns = array_keys($options);
     $values = array();
     foreach ($options as $opt) {
         $values[] = "'" . $db->real_escape($opt) . "'";
     }
     // update content
     if ($content_id > 0) {
         // check for date modified
         if (!isset($options['content_date_modified'])) {
             $columns[] = 'content_date_modified';
             $values[] = "'" . date("Y-m-d H:i:s", time()) . "'";
         }
         $query = array();
         for ($i = 0; $i < count($values); $i++) {
             $query[] = $columns[$i] . "=" . $values[$i];
         }
         $query = implode(",", $query);
         $upd = $db->query("UPDATE dl_content SET " . $query . " WHERE content_id = '{$content_id}'");
         if (!$upd) {
             // log errors and show message
             LOGS::write("Error sql insert into database.");
             //TPL::message("S-a intampinat o eroare la actualizarea datelor! Va rugam reincercati.");
             // return
             return false;
         } else {
             // return
             return true;
         }
     } else {
         // check for date published
         if (!isset($options['content_date_published'])) {
             $columns[] = 'content_date_published';
             $values[] = "'" . date("Y-m-d H:i:s", time()) . "'";
         }
         // check for auhor
         if (!isset($options['content_author'])) {
             $columns[] = 'content_author';
             $values[] = "'" . USER::get("id") . "'";
         }
         // check for category
         if (!isset($options['content_category'])) {
             $columns[] = 'content_category';
             $values[] = "'0'";
         }
         // check for visible
         if (!isset($options['content_visible'])) {
             $columns[] = 'content_visible';
             $values[] = "'1'";
         }
         // implode
         $columns = implode(",", $columns);
         $values = implode(",", $values);
         // run query
         $ins = $db->query("INSERT INTO dl_content (" . $columns . ") VALUES (" . $values . ")");
         // check on sql error
         if (!$ins) {
             // log errors and show message
             LOGS::write("Error sql insert into database.");
             TPL::message("S-a intampinat o eroare la adaugarea in baza de date! Va rugam reincercati.");
             // return
             return false;
         } else {
             // return
             return $db->insert_id();
         }
     }
 }
开发者ID:double-web,项目名称:drawline,代码行数:72,代码来源:include_content.php


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