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


PHP only_admin_access函数代码示例

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


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

示例1: edit_field_draft

 public function edit_field_draft($data)
 {
     only_admin_access();
     $page = false;
     if (isset($_SERVER["HTTP_REFERER"])) {
         $url = $_SERVER["HTTP_REFERER"];
         $url = explode('?', $url);
         $url = $url[0];
         if (trim($url) == '' or trim($url) == $this->app->url_manager->site()) {
             //$page = $this->get_by_url($url);
             $page = $this->homepage();
             // var_dump($page);
         } else {
             $page = $this->get_by_url($url);
         }
     } else {
         $url = $this->app->url_manager->string();
     }
     $this->define_constants($page);
     $table_drafts = $this->tables['content_fields_drafts'];
     $data = parse_params($data);
     if (isset($data['id']) and $data['id'] == 'latest_content_edit') {
         if (isset($page['id'])) {
             $page_data = $this->get_by_id($page['id']);
             $results = array();
             if (isset($page_data['title'])) {
                 $arr = array('rel_type' => 'content', 'field' => 'title', 'value' => $page_data['title']);
                 $results[] = $arr;
                 if (isset($page_data['content_type'])) {
                     $arr = array('rel_type' => $page_data['content_type'], 'field' => 'title', 'value' => $page_data['title']);
                     $results[] = $arr;
                 }
                 if (isset($page_data['subtype'])) {
                     $arr = array('rel_type' => $page_data['subtype'], 'field' => 'title', 'value' => $page_data['title']);
                     $results[] = $arr;
                 }
             }
             if (isset($page_data['content']) and $page_data['content'] != '') {
                 $arr = array('rel_type' => 'content', 'field' => 'content', 'value' => $page_data['content']);
                 $results[] = $arr;
                 if (isset($page_data['content_type'])) {
                     $arr = array('rel_type' => $page_data['content_type'], 'field' => 'content', 'value' => $page_data['content']);
                     $results[] = $arr;
                 }
                 if (isset($page_data['subtype'])) {
                     $arr = array('rel_type' => $page_data['subtype'], 'field' => 'content', 'value' => $page_data['content']);
                     $results[] = $arr;
                 }
             }
             //$results[]
         }
     } else {
         $data['is_draft'] = 1;
         $data['full'] = 1;
         $data['all'] = 1;
         $results = $this->edit_field($data);
     }
     $ret = array();
     if ($results == false) {
         return;
     }
     $i = 0;
     foreach ($results as $item) {
         if (isset($item['value'])) {
             $field_content = htmlspecialchars_decode($item['value']);
             $field_content = $this->_decode_entities($field_content);
             $item['value'] = mw()->parser->process($field_content, $options = false);
         }
         $ret[$i] = $item;
         $i++;
     }
     return $ret;
 }
开发者ID:Git-Host,项目名称:microweber,代码行数:73,代码来源:ContentManager.php

示例2: only_admin_access

<?php

only_admin_access();
?>
<script  type="text/javascript">
$(document).ready(function(){
  mw.options.form('.<?php 
print $config['module_class'];
?>
,.mw_adm_cont_head_change_holder', function(){
      mw.notification.success("<?php 
_e("Advanced settings updated");
?>
.");
    });


	  mw.options.form('.<?php 
print $config['module_class'];
?>
,.mw_adm_robots_txt_change_holder', function(){
      mw.notification.success("<?php 
_e("Advanced settings updated");
?>
.");
    });
});



</script>
开发者ID:newaltcoin,项目名称:microweber,代码行数:31,代码来源:advanced.php

示例3: move_uploaded_file_to_backup

 public function move_uploaded_file_to_backup($params)
 {
     only_admin_access();
     if (!isset($params['src'])) {
         return array('error' => 'You have not provided src to the file.');
     }
     $check = url2dir(trim($params['src']));
     $here = $this->get_bakup_location();
     if (is_file($check)) {
         $fn = basename($check);
         if (copy($check, $here . $fn)) {
             @unlink($check);
             return array('success' => "{$fn} was uploaded!");
         } else {
             return array('error' => 'Error moving uploaded file!');
         }
     } else {
         return array('error' => 'Uploaded file is not found!');
     }
 }
开发者ID:microweber,项目名称:microweber,代码行数:20,代码来源:Backup.php

示例4: install_version

 function install_version($new_version)
 {
     if (defined("MW_API_CALL")) {
         only_admin_access();
     }
     $params = array();
     if (!strstr(INI_SYSTEM_CHECK_DISABLED, 'ini_set')) {
         ini_set("set_time_limit", 0);
     }
     if (!strstr(INI_SYSTEM_CHECK_DISABLED, 'set_time_limit')) {
         set_time_limit(0);
     }
     $params['mw_version'] = MW_VERSION;
     $params['core_update'] = $new_version;
     $params['mw_update_check_site'] = $this->app->url_manager->site();
     $result = $this->call('get_download_link', $params);
     if (isset($result["core_update"])) {
         $value = trim($result["core_update"]);
         $fname = basename($value);
         $dir_c = mw_cache_path() . 'update/downloads' . DS;
         if (!is_dir($dir_c)) {
             mkdir_recursive($dir_c);
         }
         $dl_file = $dir_c . $fname;
         if (!is_file($dl_file)) {
             $this->_log_msg('Downloading core update');
             $get = $this->app->url_manager->download($value, $post_params = false, $save_to_file = $dl_file);
         }
         if (is_file($dl_file)) {
             $unzip = new \Microweber\Utils\Unzip();
             $target_dir = MW_ROOTPATH;
             $this->_log_msg('Preparing to unzip core update');
             $result = $unzip->extract($dl_file, $target_dir, $preserve_filepath = true);
             $this->_log_msg('Core update unzipped');
             $new_composer = $target_dir . 'composer.json.merge';
             if (is_file($new_composer)) {
                 //     $this->composer_merge($new_composer);
             }
             $this->post_update();
             return $result;
         }
     }
 }
开发者ID:kamilmiesiac,项目名称:microweber,代码行数:43,代码来源:UpdateManager.php

示例5: delete_media_file

 public function delete_media_file($params)
 {
     only_admin_access();
     $target_path = media_base_path() . 'uploaded' . DS;
     $target_path = normalize_path($target_path, 0);
     $path_restirct = userfiles_path();
     $fn_remove_path = $_REQUEST["path"];
     $resp = array();
     if ($fn_remove_path != false and is_array($fn_remove_path)) {
         foreach ($fn_remove_path as $key => $value) {
             $fn_remove = $this->app->url_manager->to_path($value);
             if (isset($fn_remove) and trim($fn_remove) != '' and trim($fn_remove) != 'false') {
                 $path = urldecode($fn_remove);
                 $path = normalize_path($path, 0);
                 $path = str_replace('..', '', $path);
                 $path = str_replace($path_restirct, '', $path);
                 $target_path = userfiles_path() . DS . $path;
                 $target_path = normalize_path($target_path, false);
                 if (stristr($target_path, media_base_path())) {
                     if (is_dir($target_path)) {
                         mw('Microweber\\Utils\\Files')->rmdir($target_path, false);
                         $resp = array('success' => 'Directory ' . $target_path . ' is deleted');
                     } else {
                         if (is_file($target_path)) {
                             unlink($target_path);
                             $resp = array('success' => 'File ' . basename($target_path) . ' is deleted');
                         } else {
                             $resp = array('error' => 'Not valid file or folder ' . $target_path . ' ');
                         }
                     }
                 } else {
                     $resp = array('error' => 'Not allowed to delete on ' . $target_path . ' ');
                 }
             }
         }
     }
     return $resp;
 }
开发者ID:kamilmiesiac,项目名称:microweber,代码行数:38,代码来源:MediaManager.php

示例6: mw_send_anonymous_server_data

function mw_send_anonymous_server_data($params)
{
    only_admin_access();
    $update_api = mw('update');
    if ($params != false) {
        $params = parse_params($params);
    }
    if (method_exists($update_api, 'send_anonymous_server_data')) {
        $iudates = $update_api->send_anonymous_server_data($params);
        return $iudates;
    } else {
        $params['site_url'] = site_url();
        $result = $update_api->call('send_anonymous_server_data', $params);
        return $result;
    }
}
开发者ID:newaltcoin,项目名称:microweber,代码行数:16,代码来源:other.php

示例7: mark_as_old

 static function mark_as_old($data)
 {
     only_admin_access();
     if (isset($data['content_id'])) {
         $table = MODULE_DB_COMMENTS;
         mw_var('FORCE_SAVE', $table);
         $data['is_new'] = 1;
         $get_comm = get_comments($data);
         if (!empty($get_comm)) {
             foreach ($get_comm as $get_com) {
                 $upd = array();
                 $upd['is_new'] = 0;
                 $upd['id'] = $get_com['id'];
                 $upd['rel_type'] = 'content';
                 $upd['rel_id'] = mw()->database_manager->escape_string($data['content_id']);
                 mw()->database_manager->save($table, $upd);
             }
         }
         return $get_comm;
     }
 }
开发者ID:hyrmedia,项目名称:microweber,代码行数:21,代码来源:Api.php

示例8: export

 public function export()
 {
     only_admin_access();
     $cont = get_content("is_active=1&is_deleted=0&limit=250000&orderby=updated_at desc");
     print count($cont);
     exit;
 }
开发者ID:newaltcoin,项目名称:microweber,代码行数:7,代码来源:Import.php


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